|
Lines 78-83
WebKit/qt/Api/qwebpage.cpp_sec1
|
| 78 |
#include "Cache.h" |
78 |
#include "Cache.h" |
| 79 |
#include "runtime/InitializeThreading.h" |
79 |
#include "runtime/InitializeThreading.h" |
| 80 |
#include "PageGroup.h" |
80 |
#include "PageGroup.h" |
|
|
81 |
#include "QWebPageClient.h" |
| 81 |
|
82 |
|
| 82 |
#include <QApplication> |
83 |
#include <QApplication> |
| 83 |
#include <QBasicTimer> |
84 |
#include <QBasicTimer> |
|
Lines 107-112
WebKit/qt/Api/qwebpage.cpp_sec2
|
| 107 |
#else |
108 |
#else |
| 108 |
#include "qwebnetworkinterface.h" |
109 |
#include "qwebnetworkinterface.h" |
| 109 |
#endif |
110 |
#endif |
|
|
111 |
#if defined(Q_WS_X11) |
| 112 |
#include <QX11Info> |
| 113 |
#endif |
| 110 |
|
114 |
|
| 111 |
using namespace WebCore; |
115 |
using namespace WebCore; |
| 112 |
|
116 |
|
|
Lines 138-143
WebKit/qt/Api/qwebpage.cpp_sec3
|
| 138 |
return page->handle()->page->groupName(); |
142 |
return page->handle()->page->groupName(); |
| 139 |
} |
143 |
} |
| 140 |
|
144 |
|
|
|
145 |
class QWebPageWidgetClient : public QWebPageClient { |
| 146 |
public: |
| 147 |
QWebPageWidgetClient(QWidget* view) |
| 148 |
: view(view) |
| 149 |
{ |
| 150 |
Q_ASSERT(view); |
| 151 |
} |
| 152 |
|
| 153 |
virtual void scroll(int dx, int dy, const QRect&); |
| 154 |
virtual void update(const QRect& dirtyRect); |
| 155 |
virtual void setInputMethodEnabled(bool enable); |
| 156 |
#if QT_VERSION >= 0x040600 |
| 157 |
virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); |
| 158 |
#endif |
| 159 |
|
| 160 |
#ifndef QT_NO_CURSOR |
| 161 |
virtual QCursor cursor() const; |
| 162 |
virtual void updateCursor(const QCursor& cursor); |
| 163 |
#endif |
| 164 |
|
| 165 |
virtual QPalette palette() const; |
| 166 |
virtual int screenNumber() const; |
| 167 |
virtual QWidget* ownerWidget() const; |
| 168 |
|
| 169 |
virtual QObject* pluginParent() const; |
| 170 |
|
| 171 |
QWidget* view; |
| 172 |
}; |
| 173 |
|
| 174 |
void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) |
| 175 |
{ |
| 176 |
view->scroll(qreal(dx), qreal(dy), rectToScroll); |
| 177 |
} |
| 178 |
|
| 179 |
void QWebPageWidgetClient::update(const QRect & dirtyRect) |
| 180 |
{ |
| 181 |
view->update(dirtyRect); |
| 182 |
} |
| 183 |
|
| 184 |
void QWebPageWidgetClient::setInputMethodEnabled(bool enable) |
| 185 |
{ |
| 186 |
view->setAttribute(Qt::WA_InputMethodEnabled, enable); |
| 187 |
} |
| 188 |
#if QT_VERSION >= 0x040600 |
| 189 |
void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) |
| 190 |
{ |
| 191 |
if (enable) |
| 192 |
view->setInputMethodHints(view->inputMethodHints() | hint); |
| 193 |
else |
| 194 |
view->setInputMethodHints(view->inputMethodHints() & ~hint); |
| 195 |
} |
| 196 |
#endif |
| 197 |
#ifndef QT_NO_CURSOR |
| 198 |
QCursor QWebPageWidgetClient::cursor() const |
| 199 |
{ |
| 200 |
return view->cursor(); |
| 201 |
} |
| 202 |
|
| 203 |
void QWebPageWidgetClient::updateCursor(const QCursor& cursor) |
| 204 |
{ |
| 205 |
view->setCursor(cursor); |
| 206 |
} |
| 207 |
#endif |
| 208 |
|
| 209 |
QPalette QWebPageWidgetClient::palette() const |
| 210 |
{ |
| 211 |
return view->palette(); |
| 212 |
} |
| 213 |
|
| 214 |
int QWebPageWidgetClient::screenNumber() const |
| 215 |
{ |
| 216 |
#if defined(Q_WS_X11) |
| 217 |
if (view) |
| 218 |
return view->x11Info().screen(); |
| 219 |
#endif |
| 220 |
|
| 221 |
return 0; |
| 222 |
} |
| 223 |
|
| 224 |
QWidget* QWebPageWidgetClient::ownerWidget() const |
| 225 |
{ |
| 226 |
return view; |
| 227 |
} |
| 228 |
|
| 229 |
QObject* QWebPageWidgetClient::pluginParent() const |
| 230 |
{ |
| 231 |
return view; |
| 232 |
} |
| 233 |
|
| 141 |
// Lookup table mapping QWebPage::WebActions to the associated Editor commands |
234 |
// Lookup table mapping QWebPage::WebActions to the associated Editor commands |
| 142 |
static const char* editorCommandWebActions[] = |
235 |
static const char* editorCommandWebActions[] = |
| 143 |
{ |
236 |
{ |
|
Lines 1672-1677
WebKit/qt/Api/qwebpage.cpp_sec4
|
| 1672 |
{ |
1765 |
{ |
| 1673 |
if (this->view() != view) { |
1766 |
if (this->view() != view) { |
| 1674 |
d->view = view; |
1767 |
d->view = view; |
|
|
1768 |
if (!view) { |
| 1769 |
delete d->client; |
| 1770 |
d->client = 0; |
| 1771 |
} else { |
| 1772 |
if (!d->client) |
| 1773 |
d->client = new QWebPageWidgetClient(view); |
| 1774 |
else |
| 1775 |
static_cast<QWebPageWidgetClient*>(d->client)->view = view; |
| 1776 |
} |
| 1675 |
setViewportSize(view ? view->size() : QSize(0, 0)); |
1777 |
setViewportSize(view ? view->size() : QSize(0, 0)); |
| 1676 |
} |
1778 |
} |
| 1677 |
} |
1779 |
} |