[Qt] Separate QWidget dependant code into separate WebKitWidgets static library
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2012 13:57:53 +0000 (13:57 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2012 13:57:53 +0000 (13:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102800

Patch by Simon Hausmann  <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com> on 2012-11-22
Reviewed by Tor Arne Vestbø.

This patch separates code that needs to use QWidget related APIs in
WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
static library. WebKit1 is compiled without QT += widgets and therefore
any widget related dependency has been moved "up" and out of WebKit1 into
the WebKitWidgets library.

Between the code in WebKit.a and WebKitWidgets.a new adapters and
interfaces have been introduced, such as QWebPageAdapter and
QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
call out into the API layer, implemented by QWebPage (QWebPagePrivate).
The other way around if QWebPage wants to access WebCore or
WebCoreSupport related functionality, it will go through
QWebPageAdapater (as base class). The separation in the direction up
into the API layer is complete with this patch, no code in WebKit1
depends on QtWidgets. The separation the other way around, code in the
API layer not using any WebCore types, is not complete yet.

Some classes such as QWebSettings, QWebElement or
DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
they do not depend on widget related Qt APIs and they make much more
use of WebCore internal APIs and therefore are easier to keep in
WebKit1.

In the future we plan to place a real shared library boundary between
WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
part of the QtWebKit shared library and by turning the WebKitWidgets
static library into a shared one.

.:

* Source/api.pri:
* WebKit.pro:

Source/WebCore:

* platform/qt/QWebPageClient.h:
(QWebPageClient):

Source/WebKit:

* WebKit1.pri:
* WebKit1.pro:
* WebKitWidgets.pri: Copied from Source/WebKit/WebKit1.pri.
* WebKitWidgets.pro: Added.

Source/WebKit/qt:

* Api/qgraphicswebview.cpp:
(QGraphicsWebViewPrivate::pageClient):
(QGraphicsWebViewPrivate::detachCurrentPage):
(QGraphicsWebView::setPage):
* Api/qwebelement.cpp:
(QWebElement::webFrame):
* Api/qwebframe.cpp:
(QWebFramePrivate::setPage):
(QWebFramePrivate::didStartProvisionalLoad):
(QWebFramePrivate::handleProgressFinished):
(QWebFramePrivate::emitInitialLayoutCompleted):
(QWebFramePrivate::emitIconChanged):
(QWebFramePrivate::emitLoadStarted):
(QWebFramePrivate::emitLoadFinished):
(QWebFramePrivate::createChildFrame):
(QWebFramePrivate::apiHandle):
(QWebFramePrivate::handle):
(QWebFramePrivate::contentsSizeDidChange):
(QWebFramePrivate::scrollBarPolicy):
(QWebFrame::QWebFrame):
(QWebFrame::~QWebFrame):
(QWebFrame::setUrl):
(QWebFrame::load):
(QWebFrame::scrollPosition):
(QWebFrame::geometry):
(QWebFramePrivate::kit):
(QWebFrame::handle):
* Api/qwebframe.h:
* Api/qwebframe_p.h:
(QWebFramePrivate::QWebFramePrivate):
(QWebFramePrivate):
* Api/qwebhistory.cpp:
(QWebHistoryPrivate::page):
* Api/qwebhistory_p.h:
(QWebHistoryPrivate):
* Api/qwebinspector.cpp:
(QWebInspectorPrivate::setFrontend):
* Api/qwebinspector_p.h:
(QWebInspectorPrivate):
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
(QWebPagePrivate::~QWebPagePrivate):
(QWebPagePrivate::core):
(QWebPagePrivate::show):
(QWebPagePrivate::setFocus):
(QWebPagePrivate::unfocus):
(QWebPagePrivate::setWindowRect):
(QWebPagePrivate::viewportSize):
(QWebPagePrivate::createWindow):
(QWebPagePrivate::javaScriptConsoleMessage):
(QWebPagePrivate::javaScriptAlert):
(QWebPagePrivate::javaScriptConfirm):
(QWebPagePrivate::javaScriptPrompt):
(QWebPagePrivate::printRequested):
(QWebPagePrivate::databaseQuotaExceeded):
(QWebPagePrivate::applicationCacheQuotaExceeded):
(QWebPagePrivate::setToolTip):
(QWebPagePrivate::createFullScreenVideoHandler):
(QWebPagePrivate::mainFrameAdapter):
(QWebPagePrivate::chooseFiles):
(QWebPagePrivate::acceptNavigationRequest):
(QWebPagePrivate::emitRestoreFrameStateRequested):
(QWebPagePrivate::emitSaveFrameStateRequested):
(QWebPagePrivate::emitDownloadRequested):
(QWebPagePrivate::emitFrameCreated):
(QWebPagePrivate::errorPageExtension):
(QWebPagePrivate::createPlugin):
(QWebPagePrivate::adapterForWidget):
(QWebPagePrivate::createMainFrame):
(QWebPagePrivate::createContextMenu):
(QWebPagePrivate::inspectorHandle):
(QWebPagePrivate::setInspectorFrontend):
(QWebPagePrivate::setInspectorWindowTitle):
(QWebPagePrivate::createWebInspector):
(iterateContextMenu):
(QWebPagePrivate::menuActionsAsText):
(QWebPagePrivate::emitViewportChangeRequested):
(QWebPagePrivate::mouseMoveEvent):
(QWebPagePrivate::mousePressEvent):
(QWebPagePrivate::mouseDoubleClickEvent):
(QWebPagePrivate::mouseTripleClickEvent):
(QWebPagePrivate::mouseReleaseEvent):
(QWebPagePrivate::handleSoftwareInputPanel):
(QWebPagePrivate::wheelEvent):
(QWebPagePrivate::gestureEvent):
(QWebPage::setView):
(QWebPage::javaScriptConsoleMessage):
(QWebPage::javaScriptAlert):
(QWebPage::javaScriptConfirm):
(QWebPage::javaScriptPrompt):
(QWebPage::shouldInterruptJavaScript):
(QWebPage::setFeaturePermission):
(QWebPagePrivate::colorSelectionRequested):
(QWebPagePrivate::createSelectPopup):
(QWebPagePrivate::viewRectRelativeToWindow):
(QWebPagePrivate::geolocationPermissionRequested):
(QWebPagePrivate::geolocationPermissionRequestCancelled):
(QWebPagePrivate::notificationsPermissionRequested):
(QWebPagePrivate::notificationsPermissionRequestCancelled):
(QWebPagePrivate::respondToChangedContents):
(QWebPagePrivate::respondToChangedSelection):
(QWebPagePrivate::microFocusChanged):
(QWebPagePrivate::triggerCopyAction):
(QWebPagePrivate::triggerActionForKeyEvent):
(QWebPagePrivate::clearUndoStack):
(QWebPagePrivate::canUndo):
(QWebPagePrivate::canRedo):
(QWebPagePrivate::undo):
(QWebPagePrivate::redo):
(QWebPagePrivate::createUndoStep):
(QWebPagePrivate::editorCommandForKeyEvent):
(QWebPage::viewportSize):
(QWebPage::setViewportSize):
(QWebPage::viewportAttributesForSize):
(QWebPage::event):
(QWebPage::extension):
(QWebPage::handle):
(QWebPage::chooseFile):
(QWebPage::setNetworkAccessManager):
(QWebPage::networkAccessManager):
* Api/qwebpage.h:
* Api/qwebpage_p.h:
(WebCore):
(QWebPagePrivate):
* Api/qwebsettings.cpp:
* Api/qwebsettings.h:
* Api/qwebview.cpp:
(QWebViewPrivate::detachCurrentPage):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::ChromeClientQt):
(WebCore::ChromeClientQt::setWindowRect):
(WebCore::ChromeClientQt::focus):
(WebCore::ChromeClientQt::unfocus):
(WebCore::ChromeClientQt::createWindow):
(WebCore::ChromeClientQt::show):
(WebCore::ChromeClientQt::setToolbarsVisible):
(WebCore::ChromeClientQt::setStatusbarVisible):
(WebCore::ChromeClientQt::setMenubarVisible):
(WebCore::ChromeClientQt::addMessageToConsole):
(WebCore::ChromeClientQt::closeWindowSoon):
(WebCore::ChromeClientQt::runJavaScriptAlert):
(WebCore::ChromeClientQt::runJavaScriptConfirm):
(WebCore::ChromeClientQt::runJavaScriptPrompt):
(WebCore::ChromeClientQt::setStatusbarText):
(WebCore::ChromeClientQt::shouldInterruptJavaScript):
(WebCore::ChromeClientQt::keyboardUIMode):
(WebCore::ChromeClientQt::windowResizerRect):
* WebCoreSupport/ChromeClientQt.h:
(ChromeClientQt):
* WebCoreSupport/ContextMenuClientQt.cpp:
* WebCoreSupport/ContextMenuClientQt.h:
(ContextMenuClientQt):
* WebCoreSupport/DefaultFullScreenVideoHandler.cpp: Added.
(DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler):
(DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler):
(DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback):
(DefaultFullScreenVideoHandler::enterFullScreen):
(DefaultFullScreenVideoHandler::exitFullScreen):
* WebCoreSupport/DefaultFullScreenVideoHandler.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(WebKit):
(DefaultFullScreenVideoHandler):
* WebCoreSupport/DragClientQt.cpp:
(WebCore::DragClientQt::startDrag):
* WebCoreSupport/DragClientQt.h:
(WebCore):
(WebCore::DragClientQt::DragClientQt):
(DragClientQt):
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(toGeolocationClientMock):
(toDeviceOrientationClientMock):
(DumpRenderTreeSupportQt::initialize):
(DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled):
(DumpRenderTreeSupportQt::setFrameFlatteningEnabled):
(DumpRenderTreeSupportQt::webPageSetGroupName):
(DumpRenderTreeSupportQt::webPageGroupName):
(DumpRenderTreeSupportQt::webInspectorExecuteScript):
(DumpRenderTreeSupportQt::webInspectorShow):
(DumpRenderTreeSupportQt::webInspectorClose):
(DumpRenderTreeSupportQt::hasDocumentElement):
(DumpRenderTreeSupportQt::pauseAnimation):
(DumpRenderTreeSupportQt::pauseTransitionOfProperty):
(DumpRenderTreeSupportQt::numberOfActiveAnimations):
(DumpRenderTreeSupportQt::clearFrameName):
(DumpRenderTreeSupportQt::setCaretBrowsingEnabled):
(DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled):
(DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled):
(DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled):
(DumpRenderTreeSupportQt::executeCoreCommandByName):
(DumpRenderTreeSupportQt::isCommandEnabled):
(DumpRenderTreeSupportQt::findString):
(DumpRenderTreeSupportQt::selectedRange):
(DumpRenderTreeSupportQt::firstRectForCharacterRange):
(DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId):
(DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior):
(DumpRenderTreeSupportQt::viewportAsText):
(DumpRenderTreeSupportQt::scalePageBy):
(DumpRenderTreeSupportQt::setMockDeviceOrientation):
(DumpRenderTreeSupportQt::resetGeolocationMock):
(DumpRenderTreeSupportQt::setMockGeolocationPermission):
(DumpRenderTreeSupportQt::setMockGeolocationPosition):
(DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError):
(DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
(DumpRenderTreeSupportQt::shouldClose):
(DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
(DumpRenderTreeSupportQt::addUserStyleSheet):
(DumpRenderTreeSupportQt::removeUserStyleSheets):
(DumpRenderTreeSupportQt::setDefersLoading):
(DumpRenderTreeSupportQt::goBack):
(DumpRenderTreeSupportQt::responseMimeType):
(DumpRenderTreeSupportQt::clearOpener):
(DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled):
(DumpRenderTreeSupportQt::contextMenu):
(DumpRenderTreeSupportQt::setMinimumTimerInterval):
(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows):
(DumpRenderTreeSupportQt::mediaContentUrlByElementId):
(DumpRenderTreeSupportQt::setAlternateHtml):
(DumpRenderTreeSupportQt::confirmComposition):
(DumpRenderTreeSupportQt::injectInternalsObject):
(DumpRenderTreeSupportQt::resetInternalsObject):
(DumpRenderTreeSupportQt::paintPagesWithBoundaries):
(DumpRenderTreeSupportQt::setTrackRepaintRects):
(DumpRenderTreeSupportQt::trackRepaintRects):
(DumpRenderTreeSupportQt::getTrackedRepaintRects):
* WebCoreSupport/DumpRenderTreeSupportQt.h:
* WebCoreSupport/EditorClientQt.cpp:
(dumpRange):
(WebCore::EditorClientQt::shouldShowDeleteInterface):
(WebCore::EditorClientQt::shouldInsertText):
(WebCore::EditorClientQt::shouldChangeSelectedRange):
(WebCore::EditorClientQt::shouldApplyStyle):
(WebCore::EditorClientQt::respondToChangedContents):
(WebCore::EditorClientQt::respondToChangedSelection):
(WebCore::EditorClientQt::registerUndoStep):
(WebCore::EditorClientQt::clearUndoRedoOperations):
(WebCore::EditorClientQt::canUndo):
(WebCore::EditorClientQt::canRedo):
(WebCore::EditorClientQt::undo):
(WebCore::EditorClientQt::redo):
(WebCore::EditorClientQt::shouldInsertNode):
(WebCore::EditorClientQt::smartInsertDeleteEnabled):
(WebCore::EditorClientQt::toggleSmartInsertDelete):
(WebCore::EditorClientQt::isSelectTrailingWhitespaceEnabled):
(WebCore::EditorClientQt::handleKeyboardEvent):
(WebCore::EditorClientQt::EditorClientQt):
(WebCore::EditorClientQt::setInputMethodState):
* WebCoreSupport/EditorClientQt.h:
(EditorClientQt):
(WebCore::EditorClientQt::setSmartInsertDeleteEnabled):
(WebCore::EditorClientQt::setSelectTrailingWhitespaceEnabled):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(drtDescriptionSuitableForTestResult):
(WebCore::FrameLoaderClientQt::setFrame):
(WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
(WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage):
(WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad):
(WebCore::FrameLoaderClientQt::dispatchDidCommitLoad):
(WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad):
(WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientQt::dispatchDidLayout):
(WebCore::FrameLoaderClientQt::dispatchWillSubmitForm):
(WebCore::FrameLoaderClientQt::postProgressStartedNotification):
(WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
(WebCore::FrameLoaderClientQt::frameLoadCompleted):
(WebCore::FrameLoaderClientQt::restoreViewState):
(WebCore::FrameLoaderClientQt::userAgent):
(WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon):
(WebCore::FrameLoaderClientQt::frameLoaderDestroyed):
(WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld):
(WebCore::FrameLoaderClientQt::didPerformFirstNavigation):
(WebCore::FrameLoaderClientQt::onIconLoadedForPageURL):
(WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks):
(WebCore::FrameLoaderClientQt::saveViewStateToItem):
(WebCore::FrameLoaderClientQt::cancelledError):
(WebCore::FrameLoaderClientQt::blockedError):
(WebCore::FrameLoaderClientQt::cannotShowURLError):
(WebCore::FrameLoaderClientQt::interruptedForPolicyChangeError):
(WebCore::FrameLoaderClientQt::cannotShowMIMETypeError):
(WebCore::FrameLoaderClientQt::fileDoesNotExistError):
(WebCore::FrameLoaderClientQt::pluginWillHandleLoadError):
(WebCore::FrameLoaderClientQt::download):
(WebCore::FrameLoaderClientQt::dispatchWillSendRequest):
(WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse):
(WebCore::FrameLoaderClientQt::dispatchDidFinishLoading):
(WebCore::FrameLoaderClientQt::dispatchDidFailLoading):
(WebCore::FrameLoaderClientQt::callErrorPageExtension):
(WebCore::FrameLoaderClientQt::dispatchCreatePage):
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
(WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
(WebCore::FrameLoaderClientQt::startDownload):
(WebCore::FrameLoaderClientQt::createFrame):
(WebCore::FrameLoaderClientQt::createPlugin):
(WebCore::FrameLoaderClientQt::createJavaAppletWidget):
(WebCore::FrameLoaderClientQt::chooseFile):
(WebCore::FrameLoaderClientQt::createNetworkingContext):
(WebCore):
(WebCore::FrameLoaderClientQt::webFrame):
(WebCore::FrameLoaderClientQt::emitLoadStarted):
(WebCore::FrameLoaderClientQt::emitLoadFinished):
* WebCoreSupport/FrameLoaderClientQt.h:
(FrameLoaderClientQt):
* WebCoreSupport/FrameNetworkingContextQt.cpp:
(WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt):
(WebCore::FrameNetworkingContextQt::create):
(WebCore::FrameNetworkingContextQt::networkAccessManager):
* WebCoreSupport/FrameNetworkingContextQt.h:
(FrameNetworkingContextQt):
* WebCoreSupport/FullScreenVideoQt.cpp:
(WebCore):
(WebCore::FullScreenVideoQt::FullScreenVideoQt):
* WebCoreSupport/FullScreenVideoQt.h:
(WebCore):
* WebCoreSupport/FullScreenVideoWidget.cpp:
* WebCoreSupport/FullScreenVideoWidget.h:
* WebCoreSupport/GeolocationClientQt.cpp:
(WebCore::GeolocationClientQt::GeolocationClientQt):
(WebCore::GeolocationClientQt::positionUpdated):
(WebCore::GeolocationClientQt::startUpdating):
(WebCore::GeolocationClientQt::requestPermission):
(WebCore::GeolocationClientQt::cancelPermissionRequest):
* WebCoreSupport/GeolocationClientQt.h:
(GeolocationClientQt):
* WebCoreSupport/GeolocationPermissionClientQt.cpp:
(WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
(WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):
(WebCore::GeolocationPermissionClientQt::setPermission):
* WebCoreSupport/GeolocationPermissionClientQt.h:
(GeolocationPermissionClientQt):
* WebCoreSupport/InitWebCoreQt.cpp:
(WebKit):
(WebKit::setWebKitWidgetsInitCallback):
(WebKit::initializeWebKitQt):
(WebKit::setImagePlatformResource):
(WebCore::initializeWebCoreQt):
* WebCoreSupport/InitWebCoreQt.h:
(WebCore):
(WebKit):
* WebCoreSupport/InitWebKitQt.cpp: Added.
(WebKit):
(WebKit::initializeWebKitWidgets):
* WebCoreSupport/InitWebKitQt.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(WebKit):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore):
(WebCore::InspectorClientQt::InspectorClientQt):
(WebCore::InspectorClientQt::openInspectorFrontend):
(WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend):
(WebCore::InspectorClientQt::detachRemoteFrontend):
(WebCore::InspectorClientQt::hideHighlight):
(WebCore::InspectorClientQt::sendMessageToFrontend):
(WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
(WebCore::InspectorFrontendClientQt::updateWindowTitle):
(WebCore::InspectorFrontendClientQt::destroyInspectorView):
* WebCoreSupport/InspectorClientQt.h:
(InspectorClientQt):
(InspectorFrontendClientQt):
* WebCoreSupport/InspectorClientWebPage.cpp: Added.
(InspectorClientWebPage::InspectorClientWebPage):
(InspectorClientWebPage::createWindow):
(InspectorClientWebPage::javaScriptWindowObjectCleared):
* WebCoreSupport/InspectorClientWebPage.h: Copied from Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h.
(WebKit):
(InspectorClientWebPage):
* WebCoreSupport/InspectorServerQt.cpp:
(WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
(WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead):
* WebCoreSupport/InspectorServerQt.h:
(InspectorServerQt):
(InspectorServerRequestHandlerQt):
* WebCoreSupport/NotificationPresenterClientQt.cpp:
(WebCore::NotificationWrapper::NotificationWrapper):
(WebCore::NotificationPresenterClientQt::displayNotification):
(WebCore::NotificationPresenterClientQt::requestPermission):
(WebCore::NotificationPresenterClientQt::cancelRequestsForPermission):
(WebCore::NotificationPresenterClientQt::dumpShowText):
(WebCore::NotificationPresenterClientQt::toPage):
(WebCore::NotificationPresenterClientQt::toFrame):
* WebCoreSupport/NotificationPresenterClientQt.h:
(WebCore::NotificationWrapper::~NotificationWrapper):
(NotificationWrapper):
(NotificationPresenterClientQt):
(WebCore::NotificationPresenterClientQt::hasSystemTrayIcon):
(WebCore::NotificationPresenterClientQt::setSystemTrayIcon):
(CallbacksInfo):
(WebCore):
* WebCoreSupport/PageClientQt.cpp:
(createPlatformGraphicsContext3DFromWidget):
(QWebPageClient::ownerWindow):
(WebCore::PageClientQWidget::ownerWidget):
(WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
(WebCore::PageClientQGraphicsWidget::ownerWidget):
(WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
* WebCoreSupport/PageClientQt.h:
(PageClientQWidget):
(WebCore::QGraphicsItemOverlay::QGraphicsItemOverlay):
(WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget):
(PageClientQGraphicsWidget):
* WebCoreSupport/PlatformStrategiesQt.cpp:
(PlatformStrategiesQt::getPluginInfo):
* WebCoreSupport/PopupMenuQt.cpp:
(SelectData::SelectData):
* WebCoreSupport/QGraphicsWidgetPluginImpl.cpp: Added.
(QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl):
(QGraphicsWidgetPluginImpl::update):
(QGraphicsWidgetPluginImpl::setGeometryAndClip):
(QGraphicsWidgetPluginImpl::setVisible):
(QGraphicsWidgetPluginImpl::setWidgetParent):
(QGraphicsWidgetPluginImpl::handle):
* WebCoreSupport/QGraphicsWidgetPluginImpl.h: Added.
(QGraphicsWidgetPluginImpl):
(QGraphicsWidgetPluginImpl::QGraphicsWidgetPluginImpl):
* WebCoreSupport/QWebFrameAdapter.cpp: Added.
(cacheLoadControlToCachePolicy):
(QWebFrameData::QWebFrameData):
(QWebFrameAdapter::QWebFrameAdapter):
(QWebFrameAdapter::~QWebFrameAdapter):
(QWebFrameAdapter::load):
(QWebFrameAdapter::handleGestureEvent):
(QWebFrameAdapter::scrollPosition):
(QWebFrameAdapter::frameRect):
(QWebFrameAdapter::init):
(QWebFrameAdapter::kit):
(QWebFrameAdapter::ensureAbsoluteUrl):
* WebCoreSupport/QWebFrameAdapter.h: Added.
(WebCore):
(QWebFrameData):
(QWebFrameAdapter):
(QWebFrameAdapter::hasView):
* WebCoreSupport/QWebPageAdapter.cpp: Added.
(QWebPageAdapter::QWebPageAdapter):
(QWebPageAdapter::~QWebPageAdapter):
(QWebPageAdapter::init):
(QWebPageAdapter::deletePage):
(QWebPageAdapter::kit):
(QWebPageAdapter::viewportArguments):
(QWebPageAdapter::registerUndoStep):
(QWebPageAdapter::setNetworkAccessManager):
(QWebPageAdapter::networkAccessManager):
* WebCoreSupport/QWebPageAdapter.h: Added.
(WebCore):
(QWebPageAdapter):
(ErrorPageOption):
(ErrorPageReturn):
* WebCoreSupport/QWebUndoCommand.cpp: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(QWebUndoCommand::QWebUndoCommand):
(QWebUndoCommand::undo):
(QWebUndoCommand::redo):
* WebCoreSupport/QWebUndoCommand.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(QWebUndoCommand):
* WebCoreSupport/QWidgetPluginImpl.cpp: Added.
(QWidgetPluginImpl::~QWidgetPluginImpl):
(QWidgetPluginImpl::update):
(QWidgetPluginImpl::setGeometryAndClip):
(QWidgetPluginImpl::setVisible):
(QWidgetPluginImpl::setStyleSheet):
(QWidgetPluginImpl::setWidgetParent):
(QWidgetPluginImpl::handle):
* WebCoreSupport/QWidgetPluginImpl.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(QWidgetPluginImpl):
(QWidgetPluginImpl::QWidgetPluginImpl):
* WebCoreSupport/QtFallbackWebPopup.cpp:
(WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
(WebCore::QtFallbackWebPopup::show):
(WebCore::QtFallbackWebPopup::pageClient):
* WebCoreSupport/QtFallbackWebPopup.h:
(QtFallbackWebPopup):
* WebCoreSupport/QtPluginWidgetAdapter.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
(QtPluginWidgetAdapter):
* WebCoreSupport/QtWebComboBox.cpp:
(WebCore::QtWebComboBox::showPopupAtCursorPosition):
* WebCoreSupport/QtWebComboBox.h:
* WebCoreSupport/SearchPopupMenuQt.h:
(SearchPopupMenuQt):
* WebCoreSupport/UndoStepQt.cpp:
(UndoStepQt::UndoStepQt):
(UndoStepQt::text):
* WebCoreSupport/UndoStepQt.h:
(UndoStepQt):
* WebCoreSupport/WebEventConversion.cpp:
(WebCore::mouseEventTypeAndMouseButtonFromQEvent):
(WebKitPlatformWheelEvent):
(WebCore::WebKitPlatformWheelEvent::applyDelta):
(WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent):
(WebKitPlatformGestureEvent):
(WebCore::toPlatformEventType):
(WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent):
(WebCore):
(WebCore::convertWheelEvent):
(WebCore::convertGesture):
* WebCoreSupport/WebEventConversion.h:
(QGestureEventFacade):
(WebCore):
* WebCoreSupport/WebSystemInterface.h:
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::loadHtml5Video):
(tst_QWebPage::multiplePageGroupsAndLocalStorage):
(tst_QWebPage::thirdPartyCookiePolicy):

Source/WebKit2:

* qt/MainQt.cpp:
(WebKit):
(main):

Tools:

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::WebPage::resetSettings):
(WebCore::WebPage::createWindow):
(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
(WebCore::DumpRenderTree::initJSObjects):
(WebCore::DumpRenderTree::dumpFrameScrollPosition):
(WebCore::DumpRenderTree::dumpFramesAsText):
(WebCore::DumpRenderTree::dump):
(WebCore::DumpRenderTree::createWindow):
(WebCore::DumpRenderTree::pageAdapter):
(WebCore):
(WebCore::DumpRenderTree::mainFrameAdapter):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
(DumpRenderTree):
* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::contextClick):
(EventSender::scalePageBy):
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::reset):
(TestRunner::display):
(TestRunner::closeWebInspector):
(TestRunner::showWebInspector):
(TestRunner::evaluateInWebInspector):
(TestRunner::setFrameFlatteningEnabled):
(TestRunner::goBack):
(TestRunner::setDefersLoading):
(TestRunner::pauseAnimationAtTimeOnElementWithId):
(TestRunner::pauseTransitionAtTimeOnElementWithId):
(TestRunner::numberOfActiveAnimations):
(TestRunner::setCaretBrowsingEnabled):
(TestRunner::setAuthorAndUserStylesEnabled):
(TestRunner::callShouldCloseOnWebView):
(TestRunner::setSmartInsertDeleteEnabled):
(TestRunner::setSelectTrailingWhitespaceEnabled):
(TestRunner::execCommand):
(TestRunner::isCommandEnabled):
(TestRunner::findString):
(TestRunner::elementDoesAutoCompleteForElementWithId):
(TestRunner::setMockDeviceOrientation):
(TestRunner::setGeolocationPermission):
(TestRunner::numberOfPendingGeolocationPermissionRequests):
(TestRunner::setMockGeolocationPositionUnavailableError):
(TestRunner::setMockGeolocationPosition):
(TestRunner::evaluateScriptInIsolatedWorld):
(TestRunner::addUserStyleSheet):
(TestRunner::setMinimumTimerInterval):
* DumpRenderTree/qt/TextInputControllerQt.cpp:
(TextInputController::selectedRange):
(TextInputController::firstRectForCharacterRange):
(TextInputController::unmarkText):
* DumpRenderTree/qt/WorkQueueItemQt.cpp:
(LoadAlternateHTMLStringItem::invoke):
* qmake/mkspecs/features/default_post.prf:
* qmake/mkspecs/features/production_build.prf:
* qmake/mkspecs/features/webkit_modules.prf:
* qmake/mkspecs/modules/webkitwidgets.prf: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135515 268f45cc-cd09-0410-ab3c-d52691b4dbfc

101 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/qt/QWebPageClient.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit1.pri
Source/WebKit/WebKit1.pro
Source/WebKit/WebKitWidgets.pri [new file with mode: 0644]
Source/WebKit/WebKitWidgets.pro [new file with mode: 0644]
Source/WebKit/qt/Api/qgraphicswebview.cpp
Source/WebKit/qt/Api/qwebelement.cpp
Source/WebKit/qt/Api/qwebframe.cpp
Source/WebKit/qt/Api/qwebframe.h
Source/WebKit/qt/Api/qwebframe_p.h
Source/WebKit/qt/Api/qwebhistory.cpp
Source/WebKit/qt/Api/qwebhistory_p.h
Source/WebKit/qt/Api/qwebinspector.cpp
Source/WebKit/qt/Api/qwebinspector_p.h
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/Api/qwebpage.h
Source/WebKit/qt/Api/qwebpage_p.h
Source/WebKit/qt/Api/qwebsettings.cpp
Source/WebKit/qt/Api/qwebsettings.h
Source/WebKit/qt/Api/qwebview.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h
Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
Source/WebKit/qt/WebCoreSupport/DragClientQt.h
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp
Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h
Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h
Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h
Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp
Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h
Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h
Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h
Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
Source/WebKit/qt/WebCoreSupport/PageClientQt.h
Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h [new file with mode: 0644]
Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h
Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp
Source/WebKit/qt/WebCoreSupport/UndoStepQt.h
Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
Source/WebKit/qt/WebCoreSupport/WebEventConversion.h
Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h
Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/qt/MainQt.cpp
Source/api.pri
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
Tools/DumpRenderTree/qt/DumpRenderTreeQt.h
Tools/DumpRenderTree/qt/EventSenderQt.cpp
Tools/DumpRenderTree/qt/TestRunnerQt.cpp
Tools/DumpRenderTree/qt/TextInputControllerQt.cpp
Tools/DumpRenderTree/qt/WorkQueueItemQt.cpp
Tools/qmake/mkspecs/features/default_post.prf
Tools/qmake/mkspecs/features/production_build.prf
Tools/qmake/mkspecs/features/webkit_modules.prf
Tools/qmake/mkspecs/modules/webkitwidgets.prf [new file with mode: 0644]
WebKit.pro

index 814a8bc794e79f010c90dd6f8d5eb2bc6610bdcd..17a62bd7c2218bfc9d333857d08fa2176794e7cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2012-11-22  Simon Hausmann  <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com>
+
+        [Qt] Separate QWidget dependant code into separate WebKitWidgets static library
+        https://bugs.webkit.org/show_bug.cgi?id=102800
+
+        Reviewed by Tor Arne Vestbø.
+
+        This patch separates code that needs to use QWidget related APIs in
+        WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
+        example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
+        while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
+        static library. WebKit1 is compiled without QT += widgets and therefore
+        any widget related dependency has been moved "up" and out of WebKit1 into
+        the WebKitWidgets library.
+
+        Between the code in WebKit.a and WebKitWidgets.a new adapters and
+        interfaces have been introduced, such as QWebPageAdapter and
+        QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
+        call out into the API layer, implemented by QWebPage (QWebPagePrivate).
+        The other way around if QWebPage wants to access WebCore or
+        WebCoreSupport related functionality, it will go through
+        QWebPageAdapater (as base class). The separation in the direction up
+        into the API layer is complete with this patch, no code in WebKit1
+        depends on QtWidgets. The separation the other way around, code in the
+        API layer not using any WebCore types, is not complete yet.
+
+        Some classes such as QWebSettings, QWebElement or
+        DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
+        they do not depend on widget related Qt APIs and they make much more
+        use of WebCore internal APIs and therefore are easier to keep in
+        WebKit1.
+
+        In the future we plan to place a real shared library boundary between
+        WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
+        part of the QtWebKit shared library and by turning the WebKitWidgets
+        static library into a shared one.
+
+
+        * Source/api.pri:
+        * WebKit.pro:
+
 2012-11-21  Ryuan Choi  <ryuan.choi@gmail.com>
 
         [EFL] Remove unnecessary definition, -DENABLE_SPELLCHECK=1
index 2bb2b52c0ec809cdf98d8122d46d24c2e07e4548..7f8f0b4c5e534da294d2d7b5cf92442650d90eca 100644 (file)
@@ -1,3 +1,43 @@
+2012-11-22  Simon Hausmann  <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com>
+
+        [Qt] Separate QWidget dependant code into separate WebKitWidgets static library
+        https://bugs.webkit.org/show_bug.cgi?id=102800
+
+        Reviewed by Tor Arne Vestbø.
+
+        This patch separates code that needs to use QWidget related APIs in
+        WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
+        example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
+        while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
+        static library. WebKit1 is compiled without QT += widgets and therefore
+        any widget related dependency has been moved "up" and out of WebKit1 into
+        the WebKitWidgets library.
+
+        Between the code in WebKit.a and WebKitWidgets.a new adapters and
+        interfaces have been introduced, such as QWebPageAdapter and
+        QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
+        call out into the API layer, implemented by QWebPage (QWebPagePrivate).
+        The other way around if QWebPage wants to access WebCore or
+        WebCoreSupport related functionality, it will go through
+        QWebPageAdapater (as base class). The separation in the direction up
+        into the API layer is complete with this patch, no code in WebKit1
+        depends on QtWidgets. The separation the other way around, code in the
+        API layer not using any WebCore types, is not complete yet.
+
+        Some classes such as QWebSettings, QWebElement or
+        DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
+        they do not depend on widget related Qt APIs and they make much more
+        use of WebCore internal APIs and therefore are easier to keep in
+        WebKit1.
+
+        In the future we plan to place a real shared library boundary between
+        WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
+        part of the QtWebKit shared library and by turning the WebKitWidgets
+        static library into a shared one.
+
+        * platform/qt/QWebPageClient.h:
+        (QWebPageClient):
+
 2012-11-22  Dan Carney  <dcarney@google.com>
 
         [V8] Add context checks to WorldContextHandle and V8DOMWindowShell
index cda0b0f4d63b5ce5457ee1b3a2016e3b1c789016..ae3fb4e2fa0db24bd3e4beac218a219602bde71c 100644 (file)
@@ -91,7 +91,7 @@ public:
 
     virtual QPalette palette() const = 0;
     virtual int screenNumber() const = 0;
-    virtual QWidget* ownerWidget() const = 0;
+    virtual QObject* ownerWidget() const = 0;
     virtual QRect geometryRelativeToOwnerWidget() const = 0;
 
     virtual QObject* pluginParent() const = 0;
index 6f392306ba0dcc0c5a39fbdad82a98626178e5d7..f2f774ac4466c18fa82057a27a79e2b7a4d65b33 100644 (file)
@@ -1,3 +1,45 @@
+2012-11-22  Simon Hausmann  <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com>
+
+        [Qt] Separate QWidget dependant code into separate WebKitWidgets static library
+        https://bugs.webkit.org/show_bug.cgi?id=102800
+
+        Reviewed by Tor Arne Vestbø.
+
+        This patch separates code that needs to use QWidget related APIs in
+        WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
+        example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
+        while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
+        static library. WebKit1 is compiled without QT += widgets and therefore
+        any widget related dependency has been moved "up" and out of WebKit1 into
+        the WebKitWidgets library.
+
+        Between the code in WebKit.a and WebKitWidgets.a new adapters and
+        interfaces have been introduced, such as QWebPageAdapter and
+        QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
+        call out into the API layer, implemented by QWebPage (QWebPagePrivate).
+        The other way around if QWebPage wants to access WebCore or
+        WebCoreSupport related functionality, it will go through
+        QWebPageAdapater (as base class). The separation in the direction up
+        into the API layer is complete with this patch, no code in WebKit1
+        depends on QtWidgets. The separation the other way around, code in the
+        API layer not using any WebCore types, is not complete yet.
+
+        Some classes such as QWebSettings, QWebElement or
+        DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
+        they do not depend on widget related Qt APIs and they make much more
+        use of WebCore internal APIs and therefore are easier to keep in
+        WebKit1.
+
+        In the future we plan to place a real shared library boundary between
+        WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
+        part of the QtWebKit shared library and by turning the WebKitWidgets
+        static library into a shared one.
+
+        * WebKit1.pri:
+        * WebKit1.pro:
+        * WebKitWidgets.pri: Copied from Source/WebKit/WebKit1.pri.
+        * WebKitWidgets.pro: Added.
+
 2012-11-21  Kai Koehne  <kai.koehne@digia.com>
 
         [Qt] MinGW: Don't add OpenGL library dependencies here
index f988b4c6bd99acd13411a5ad2259145929653e02..0297fcc92d1d28960f967df9762ae9f6c2dc6305 100644 (file)
@@ -18,16 +18,9 @@ enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) {
 
 enable?(GEOLOCATION): QT += location
 
-use?(QT_MULTIMEDIA): QT *= multimediawidgets
-
 contains(CONFIG, texmap): DEFINES += WTF_USE_TEXTURE_MAPPER=1
 
 use?(PLUGIN_BACKEND_XLIB): PKGCONFIG += x11
 
-QT += network widgets
-have?(QTQUICK): QT += quick
-have?(QTPRINTSUPPORT): QT += printsupport
+QT += network
 
-use?(TEXTURE_MAPPER_GL)|enable?(WEBGL) {
-    QT *= opengl
-}
index 75d4d79de5ac4ce3ec692eed2f95d5d7df94b439..fee99e8851bffd6118cf4caa0f226b12db4b7477 100644 (file)
@@ -15,30 +15,20 @@ QT += gui
 CONFIG += staticlib
 
 SOURCES += \
-    $$PWD/qt/Api/qwebframe.cpp \
-    $$PWD/qt/Api/qgraphicswebview.cpp \
-    $$PWD/qt/Api/qwebpage.cpp \
-    $$PWD/qt/Api/qwebview.cpp \
+    $$PWD/qt/Api/qhttpheader.cpp \
+    $$PWD/qt/Api/qwebdatabase.cpp \
     $$PWD/qt/Api/qwebelement.cpp \
     $$PWD/qt/Api/qwebhistory.cpp \
-    $$PWD/qt/Api/qwebsettings.cpp \
     $$PWD/qt/Api/qwebhistoryinterface.cpp \
-    $$PWD/qt/Api/qwebplugindatabase.cpp \
     $$PWD/qt/Api/qwebpluginfactory.cpp \
     $$PWD/qt/Api/qwebsecurityorigin.cpp \
+    $$PWD/qt/Api/qwebsettings.cpp \
     $$PWD/qt/Api/qwebscriptworld.cpp \
-    $$PWD/qt/Api/qwebdatabase.cpp \
-    $$PWD/qt/Api/qwebinspector.cpp \
-    $$PWD/qt/Api/qwebkitversion.cpp \
-    $$PWD/qt/Api/qhttpheader.cpp \
-    $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.cpp \
-    $$PWD/qt/WebCoreSupport/QtWebComboBox.cpp \
     $$PWD/qt/WebCoreSupport/ChromeClientQt.cpp \
     $$PWD/qt/WebCoreSupport/ContextMenuClientQt.cpp \
     $$PWD/qt/WebCoreSupport/DragClientQt.cpp \
     $$PWD/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp \
     $$PWD/qt/WebCoreSupport/EditorClientQt.cpp \
-    $$PWD/qt/WebCoreSupport/UndoStepQt.cpp \
     $$PWD/qt/WebCoreSupport/FrameLoaderClientQt.cpp \
     $$PWD/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \
     $$PWD/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \
@@ -46,67 +36,72 @@ SOURCES += \
     $$PWD/qt/WebCoreSupport/InspectorClientQt.cpp \
     $$PWD/qt/WebCoreSupport/InspectorServerQt.cpp \
     $$PWD/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
-    $$PWD/qt/WebCoreSupport/PageClientQt.cpp \
+    $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.cpp \
     $$PWD/qt/WebCoreSupport/PopupMenuQt.cpp \
-    $$PWD/qt/WebCoreSupport/QStyleFacadeImp.cpp \
     $$PWD/qt/WebCoreSupport/QtPlatformPlugin.cpp \
+    $$PWD/qt/WebCoreSupport/QWebFrameAdapter.cpp \
+    $$PWD/qt/WebCoreSupport/QWebPageAdapter.cpp \
     $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.cpp \
     $$PWD/qt/WebCoreSupport/TextCheckerClientQt.cpp \
-    $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.cpp \
+    $$PWD/qt/WebCoreSupport/UndoStepQt.cpp \
     $$PWD/qt/WebCoreSupport/WebEventConversion.cpp
 
 HEADERS += \
-    $$PWD/qt/Api/qwebframe.h \
-    $$PWD/qt/Api/qwebframe_p.h \
-    $$PWD/qt/Api/qgraphicswebview.h \
-    $$PWD/qt/Api/qwebkitglobal.h \
-    $$PWD/qt/Api/qwebkitplatformplugin.h \
-    $$PWD/qt/Api/qwebpage.h \
-    $$PWD/qt/Api/qwebview.h \
-    $$PWD/qt/Api/qwebsettings.h \
-    $$PWD/qt/Api/qwebhistoryinterface.h \
+    $$PWD/qt/Api/qhttpheader_p.h \
     $$PWD/qt/Api/qwebdatabase.h \
-    $$PWD/qt/Api/qwebsecurityorigin.h \
     $$PWD/qt/Api/qwebelement.h \
     $$PWD/qt/Api/qwebelement_p.h \
-    $$PWD/qt/Api/qwebpluginfactory.h \
     $$PWD/qt/Api/qwebhistory.h \
-    $$PWD/qt/Api/qwebinspector.h \
-    $$PWD/qt/Api/qwebkitversion.h \
-    $$PWD/qt/Api/qwebplugindatabase_p.h \
-    $$PWD/qt/Api/qhttpheader_p.h \
-    $$PWD/qt/WebCoreSupport/InitWebCoreQt.h \
-    $$PWD/qt/WebCoreSupport/InspectorServerQt.h \
-    $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.h \
-    $$PWD/qt/WebCoreSupport/QtWebComboBox.h \
+    $$PWD/qt/Api/qwebhistory_p.h \
+    $$PWD/qt/Api/qwebhistoryinterface.h \
+    $$PWD/qt/Api/qwebpluginfactory.h \
+    $$PWD/qt/Api/qwebsecurityorigin.h \
+    $$PWD/qt/Api/qwebsettings.h \
+    $$PWD/qt/Api/qwebscriptworld_p.h \
+    $$PWD/qt/WebCoreSupport/ChromeClientQt.h \
+    $$PWD/qt/WebCoreSupport/ContextMenuClientQt.h \
+    $$PWD/qt/WebCoreSupport/DragClientQt.h \
+    $$PWD/qt/WebCoreSupport/EditorClientQt.h \
     $$PWD/qt/WebCoreSupport/FrameLoaderClientQt.h \
     $$PWD/qt/WebCoreSupport/FrameNetworkingContextQt.h \
     $$PWD/qt/WebCoreSupport/GeolocationPermissionClientQt.h \
+    $$PWD/qt/WebCoreSupport/InitWebCoreQt.h \
+    $$PWD/qt/WebCoreSupport/InspectorClientQt.h \
+    $$PWD/qt/WebCoreSupport/InspectorServerQt.h \
     $$PWD/qt/WebCoreSupport/NotificationPresenterClientQt.h \
-    $$PWD/qt/WebCoreSupport/PageClientQt.h \
+    $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.h \
     $$PWD/qt/WebCoreSupport/PopupMenuQt.h \
-    $$PWD/qt/WebCoreSupport/QStyleFacadeImp.h \
     $$PWD/qt/WebCoreSupport/QtPlatformPlugin.h \
+    $$PWD/qt/WebCoreSupport/QtPluginWidgetAdapter.h \
+    $$PWD/qt/WebCoreSupport/QWebFrameAdapter.h \
+    $$PWD/qt/WebCoreSupport/QWebPageAdapter.h \
     $$PWD/qt/WebCoreSupport/SearchPopupMenuQt.h \
     $$PWD/qt/WebCoreSupport/TextCheckerClientQt.h \
-    $$PWD/qt/WebCoreSupport/PlatformStrategiesQt.h \
+    $$PWD/qt/WebCoreSupport/UndoStepQt.h \
     $$PWD/qt/WebCoreSupport/WebEventConversion.h
 
-contains(QT_CONFIG,accessibility) {
-    SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp
-    HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h 
-}
-
 INCLUDEPATH += \
-    $$PWD/qt/Api \
     $$PWD/qt/WebCoreSupport
 
-enable?(VIDEO) {
-    !use?(QTKIT):!use?(GSTREAMER):use?(QT_MULTIMEDIA) {
-        HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.h
-        SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.cpp
-    }
+use?(3D_GRAPHICS): WEBKIT += angle
 
+enable?(GEOLOCATION) {
+     HEADERS += \
+        $$PWD/qt/WebCoreSupport/GeolocationClientQt.h
+     SOURCES += \
+        $$PWD/qt/WebCoreSupport/GeolocationClientQt.cpp
+}
+
+enable?(ICONDATABASE) {
+    HEADERS += \
+        $$PWD/../WebCore/loader/icon/IconDatabaseClient.h \
+        $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.h
+
+    SOURCES += \
+        $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.cpp
+}
+
+enable?(VIDEO) {
     use?(QTKIT) | use?(GSTREAMER) | use?(QT_MULTIMEDIA) {
         HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoQt.h
         SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoQt.cpp
@@ -134,21 +129,4 @@ enable?(VIDEO) {
     }
 }
 
-enable?(ICONDATABASE) {
-    HEADERS += \
-        $$PWD/../WebCore/loader/icon/IconDatabaseClient.h \
-        $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.h
-
-    SOURCES += \
-        $$PWD/qt/WebCoreSupport/IconDatabaseClientQt.cpp
-}
-
-enable?(GEOLOCATION) {
-     HEADERS += \
-        $$PWD/qt/WebCoreSupport/GeolocationClientQt.h
-     SOURCES += \
-        $$PWD/qt/WebCoreSupport/GeolocationClientQt.cpp
-}
-
-use?(3D_GRAPHICS): WEBKIT += angle
 
diff --git a/Source/WebKit/WebKitWidgets.pri b/Source/WebKit/WebKitWidgets.pri
new file mode 100644 (file)
index 0000000..54c6148
--- /dev/null
@@ -0,0 +1,33 @@
+# -------------------------------------------------------------------
+# This file contains shared rules used both when building WebKitWidgets
+# itself, and by targets that use WebKitWidgets.
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebKit
+
+INCLUDEPATH += \
+    $$SOURCE_DIR/qt/Api \
+    $$SOURCE_DIR/qt/WebCoreSupport \
+    $$ROOT_WEBKIT_DIR/Source/WTF/wtf/qt
+
+enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) {
+    QT += sensors
+}
+
+enable?(GEOLOCATION): QT += location
+
+use?(QT_MULTIMEDIA): QT *= multimediawidgets
+
+contains(CONFIG, texmap): DEFINES += WTF_USE_TEXTURE_MAPPER=1
+
+use?(PLUGIN_BACKEND_XLIB): PKGCONFIG += x11
+
+QT += network widgets
+have?(QTQUICK): QT += quick
+have?(QTPRINTSUPPORT): QT += printsupport
+
+use?(TEXTURE_MAPPER_GL)|enable?(WEBGL) {
+    QT *= opengl
+}
diff --git a/Source/WebKit/WebKitWidgets.pro b/Source/WebKit/WebKitWidgets.pro
new file mode 100644 (file)
index 0000000..5ca7541
--- /dev/null
@@ -0,0 +1,75 @@
+# -------------------------------------------------------------------
+# Target file for the WebKitWidgets static library
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+TEMPLATE = lib
+TARGET = WebKitWidgets
+
+include(WebKitWidgets.pri)
+
+WEBKIT += wtf javascriptcore webcore webkit1
+QT += gui
+
+CONFIG += staticlib
+
+SOURCES += \
+    $$PWD/qt/Api/qgraphicswebview.cpp \
+    $$PWD/qt/Api/qwebframe.cpp \
+    $$PWD/qt/Api/qwebpage.cpp \
+    $$PWD/qt/Api/qwebview.cpp \
+    $$PWD/qt/Api/qwebplugindatabase.cpp \
+    $$PWD/qt/Api/qwebinspector.cpp \
+    $$PWD/qt/Api/qwebkitversion.cpp \
+    $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.cpp \
+    $$PWD/qt/WebCoreSupport/QtWebComboBox.cpp \
+    $$PWD/qt/WebCoreSupport/QWebUndoCommand.cpp \
+    $$PWD/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp \
+    $$PWD/qt/WebCoreSupport/InitWebKitQt.cpp \
+    $$PWD/qt/WebCoreSupport/InspectorClientWebPage.cpp \
+    $$PWD/qt/WebCoreSupport/PageClientQt.cpp \
+    $$PWD/qt/WebCoreSupport/QStyleFacadeImp.cpp \
+    $$PWD/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp \
+    $$PWD/qt/WebCoreSupport/QWidgetPluginImpl.cpp
+
+HEADERS += \
+    $$PWD/qt/Api/qgraphicswebview.h \
+    $$PWD/qt/Api/qwebframe.h \
+    $$PWD/qt/Api/qwebframe_p.h \
+    $$PWD/qt/Api/qwebkitglobal.h \
+    $$PWD/qt/Api/qwebkitplatformplugin.h \
+    $$PWD/qt/Api/qwebpage.h \
+    $$PWD/qt/Api/qwebpage_p.h \
+    $$PWD/qt/Api/qwebview.h \
+    $$PWD/qt/Api/qwebinspector.h \
+    $$PWD/qt/Api/qwebkitversion.h \
+    $$PWD/qt/Api/qwebplugindatabase_p.h \
+    $$PWD/qt/WebCoreSupport/InitWebKitQt.h \
+    $$PWD/qt/WebCoreSupport/InspectorClientWebPage.h \
+    $$PWD/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h \
+    $$PWD/qt/WebCoreSupport/QtFallbackWebPopup.h \
+    $$PWD/qt/WebCoreSupport/QtWebComboBox.h \
+    $$PWD/qt/WebCoreSupport/QWebUndoCommand.h \
+    $$PWD/qt/WebCoreSupport/PageClientQt.h \
+    $$PWD/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h \
+    $$PWD/qt/WebCoreSupport/QStyleFacadeImp.h \
+    $$PWD/qt/WebCoreSupport/QWidgetPluginImpl.h
+
+contains(QT_CONFIG, accessibility) {
+    SOURCES += $$PWD/qt/Api/qwebviewaccessible.cpp
+    HEADERS += $$PWD/qt/Api/qwebviewaccessible_p.h 
+}
+
+INCLUDEPATH += \
+    $$PWD/qt/Api \
+    $$PWD/qt/WebCoreSupport
+
+enable?(VIDEO) {
+    !use?(QTKIT):!use?(GSTREAMER):use?(QT_MULTIMEDIA) {
+        HEADERS += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.h
+        SOURCES += $$PWD/qt/WebCoreSupport/FullScreenVideoWidget.cpp
+    }
+}
+
+use?(3D_GRAPHICS): WEBKIT += angle
index ef42c95186e0e64dd3cd717f118c7888ff37a521..84b4e801bd1acdf6ffbf732964c98ecae33a4175 100644 (file)
@@ -88,7 +88,7 @@ public:
 
     PageClientQGraphicsWidget* pageClient() const
     {
-        return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get());
+        return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.data());
     } 
 };
 
@@ -468,7 +468,7 @@ void QGraphicsWebViewPrivate::detachCurrentPage()
         return;
 
     page->d->view = 0;
-    page->d->client = nullptr;
+    page->d->client.reset();
 
     // if the page was created by us, we own it and need to
     // destroy it as well.
@@ -501,7 +501,7 @@ void QGraphicsWebView::setPage(QWebPage* page)
     if (!d->page)
         return;
 
-    d->page->d->client = adoptPtr(new PageClientQGraphicsWidget(this, page));
+    d->page->d->client.reset(new PageClientQGraphicsWidget(this, page));
 
     if (d->overlay())
         d->overlay()->prepareGraphicsItemGeometryChange();
index 108b9b06f1df3bf33d1c4e375d88fdb3f80d83d3..82f579d9550a3acfd99d430d1d5cfa078fee838e 100644 (file)
@@ -39,6 +39,7 @@
 #include "JSHTMLElement.h"
 #include "JSObject.h"
 #include "PropertyNameArray.h"
+#include <QWebFrameAdapter.h>
 #include <parser/SourceCode.h>
 #include "qt_runtime.h"
 #include "NodeList.h"
@@ -47,8 +48,6 @@
 #include "StaticNodeList.h"
 #include "StyleResolver.h"
 #include "markup.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
 #include "runtime_root.h"
 #include <JSDocument.h>
 #include <wtf/Vector.h>
@@ -706,7 +705,8 @@ QWebFrame *QWebElement::webFrame() const
     Frame* frame = document->frame();
     if (!frame)
         return 0;
-    return QWebFramePrivate::kit(frame);
+    QWebFrameAdapter* frameAdapter = QWebFrameAdapter::kit(frame);
+    return frameAdapter->apiHandle();
 }
 
 static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController)
index 1310348ed8979490aa2bc0b22fdc2dc16d51b65e..89474dd2e6b5eea47cddcca1062661bc15c30413 100644 (file)
@@ -106,54 +106,6 @@ QT_BEGIN_NAMESPACE
 extern Q_GUI_EXPORT int qt_defaultDpi();
 QT_END_NAMESPACE
 
-static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl)
-{
-    switch (cacheLoadControl) {
-    case QNetworkRequest::AlwaysNetwork:
-        return WebCore::ReloadIgnoringCacheData;
-    case QNetworkRequest::PreferCache:
-        return WebCore::ReturnCacheDataElseLoad;
-    case QNetworkRequest::AlwaysCache:
-        return WebCore::ReturnCacheDataDontLoad;
-    default:
-        break;
-    }
-    return WebCore::UseProtocolCachePolicy;
-}
-
-QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame,
-                             WebCore::HTMLFrameOwnerElement* ownerFrameElement,
-                             const WTF::String& frameName)
-    : name(frameName)
-    , ownerElement(ownerFrameElement)
-    , page(parentPage)
-    , allowsScrolling(true)
-    , marginWidth(0)
-    , marginHeight(0)
-{
-    frameLoaderClient = new FrameLoaderClientQt();
-    frame = Frame::create(page, ownerElement, frameLoaderClient);
-
-    // FIXME: All of the below should probably be moved over into WebCore
-    frame->tree()->setName(name);
-    if (parentFrame)
-        parentFrame->tree()->appendChild(frame);
-}
-
-void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData)
-{
-    q = qframe;
-
-    allowsScrolling = frameData->allowsScrolling;
-    marginWidth = frameData->marginWidth;
-    marginHeight = frameData->marginHeight;
-    frame = frameData->frame.get();
-    frameLoaderClient = frameData->frameLoaderClient;
-    frameLoaderClient->setFrame(qframe, frame);
-
-    frame->init();
-}
-
 void QWebFramePrivate::setPage(QWebPage* newPage)
 {
     if (page == newPage)
@@ -166,6 +118,7 @@ void QWebFramePrivate::setPage(QWebPage* newPage)
         q->setParent(newPage);
 
     page = newPage;
+    pageAdapter = newPage->handle();
     emit q->pageChanged();
 }
 
@@ -375,6 +328,11 @@ void QWebFramePrivate::emitUrlChanged()
     emit q->urlChanged(url);
 }
 
+void QWebFramePrivate::didStartProvisionalLoad()
+{
+    emit q->provisionalLoad();
+}
+
 void QWebFramePrivate::_q_orientationChanged()
 {
 #if ENABLE(ORIENTATION_EVENTS)
@@ -409,6 +367,65 @@ void QWebFramePrivate::didClearWindowObject()
     emit q->javaScriptWindowObjectCleared();
 }
 
+bool QWebFramePrivate::handleProgressFinished(QPoint *localPos)
+{
+    QWidget *view = q->page()->view();
+    if (!view || !localPos)
+        return false;
+    *localPos = view->mapFromGlobal(QCursor::pos());
+    return view->hasFocus() && view->rect().contains(*localPos);
+}
+
+void QWebFramePrivate::emitInitialLayoutCompleted()
+{
+    emit q->initialLayoutCompleted();
+}
+
+void QWebFramePrivate::emitIconChanged()
+{
+    emit q->iconChanged();
+}
+
+void QWebFramePrivate::emitLoadStarted(bool originatingLoad)
+{
+    if (page && originatingLoad)
+        emit page->loadStarted();
+    emit q->loadStarted();
+}
+
+void QWebFramePrivate::emitLoadFinished(bool originatingLoad, bool ok)
+{
+    if (page && originatingLoad)
+        emit page->loadFinished(ok);
+    emit q->loadFinished(ok);
+}
+
+QWebFrameAdapter* QWebFramePrivate::createChildFrame(QWebFrameData* frameData)
+{
+    QWebFrame* newFrame = new QWebFrame(/*parent frame*/q, frameData);
+    return newFrame->d;
+}
+
+QWebFrame *QWebFramePrivate::apiHandle()
+{
+    return q;
+}
+
+QObject *QWebFramePrivate::handle()
+{
+    return q;
+}
+
+void QWebFramePrivate::contentsSizeDidChange(const QSize &size)
+{
+    emit q->contentsSizeChanged(size);
+}
+
+int QWebFramePrivate::scrollBarPolicy(Qt::Orientation orientation) const
+{
+    return (int) q->scrollBarPolicy(orientation);
+}
+
 /*!
     \class QWebFrame
     \since 4.4
@@ -472,29 +489,27 @@ void QWebFramePrivate::didClearWindowObject()
     \value AllLayers Includes all the above layers
 */
 
-QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
-    : QObject(parent)
+QWebFrame::QWebFrame(QWebPage *parentPage)
+    : QObject(parentPage)
     , d(new QWebFramePrivate)
 {
-    d->page = parent;
-    d->init(this, frameData);
+    d->page = parentPage;
+    d->q = this;
+    d->init(/*page adapter*/ parentPage->handle());
 
-    if (!frameData->url.isEmpty()) {
-        WebCore::ResourceRequest request(frameData->url, frameData->referrer);
-        d->frame->loader()->load(request, frameData->name, false);
-    }
 #if ENABLE(ORIENTATION_EVENTS)
     connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
     d->m_orientation.start();
 #endif
 }
 
-QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
+QWebFrame::QWebFrame(QWebFrame* parent, QWebFrameData* frameData)
     : QObject(parent)
     , d(new QWebFramePrivate)
 {
     d->page = parent->d->page;
-    d->init(this, frameData);
+    d->q = this;
+    d->init(parent->d->pageAdapter, frameData);
 #if ENABLE(ORIENTATION_EVENTS)
     connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
     d->m_orientation.start();
@@ -503,9 +518,6 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
 
 QWebFrame::~QWebFrame()
 {
-    if (d->frame && d->frame->loader() && d->frame->loader()->client())
-        static_cast<FrameLoaderClientQt*>(d->frame->loader()->client())->m_webFrame = 0;
-
     delete d;
 }
 
@@ -674,22 +686,6 @@ static inline bool isCoreFrameClear(WebCore::Frame* frame)
     return frame->document()->url().isEmpty();
 }
 
-static inline QUrl ensureAbsoluteUrl(const QUrl &url)
-{
-    if (!url.isValid() || !url.isRelative())
-        return url;
-
-    // This contains the URL with absolute path but without 
-    // the query and the fragment part.
-    QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath()); 
-
-    // The path is removed so the query and the fragment parts are there.
-    QString pathRemoved = url.toString(QUrl::RemovePath);
-    QUrl toResolve(pathRemoved);
-    
-    return baseUrl.resolved(toResolve);
-}
-
 /*!
     \property QWebFrame::url
     \brief the url of the frame currently viewed
@@ -704,7 +700,7 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url)
 void QWebFrame::setUrl(const QUrl &url)
 {
     clearCoreFrame(d->frame);
-    const QUrl absolute = ensureAbsoluteUrl(url);
+    const QUrl absolute = QWebFrameAdapter::ensureAbsoluteUrl(url);
     d->url = absolute;
     load(absolute);
 }
@@ -798,58 +794,7 @@ void QWebFrame::load(const QNetworkRequest &req,
                      QNetworkAccessManager::Operation operation,
                      const QByteArray &body)
 {
-    if (d->parentFrame())
-        d->page->d->insideOpenCall = true;
-
-    QUrl url = ensureAbsoluteUrl(req.url());
-
-    WebCore::ResourceRequest request(url);
-
-    switch (operation) {
-        case QNetworkAccessManager::HeadOperation:
-            request.setHTTPMethod("HEAD");
-            break;
-        case QNetworkAccessManager::GetOperation:
-            request.setHTTPMethod("GET");
-            break;
-        case QNetworkAccessManager::PutOperation:
-            request.setHTTPMethod("PUT");
-            break;
-        case QNetworkAccessManager::PostOperation:
-            request.setHTTPMethod("POST");
-            break;
-        case QNetworkAccessManager::DeleteOperation:
-            request.setHTTPMethod("DELETE");
-            break;
-        case QNetworkAccessManager::CustomOperation:
-            request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData());
-            break;
-        case QNetworkAccessManager::UnknownOperation:
-            // eh?
-            break;
-    }
-
-    QVariant cacheLoad = req.attribute(QNetworkRequest::CacheLoadControlAttribute);
-    if (cacheLoad.isValid()) {
-        bool ok;
-        uint cacheLoadValue = cacheLoad.toUInt(&ok);
-        if (ok)
-            request.setCachePolicy(cacheLoadControlToCachePolicy(cacheLoadValue));
-    }
-
-    QList<QByteArray> httpHeaders = req.rawHeaderList();
-    for (int i = 0; i < httpHeaders.size(); ++i) {
-        const QByteArray &headerName = httpHeaders.at(i);
-        request.addHTTPHeaderField(QString::fromLatin1(headerName), QString::fromLatin1(req.rawHeader(headerName)));
-    }
-
-    if (!body.isEmpty())
-        request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size()));
-
-    d->frame->loader()->load(request, false);
-
-    if (d->parentFrame())
-        d->page->d->insideOpenCall = false;
+    d->load(req, operation, body);
 }
 
 /*!
@@ -1088,10 +1033,7 @@ void QWebFrame::scroll(int dx, int dy)
 
 QPoint QWebFrame::scrollPosition() const
 {
-    if (!d->frame->view())
-        return QPoint(0, 0);
-
-    IntSize ofs = d->frame->view()->scrollOffset();
+    IntSize ofs = d->scrollPosition();
     return QPoint(ofs.width(), ofs.height());
 }
 
@@ -1248,9 +1190,7 @@ QPoint QWebFrame::pos() const
 */
 QRect QWebFrame::geometry() const
 {
-    if (!d->frame->view())
-        return QRect();
-    return d->frame->view()->frameRect();
+    return d->frameRect();
 }
 
 /*!
@@ -1479,6 +1419,11 @@ QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame)
     return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject());
 }
 
+QWebFrame *QWebFramePrivate::kit(const QWebFrameAdapter* frameAdapter)
+{
+    return static_cast<const QWebFramePrivate*>(frameAdapter)->q;
+}
+
 
 /*!
     \fn void QWebFrame::javaScriptWindowObjectCleared()
@@ -1859,4 +1804,12 @@ QWebFrame *QWebHitTestResult::frame() const
     return d->frame.data();
 }
 
+/*!
+ * \internal
+ */
+QWebFrameAdapter *QWebFrame::handle() const
+{
+    return d;
+}
+
 #include "moc_qwebframe.cpp"
index ca96661e35cac5266d55f0f41873c56670dc3991..fe00d81f5a0452ad248189966394198dccd7fbf7 100644 (file)
@@ -41,8 +41,10 @@ class QPrinter;
 QT_END_NAMESPACE
 
 class QWebNetworkRequest;
+class QWebFrameAdapter;
 class QWebFramePrivate;
 class QWebPage;
+class QWebPageAdapter;
 class QWebHitTestResult;
 class QWebHistoryItem;
 class QWebSecurityOrigin;
@@ -115,8 +117,8 @@ class QWEBKIT_EXPORT QWebFrame : public QObject {
     Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition)
     Q_PROPERTY(bool focus READ hasFocus)
 private:
-    QWebFrame(QWebPage *parent, QWebFrameData *frameData);
-    QWebFrame(QWebFrame *parent, QWebFrameData *frameData);
+    QWebFrame(QWebPage *parentPage);
+    QWebFrame(QWebFrame* parent, QWebFrameData*);
     ~QWebFrame();
 
 public:
@@ -200,6 +202,7 @@ public:
     virtual bool event(QEvent *);
 
     QWebSecurityOrigin securityOrigin() const;
+    QWebFrameAdapter* handle() const;
 
 public Q_SLOTS:
     QVariant evaluateJavaScript(const QString& scriptSource);
index d6779f2bc5993139bc7d0fec4b64e16ebf509d36..dbdcbc85a458b8e99479a60968a48a88c8be7018 100644 (file)
 #ifndef QWEBFRAME_P_H
 #define QWEBFRAME_P_H
 
+#include "QWebFrameAdapter.h"
+
 #include "qwebframe.h"
 #include "qwebpage_p.h"
 
 #include "EventHandler.h"
+#include "Frame.h"
 #include "GraphicsContext.h"
 #include "KURL.h"
 #if ENABLE(ORIENTATION_EVENTS)
 #include "qorientationsensor.h"
 #endif // ENABLE(ORIENTATION_EVENTS).
 #include "qwebelement.h"
-#include "wtf/RefPtr.h"
-#include "Frame.h"
-#include "ViewportArguments.h"
-#include <wtf/text/WTFString.h>
-
 #if USE(ACCELERATED_COMPOSITING)
 #include "texmap/TextureMapper.h"
 #endif
+#include "ViewportArguments.h"
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
 
 
 namespace WebCore {
@@ -50,42 +51,17 @@ namespace WebCore {
 }
 class QWebPage;
 
-class QWebFrameData {
-public:
-    QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0,
-                  WebCore::HTMLFrameOwnerElement* = 0,
-                  const WTF::String& frameName = WTF::String());
-
-    WebCore::KURL url;
-    WTF::String name;
-    WebCore::HTMLFrameOwnerElement* ownerElement;
-    WebCore::Page* page;
-    RefPtr<WebCore::Frame> frame;
-    WebCore::FrameLoaderClientQt* frameLoaderClient;
-
-    WTF::String referrer;
-    bool allowsScrolling;
-    int marginWidth;
-    int marginHeight;
-};
-
-class QWebFramePrivate {
+class QWebFramePrivate : public QWebFrameAdapter {
 public:
     QWebFramePrivate()
         : q(0)
         , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded)
         , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded)
-        , frameLoaderClient(0)
-        , frame(0)
         , page(0)
-        , allowsScrolling(true)
-        , marginWidth(-1)
-        , marginHeight(-1)
 #if USE(ACCELERATED_COMPOSITING)
         , rootTextureMapperLayer(0)
 #endif
         {}
-    void init(QWebFrame* qframe, QWebFrameData* frameData);
     void setPage(QWebPage*);
 
     inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); }
@@ -95,6 +71,7 @@ public:
 
     static WebCore::Frame* core(const QWebFrame*);
     static QWebFrame* kit(const WebCore::Frame*);
+    static QWebFrame* kit(const QWebFrameAdapter*);
 
     void renderRelativeCoords(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
 #if USE(TILED_BACKING_STORE)
@@ -105,22 +82,29 @@ public:
     void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip);
 #endif
     void renderFrameExtras(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
-    void emitUrlChanged();
     void _q_orientationChanged();
 
-    void didClearWindowObject();
+
+    // Adapter implementation
+    virtual QWebFrame* apiHandle() OVERRIDE;
+    virtual QObject* handle() OVERRIDE;
+    virtual void contentsSizeDidChange(const QSize &) OVERRIDE;
+    virtual int scrollBarPolicy(Qt::Orientation) const OVERRIDE;
+    virtual void emitUrlChanged() OVERRIDE;
+    virtual void didStartProvisionalLoad() OVERRIDE;
+    virtual void didClearWindowObject() OVERRIDE;
+    virtual bool handleProgressFinished(QPoint*) OVERRIDE;
+    virtual void emitInitialLayoutCompleted() OVERRIDE;
+    virtual void emitIconChanged() OVERRIDE;
+    virtual void emitLoadStarted(bool originatingLoad) OVERRIDE;
+    virtual void emitLoadFinished(bool originatingLoad, bool ok) OVERRIDE;
+    virtual QWebFrameAdapter* createChildFrame(QWebFrameData*) OVERRIDE;
 
     QWebFrame *q;
     Qt::ScrollBarPolicy horizontalScrollBarPolicy;
     Qt::ScrollBarPolicy verticalScrollBarPolicy;
-    WebCore::FrameLoaderClientQt *frameLoaderClient;
-    WebCore::Frame *frame;
     QWebPage *page;
-    WebCore::KURL url;
 
-    bool allowsScrolling;
-    int marginWidth;
-    int marginHeight;
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::TextureMapperLayer* rootTextureMapperLayer;
     OwnPtr<WebCore::TextureMapper> textureMapper;
index f7849666e0fcbd18ccf2aebd1e273c72b7992740..a945b592bb290e186c56b039c0dbc8e6552bd922 100644 (file)
 #include "config.h"
 #include "qwebhistory.h"
 #include "qwebhistory_p.h"
-#include "qwebframe_p.h"
 
 #include "BackForwardListImpl.h"
+#include "Frame.h"
 #include "IconDatabaseBase.h"
 #include "Image.h"
 #include "IntSize.h"
 #include "KURL.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include <QWebPageAdapter.h>
 #include <wtf/text/WTFString.h>
 
 #include <QSharedData>
@@ -552,9 +553,9 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history)
     return source;
 }
 
-QWebPagePrivate* QWebHistoryPrivate::page()
+QWebPageAdapter* QWebHistoryPrivate::page()
 {
-    return QWebFramePrivate::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page()->mainFrame())->page()->handle();
+    return QWebPageAdapter::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page());
 }
 
 WebCore::HistoryItem* QWebHistoryItemPrivate::core(const QWebHistoryItem* q)
index aaee386329c05fc57c172db6e68369621b2afb31..17634ebc088de8e94b564815ccd489c09f063276 100644 (file)
@@ -26,7 +26,7 @@
 #include <QtCore/qglobal.h>
 #include <QtCore/qshareddata.h>
 
-class QWebPagePrivate;
+class QWebPageAdapter;
 
 class QWEBKIT_EXPORT QWebHistoryItemPrivate : public QSharedData {
 public:
@@ -63,7 +63,7 @@ public:
         lst->deref();
     }
 
-    QWebPagePrivate* page();
+    QWebPageAdapter* page();
 
     WebCore::BackForwardListImpl* lst;
 };
index 2fbbab249a041c36acfcd2c8ea76c81268f6f25d..55089e1a1fcee8cde9439bd952ccbc5b3316ef90 100644 (file)
@@ -184,12 +184,12 @@ void QWebInspector::closeEvent(QCloseEvent* event)
 }
 
 /*! \internal */
-void QWebInspectorPrivate::setFrontend(QWidget* newFrontend)
+void QWebInspectorPrivate::setFrontend(QObject* newFrontend)
 {
     if (frontend)
         frontend->setParent(0);
 
-    frontend = newFrontend;
+    frontend = qobject_cast<QWidget*>(newFrontend);
 
     if (frontend) {
         frontend->setParent(q);
index 4d327cc5a911f7e5229804f1d8e279a4548ed757..908de84edc1d9ab7a07118dddb592f4ae1bf26d6 100644 (file)
@@ -35,7 +35,7 @@ public:
     , frontend(0)
     {}
 
-    void setFrontend(QWidget* newFrontend);
+    void setFrontend(QObject* newFrontend);
     void adjustFrontendSize(const QSize& size);
 
     QWebInspector* q;
index 02383ac6741584904d82ca0d782ec967289de888..68a3ff1f3e25e94021bec0bacf6b7b2bc4906601 100644 (file)
 #include "config.h"
 #include "qwebpage.h"
 
-#include "qwebview.h"
-#include "qwebframe.h"
-#include "qwebpage_p.h"
-#include "qwebframe_p.h"
-#include "qwebhistory.h"
-#include "qwebhistory_p.h"
-#include "qwebinspector.h"
-#include "qwebinspector_p.h"
-#include "qwebsettings.h"
-#include "qwebkitplatformplugin.h"
-#include "qwebkitversion.h"
-
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSParser.h"
 #include "ApplicationCacheStorage.h"
@@ -45,6 +33,9 @@
 #include "ContextMenu.h"
 #include "ContextMenuClientQt.h"
 #include "ContextMenuController.h"
+#if USE(QT_MULTIMEDIA)
+#include "DefaultFullScreenVideoHandler.h"
+#endif
 #if ENABLE(DEVICE_ORIENTATION)
 #include "DeviceMotionClientQt.h"
 #include "DeviceOrientationClientMock.h"
@@ -62,7 +53,6 @@
 #include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "FrameLoader.h"
-#include "FrameLoader.h"
 #include "FrameLoaderClientQt.h"
 #include "FrameTree.h"
 #include "FrameView.h"
@@ -78,8 +68,9 @@
 #include "HTMLNames.h"
 #include "HitTestResult.h"
 #include "Image.h"
-#include "InitWebCoreQt.h"
+#include "InitWebKitQt.h"
 #include "InspectorClientQt.h"
+#include "InspectorClientWebPage.h"
 #include "InspectorController.h"
 #include "InspectorServerQt.h"
 #include "KURL.h"
 #include "NavigationAction.h"
 #include "NetworkingContext.h"
 #include "NodeList.h"
-#include "NotificationPresenterClientQt.h"
 #include "NotImplemented.h"
+#include "NotificationPresenterClientQt.h"
 #include "Page.h"
 #include "PageClientQt.h"
 #include "PageGroup.h"
 #include "Pasteboard.h"
-#include "PlatformGestureEvent.h"
 #include "PlatformKeyboardEvent.h"
 #include "PlatformTouchEvent.h"
 #include "PlatformWheelEvent.h"
 #include "PluginDatabase.h"
-#include "PluginDatabase.h"
 #include "PluginPackage.h"
 #include "ProgressTracker.h"
+#include "QGraphicsWidgetPluginImpl.h"
+#include "QWebUndoCommand.h"
+#include "QWidgetPluginImpl.h"
+#include "QtFallbackWebPopup.h"
 #include "QtPlatformPlugin.h"
 #include "RenderTextControl.h"
 #include "RenderThemeQt.h"
 #include "SystemInfo.h"
 #endif // Q_OS_WIN32
 #include "TextIterator.h"
+#include "UndoStepQt.h"
 #include "UserAgentQt.h"
 #include "WebEventConversion.h"
 #include "WebKitVersion.h"
 #include "WindowFeatures.h"
 #include "WorkerThread.h"
 
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "qwebhistory.h"
+#include "qwebhistory_p.h"
+#include "qwebinspector.h"
+#include "qwebinspector_p.h"
+#include "qwebkitplatformplugin.h"
+#include "qwebkitversion.h"
+#include "qwebpage_p.h"
+#include "qwebsettings.h"
+#include "qwebview.h"
+
 #include <QAction>
 #include <QApplication>
 #include <QBasicTimer>
 #include <QBitArray>
+#include <QClipboard>
 #include <QColorDialog>
 #include <QDebug>
 #include <QDesktopWidget>
 #include <QLabel>
 #include <QMenu>
 #include <QMessageBox>
+#include <QNetworkAccessManager>
 #include <QNetworkProxy>
-#include <QUndoStack>
-#include <QUrl>
+#include <QNetworkRequest>
 #include <QPainter>
-#include <QClipboard>
 #include <QSslSocket>
 #include <QStyle>
 #include <QSysInfo>
+#if USE(QT_MOBILITY_SYSTEMINFO)
+#include <qsysteminfo.h>
+#endif
+#include <QSystemTrayIcon>
 #include <QTextCharFormat>
+#include <QToolTip>
 #include <QTouchEvent>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
+#include <QUndoStack>
+#include <QUrl>
 #if defined(Q_WS_X11)
 #include <QX11Info>
 #endif
-#if USE(QT_MOBILITY_SYSTEMINFO)
-#include <qsysteminfo.h>
-#endif
 
 using namespace WebCore;
 
@@ -163,8 +171,6 @@ QT_BEGIN_NAMESPACE
 extern Q_GUI_EXPORT int qt_defaultDpi();
 QT_END_NAMESPACE
 
-bool QWebPagePrivate::drtRun = false;
-
 // Lookup table mapping QWebPage::WebActions to the associated Editor commands
 static const char* editorCommandWebActions[] =
 {
@@ -300,40 +306,32 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
 
 QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
     : q(qq)
-    , page(0)
 #ifndef QT_NO_UNDOSTACK
     , undoStack(0)
 #endif
-    , insideOpenCall(false)
     , m_totalBytes(0)
     , m_bytesReceived()
     , clickCausedFocus(false)
-    , networkManager(0)
-    , forwardUnsupportedContent(false)
-    , smartInsertDeleteEnabled(true)
-    , selectTrailingWhitespaceEnabled(false)
     , linkPolicy(QWebPage::DontDelegateLinks)
-    , viewportSize(QSize(0, 0))
-    , settings(0)
+    , m_viewportSize(QSize(0, 0))
     , useFixedLayout(false)
-    , pluginFactory(0)
     , inspectorFrontend(0)
     , inspector(0)
     , inspectorIsInternalOnly(false)
     , m_lastDropAction(Qt::IgnoreAction)
 {
 #if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION)
-    bool useMock = QWebPagePrivate::drtRun;
+    bool useMock = QWebPageAdapter::drtRun;
 #endif
 
-    WebCore::initializeWebCoreQt();
+    WebKit::initializeWebKitWidgets();
 
     Page::PageClients pageClients;
-    pageClients.chromeClient = new ChromeClientQt(q);
+    pageClients.chromeClient = new ChromeClientQt(this);
     pageClients.contextMenuClient = new ContextMenuClientQt();
-    pageClients.editorClient = new EditorClientQt(q);
-    pageClients.dragClient = new DragClientQt(q);
-    pageClients.inspectorClient = new InspectorClientQt(q);
+    pageClients.editorClient = new EditorClientQt(this);
+    pageClients.dragClient = new DragClientQt(pageClients.chromeClient);
+    pageClients.inspectorClient = new InspectorClientQt(this);
     page = new Page(pageClients);
 #if ENABLE(GEOLOCATION)
     if (useMock) {
@@ -342,7 +340,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
         WebCore::provideGeolocationTo(page, mock);
         mock->setController(WebCore::GeolocationController::from(page));
     } else
-        WebCore::provideGeolocationTo(page, new GeolocationClientQt(q));
+        WebCore::provideGeolocationTo(page, new GeolocationClientQt(this));
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
     if (useMock)
@@ -351,9 +349,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
         WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt);
     WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt);
 #endif
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter());
-#endif
 
     // By default each page is put into their own unique page group, which affects popup windows
     // and visited links. Page groups (per process only) is a feature making it possible to use
@@ -364,7 +359,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
 
     page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
 
-    settings = new QWebSettings(page->settings());
+    QWebPageAdapter::init(page);
 
     history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList()));
     memset(actions, 0, sizeof(actions));
@@ -372,8 +367,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
     PageGroup::setShouldTrackVisitedLinks(true);
     
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    NotificationPresenterClientQt::notificationPresenter()->addClient();
-#endif
+    NotificationPresenterClientQt* presenter = NotificationPresenterClientQt::notificationPresenter();
+    presenter->addClient();
+#ifndef QT_NO_SYSTEMTRAYICON
+    if (!presenter->hasSystemTrayIcon())
+        presenter->setSystemTrayIcon(new QSystemTrayIcon);
+#endif // QT_NO_SYSTEMTRAYICON
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
 }
 
 QWebPagePrivate::~QWebPagePrivate()
@@ -384,8 +384,6 @@ QWebPagePrivate::~QWebPagePrivate()
 #ifndef QT_NO_UNDOSTACK
     delete undoStack;
 #endif
-    delete settings;
-    delete page;
     
     if (inspector) {
         // If the inspector is ours, delete it, otherwise just detach from it.
@@ -394,41 +392,220 @@ QWebPagePrivate::~QWebPagePrivate()
         else
             inspector->setPage(0);
     }
+    // Explicitly destruct the WebCore page at this point when the
+    // QWebPagePrivate / QWebPageAdapater vtables are still intact,
+    // in order for various destruction callbacks out of WebCore to
+    // work.
+    deletePage();
+}
 
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    NotificationPresenterClientQt::notificationPresenter()->removeClient();
+WebCore::Page* QWebPagePrivate::core(const QWebPage* page)
+{
+    return page->d->page;
+}
+
+void QWebPagePrivate::show()
+{
+    if (!view)
+        return;
+    view->window()->show();
+}
+
+void QWebPagePrivate::setFocus()
+{
+    if (!view)
+        return;
+    view->setFocus();
+}
+
+void QWebPagePrivate::unfocus()
+{
+    if (!view)
+        return;
+    view->clearFocus();
+}
+
+void QWebPagePrivate::setWindowRect(const QRect &rect)
+{
+    emit q->geometryChangeRequested(rect);
+}
+
+QSize QWebPagePrivate::viewportSize() const
+{
+    return q->viewportSize();
+}
+
+QWebPageAdapter *QWebPagePrivate::createWindow(bool dialog)
+{
+    QWebPage *newPage = q->createWindow(dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow);
+    if (!newPage)
+        return 0;
+    // Make sure the main frame exists, as WebCore expects it when returning from this ChromeClient::createWindow()
+    newPage->d->createMainFrame();
+    return newPage->d;
+}
+
+void QWebPagePrivate::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID)
+{
+    q->javaScriptConsoleMessage(message, lineNumber, sourceID);
+}
+
+void QWebPagePrivate::javaScriptAlert(QWebFrameAdapter* frame, const QString& msg)
+{
+    q->javaScriptAlert(QWebFramePrivate::kit(frame), msg);
+}
+
+bool QWebPagePrivate::javaScriptConfirm(QWebFrameAdapter* frame, const QString& msg)
+{
+    return q->javaScriptConfirm(QWebFramePrivate::kit(frame), msg);
+}
+
+bool QWebPagePrivate::javaScriptPrompt(QWebFrameAdapter *frame, const QString &msg, const QString &defaultValue, QString *result)
+{
+    return q->javaScriptPrompt(QWebFramePrivate::kit(frame), msg, defaultValue, result);
+}
+
+void QWebPagePrivate::printRequested(QWebFrameAdapter *frame)
+{
+    emit q->printRequested(QWebFramePrivate::kit(frame));
+}
+
+void QWebPagePrivate::databaseQuotaExceeded(QWebFrameAdapter* frame, const QString& databaseName)
+{
+    emit q->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
+}
+
+void QWebPagePrivate::applicationCacheQuotaExceeded(QWebSecurityOrigin *origin, quint64 defaultOriginQuota, quint64 c)
+{
+    emit q->applicationCacheQuotaExceeded(origin, defaultOriginQuota, defaultOriginQuota);
+}
+
+void QWebPagePrivate::setToolTip(const QString &tip)
+{
+#ifndef QT_NO_TOOLTIP
+    if (!view)
+        return;
+
+    if (tip.isEmpty()) {
+        view->setToolTip(QString());
+        QToolTip::hideText();
+    } else {
+        QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>");
+        view->setToolTip(dtip);
+    }
+#else
+    Q_UNUSED(tip);
 #endif
 }
 
-WebCore::ViewportArguments QWebPagePrivate::viewportArguments()
+#if USE(QT_MULTIMEDIA)
+QWebFullScreenVideoHandler *QWebPagePrivate::createFullScreenVideoHandler()
 {
-    return page ? page->viewportArguments() : WebCore::ViewportArguments();
+    return new WebKit::DefaultFullScreenVideoHandler;
 }
+#endif
 
-WebCore::Page* QWebPagePrivate::core(const QWebPage* page)
+QWebFrameAdapter *QWebPagePrivate::mainFrameAdapter()
 {
-    return page->d->page;
+    return q->mainFrame()->d;
 }
 
-QWebPagePrivate* QWebPagePrivate::priv(QWebPage* page)
+QStringList QWebPagePrivate::chooseFiles(QWebFrameAdapter *frame, bool allowMultiple, const QStringList &suggestedFileNames)
 {
-    return page->d;
+    if (allowMultiple && q->supportsExtension(QWebPage::ChooseMultipleFilesExtension)) {
+        QWebPage::ChooseMultipleFilesExtensionOption option;
+        option.parentFrame = QWebFramePrivate::kit(frame);
+        option.suggestedFileNames = suggestedFileNames;
+
+        QWebPage::ChooseMultipleFilesExtensionReturn output;
+        q->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output);
+
+        return output.fileNames;
+    }
+    // Single file
+    QStringList result;
+    QString suggestedFile;
+    if (!suggestedFileNames.isEmpty())
+        suggestedFile = suggestedFileNames.first();
+    QString file = q->chooseFile(QWebFramePrivate::kit(frame), suggestedFile);
+    if (!file.isEmpty())
+        result << file;
+    return result;
 }
 
-bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
+bool QWebPagePrivate::acceptNavigationRequest(QWebFrameAdapter *frameAdapter, const QNetworkRequest &request, int type)
 {
+    QWebFrame *frame = frameAdapter ? QWebFramePrivate::kit(frameAdapter): 0;
     if (insideOpenCall
         && frame == mainFrame.data())
         return true;
-    return q->acceptNavigationRequest(frame, request, type);
+    return q->acceptNavigationRequest(frame, request, QWebPage::NavigationType(type));
+}
+
+void QWebPagePrivate::emitRestoreFrameStateRequested(QWebFrameAdapter *frame)
+{
+    emit q->restoreFrameStateRequested(QWebFramePrivate::kit(frame));
+}
+
+void QWebPagePrivate::emitSaveFrameStateRequested(QWebFrameAdapter *frame, QWebHistoryItem *item)
+{
+    emit q->saveFrameStateRequested(QWebFramePrivate::kit(frame), item);
+}
+
+void QWebPagePrivate::emitDownloadRequested(const QNetworkRequest &request)
+{
+    emit q->downloadRequested(request);
+}
+
+void QWebPagePrivate::emitFrameCreated(QWebFrameAdapter *frame)
+{
+    emit q->frameCreated(QWebFramePrivate::kit(frame));
+}
+
+bool QWebPagePrivate::errorPageExtension(QWebPageAdapter::ErrorPageOption *opt, QWebPageAdapter::ErrorPageReturn *out)
+{
+    QWebPage::ErrorPageExtensionOption option;
+    if (opt->domain == QLatin1String("QtNetwork"))
+        option.domain = QWebPage::QtNetwork;
+    else if (opt->domain == QLatin1String("HTTP"))
+        option.domain = QWebPage::Http;
+    else if (opt->domain == QLatin1String("WebKit"))
+        option.domain = QWebPage::WebKit;
+    else
+        return false;
+    option.url = opt->url;
+    option.frame = QWebFramePrivate::kit(opt->frame);
+    option.error = opt->error;
+    option.errorString = opt->errorString;
+    QWebPage::ErrorPageExtensionReturn output;
+    if (!q->extension(QWebPage::ErrorPageExtension, &option, &output))
+        return false;
+    out->baseUrl = output.baseUrl;
+    out->content = output.content;
+    out->contentType = output.contentType;
+    out->encoding = output.encoding;
+    return true;
+}
+
+QtPluginWidgetAdapter *QWebPagePrivate::createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
+{
+    QObject *widget = q->createPlugin(classid, url, paramNames, paramValues);
+    return adapterForWidget(widget);
+}
+
+QtPluginWidgetAdapter *QWebPagePrivate::adapterForWidget(QObject *object) const
+{
+    if (QWidget *widget = qobject_cast<QWidget*>(object))
+        return new QWidgetPluginImpl(widget);
+    if (QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(object))
+        return new QGraphicsWidgetPluginImpl(widget);
+    return 0;
 }
 
 void QWebPagePrivate::createMainFrame()
 {
     if (!mainFrame) {
-        QWebFrameData frameData(page);
-        mainFrame = new QWebFrame(q, &frameData);
-
+        mainFrame = new QWebFrame(q);
         emit q->frameCreated(mainFrame.data());
     }
 }
@@ -475,49 +652,49 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen
     if (!client || !webcoreMenu)
         return 0;
 
-    QMenu* menu = new QMenu(client->ownerWidget());
+    QMenu* menu = new QMenu(q->view());
     for (int i = 0; i < items->count(); ++i) {
         const ContextMenuItem &item = items->at(i);
         switch (item.type()) {
-            case WebCore::CheckableActionType: /* fall through */
-            case WebCore::ActionType: {
-                QWebPage::WebAction action = webActionForContextMenuAction(item.action());
-                QAction *a = q->action(action);
-                if (a) {
-                    ContextMenuItem it(item);
-                    page->contextMenuController()->checkOrEnableIfNeeded(it);
-                    PlatformMenuItemDescription desc = it.releasePlatformDescription();
-                    a->setEnabled(desc.enabled);
-                    a->setChecked(desc.checked);
-                    a->setCheckable(item.type() == WebCore::CheckableActionType);
-
-                    menu->addAction(a);
-                    visitedWebActions->setBit(action);
-                }
-                break;
+        case WebCore::CheckableActionType: /* fall through */
+        case WebCore::ActionType: {
+            QWebPage::WebAction action = webActionForContextMenuAction(item.action());
+            QAction *a = q->action(action);
+            if (a) {
+                ContextMenuItem it(item);
+                page->contextMenuController()->checkOrEnableIfNeeded(it);
+                PlatformMenuItemDescription desc = it.releasePlatformDescription();
+                a->setEnabled(desc.enabled);
+                a->setChecked(desc.checked);
+                a->setCheckable(item.type() == WebCore::CheckableActionType);
+
+                menu->addAction(a);
+                visitedWebActions->setBit(action);
             }
-            case WebCore::SeparatorType:
-                menu->addSeparator();
-                break;
-            case WebCore::SubmenuType: {
-                QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions);
+            break;
+        }
+        case WebCore::SeparatorType:
+            menu->addSeparator();
+            break;
+        case WebCore::SubmenuType: {
+            QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions);
 
-                bool anyEnabledAction = false;
+            bool anyEnabledAction = false;
 
-                QList<QAction *> actions = subMenu->actions();
-                for (int i = 0; i < actions.count(); ++i) {
-                    if (actions.at(i)->isVisible())
-                        anyEnabledAction |= actions.at(i)->isEnabled();
-                }
-
-                // don't show sub-menus with just disabled actions
-                if (anyEnabledAction) {
-                    subMenu->setTitle(item.title());
-                    menu->addAction(subMenu->menuAction());
-                } else
-                    delete subMenu;
-                break;
+            QList<QAction *> actions = subMenu->actions();
+            for (int i = 0; i < actions.count(); ++i) {
+                if (actions.at(i)->isVisible())
+                    anyEnabledAction |= actions.at(i)->isEnabled();
             }
+
+            // don't show sub-menus with just disabled actions
+            if (anyEnabledAction) {
+                subMenu->setTitle(item.title());
+                menu->addAction(subMenu->menuAction());
+            } else
+                delete subMenu;
+            break;
+        }
         }
     }
     return menu;
@@ -619,6 +796,65 @@ void QWebPagePrivate::updateNavigationActions()
     updateAction(QWebPage::ReloadAndBypassCache);
 }
 
+QObject *QWebPagePrivate::inspectorHandle()
+{
+    return getOrCreateInspector();
+}
+
+void QWebPagePrivate::setInspectorFrontend(QObject* frontend)
+{
+    inspectorFrontend = qobject_cast<QWidget*>(frontend);
+    if (inspector)
+        inspector->d->setFrontend(frontend);
+}
+
+void QWebPagePrivate::setInspectorWindowTitle(const QString& title)
+{
+    if (inspector)
+        inspector->setWindowTitle(title);
+}
+
+void QWebPagePrivate::createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage)
+{
+    QWebPage* page = new WebKit::InspectorClientWebPage;
+    *inspectorView = page->view();
+    *inspectorPage = page->d;
+}
+
+#ifndef QT_NO_MENU
+static QStringList iterateContextMenu(QMenu* menu)
+{
+    if (!menu)
+        return QStringList();
+
+    QStringList items;
+    QList<QAction *> actions = menu->actions();
+    for (int i = 0; i < actions.count(); ++i) {
+        if (actions.at(i)->isSeparator())
+            items << QLatin1String("<separator>");
+        else
+            items << actions.at(i)->text();
+        if (actions.at(i)->menu())
+            items << iterateContextMenu(actions.at(i)->menu());
+    }
+    return items;
+}
+#endif
+
+QStringList QWebPagePrivate::menuActionsAsText()
+{
+#ifndef QT_NO_MENU
+    return iterateContextMenu(currentContextMenu.data());
+#else
+    return QStringList();
+#endif
+}
+
+void QWebPagePrivate::emitViewportChangeRequested()
+{
+    emit q->viewportChangeRequested();
+}
+
 void QWebPagePrivate::updateEditorActions()
 {
     updateAction(QWebPage::Cut);
@@ -682,8 +918,7 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev)
         q->timerEvent(ev);
 }
 
-template<class T>
-void QWebPagePrivate::mouseMoveEvent(T* ev)
+void QWebPagePrivate::mouseMoveEvent(QMouseEvent* ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
@@ -693,8 +928,7 @@ void QWebPagePrivate::mouseMoveEvent(T* ev)
     ev->setAccepted(accepted);
 }
 
-template<class T>
-void QWebPagePrivate::mousePressEvent(T* ev)
+void QWebPagePrivate::mousePressEvent(QMouseEvent* ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
@@ -729,8 +963,7 @@ void QWebPagePrivate::mousePressEvent(T* ev)
         clickCausedFocus = true;
 }
 
-template<class T>
-void QWebPagePrivate::mouseDoubleClickEvent(T *ev)
+void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
@@ -747,8 +980,7 @@ void QWebPagePrivate::mouseDoubleClickEvent(T *ev)
     tripleClick = QPointF(ev->pos()).toPoint();
 }
 
-template<class T>
-void QWebPagePrivate::mouseTripleClickEvent(T *ev)
+void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
@@ -762,8 +994,7 @@ void QWebPagePrivate::mouseTripleClickEvent(T *ev)
     ev->setAccepted(accepted);
 }
 
-template<class T>
-void QWebPagePrivate::mouseReleaseEvent(T *ev)
+void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
@@ -790,7 +1021,7 @@ void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button, const QPo
         && frame->document()->focusedNode()
         && button == Qt::LeftButton && qApp->autoSipEnabled()) {
         QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
-            client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+            client->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
         if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
             HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), false);
             if (result.isContentEditable()) {
@@ -833,14 +1064,13 @@ QMenu *QWebPage::createStandardContextMenu()
 }
 
 #ifndef QT_NO_WHEELEVENT
-template<class T>
-void QWebPagePrivate::wheelEvent(T *ev)
+void QWebPagePrivate::wheelEvent(QWheelEvent *ev)
 {
     WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     if (!frame->view())
         return;
 
-    PlatformWheelEvent pev = convertWheelEvent(ev);
+    PlatformWheelEvent pev = convertWheelEvent(ev, QApplication::wheelScrollLines());
     bool accepted = frame->eventHandler()->handleWheelEvent(pev);
     ev->setAccepted(accepted);
 }
@@ -1340,33 +1570,39 @@ bool QWebPagePrivate::touchEvent(QTouchEvent* event)
 
 bool QWebPagePrivate::gestureEvent(QGestureEvent* event)
 {
-#if ENABLE(GESTURE_EVENTS)
-    WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
-    if (!frame->view())
+    QWebFrameAdapter* frame = mainFrame.data()->d;
+    if (!frame->hasView())
         return false;
-
     // QGestureEvents can contain updates for multiple gestures.
     bool handled = false;
+#if ENABLE(GESTURE_EVENTS)
+    // QGestureEvent lives in Widgets, we'll need a dummy struct to mule the info it contains to the "other side"
+    QGestureEventFacade gestureFacade;
+
     QGesture* gesture = event->gesture(Qt::TapGesture);
     // Beware that gestures send by DumpRenderTree will have state Qt::NoGesture,
     // due to not originating from a GestureRecognizer.
     if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
-        frame->eventHandler()->handleGestureEvent(convertGesture(event, gesture));
-        event->setAccepted(true);
+        gestureFacade.type = Qt::TapGesture;
+        QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position();
+        gestureFacade.globalPos = globalPos.toPoint();
+        gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint());
+        frame->handleGestureEvent(&gestureFacade);
         handled = true;
     }
     gesture = event->gesture(Qt::TapAndHoldGesture);
     if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
-        frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(event, gesture));
-        event->setAccepted(true);
+        gestureFacade.type = Qt::TapAndHoldGesture;
+        QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position();
+        gestureFacade.globalPos = globalPos.toPoint();
+        gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint());
+        frame->handleGestureEvent(&gestureFacade);
         handled = true;
     }
+#endif // ENABLE(GESTURE_EVENTS)
 
+    event->setAccepted(handled);
     return handled;
-#else
-    event->ignore();
-    return false;
-#endif
 }
 
 /*!
@@ -2037,12 +2273,12 @@ void QWebPage::setView(QWidget* view)
 
     if (d->client) {
         if (d->client->isQWidgetClient())
-            static_cast<PageClientQWidget*>(d->client.get())->view = view;
+            static_cast<PageClientQWidget*>(d->client.data())->view = view;
         return;
     }
 
     if (view)
-        d->client = adoptPtr(new PageClientQWidget(view, this));
+        d->client.reset(new PageClientQWidget(view, this));
 }
 
 /*!
@@ -2068,7 +2304,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
 
     // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html
     // At this point DRT's WebPage has already been destroyed
-    if (QWebPagePrivate::drtRun) {
+    if (QWebPageAdapter::drtRun) {
         if (message == QLatin1String("PLUGIN: NPP_Destroy")) {
             fprintf(stdout, "CONSOLE MESSAGE: ");
             if (lineNumber)
@@ -2088,8 +2324,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg)
 {
     Q_UNUSED(frame)
 #ifndef QT_NO_MESSAGEBOX
-    QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-    QMessageBox box(parent);
+    QMessageBox box(view());
     box.setWindowTitle(tr("JavaScript Alert - %1").arg(mainFrame()->url().host()));
     box.setTextFormat(Qt::PlainText);
     box.setText(msg);
@@ -2110,8 +2345,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
 #ifdef QT_NO_MESSAGEBOX
     return true;
 #else
-    QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-    QMessageBox box(parent);
+    QMessageBox box(view());
     box.setWindowTitle(tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()));
     box.setTextFormat(Qt::PlainText);
     box.setText(msg);
@@ -2136,8 +2370,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr
     bool ok = false;
 #ifndef QT_NO_INPUTDIALOG
 
-    QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-    QInputDialog dlg(parent);
+    QInputDialog dlg(view());
     dlg.setWindowTitle(tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()));
 
     // Hack to force the dialog's QLabel into plain text mode
@@ -2181,8 +2414,7 @@ bool QWebPage::shouldInterruptJavaScript()
 #ifdef QT_NO_MESSAGEBOX
     return false;
 #else
-    QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-    return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
+    return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
 #endif
 }
 
@@ -2197,7 +2429,8 @@ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, Permissio
         break;
     case Geolocation:
 #if ENABLE(GEOLOCATION)
-        GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy);
+        if (policy != PermissionUnknown)
+            GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame->d, (policy == PermissionGrantedByUser));
 #endif
         break;
 
@@ -2461,20 +2694,146 @@ QColor QWebPagePrivate::colorSelectionRequested(const QColor &selectedColor)
 {
     QColor ret = selectedColor;
 #ifndef QT_NO_COLORDIALOG
-    QWidget* parent = (client) ? client->ownerWidget() : 0;
-    ret = QColorDialog::getColor(selectedColor, parent);
+    ret = QColorDialog::getColor(selectedColor, q->view());
     if (!ret.isValid())
         ret = selectedColor;
 #endif
     return ret;
 }
 
+QWebSelectMethod *QWebPagePrivate::createSelectPopup()
+{
+    return new QtFallbackWebPopup(this);
+}
+
+QRect QWebPagePrivate::viewRectRelativeToWindow()
+{
+
+    QWidget* ownerWidget= client.isNull() ? 0 : qobject_cast<QWidget*>(client->ownerWidget());
+    if (!ownerWidget)
+        return QRect();
+    QWidget* topLevelWidget = ownerWidget->window();
+
+    QPoint topLeftCorner = ownerWidget->mapFrom(topLevelWidget, QPoint(0, 0));
+    return QRect(topLeftCorner, ownerWidget->size());
+}
+
+void QWebPagePrivate::geolocationPermissionRequested(QWebFrameAdapter* frame)
+{
+    emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Geolocation);
+}
+
+void QWebPagePrivate::geolocationPermissionRequestCancelled(QWebFrameAdapter* frame)
+{
+    emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Geolocation);
+}
+
+void QWebPagePrivate::notificationsPermissionRequested(QWebFrameAdapter* frame)
+{
+    emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Notifications);
+}
+
+void QWebPagePrivate::notificationsPermissionRequestCancelled(QWebFrameAdapter* frame)
+{
+    emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Notifications);
+}
+
+void QWebPagePrivate::respondToChangedContents()
+{
+    updateEditorActions();
+
+    emit q->contentsChanged();
+}
+
+void QWebPagePrivate::respondToChangedSelection()
+{
+    updateEditorActions();
+    emit q->selectionChanged();
+}
+
+void QWebPagePrivate::microFocusChanged()
+{
+    emit q->microFocusChanged();
+}
+
+void QWebPagePrivate::triggerCopyAction()
+{
+    q->triggerAction(QWebPage::Copy);
+}
+
+void QWebPagePrivate::triggerActionForKeyEvent(QKeyEvent* event)
+{
+    QWebPage::WebAction action = editorActionForKeyEvent(event);
+    q->triggerAction(action);
+}
+
+void QWebPagePrivate::clearUndoStack()
+{
+#ifndef QT_NO_UNDOSTACK
+    if (undoStack)
+        undoStack->clear();
+#endif
+}
+
+bool QWebPagePrivate::canUndo() const
+{
+#ifndef QT_NO_UNDOSTACK
+    if (!undoStack)
+        return false;
+    return undoStack->canUndo();
+#else
+    return false;
+#endif
+}
+
+bool QWebPagePrivate::canRedo() const
+{
+#ifndef QT_NO_UNDOSTACK
+    if (!undoStack)
+        return false;
+    return undoStack->canRedo();
+#else
+    return false;
+#endif
+}
+
+void QWebPagePrivate::undo()
+{
+#ifndef QT_NO_UNDOSTACK
+    if (undoStack)
+        undoStack->undo();
+#endif
+}
+
+void QWebPagePrivate::redo()
+{
+#ifndef QT_NO_UNDOSTACK
+    if (undoStack)
+        undoStack->redo();
+#endif
+}
+
+void QWebPagePrivate::createUndoStep(QSharedPointer<UndoStepQt> step)
+{
+#ifndef QT_NO_UNDOSTACK
+    // Call undoStack() getter first to ensure stack is created
+    // if it doesn't exist yet.
+    q->undoStack()->push(new QWebUndoCommand(step));
+#endif
+}
+
+const char *QWebPagePrivate::editorCommandForKeyEvent(QKeyEvent* event)
+{
+    QWebPage::WebAction action = editorActionForKeyEvent(event);
+    return editorCommandForWebActions(action);
+}
+
 QSize QWebPage::viewportSize() const
 {
     if (d->mainFrame && d->mainFrame.data()->d->frame->view())
         return d->mainFrame.data()->d->frame->view()->frameRect().size();
 
-    return d->viewportSize;
+    return d->m_viewportSize;
 }
 
 /*!
@@ -2491,7 +2850,7 @@ QSize QWebPage::viewportSize() const
 */
 void QWebPage::setViewportSize(const QSize &size) const
 {
-    d->viewportSize = size;
+    d->m_viewportSize = size;
 
     QWebFrame *frame = mainFrame();
     if (frame->d->frame && frame->d->frame->view()) {
@@ -2577,7 +2936,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
 
     // Both environment variables need to be set - or they will be ignored.
     if (deviceWidth < 0 && deviceHeight < 0) {
-        QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0);
+        QSize size = queryDeviceSizeForScreenContainingWidget(view());
         deviceWidth = size.width();
         deviceHeight = size.height();
     }
@@ -3093,18 +3452,34 @@ bool QWebPage::event(QEvent *ev)
         d->mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
         break;
 #if !defined(QT_NO_GRAPHICSVIEW)
-    case QEvent::GraphicsSceneMouseMove:
-        d->mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+    case QEvent::GraphicsSceneMouseMove: {
+        QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+        QMouseEvent dummyEvent(QEvent::MouseMove, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+        d->mouseMoveEvent(&dummyEvent);
+        ev->setAccepted(dummyEvent.isAccepted());
         break;
-    case QEvent::GraphicsSceneMousePress:
-        d->mousePressEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+    }
+    case QEvent::GraphicsSceneMouseRelease: {
+        QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+        QMouseEvent dummyEvent(QEvent::MouseButtonRelease, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+        d->mouseReleaseEvent(&dummyEvent);
+        ev->setAccepted(dummyEvent.isAccepted());
         break;
-    case QEvent::GraphicsSceneMouseDoubleClick:
-        d->mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+    }
+    case QEvent::GraphicsSceneMousePress: {
+        QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+        QMouseEvent dummyEvent(QEvent::MouseButtonPress, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+        d->mousePressEvent(&dummyEvent);
+        ev->setAccepted(dummyEvent.isAccepted());
         break;
-    case QEvent::GraphicsSceneMouseRelease:
-        d->mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+    }
+    case QEvent::GraphicsSceneMouseDoubleClick: {
+        QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+        QMouseEvent dummyEvent(QEvent::MouseButtonDblClick, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+        d->mouseDoubleClickEvent(&dummyEvent);
+        ev->setAccepted(dummyEvent.isAccepted());
         break;
+    }
 #endif
 #ifndef QT_NO_CONTEXTMENU
     case QEvent::ContextMenu:
@@ -3121,9 +3496,13 @@ bool QWebPage::event(QEvent *ev)
         d->wheelEvent(static_cast<QWheelEvent*>(ev));
         break;
 #if !defined(QT_NO_GRAPHICSVIEW)
-    case QEvent::GraphicsSceneWheel:
-        d->wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(ev));
+    case QEvent::GraphicsSceneWheel: {
+        QGraphicsSceneWheelEvent *gsEv = static_cast<QGraphicsSceneWheelEvent*>(ev);
+        QWheelEvent dummyEvent(gsEv->pos(), gsEv->screenPos(), gsEv->delta(), gsEv->buttons(), gsEv->modifiers(), gsEv->orientation());
+        d->wheelEvent(&dummyEvent);
+        ev->setAccepted(dummyEvent.isAccepted());
         break;
+    }
 #endif
 #endif
     case QEvent::KeyPress:
@@ -3639,8 +4018,7 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext
     if (extension == ChooseMultipleFilesExtension) {
         // FIXME: do not ignore suggestedFiles
         QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames;
-        QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-        QStringList names = QFileDialog::getOpenFileNames(parent, QString::null);
+        QStringList names = QFileDialog::getOpenFileNames(view(), QString::null);
         static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names;
         return true;
     }
@@ -3664,6 +4042,14 @@ bool QWebPage::supportsExtension(Extension extension) const
 #endif
 }
 
+/*!
+ * \internal
+ */
+QWebPageAdapter *QWebPage::handle() const
+{
+    return d;
+}
+
 /*!
     Finds the specified string, \a subString, in the page, using the given \a options.
 
@@ -3732,8 +4118,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil
 {
     Q_UNUSED(parentFrame)
 #ifndef QT_NO_FILEDIALOG
-    QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
-    return QFileDialog::getOpenFileName(parent, QString::null, suggestedFile);
+    return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile);
 #else
     return QString::null;
 #endif
@@ -3750,11 +4135,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil
 */
 void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager)
 {
-    if (manager == d->networkManager)
-        return;
-    if (d->networkManager && d->networkManager->parent() == this)
-        delete d->networkManager;
-    d->networkManager = manager;
+    d->setNetworkAccessManager(manager);
 }
 
 /*!
@@ -3765,11 +4146,7 @@ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager)
 */
 QNetworkAccessManager *QWebPage::networkAccessManager() const
 {
-    if (!d->networkManager) {
-        QWebPage *that = const_cast<QWebPage *>(this);
-        that->d->networkManager = new QNetworkAccessManager(that);
-    }
-    return d->networkManager;
+    return d->networkAccessManager();
 }
 
 /*!
index b2caa131dea6505e5f0ab47dcd49175c25e1817c..f975ab05677ccf5bd32b3d2a5f7f4b4a15cb7b7a 100644 (file)
@@ -46,6 +46,7 @@ class QWebFrameData;
 class QWebHistoryItem;
 class QWebHitTestResult;
 class QWebNetworkInterface;
+class QWebPageAdapter;
 class QWebPagePrivate;
 class QWebPluginFactory;
 class QWebSecurityOrigin;
@@ -365,7 +366,7 @@ public:
     virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0);
     virtual bool supportsExtension(Extension extension) const;
 
-    inline QWebPagePrivate* handle() const { return d; }
+    QWebPageAdapter* handle() const;
 
 public Q_SLOTS:
     bool shouldInterruptJavaScript();
index 794322991321bf7a00c3662b9ab926f807dc3402..2136e3cbc159e852a2cf52aa9567aa507d79c9d7 100644 (file)
 #ifndef QWEBPAGE_P_H
 #define QWEBPAGE_P_H
 
-#include <QPointer>
+#include "QWebPageAdapter.h"
+
+#include "qwebframe.h"
+#include "qwebhistory.h"
+#include "qwebpage.h"
 
+#include <QPointer>
 #include <qbasictimer.h>
-#include <qnetworkproxy.h>
 #include <qevent.h>
 #include <qgesture.h>
 #include <qgraphicssceneevent.h>
+#include <qgraphicswidget.h>
+#include <qnetworkproxy.h>
 
-#include "qwebpage.h"
-#include "qwebhistory.h"
-#include "qwebframe.h"
-
-#include "IntPoint.h"
-#include "KURL.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
-#include "ViewportArguments.h"
 
 namespace WebCore {
-    class ChromeClientQt;
     class ContextMenuClientQt;
     class ContextMenuItem;
     class ContextMenu;
@@ -54,7 +47,6 @@ namespace WebCore {
     class IntRect;
     class Node;
     class NodeList;
-    class Page;
     class Frame;
 }
 
@@ -64,8 +56,10 @@ class QMenu;
 class QBitArray;
 QT_END_NAMESPACE
 
+class QtPluginWidgetAdapter;
 class QWebInspector;
-class QWebPageClient;
+class QWebFrameAdapter;
+class UndoStepQt;
 
 class QtViewportAttributesPrivate : public QSharedData {
 public:
@@ -76,13 +70,73 @@ public:
     QWebPage::ViewportAttributes* q;
 };
 
-class QWebPagePrivate {
+class QWebPagePrivate : public QWebPageAdapter {
 public:
     QWebPagePrivate(QWebPage*);
     ~QWebPagePrivate();
 
     static WebCore::Page* core(const QWebPage*);
-    static QWebPagePrivate* priv(QWebPage*);
+
+    // Adapter implementation
+    virtual void show() OVERRIDE;
+    virtual void setFocus() OVERRIDE;
+    virtual void unfocus() OVERRIDE;
+    virtual void setWindowRect(const QRect &) OVERRIDE;
+    virtual QSize viewportSize() const OVERRIDE;
+    virtual QWebPageAdapter* createWindow(bool /*dialog*/) OVERRIDE;
+    virtual QObject* handle() OVERRIDE { return q; }
+    virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) OVERRIDE;
+    virtual void javaScriptAlert(QWebFrameAdapter*, const QString& msg) OVERRIDE;
+    virtual bool javaScriptConfirm(QWebFrameAdapter*, const QString& msg) OVERRIDE;
+    virtual bool javaScriptPrompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) OVERRIDE;
+    virtual void printRequested(QWebFrameAdapter*) OVERRIDE;
+    virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) OVERRIDE;
+    virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) OVERRIDE;
+    virtual void setToolTip(const QString&) OVERRIDE;
+#if USE(QT_MULTIMEDIA)
+    virtual QWebFullScreenVideoHandler* createFullScreenVideoHandler() OVERRIDE;
+#endif
+    virtual QWebFrameAdapter* mainFrameAdapter() OVERRIDE;
+    virtual QStringList chooseFiles(QWebFrameAdapter*, bool allowMultiple, const QStringList& suggestedFileNames) OVERRIDE;
+    virtual QColor colorSelectionRequested(const QColor& selectedColor) OVERRIDE;
+    virtual QWebSelectMethod* createSelectPopup() OVERRIDE;
+    virtual QRect viewRectRelativeToWindow() OVERRIDE;
+    virtual void geolocationPermissionRequested(QWebFrameAdapter*) OVERRIDE;
+    virtual void geolocationPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE;
+    virtual void notificationsPermissionRequested(QWebFrameAdapter*) OVERRIDE;
+    virtual void notificationsPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE;
+
+    virtual void respondToChangedContents() OVERRIDE;
+    virtual void respondToChangedSelection() OVERRIDE;
+    virtual void microFocusChanged() OVERRIDE;
+    virtual void triggerCopyAction() OVERRIDE;
+    virtual void triggerActionForKeyEvent(QKeyEvent*) OVERRIDE;
+    virtual void clearUndoStack() OVERRIDE;
+    virtual bool canUndo() const OVERRIDE;
+    virtual bool canRedo() const OVERRIDE;
+    virtual void undo() OVERRIDE;
+    virtual void redo() OVERRIDE;
+    virtual void createUndoStep(QSharedPointer<UndoStepQt>) OVERRIDE;
+    virtual const char* editorCommandForKeyEvent(QKeyEvent*) OVERRIDE;
+
+    void updateNavigationActions() OVERRIDE;
+
+    virtual QObject* inspectorHandle() OVERRIDE;
+    virtual void setInspectorFrontend(QObject*) OVERRIDE;
+    virtual void setInspectorWindowTitle(const QString&) OVERRIDE;
+    virtual void createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) OVERRIDE;
+    virtual QStringList menuActionsAsText() OVERRIDE;
+    virtual void emitViewportChangeRequested() OVERRIDE;
+    virtual bool acceptNavigationRequest(QWebFrameAdapter*, const QNetworkRequest&, int type) OVERRIDE;
+    virtual void emitRestoreFrameStateRequested(QWebFrameAdapter*) OVERRIDE;
+    virtual void emitSaveFrameStateRequested(QWebFrameAdapter*, QWebHistoryItem*) OVERRIDE;
+    virtual void emitDownloadRequested(const QNetworkRequest&) OVERRIDE;
+    virtual void emitFrameCreated(QWebFrameAdapter*) OVERRIDE;
+    virtual QString userAgentForUrl(const QUrl &url) const OVERRIDE { return q->userAgentForUrl(url); }
+    virtual bool supportsErrorPageExtension() const OVERRIDE { return q->supportsExtension(QWebPage::ErrorPageExtension); }
+    virtual bool errorPageExtension(ErrorPageOption *, ErrorPageReturn *) OVERRIDE;
+    virtual QtPluginWidgetAdapter* createPlugin(const QString &, const QUrl &, const QStringList &, const QStringList &) OVERRIDE;
+    virtual QtPluginWidgetAdapter* adapterForWidget(QObject *) const OVERRIDE;
 
     void createMainFrame();
 #ifndef QT_NO_CONTEXTMENU
@@ -92,23 +146,20 @@ public:
     void _q_webActionTriggered(bool checked);
     void _q_cleanupLeakMessages();
     void updateAction(QWebPage::WebAction action);
-    void updateNavigationActions();
     void updateEditorActions();
 
-    QColor colorSelectionRequested(const QColor& selectedColor);
-
     void timerEvent(QTimerEvent*);
 
-    template<class T> void mouseMoveEvent(T*);
-    template<class T> void mousePressEvent(T*);
-    template<class T> void mouseDoubleClickEvent(T*);
-    template<class T> void mouseTripleClickEvent(T*);
-    template<class T> void mouseReleaseEvent(T*);
+    void mouseMoveEvent(QMouseEvent*);
+    void mousePressEvent(QMouseEvent*);
+    void mouseDoubleClickEvent(QMouseEvent*);
+    void mouseTripleClickEvent(QMouseEvent*);
+    void mouseReleaseEvent(QMouseEvent*);
 #ifndef QT_NO_CONTEXTMENU
     void contextMenuEvent(const QPoint& globalPos);
 #endif
 #ifndef QT_NO_WHEELEVENT
-    template<class T> void wheelEvent(T*);
+    void wheelEvent(QWheelEvent*);
 #endif
     void keyPressEvent(QKeyEvent*);
     void keyReleaseEvent(QKeyEvent*);
@@ -159,16 +210,12 @@ public:
     WebCore::InspectorController* inspectorController();
     quint16 inspectorServerPort();
 
-    WebCore::ViewportArguments viewportArguments();
-
 #ifndef QT_NO_SHORTCUT
     static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event);
 #endif
     static const char* editorCommandForWebActions(QWebPage::WebAction action);
 
     QWebPage *q;
-    WebCore::Page *page;
-    OwnPtr<QWebPageClient> client;
     QPointer<QWebFrame> mainFrame;
 
 #ifndef QT_NO_UNDOSTACK
@@ -177,7 +224,6 @@ public:
 
     QPointer<QWidget> view;
 
-    bool insideOpenCall;
     quint64 m_totalBytes;
     quint64 m_bytesReceived;
 
@@ -186,15 +232,9 @@ public:
 
     bool clickCausedFocus;
 
-    bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
-    QNetworkAccessManager *networkManager;
-
-    bool forwardUnsupportedContent;
-    bool smartInsertDeleteEnabled;
-    bool selectTrailingWhitespaceEnabled;
     QWebPage::LinkDelegationPolicy linkPolicy;
 
-    QSize viewportSize;
+    QSize m_viewportSize;
     QSize fixedLayoutSize;
 
     QWebHistory history;
@@ -202,20 +242,15 @@ public:
 #ifndef QT_NO_CONTEXTMENU
     QPointer<QMenu> currentContextMenu;
 #endif
-    QWebSettings *settings;
     QPalette palette;
     bool useFixedLayout;
 
     QAction *actions[QWebPage::WebActionCount];
 
-    QWebPluginFactory *pluginFactory;
-
     QWidget* inspectorFrontend;
     QWebInspector* inspector;
     bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
     Qt::DropAction m_lastDropAction;
-
-    static bool drtRun;
 };
 
 #endif
index 768c80256ec126611d3a8f827cd1ec93172f3a83..74d8524d8c52e3c808555de5493261cf3843f262 100644 (file)
 #include "config.h"
 #include "qwebsettings.h"
 
-#include "qwebpage.h"
-#include "qwebpage_p.h"
 #include "qwebplugindatabase_p.h"
 
 #include "AbstractDatabase.h"
-#include "MemoryCache.h"
+#include "ApplicationCacheStorage.h"
 #include "CrossOriginPreflightResultCache.h"
+#include "DatabaseTracker.h"
+#include "FileSystem.h"
 #include "FontCache.h"
+#include "IconDatabase.h"
+#include "Image.h"
 #if ENABLE(ICONDATABASE)
 #include "IconDatabaseClientQt.h"
 #endif
 #include "InitWebCoreQt.h"
+#include "IntSize.h"
+#include "KURL.h"
+#include "MemoryCache.h"
+#include "NetworkStateNotifier.h"
 #include "Page.h"
 #include "PageCache.h"
-#include "Settings.h"
-#include "KURL.h"
-#include "IconDatabase.h"
 #include "PluginDatabase.h"
-#include "Image.h"
-#include "IntSize.h"
-#include "ApplicationCacheStorage.h"
-#include "DatabaseTracker.h"
-#include "FileSystem.h"
-#include <wtf/text/WTFString.h>
-
-#include <QApplication>
-#include <QStandardPaths>
+#include "Settings.h"
 #include <QDir>
+#include <QFileInfo>
+#include <QFont>
+#include <QGuiApplication>
 #include <QHash>
 #include <QSharedData>
+#include <QStandardPaths>
 #include <QUrl>
-#include <QFileInfo>
-#include <QStyle>
+#include <wtf/text/WTFString.h>
+
 
-#include "NetworkStateNotifier.h"
 
 void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed)
 {
index 5e7d3e1b4d3d4c81356812c92b1f84b508d40e39..49721b7cb93d2c58ef6e4a488c3d70b2b05c4b07 100644 (file)
@@ -163,6 +163,7 @@ public:
     inline QWebSettingsPrivate* handle() const { return d; }
 
 private:
+    friend class QWebPageAdapter;
     friend class QWebPagePrivate;
     friend class QWebSettingsPrivate;
 
index 9f2af5787eecbcde022a8e01fbfb05cc50b1c456..2eda6a18efd178258462f15cb929514d8d009323 100644 (file)
@@ -227,9 +227,9 @@ void QWebViewPrivate::detachCurrentPage()
     // to destroy it.
 
     if (page->d->client && page->d->client->isQWidgetClient())
-        page->d->client.clear();
+        page->d->client.reset();
 
-    page->d->client.release();
+    page->d->client.take();
 
     // if the page was created by us, we own it and need to
     // destroy it as well.
index f0791bfc02f582e3c6780c29eb874128f3e570e6..bbc4c42b9b5d8192f5b68b76bca6baa5da7de42f 100644 (file)
@@ -1,3 +1,538 @@
+2012-11-22  Simon Hausmann  <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com>
+
+        [Qt] Separate QWidget dependant code into separate WebKitWidgets static library
+        https://bugs.webkit.org/show_bug.cgi?id=102800
+
+        Reviewed by Tor Arne Vestbø.
+
+        This patch separates code that needs to use QWidget related APIs in
+        WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
+        example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
+        while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
+        static library. WebKit1 is compiled without QT += widgets and therefore
+        any widget related dependency has been moved "up" and out of WebKit1 into
+        the WebKitWidgets library.
+
+        Between the code in WebKit.a and WebKitWidgets.a new adapters and
+        interfaces have been introduced, such as QWebPageAdapter and
+        QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
+        call out into the API layer, implemented by QWebPage (QWebPagePrivate).
+        The other way around if QWebPage wants to access WebCore or
+        WebCoreSupport related functionality, it will go through
+        QWebPageAdapater (as base class). The separation in the direction up
+        into the API layer is complete with this patch, no code in WebKit1
+        depends on QtWidgets. The separation the other way around, code in the
+        API layer not using any WebCore types, is not complete yet.
+
+        Some classes such as QWebSettings, QWebElement or
+        DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
+        they do not depend on widget related Qt APIs and they make much more
+        use of WebCore internal APIs and therefore are easier to keep in
+        WebKit1.
+
+        In the future we plan to place a real shared library boundary between
+        WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
+        part of the QtWebKit shared library and by turning the WebKitWidgets
+        static library into a shared one.
+
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebViewPrivate::pageClient):
+        (QGraphicsWebViewPrivate::detachCurrentPage):
+        (QGraphicsWebView::setPage):
+        * Api/qwebelement.cpp:
+        (QWebElement::webFrame):
+        * Api/qwebframe.cpp:
+        (QWebFramePrivate::setPage):
+        (QWebFramePrivate::didStartProvisionalLoad):
+        (QWebFramePrivate::handleProgressFinished):
+        (QWebFramePrivate::emitInitialLayoutCompleted):
+        (QWebFramePrivate::emitIconChanged):
+        (QWebFramePrivate::emitLoadStarted):
+        (QWebFramePrivate::emitLoadFinished):
+        (QWebFramePrivate::createChildFrame):
+        (QWebFramePrivate::apiHandle):
+        (QWebFramePrivate::handle):
+        (QWebFramePrivate::contentsSizeDidChange):
+        (QWebFramePrivate::scrollBarPolicy):
+        (QWebFrame::QWebFrame):
+        (QWebFrame::~QWebFrame):
+        (QWebFrame::setUrl):
+        (QWebFrame::load):
+        (QWebFrame::scrollPosition):
+        (QWebFrame::geometry):
+        (QWebFramePrivate::kit):
+        (QWebFrame::handle):
+        * Api/qwebframe.h:
+        * Api/qwebframe_p.h:
+        (QWebFramePrivate::QWebFramePrivate):
+        (QWebFramePrivate):
+        * Api/qwebhistory.cpp:
+        (QWebHistoryPrivate::page):
+        * Api/qwebhistory_p.h:
+        (QWebHistoryPrivate):
+        * Api/qwebinspector.cpp:
+        (QWebInspectorPrivate::setFrontend):
+        * Api/qwebinspector_p.h:
+        (QWebInspectorPrivate):
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::QWebPagePrivate):
+        (QWebPagePrivate::~QWebPagePrivate):
+        (QWebPagePrivate::core):
+        (QWebPagePrivate::show):
+        (QWebPagePrivate::setFocus):
+        (QWebPagePrivate::unfocus):
+        (QWebPagePrivate::setWindowRect):
+        (QWebPagePrivate::viewportSize):
+        (QWebPagePrivate::createWindow):
+        (QWebPagePrivate::javaScriptConsoleMessage):
+        (QWebPagePrivate::javaScriptAlert):
+        (QWebPagePrivate::javaScriptConfirm):
+        (QWebPagePrivate::javaScriptPrompt):
+        (QWebPagePrivate::printRequested):
+        (QWebPagePrivate::databaseQuotaExceeded):
+        (QWebPagePrivate::applicationCacheQuotaExceeded):
+        (QWebPagePrivate::setToolTip):
+        (QWebPagePrivate::createFullScreenVideoHandler):
+        (QWebPagePrivate::mainFrameAdapter):
+        (QWebPagePrivate::chooseFiles):
+        (QWebPagePrivate::acceptNavigationRequest):
+        (QWebPagePrivate::emitRestoreFrameStateRequested):
+        (QWebPagePrivate::emitSaveFrameStateRequested):
+        (QWebPagePrivate::emitDownloadRequested):
+        (QWebPagePrivate::emitFrameCreated):
+        (QWebPagePrivate::errorPageExtension):
+        (QWebPagePrivate::createPlugin):
+        (QWebPagePrivate::adapterForWidget):
+        (QWebPagePrivate::createMainFrame):
+        (QWebPagePrivate::createContextMenu):
+        (QWebPagePrivate::inspectorHandle):
+        (QWebPagePrivate::setInspectorFrontend):
+        (QWebPagePrivate::setInspectorWindowTitle):
+        (QWebPagePrivate::createWebInspector):
+        (iterateContextMenu):
+        (QWebPagePrivate::menuActionsAsText):
+        (QWebPagePrivate::emitViewportChangeRequested):
+        (QWebPagePrivate::mouseMoveEvent):
+        (QWebPagePrivate::mousePressEvent):
+        (QWebPagePrivate::mouseDoubleClickEvent):
+        (QWebPagePrivate::mouseTripleClickEvent):
+        (QWebPagePrivate::mouseReleaseEvent):
+        (QWebPagePrivate::handleSoftwareInputPanel):
+        (QWebPagePrivate::wheelEvent):
+        (QWebPagePrivate::gestureEvent):
+        (QWebPage::setView):
+        (QWebPage::javaScriptConsoleMessage):
+        (QWebPage::javaScriptAlert):
+        (QWebPage::javaScriptConfirm):
+        (QWebPage::javaScriptPrompt):
+        (QWebPage::shouldInterruptJavaScript):
+        (QWebPage::setFeaturePermission):
+        (QWebPagePrivate::colorSelectionRequested):
+        (QWebPagePrivate::createSelectPopup):
+        (QWebPagePrivate::viewRectRelativeToWindow):
+        (QWebPagePrivate::geolocationPermissionRequested):
+        (QWebPagePrivate::geolocationPermissionRequestCancelled):
+        (QWebPagePrivate::notificationsPermissionRequested):
+        (QWebPagePrivate::notificationsPermissionRequestCancelled):
+        (QWebPagePrivate::respondToChangedContents):
+        (QWebPagePrivate::respondToChangedSelection):
+        (QWebPagePrivate::microFocusChanged):
+        (QWebPagePrivate::triggerCopyAction):
+        (QWebPagePrivate::triggerActionForKeyEvent):
+        (QWebPagePrivate::clearUndoStack):
+        (QWebPagePrivate::canUndo):
+        (QWebPagePrivate::canRedo):
+        (QWebPagePrivate::undo):
+        (QWebPagePrivate::redo):
+        (QWebPagePrivate::createUndoStep):
+        (QWebPagePrivate::editorCommandForKeyEvent):
+        (QWebPage::viewportSize):
+        (QWebPage::setViewportSize):
+        (QWebPage::viewportAttributesForSize):
+        (QWebPage::event):
+        (QWebPage::extension):
+        (QWebPage::handle):
+        (QWebPage::chooseFile):
+        (QWebPage::setNetworkAccessManager):
+        (QWebPage::networkAccessManager):
+        * Api/qwebpage.h:
+        * Api/qwebpage_p.h:
+        (WebCore):
+        (QWebPagePrivate):
+        * Api/qwebsettings.cpp:
+        * Api/qwebsettings.h:
+        * Api/qwebview.cpp:
+        (QWebViewPrivate::detachCurrentPage):
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::ChromeClientQt):
+        (WebCore::ChromeClientQt::setWindowRect):
+        (WebCore::ChromeClientQt::focus):
+        (WebCore::ChromeClientQt::unfocus):
+        (WebCore::ChromeClientQt::createWindow):
+        (WebCore::ChromeClientQt::show):
+        (WebCore::ChromeClientQt::setToolbarsVisible):
+        (WebCore::ChromeClientQt::setStatusbarVisible):
+        (WebCore::ChromeClientQt::setMenubarVisible):
+        (WebCore::ChromeClientQt::addMessageToConsole):
+        (WebCore::ChromeClientQt::closeWindowSoon):
+        (WebCore::ChromeClientQt::runJavaScriptAlert):
+        (WebCore::ChromeClientQt::runJavaScriptConfirm):
+        (WebCore::ChromeClientQt::runJavaScriptPrompt):
+        (WebCore::ChromeClientQt::setStatusbarText):
+        (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+        (WebCore::ChromeClientQt::keyboardUIMode):
+        (WebCore::ChromeClientQt::windowResizerRect):
+        * WebCoreSupport/ChromeClientQt.h:
+        (ChromeClientQt):
+        * WebCoreSupport/ContextMenuClientQt.cpp:
+        * WebCoreSupport/ContextMenuClientQt.h:
+        (ContextMenuClientQt):
+        * WebCoreSupport/DefaultFullScreenVideoHandler.cpp: Added.
+        (DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler):
+        (DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler):
+        (DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback):
+        (DefaultFullScreenVideoHandler::enterFullScreen):
+        (DefaultFullScreenVideoHandler::exitFullScreen):
+        * WebCoreSupport/DefaultFullScreenVideoHandler.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (WebKit):
+        (DefaultFullScreenVideoHandler):
+        * WebCoreSupport/DragClientQt.cpp:
+        (WebCore::DragClientQt::startDrag):
+        * WebCoreSupport/DragClientQt.h:
+        (WebCore):
+        (WebCore::DragClientQt::DragClientQt):
+        (DragClientQt):
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (toGeolocationClientMock):
+        (toDeviceOrientationClientMock):
+        (DumpRenderTreeSupportQt::initialize):
+        (DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled):
+        (DumpRenderTreeSupportQt::setFrameFlatteningEnabled):
+        (DumpRenderTreeSupportQt::webPageSetGroupName):
+        (DumpRenderTreeSupportQt::webPageGroupName):
+        (DumpRenderTreeSupportQt::webInspectorExecuteScript):
+        (DumpRenderTreeSupportQt::webInspectorShow):
+        (DumpRenderTreeSupportQt::webInspectorClose):
+        (DumpRenderTreeSupportQt::hasDocumentElement):
+        (DumpRenderTreeSupportQt::pauseAnimation):
+        (DumpRenderTreeSupportQt::pauseTransitionOfProperty):
+        (DumpRenderTreeSupportQt::numberOfActiveAnimations):
+        (DumpRenderTreeSupportQt::clearFrameName):
+        (DumpRenderTreeSupportQt::setCaretBrowsingEnabled):
+        (DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled):
+        (DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled):
+        (DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled):
+        (DumpRenderTreeSupportQt::executeCoreCommandByName):
+        (DumpRenderTreeSupportQt::isCommandEnabled):
+        (DumpRenderTreeSupportQt::findString):
+        (DumpRenderTreeSupportQt::selectedRange):
+        (DumpRenderTreeSupportQt::firstRectForCharacterRange):
+        (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId):
+        (DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior):
+        (DumpRenderTreeSupportQt::viewportAsText):
+        (DumpRenderTreeSupportQt::scalePageBy):
+        (DumpRenderTreeSupportQt::setMockDeviceOrientation):
+        (DumpRenderTreeSupportQt::resetGeolocationMock):
+        (DumpRenderTreeSupportQt::setMockGeolocationPermission):
+        (DumpRenderTreeSupportQt::setMockGeolocationPosition):
+        (DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError):
+        (DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
+        (DumpRenderTreeSupportQt::shouldClose):
+        (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
+        (DumpRenderTreeSupportQt::addUserStyleSheet):
+        (DumpRenderTreeSupportQt::removeUserStyleSheets):
+        (DumpRenderTreeSupportQt::setDefersLoading):
+        (DumpRenderTreeSupportQt::goBack):
+        (DumpRenderTreeSupportQt::responseMimeType):
+        (DumpRenderTreeSupportQt::clearOpener):
+        (DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled):
+        (DumpRenderTreeSupportQt::contextMenu):
+        (DumpRenderTreeSupportQt::setMinimumTimerInterval):
+        (DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows):
+        (DumpRenderTreeSupportQt::mediaContentUrlByElementId):
+        (DumpRenderTreeSupportQt::setAlternateHtml):
+        (DumpRenderTreeSupportQt::confirmComposition):
+        (DumpRenderTreeSupportQt::injectInternalsObject):
+        (DumpRenderTreeSupportQt::resetInternalsObject):
+        (DumpRenderTreeSupportQt::paintPagesWithBoundaries):
+        (DumpRenderTreeSupportQt::setTrackRepaintRects):
+        (DumpRenderTreeSupportQt::trackRepaintRects):
+        (DumpRenderTreeSupportQt::getTrackedRepaintRects):
+        * WebCoreSupport/DumpRenderTreeSupportQt.h:
+        * WebCoreSupport/EditorClientQt.cpp:
+        (dumpRange):
+        (WebCore::EditorClientQt::shouldShowDeleteInterface):
+        (WebCore::EditorClientQt::shouldInsertText):
+        (WebCore::EditorClientQt::shouldChangeSelectedRange):
+        (WebCore::EditorClientQt::shouldApplyStyle):
+        (WebCore::EditorClientQt::respondToChangedContents):
+        (WebCore::EditorClientQt::respondToChangedSelection):
+        (WebCore::EditorClientQt::registerUndoStep):
+        (WebCore::EditorClientQt::clearUndoRedoOperations):
+        (WebCore::EditorClientQt::canUndo):
+        (WebCore::EditorClientQt::canRedo):
+        (WebCore::EditorClientQt::undo):
+        (WebCore::EditorClientQt::redo):
+        (WebCore::EditorClientQt::shouldInsertNode):
+        (WebCore::EditorClientQt::smartInsertDeleteEnabled):
+        (WebCore::EditorClientQt::toggleSmartInsertDelete):
+        (WebCore::EditorClientQt::isSelectTrailingWhitespaceEnabled):
+        (WebCore::EditorClientQt::handleKeyboardEvent):
+        (WebCore::EditorClientQt::EditorClientQt):
+        (WebCore::EditorClientQt::setInputMethodState):
+        * WebCoreSupport/EditorClientQt.h:
+        (EditorClientQt):
+        (WebCore::EditorClientQt::setSmartInsertDeleteEnabled):
+        (WebCore::EditorClientQt::setSelectTrailingWhitespaceEnabled):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (drtDescriptionSuitableForTestResult):
+        (WebCore::FrameLoaderClientQt::setFrame):
+        (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
+        (WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage):
+        (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad):
+        (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad):
+        (WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad):
+        (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
+        (WebCore::FrameLoaderClientQt::dispatchDidLayout):
+        (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm):
+        (WebCore::FrameLoaderClientQt::postProgressStartedNotification):
+        (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
+        (WebCore::FrameLoaderClientQt::frameLoadCompleted):
+        (WebCore::FrameLoaderClientQt::restoreViewState):
+        (WebCore::FrameLoaderClientQt::userAgent):
+        (WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon):
+        (WebCore::FrameLoaderClientQt::frameLoaderDestroyed):
+        (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld):
+        (WebCore::FrameLoaderClientQt::didPerformFirstNavigation):
+        (WebCore::FrameLoaderClientQt::onIconLoadedForPageURL):
+        (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks):
+        (WebCore::FrameLoaderClientQt::saveViewStateToItem):
+        (WebCore::FrameLoaderClientQt::cancelledError):
+        (WebCore::FrameLoaderClientQt::blockedError):
+        (WebCore::FrameLoaderClientQt::cannotShowURLError):
+        (WebCore::FrameLoaderClientQt::interruptedForPolicyChangeError):
+        (WebCore::FrameLoaderClientQt::cannotShowMIMETypeError):
+        (WebCore::FrameLoaderClientQt::fileDoesNotExistError):
+        (WebCore::FrameLoaderClientQt::pluginWillHandleLoadError):
+        (WebCore::FrameLoaderClientQt::download):
+        (WebCore::FrameLoaderClientQt::dispatchWillSendRequest):
+        (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse):
+        (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading):
+        (WebCore::FrameLoaderClientQt::dispatchDidFailLoading):
+        (WebCore::FrameLoaderClientQt::callErrorPageExtension):
+        (WebCore::FrameLoaderClientQt::dispatchCreatePage):
+        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
+        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
+        (WebCore::FrameLoaderClientQt::startDownload):
+        (WebCore::FrameLoaderClientQt::createFrame):
+        (WebCore::FrameLoaderClientQt::createPlugin):
+        (WebCore::FrameLoaderClientQt::createJavaAppletWidget):
+        (WebCore::FrameLoaderClientQt::chooseFile):
+        (WebCore::FrameLoaderClientQt::createNetworkingContext):
+        (WebCore):
+        (WebCore::FrameLoaderClientQt::webFrame):
+        (WebCore::FrameLoaderClientQt::emitLoadStarted):
+        (WebCore::FrameLoaderClientQt::emitLoadFinished):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+        (FrameLoaderClientQt):
+        * WebCoreSupport/FrameNetworkingContextQt.cpp:
+        (WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt):
+        (WebCore::FrameNetworkingContextQt::create):
+        (WebCore::FrameNetworkingContextQt::networkAccessManager):
+        * WebCoreSupport/FrameNetworkingContextQt.h:
+        (FrameNetworkingContextQt):
+        * WebCoreSupport/FullScreenVideoQt.cpp:
+        (WebCore):
+        (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+        * WebCoreSupport/FullScreenVideoQt.h:
+        (WebCore):
+        * WebCoreSupport/FullScreenVideoWidget.cpp:
+        * WebCoreSupport/FullScreenVideoWidget.h:
+        * WebCoreSupport/GeolocationClientQt.cpp:
+        (WebCore::GeolocationClientQt::GeolocationClientQt):
+        (WebCore::GeolocationClientQt::positionUpdated):
+        (WebCore::GeolocationClientQt::startUpdating):
+        (WebCore::GeolocationClientQt::requestPermission):
+        (WebCore::GeolocationClientQt::cancelPermissionRequest):
+        * WebCoreSupport/GeolocationClientQt.h:
+        (GeolocationClientQt):
+        * WebCoreSupport/GeolocationPermissionClientQt.cpp:
+        (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
+        (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):
+        (WebCore::GeolocationPermissionClientQt::setPermission):
+        * WebCoreSupport/GeolocationPermissionClientQt.h:
+        (GeolocationPermissionClientQt):
+        * WebCoreSupport/InitWebCoreQt.cpp:
+        (WebKit):
+        (WebKit::setWebKitWidgetsInitCallback):
+        (WebKit::initializeWebKitQt):
+        (WebKit::setImagePlatformResource):
+        (WebCore::initializeWebCoreQt):
+        * WebCoreSupport/InitWebCoreQt.h:
+        (WebCore):
+        (WebKit):
+        * WebCoreSupport/InitWebKitQt.cpp: Added.
+        (WebKit):
+        (WebKit::initializeWebKitWidgets):
+        * WebCoreSupport/InitWebKitQt.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (WebKit):
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore):
+        (WebCore::InspectorClientQt::InspectorClientQt):
+        (WebCore::InspectorClientQt::openInspectorFrontend):
+        (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend):
+        (WebCore::InspectorClientQt::detachRemoteFrontend):
+        (WebCore::InspectorClientQt::hideHighlight):
+        (WebCore::InspectorClientQt::sendMessageToFrontend):
+        (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
+        (WebCore::InspectorFrontendClientQt::updateWindowTitle):
+        (WebCore::InspectorFrontendClientQt::destroyInspectorView):
+        * WebCoreSupport/InspectorClientQt.h:
+        (InspectorClientQt):
+        (InspectorFrontendClientQt):
+        * WebCoreSupport/InspectorClientWebPage.cpp: Added.
+        (InspectorClientWebPage::InspectorClientWebPage):
+        (InspectorClientWebPage::createWindow):
+        (InspectorClientWebPage::javaScriptWindowObjectCleared):
+        * WebCoreSupport/InspectorClientWebPage.h: Copied from Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h.
+        (WebKit):
+        (InspectorClientWebPage):
+        * WebCoreSupport/InspectorServerQt.cpp:
+        (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
+        (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead):
+        * WebCoreSupport/InspectorServerQt.h:
+        (InspectorServerQt):
+        (InspectorServerRequestHandlerQt):
+        * WebCoreSupport/NotificationPresenterClientQt.cpp:
+        (WebCore::NotificationWrapper::NotificationWrapper):
+        (WebCore::NotificationPresenterClientQt::displayNotification):
+        (WebCore::NotificationPresenterClientQt::requestPermission):
+        (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission):
+        (WebCore::NotificationPresenterClientQt::dumpShowText):
+        (WebCore::NotificationPresenterClientQt::toPage):
+        (WebCore::NotificationPresenterClientQt::toFrame):
+        * WebCoreSupport/NotificationPresenterClientQt.h:
+        (WebCore::NotificationWrapper::~NotificationWrapper):
+        (NotificationWrapper):
+        (NotificationPresenterClientQt):
+        (WebCore::NotificationPresenterClientQt::hasSystemTrayIcon):
+        (WebCore::NotificationPresenterClientQt::setSystemTrayIcon):
+        (CallbacksInfo):
+        (WebCore):
+        * WebCoreSupport/PageClientQt.cpp:
+        (createPlatformGraphicsContext3DFromWidget):
+        (QWebPageClient::ownerWindow):
+        (WebCore::PageClientQWidget::ownerWidget):
+        (WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
+        (WebCore::PageClientQGraphicsWidget::ownerWidget):
+        (WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
+        * WebCoreSupport/PageClientQt.h:
+        (PageClientQWidget):
+        (WebCore::QGraphicsItemOverlay::QGraphicsItemOverlay):
+        (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget):
+        (PageClientQGraphicsWidget):
+        * WebCoreSupport/PlatformStrategiesQt.cpp:
+        (PlatformStrategiesQt::getPluginInfo):
+        * WebCoreSupport/PopupMenuQt.cpp:
+        (SelectData::SelectData):
+        * WebCoreSupport/QGraphicsWidgetPluginImpl.cpp: Added.
+        (QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl):
+        (QGraphicsWidgetPluginImpl::update):
+        (QGraphicsWidgetPluginImpl::setGeometryAndClip):
+        (QGraphicsWidgetPluginImpl::setVisible):
+        (QGraphicsWidgetPluginImpl::setWidgetParent):
+        (QGraphicsWidgetPluginImpl::handle):
+        * WebCoreSupport/QGraphicsWidgetPluginImpl.h: Added.
+        (QGraphicsWidgetPluginImpl):
+        (QGraphicsWidgetPluginImpl::QGraphicsWidgetPluginImpl):
+        * WebCoreSupport/QWebFrameAdapter.cpp: Added.
+        (cacheLoadControlToCachePolicy):
+        (QWebFrameData::QWebFrameData):
+        (QWebFrameAdapter::QWebFrameAdapter):
+        (QWebFrameAdapter::~QWebFrameAdapter):
+        (QWebFrameAdapter::load):
+        (QWebFrameAdapter::handleGestureEvent):
+        (QWebFrameAdapter::scrollPosition):
+        (QWebFrameAdapter::frameRect):
+        (QWebFrameAdapter::init):
+        (QWebFrameAdapter::kit):
+        (QWebFrameAdapter::ensureAbsoluteUrl):
+        * WebCoreSupport/QWebFrameAdapter.h: Added.
+        (WebCore):
+        (QWebFrameData):
+        (QWebFrameAdapter):
+        (QWebFrameAdapter::hasView):
+        * WebCoreSupport/QWebPageAdapter.cpp: Added.
+        (QWebPageAdapter::QWebPageAdapter):
+        (QWebPageAdapter::~QWebPageAdapter):
+        (QWebPageAdapter::init):
+        (QWebPageAdapter::deletePage):
+        (QWebPageAdapter::kit):
+        (QWebPageAdapter::viewportArguments):
+        (QWebPageAdapter::registerUndoStep):
+        (QWebPageAdapter::setNetworkAccessManager):
+        (QWebPageAdapter::networkAccessManager):
+        * WebCoreSupport/QWebPageAdapter.h: Added.
+        (WebCore):
+        (QWebPageAdapter):
+        (ErrorPageOption):
+        (ErrorPageReturn):
+        * WebCoreSupport/QWebUndoCommand.cpp: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (QWebUndoCommand::QWebUndoCommand):
+        (QWebUndoCommand::undo):
+        (QWebUndoCommand::redo):
+        * WebCoreSupport/QWebUndoCommand.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (QWebUndoCommand):
+        * WebCoreSupport/QWidgetPluginImpl.cpp: Added.
+        (QWidgetPluginImpl::~QWidgetPluginImpl):
+        (QWidgetPluginImpl::update):
+        (QWidgetPluginImpl::setGeometryAndClip):
+        (QWidgetPluginImpl::setVisible):
+        (QWidgetPluginImpl::setStyleSheet):
+        (QWidgetPluginImpl::setWidgetParent):
+        (QWidgetPluginImpl::handle):
+        * WebCoreSupport/QWidgetPluginImpl.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (QWidgetPluginImpl):
+        (QWidgetPluginImpl::QWidgetPluginImpl):
+        * WebCoreSupport/QtFallbackWebPopup.cpp:
+        (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
+        (WebCore::QtFallbackWebPopup::show):
+        (WebCore::QtFallbackWebPopup::pageClient):
+        * WebCoreSupport/QtFallbackWebPopup.h:
+        (QtFallbackWebPopup):
+        * WebCoreSupport/QtPluginWidgetAdapter.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+        (QtPluginWidgetAdapter):
+        * WebCoreSupport/QtWebComboBox.cpp:
+        (WebCore::QtWebComboBox::showPopupAtCursorPosition):
+        * WebCoreSupport/QtWebComboBox.h:
+        * WebCoreSupport/SearchPopupMenuQt.h:
+        (SearchPopupMenuQt):
+        * WebCoreSupport/UndoStepQt.cpp:
+        (UndoStepQt::UndoStepQt):
+        (UndoStepQt::text):
+        * WebCoreSupport/UndoStepQt.h:
+        (UndoStepQt):
+        * WebCoreSupport/WebEventConversion.cpp:
+        (WebCore::mouseEventTypeAndMouseButtonFromQEvent):
+        (WebKitPlatformWheelEvent):
+        (WebCore::WebKitPlatformWheelEvent::applyDelta):
+        (WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent):
+        (WebKitPlatformGestureEvent):
+        (WebCore::toPlatformEventType):
+        (WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent):
+        (WebCore):
+        (WebCore::convertWheelEvent):
+        (WebCore::convertGesture):
+        * WebCoreSupport/WebEventConversion.h:
+        (QGestureEventFacade):
+        (WebCore):
+        * WebCoreSupport/WebSystemInterface.h:
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::loadHtml5Video):
+        (tst_QWebPage::multiplePageGroupsAndLocalStorage):
+        (tst_QWebPage::thirdPartyCookiePolicy):
+
 2012-11-21  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Position in QWebHitTestResult does not match documentation
index eaaeb012f86d0a53110b579773f6d5b8c05d9342..e3635c04f93e891c6dcc948d2a9ae2904867c380 100644 (file)
 #include "NetworkingContext.h"
 #include "NotImplemented.h"
 #include "Page.h"
-#include "PageClientQt.h"
 #include "PopupMenuQt.h"
-#include "QtFallbackWebPopup.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "QWebPageClient.h"
 #include "ScrollbarTheme.h"
 #include "SearchPopupMenuQt.h"
 #include "SecurityOrigin.h"
+#include "TiledBackingStore.h"
 #include "ViewportArguments.h"
 #include "WindowFeatures.h"
-
-#include "qgraphicswebview.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
+#include "qwebkitplatformplugin.h"
 #include "qwebsecurityorigin.h"
 #include "qwebsecurityorigin_p.h"
-#include "qwebview.h"
+#include "qwebsettings.h"
+
 #include <qabstractanimation.h>
 #include <qdebug.h>
 #include <qeventloop.h>
-#include <qtooltip.h>
+#include <qwindow.h>
 #include <wtf/OwnPtr.h>
 
 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
@@ -124,8 +122,8 @@ private:
 
 bool ChromeClientQt::dumpVisitedLinksCallbacks = false;
 
-ChromeClientQt::ChromeClientQt(QWebPage* webPage)
-    : m_webPage(webPage)
+ChromeClientQt::ChromeClientQt(QWebPageAdapter* webPageAdapter)
+    : m_webPage(webPageAdapter)
     , m_eventLoop(0)
 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     , m_fullScreenVideo(0)
@@ -148,8 +146,7 @@ void ChromeClientQt::setWindowRect(const FloatRect& rect)
 {
     if (!m_webPage)
         return;
-    emit m_webPage->geometryChangeRequested(QRect(qRound(rect.x()), qRound(rect.y()),
-                            qRound(rect.width()), qRound(rect.height())));
+    m_webPage->setWindowRect(QRect(qRound(rect.x()), qRound(rect.y()), qRound(rect.width()), qRound(rect.height())));
 }
 
 /*!
@@ -182,11 +179,7 @@ void ChromeClientQt::focus()
 {
     if (!m_webPage)
         return;
-    QWidget* view = m_webPage->view();
-    if (!view)
-        return;
-
-    view->setFocus();
+    m_webPage->setFocus();
 }
 
 
@@ -194,10 +187,7 @@ void ChromeClientQt::unfocus()
 {
     if (!m_webPage)
         return;
-    QWidget* view = m_webPage->view();
-    if (!view)
-        return;
-    view->clearFocus();
+    m_webPage->unfocus();
 }
 
 bool ChromeClientQt::canTakeFocus(FocusDirection)
@@ -227,24 +217,18 @@ void ChromeClientQt::focusedFrameChanged(Frame*)
 
 Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&)
 {
-    QWebPage* newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow);
+    QWebPageAdapter* newPage = m_webPage->createWindow(features.dialog);
     if (!newPage)
         return 0;
 
-    // A call to QWebPage::mainFrame() implicitly creates the main frame.
-    // Make sure it exists, as WebCore expects it when returning from this call.
-    newPage->mainFrame();
-    return newPage->d->page;
+    return newPage->page;
 }
 
 void ChromeClientQt::show()
 {
     if (!m_webPage)
         return;
-    QWidget* view = m_webPage->view();
-    if (!view)
-        return;
-    view->window()->show();
+    m_webPage->show();
 }
 
 
@@ -266,7 +250,7 @@ void ChromeClientQt::runModal()
 void ChromeClientQt::setToolbarsVisible(bool visible)
 {
     toolBarsVisible = visible;
-    emit m_webPage->toolBarVisibilityChangeRequested(visible);
+    QMetaObject::invokeMethod(m_webPage->handle(), "toolBarVisibilityChangeRequested", Q_ARG(bool, visible));
 }
 
 
@@ -278,7 +262,7 @@ bool ChromeClientQt::toolbarsVisible()
 
 void ChromeClientQt::setStatusbarVisible(bool visible)
 {
-    emit m_webPage->statusBarVisibilityChangeRequested(visible);
+    QMetaObject::invokeMethod(m_webPage->handle(), "statusBarVisibilityChangeRequested", Q_ARG(bool, visible));
     statusBarVisible = visible;
 }
 
@@ -305,7 +289,7 @@ bool ChromeClientQt::scrollbarsVisible()
 void ChromeClientQt::setMenubarVisible(bool visible)
 {
     menuBarVisible = visible;
-    emit m_webPage->menuBarVisibilityChangeRequested(visible);
+    QMetaObject::invokeMethod(m_webPage->handle(), "menuBarVisibilityChangeRequested", Q_ARG(bool, visible));
 }
 
 bool ChromeClientQt::menubarVisible()
@@ -318,8 +302,7 @@ void ChromeClientQt::setResizable(bool)
     notImplemented();
 }
 
-void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
-                                         unsigned int lineNumber, const String& sourceID)
+void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID)
 {
     QString x = message;
     QString y = sourceID;
@@ -343,30 +326,26 @@ bool ChromeClientQt::runBeforeUnloadConfirmPanel(const String& message, Frame* f
 
 void ChromeClientQt::closeWindowSoon()
 {
-    m_webPage->d->page->setGroupName(String());
-    m_webPage->mainFrame()->d->frame->loader()->stopAllLoaders();
-    emit m_webPage->windowCloseRequested();
+    m_webPage->page->setGroupName(String());
+    m_webPage->page->mainFrame()->loader()->stopAllLoaders();
+    QMetaObject::invokeMethod(m_webPage->handle(), "windowCloseRequested");
 }
 
 void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg)
 {
-    QString x = msg;
-    QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
-    m_webPage->javaScriptAlert(webFrame, x);
+    m_webPage->javaScriptAlert(QWebFrameAdapter::kit(f), msg);
 }
 
 bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg)
 {
-    QString x = msg;
-    QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
-    return m_webPage->javaScriptConfirm(webFrame, x);
+    return m_webPage->javaScriptConfirm(QWebFrameAdapter::kit(f), msg);
 }
 
 bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result)
 {
     QString x = result;
-    QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
-    bool rc = m_webPage->javaScriptPrompt(webFrame, (QString)message, (QString)defaultValue, &x);
+    QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(f);
+    bool rc = m_webPage->javaScriptPrompt(webFrame, message, defaultValue, &x);
 
     // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
     // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
@@ -381,19 +360,19 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
 void ChromeClientQt::setStatusbarText(const String& msg)
 {
     QString x = msg;
-    emit m_webPage->statusBarMessage(x);
+    QMetaObject::invokeMethod(m_webPage->handle(), "statusBarMessage", Q_ARG(QString, x));
 }
 
 bool ChromeClientQt::shouldInterruptJavaScript()
 {
     bool shouldInterrupt = false;
-    QMetaObject::invokeMethod(m_webPage, "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt));
+    QMetaObject::invokeMethod(m_webPage->handle(), "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt));
     return shouldInterrupt;
 }
 
 KeyboardUIMode ChromeClientQt::keyboardUIMode()
 {
-    return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain)
+    return m_webPage->settings->testAttribute(QWebSettings::LinksIncludedInFocusChain)
         ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
 }
 
@@ -407,11 +386,10 @@ IntRect ChromeClientQt::windowResizerRect() const
     if (!pageClient)
         return IntRect();
 
-    QWidget* ownerWidget = pageClient->ownerWidget();
-    if (!ownerWidget)
+    QWindow* topLevelWidget = pageClient->ownerWindow();
+    if (!topLevelWidget)
         return IntRect();
 
-    QWidget* topLevelWidget = ownerWidget->window();
     QRect topLevelGeometry(topLevelWidget->geometry());
 
     // There's no API in Qt to query for the size of the resizer, so we assume
@@ -423,12 +401,13 @@ IntRect ChromeClientQt::windowResizerRect() const
     // it might even be on the lower left side of the window, but in WebKit we
     // always draw scrollbars on the right hand side, so we assume this to be the
     // location when computing the resize rect to reserve for WebKit.
-    QPoint resizeCornerTopLeft = ownerWidget->mapFrom(topLevelWidget,
-            QPoint(topLevelGeometry.width(), topLevelGeometry.height())
-            - QPoint(scollbarThickness, scollbarThickness));
+    QPoint resizeCornerTopLeft = QPoint(topLevelGeometry.width(), topLevelGeometry.height())
+        - QPoint(scollbarThickness, scollbarThickness))
+        - m_webPage->viewRectRelativeToWindow().topLeft();
 
     QRect resizeCornerRect = QRect(resizeCornerTopLeft, QSize(scollbarThickness, scollbarThickness));
     return resizeCornerRect.intersected(pageClient->geometryRelativeToOwnerWidget());
+
 #else
     return IntRect();
 #endif
@@ -438,7 +417,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool)
 {
 #if USE(TILED_BACKING_STORE)
     if (platformPageClient()) {
-        WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(m_webPage->mainFrame())->tiledBackingStore();
+        WebCore::TiledBackingStore* backingStore = m_webPage->mainFrameAdapter()->frame->tiledBackingStore();
         if (!backingStore)
             return;
         backingStore->invalidate(windowRect);
@@ -448,7 +427,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool)
 #endif
 }
 
-void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool immediate)
+void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool)
 {
     // No double buffer, so only update the QWidget if content changed.
     if (platformPageClient()) {
@@ -457,9 +436,9 @@ void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bo
         if (!rect.isEmpty())
             platformPageClient()->update(rect);
     }
-    QMetaObject::invokeMethod(m_webPage, "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect));
+    QMetaObject::invokeMethod(m_webPage->handle(), "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect));
 
-    // FIXME: There is no "immediate" support for window painting.  This should be done always whenever the flag
+    // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag
     // is set.
 }
 
@@ -472,14 +451,18 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect,
 {
     if (platformPageClient())
         platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect);
-    emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect);
+    QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, delta.width()), Q_ARG(int, delta.height()), Q_ARG(QRect, scrollViewRect));
 }
 
 #if USE(TILED_BACKING_STORE)
 void ChromeClientQt::delegatedScrollRequested(const IntPoint& point)
 {
-    QPoint currentPosition(m_webPage->mainFrame()->scrollPosition());
-    emit m_webPage->scrollRequested(point.x() - currentPosition.x(), point.y() - currentPosition.y(), QRect(QPoint(0, 0), m_webPage->viewportSize()));
+
+    IntSize currentPosition = m_webPage->mainFrameAdapter()->scrollPosition();
+    int x = point.x() - currentPosition.width();
+    int y = point.y() - currentPosition.height();
+    const QRect rect(QPoint(0, 0), m_webPage->viewportSize());
+    QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, x), Q_ARG(int, y), Q_ARG(QRect, rect));
 }
 #endif
 
@@ -489,12 +472,12 @@ IntRect ChromeClientQt::rootViewToScreen(const IntRect& rect) const
     if (!pageClient)
         return rect;
 
-    QWidget* ownerWidget = pageClient->ownerWidget();
-    if (!ownerWidget)
-       return rect;
+    QWindow* ownerWindow = pageClient->ownerWindow();
+    if (!ownerWindow)
+        return rect;
 
     QRect screenRect(rect);
-    screenRect.translate(ownerWidget->mapToGlobal(QPoint(0, 0)));
+    screenRect.translate(ownerWindow->mapToGlobal(m_webPage->viewRectRelativeToWindow().topLeft()));
 
     return screenRect;
 }
@@ -505,22 +488,22 @@ IntPoint ChromeClientQt::screenToRootView(const IntPoint& point) const
     if (!pageClient)
         return point;
 
-    QWidget* ownerWidget = pageClient->ownerWidget();
-    if (!ownerWidget)
+    QWindow* ownerWindow = pageClient->ownerWindow();
+    if (!ownerWindow)
         return point;
 
-    return ownerWidget->mapFromGlobal(point);
+    return ownerWindow->mapFromGlobal(point) - m_webPage->viewRectRelativeToWindow().topLeft();
 }
 
 PlatformPageClient ChromeClientQt::platformPageClient() const
 {
-    return m_webPage->d->client.get();
+    return m_webPage->client.data();
 }
 
 void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
 {
     if (frame->loader()->networkingContext())
-        QWebFramePrivate::kit(frame)->contentsSizeChanged(size);
+        QWebFrameAdapter::kit(frame)->contentsSizeDidChange(size);
 }
 
 void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
@@ -532,33 +515,19 @@ void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsign
         lastHoverURL = result.absoluteLinkURL();
         lastHoverTitle = result.title(dir);
         lastHoverContent = result.textContent();
-        emit m_webPage->linkHovered(lastHoverURL.string(),
-                lastHoverTitle, lastHoverContent);
+        QMetaObject::invokeMethod(m_webPage->handle(), "linkHovered", Q_ARG(QString, lastHoverURL.string()),
+            Q_ARG(QString, lastHoverTitle), Q_ARG(QString, lastHoverContent));
     }
 }
 
 void ChromeClientQt::setToolTip(const String &tip, TextDirection)
 {
-#ifndef QT_NO_TOOLTIP
-    QWidget* view = m_webPage->view();
-    if (!view)
-        return;
-
-    if (tip.isEmpty()) {
-        view->setToolTip(QString());
-        QToolTip::hideText();
-    } else {
-        QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>");
-        view->setToolTip(dtip);
-    }
-#else
-    Q_UNUSED(tip);
-#endif
+    m_webPage->setToolTip(tip);
 }
 
 void ChromeClientQt::print(Frame* frame)
 {
-    emit m_webPage->printRequested(QWebFramePrivate::kit(frame));
+    emit m_webPage->printRequested(QWebFrameAdapter::kit(frame));
 }
 
 #if ENABLE(SQL_DATABASE)
@@ -569,7 +538,7 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN
     if (!DatabaseTracker::tracker().hasEntryForOrigin(frame->document()->securityOrigin()))
         DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota);
 
-    emit m_webPage->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
+    m_webPage->databaseQuotaExceeded(QWebFrameAdapter::kit(frame), databaseName);
 }
 #endif
 
@@ -588,7 +557,7 @@ void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin,
     QWebSecurityOrigin* securityOrigin = new QWebSecurityOrigin(priv);
 
     if (!WebCore::cacheStorage().calculateQuotaForOrigin(origin, quota))
-       WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
+        WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
 
     emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded));
 }
@@ -596,7 +565,7 @@ void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin,
 #if ENABLE(INPUT_TYPE_COLOR)
 PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient* client, const Color& color)
 {
-    const QColor selectedColor = m_webPage->d->colorSelectionRequested(QColor(color));
+    const QColor selectedColor = m_webPage->colorSelectionRequested(QColor(color));
     client->didChooseColor(selectedColor);
     client->didEndChooser();
     return nullptr;
@@ -606,32 +575,22 @@ PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient*
 void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
 {
     RefPtr<FileChooser> fileChooser = prpFileChooser;
-    bool supportMulti = m_webPage->supportsExtension(QWebPage::ChooseMultipleFilesExtension);
-
-    if (fileChooser->settings().allowsMultipleFiles && supportMulti) {
-        QWebPage::ChooseMultipleFilesExtensionOption option;
-        option.parentFrame = QWebFramePrivate::kit(frame);
 
-        if (!fileChooser->settings().selectedFiles.isEmpty())
-            for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i)
-                option.suggestedFileNames += fileChooser->settings().selectedFiles[i];
+    QStringList suggestedFileNames;
+    for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i)
+        suggestedFileNames += fileChooser->settings().selectedFiles[i];
 
-        QWebPage::ChooseMultipleFilesExtensionReturn output;
-        m_webPage->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output);
+    const bool allowMultiple = fileChooser->settings().allowsMultipleFiles;
 
-        if (!output.fileNames.isEmpty()) {
+    QStringList result = m_webPage->chooseFiles(QWebFrameAdapter::kit(frame), allowMultiple, suggestedFileNames);
+    if (!result.isEmpty()) {
+        if (allowMultiple) {
             Vector<String> names;
-            for (int i = 0; i < output.fileNames.count(); ++i)
-                names.append(output.fileNames.at(i));
+            for (int i = 0; i < result.count(); ++i)
+                names.append(result.at(i));
             fileChooser->chooseFiles(names);
-        }
-    } else {
-        QString suggestedFile;
-        if (!fileChooser->settings().selectedFiles.isEmpty())
-            suggestedFile = fileChooser->settings().selectedFiles[0];
-        QString file = m_webPage->chooseFile(QWebFramePrivate::kit(frame), suggestedFile);
-        if (!file.isEmpty())
-            fileChooser->chooseFile(file);
+        } else
+            fileChooser->chooseFile(result.first());
     }
 }
 
@@ -662,7 +621,7 @@ void ChromeClientQt::scheduleAnimation()
 
 void ChromeClientQt::serviceScriptedAnimations()
 {
-    m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
+    m_webPage->mainFrameAdapter()->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
 }
 #endif
 
@@ -703,8 +662,10 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
     if (!platformPageClient() || !m_webPage)
         return IntRect();
 
-    if (!platformPageClient()->viewResizesToContentsEnabled())
-        return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size());
+    if (!platformPageClient()->viewResizesToContentsEnabled()) {
+        IntSize offset = m_webPage->mainFrameAdapter()->scrollPosition();
+        return QRect(QPoint(offset.width(), offset.height()), m_webPage->mainFrameAdapter()->frameRect().size());
+    }
 
     return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect()));
 }
@@ -751,7 +712,7 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const
         return result.release();
 
 #if !defined(QT_NO_COMBOBOX)
-    return adoptPtr(new QtFallbackWebPopup(this));
+    return adoptPtr(m_webPage->createSelectPopup());
 #else
     return nullptr;
 #endif
@@ -759,8 +720,18 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const
 
 void ChromeClientQt::dispatchViewportPropertiesDidChange(const ViewportArguments&) const
 {
-    emit m_webPage->viewportChangeRequested();
+    m_webPage->emitViewportChangeRequested();
+}
+
+#if USE(QT_MULTIMEDIA)
+QWebFullScreenVideoHandler* ChromeClientQt::createFullScreenVideoHandler()
+{
+    QWebFullScreenVideoHandler* handler = m_platformPlugin.createFullScreenVideoHandler().leakPtr();
+    if (!handler)
+        handler = m_webPage->createFullScreenVideoHandler();
+    return handler;
 }
+#endif
 
 bool ChromeClientQt::selectItemWritingDirectionIsNatural()
 {
@@ -794,7 +765,7 @@ void ChromeClientQt::populateVisitedLinks()
     // in a separate database
     if (dumpVisitedLinksCallbacks) {
         printf("Asked to populate visited links for WebView \"%s\"\n",
-                qPrintable(m_webPage->mainFrame()->url().toString()));
+            qPrintable(QUrl(m_webPage->mainFrameAdapter()->url).toString()));
     }
 }
 
index f7359d2e2874a75519c2f538768132980ae4b9cd..96d8625c05013f27eab2974234feeb7a8d3affa2 100644 (file)
@@ -42,6 +42,8 @@ class QEventLoop;
 QT_END_NAMESPACE
 
 class QWebPage;
+class QWebPageAdapter;
+class QWebFullScreenVideoHandler;
 
 namespace WebCore {
 
@@ -59,7 +61,7 @@ class FullScreenVideoQt;
 
 class ChromeClientQt : public ChromeClient {
 public:
-    ChromeClientQt(QWebPage*);
+    ChromeClientQt(QWebPageAdapter*);
     virtual ~ChromeClientQt();
     virtual void chromeDestroyed();
 
@@ -98,7 +100,7 @@ public:
 
     virtual void setResizable(bool);
 
-    virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID);
+    virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
 
     virtual bool canRunBeforeUnloadConfirmPanel();
     virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame*);
@@ -156,7 +158,7 @@ public:
 #if ENABLE(TOUCH_EVENTS)
     virtual void needTouchEvents(bool) { }
 #endif
+
 #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     virtual bool supportsFullscreenForNode(const Node*);
     virtual void enterFullscreenForNode(Node*);
@@ -169,8 +171,8 @@ public:
     virtual PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&);
 #endif
 
-     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-     virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
+    virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
+    virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 
     virtual void formStateDidChange(const Node*) { }
 
@@ -198,7 +200,9 @@ public:
     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
     virtual void numWheelEventHandlersChanged(unsigned) { }
 
-    QWebPage* m_webPage;
+    QWebFullScreenVideoHandler* createFullScreenVideoHandler();
+
+    QWebPageAdapter* m_webPage;
     KURL lastHoverURL;
     String lastHoverTitle;
     String lastHoverContent;
index 29180e06284c19bf77c1a19e926cf1119c32d8b3..d2984c3d4f068df96fb05e0d7f609841150948af 100644 (file)
@@ -30,9 +30,8 @@
 #include "HitTestResult.h"
 #include "KURL.h"
 #include "NotImplemented.h"
-#include <wtf/RefCounted.h>
 
-#include <stdio.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
     
index 0420f8d4a9cad639200d2e1945d212b41d8fe21c..eabac1b1a4f1030ad6f03ec2aa014f28e26dbf48 100644 (file)
@@ -40,7 +40,7 @@ public:
     virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*);
     virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*);
 
-    virtual void downloadURL(const KURL& url);
+    virtual void downloadURL(const KURL&);
     virtual void lookUpInDictionary(Frame*);
     virtual void speak(const String&);
     virtual bool isSpeaking();
diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp
new file mode 100644 (file)
index 0000000..0fe24e8
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "DefaultFullScreenVideoHandler.h"
+
+#if USE(QT_MULTIMEDIA)
+
+#include "FullScreenVideoWidget.h"
+
+using namespace WebKit;
+
+bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false;
+
+DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
+    : QWebFullScreenVideoHandler()
+    , m_fullScreenWidget(new FullScreenVideoWidget)
+{
+    connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed()));
+    m_fullScreenWidget->hide();
+
+    m_fullScreenWidget->close();
+}
+
+DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler()
+{
+    delete m_fullScreenWidget;
+}
+
+bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const
+{
+    static bool initialized = false;
+    if (!initialized) {
+        QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO");
+        if (!forceFullScreen.isEmpty())
+            s_shouldForceFullScreenVideoPlayback = true;
+
+        initialized = true;
+    }
+
+    return s_shouldForceFullScreenVideoPlayback;
+}
+
+void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player)
+{
+    m_fullScreenWidget->show(player);
+}
+
+void DefaultFullScreenVideoHandler::exitFullScreen()
+{
+    m_fullScreenWidget->close();
+}
+#endif
+
+
diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h
new file mode 100644 (file)
index 0000000..e943c55
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef DefaultFullScreenVideoHandler_h
+#define DefaultFullScreenVideoHandler_h
+
+#include "qwebkitplatformplugin.h"
+
+namespace WebKit {
+
+class FullScreenVideoWidget;
+
+// We do not use ENABLE or USE because moc does not expand these macros.
+#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
+class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
+    Q_OBJECT
+public:
+    DefaultFullScreenVideoHandler();
+    virtual ~DefaultFullScreenVideoHandler();
+    bool requiresFullScreenForVideoPlayback() const;
+
+public Q_SLOTS:
+    void enterFullScreen(QMediaPlayer*);
+    void exitFullScreen();
+
+private:
+    static bool s_shouldForceFullScreenVideoPlayback;
+    FullScreenVideoWidget *m_fullScreenWidget;
+};
+#endif
+
+} // namespace WebKit
+
+#endif // DefaultFullScreenVideoHandler_h
index cb632834009894cc95636260385d400a05730f47..2e0d05ed12348f04ef794f052ab3ae69a12934b6 100644 (file)
 #include "config.h"
 #include "DragClientQt.h"
 
+#include "ChromeClient.h"
 #include "ClipboardQt.h"
 #include "DragController.h"
 #include "Frame.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
-#include "qwebpage.h"
 
 #include <QDrag>
 #include <QMimeData>
-
+#include <QWebPageClient.h>
 
 namespace WebCore {
 
@@ -93,7 +93,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP
 #ifndef QT_NO_DRAGANDDROP
     QMimeData* clipboardData = static_cast<ClipboardQt*>(clipboard)->clipboardData();
     static_cast<ClipboardQt*>(clipboard)->invalidateWritableData();
-    QWidget* view = m_webPage->view();
+    QObject* view = m_chromeClient->platformPageClient()->ownerWidget();
     if (view) {
         QDrag* drag = new QDrag(view);
         if (dragImage)
@@ -105,7 +105,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP
         Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
 
         // Send dragEnd event
-        PlatformMouseEvent me(m_webPage->view()->mapFromGlobal(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0);
+        PlatformMouseEvent me(m_chromeClient->screenToRootView(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0);
         frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction));
     }
     frame->page()->dragController()->dragEnded();
index 15724f1e148563f3e6ee018553a7ed3ec84cc158..aa8b8085b8150f0a16434dc36455fac51d7c2e3e 100644 (file)
 
 #include "DragClient.h"
 
-class QWebPage;
-
 namespace WebCore {
 
+class ChromeClient;
+
 class DragClientQt : public DragClient {
 public:
-    DragClientQt(QWebPage* webPage) : m_webPage(webPage) {};
+    DragClientQt(ChromeClient* chromeClient) : m_chromeClient(chromeClient) { };
     virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*);
     virtual DragDestinationAction actionMaskForDrag(DragData*);
     virtual void dragControllerDestroyed();
@@ -42,7 +42,7 @@ public:
     virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*);    
     virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false);
 private:
-    QWebPage* m_webPage;
+    ChromeClient* m_chromeClient;
 };
 
 }
index edf20a46050331764d79dbff0d33bc907bcbf67c..8d08c4a10ddb20d9dd35cd39729a768f5b947574 100644 (file)
@@ -43,8 +43,6 @@
 #include "FrameLoaderClientQt.h"
 #include "FrameView.h"
 #include "GCController.h"
-#include "JSNode.h"
-#include "qt_runtime.h"
 #include "GeolocationClient.h"
 #include "GeolocationClientMock.h"
 #include "GeolocationController.h"
@@ -53,8 +51,8 @@
 #include "HTMLFormElement.h"
 #include "HTMLInputElement.h"
 #include "HistoryItem.h"
-#include "InitWebCoreQt.h"
 #include "InspectorController.h"
+#include "JSNode.h"
 #include "NodeList.h"
 #include "NotificationPresenterClientQt.h"
 #include "Page.h"
@@ -63,6 +61,8 @@
 #include "PluginView.h"
 #include "PositionError.h"
 #include "PrintContext.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "RenderListItem.h"
 #include "RenderTreeAsText.h"
 #include "SchemeRegistry.h"
 #include "ThirdPartyCookiesQt.h"
 #include "WebCoreTestSupport.h"
 #include "WorkerThread.h"
-#include <wtf/CurrentTime.h>
-
+#include "qt_runtime.h"
 #include "qwebelement.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
 #include "qwebhistory.h"
 #include "qwebhistory_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
 #include "qwebscriptworld.h"
 
 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
@@ -92,9 +87,8 @@
 #include "MediaPlayerPrivateQt.h"
 #endif
 
-#include <QAction>
-#include <QMenu>
 #include <QPainter>
+#include <wtf/CurrentTime.h>
 
 using namespace WebCore;
 
@@ -103,15 +97,15 @@ QMap<int, QWebScriptWorld*> m_worldMap;
 #if ENABLE(GEOLOCATION)
 GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client)
 {
-     ASSERT(QWebPagePrivate::drtRun);
-     return static_cast<GeolocationClientMock*>(client);
+    ASSERT(QWebPageAdapter::drtRun);
+    return static_cast<GeolocationClientMock*>(client);
 }
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)
 DeviceOrientationClientMock* toDeviceOrientationClientMock(DeviceOrientationClient* client)
 {
-    ASSERT(QWebPagePrivate::drtRun);
+    ASSERT(QWebPageAdapter::drtRun);
     return static_cast<DeviceOrientationClientMock*>(client);
 }
 #endif
@@ -198,7 +192,6 @@ DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt()
 
 void DumpRenderTreeSupportQt::initialize()
 {
-    WebCore::initializeWebCoreQt();
     QtDRTNodeRuntime::initialize();
 }
 
@@ -225,58 +218,58 @@ int DumpRenderTreeSupportQt::workerThreadCount()
 
 void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b)
 {
-    QWebPagePrivate::drtRun = b;
+    QWebPageAdapter::drtRun = b;
 #if ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX)
     // PluginViewQt (X11) needs a few workarounds when running under DRT
     PluginView::setIsRunningUnderDRT(b);
 #endif
 }
 
-void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPageAdapter* adapter, bool enabled)
 {
-    QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled);
+    adapter->page->settings()->setFrameFlatteningEnabled(enabled);
 }
 
-void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName)
+void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPageAdapter *adapter, const QString& groupName)
 {
-    page->handle()->page->setGroupName(groupName);
+    adapter->page->setGroupName(groupName);
 }
 
-QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page)
+QString DumpRenderTreeSupportQt::webPageGroupName(QWebPageAdapter* adapter)
 {
-    return page->handle()->page->groupName();
+    return adapter->page->groupName();
 }
 
-void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script)
+void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPageAdapter* adapter, long callId, const QString& script)
 {
 #if ENABLE(INSPECTOR)
-    if (!page->handle()->page->inspectorController())
+    if (!adapter->page->inspectorController())
         return;
-    page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script);
+    adapter->page->inspectorController()->evaluateForTestInFrontend(callId, script);
 #endif
 }
 
-void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page)
+void DumpRenderTreeSupportQt::webInspectorShow(QWebPageAdapter* adapter)
 {
 #if ENABLE(INSPECTOR)
-    if (!page->handle()->page->inspectorController())
+    if (!adapter->page->inspectorController())
         return;
-    page->handle()->page->inspectorController()->close();
+    adapter->page->inspectorController()->show();
 #endif
 }
 
-void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page)
+void DumpRenderTreeSupportQt::webInspectorClose(QWebPageAdapter* adapter)
 {
 #if ENABLE(INSPECTOR)
-    if (!page->handle()->page->inspectorController())
+    if (!adapter->page->inspectorController())
         return;
-    page->handle()->page->inspectorController()->show();
+    adapter->page->inspectorController()->close();
 #endif
 }
 
-bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrameAdapter *adapter)
 {
-    return QWebFramePrivate::core(frame)->document()->documentElement();
+    return adapter->frame->document()->documentElement();
 }
 
 void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isAutofilled)
@@ -306,9 +299,9 @@ void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const
 // Pause a given CSS animation or transition on the target node at a specific time.
 // If the animation or transition is already paused, it will update its pause time.
 // This method is only intended to be used for testing the CSS animation and transition system.
-bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId)
+bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrameAdapter *adapter, const QString &animationName, double time, const QString &elementId)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     if (!coreFrame)
         return false;
 
@@ -326,9 +319,9 @@ bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &an
     return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
 }
 
-bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId)
+bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrameAdapter *adapter, const QString &propertyName, double time, const QString &elementId)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     if (!coreFrame)
         return false;
 
@@ -347,9 +340,9 @@ bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const
 }
 
 // Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
-int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
+int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrameAdapter *adapter)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     if (!coreFrame)
         return false;
 
@@ -360,9 +353,9 @@ int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
     return controller->numberOfActiveAnimations(coreFrame->document());
 }
 
-void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame)
+void DumpRenderTreeSupportQt::clearFrameName(QWebFrameAdapter *adapter)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     coreFrame->tree()->clearName();
 }
 
@@ -381,24 +374,6 @@ void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool wait
     gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone);
 }
 
-// Suspend active DOM objects in this frame.
-void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame)
-{
-    Frame* coreFrame = QWebFramePrivate::core(frame);
-    if (coreFrame->document())
-        // FIXME: This function should be changed take a ReasonForSuspension parameter 
-        // https://bugs.webkit.org/show_bug.cgi?id=45732
-        coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
-}
-
-// Resume active DOM objects in this frame.
-void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame)
-{
-    Frame* coreFrame = QWebFramePrivate::core(frame);
-    if (coreFrame->document())
-        coreFrame->document()->resumeActiveDOMObjects();
-}
-
 void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
 {
     SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
@@ -419,39 +394,39 @@ void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forb
     SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
 }
 
-void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value)
+void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPageAdapter* adapter, bool value)
 {
-    page->handle()->page->settings()->setCaretBrowsingEnabled(value);
+    adapter->page->settings()->setCaretBrowsingEnabled(value);
 }
 
-void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPage* page, bool value)
+void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPageAdapter* adapter, bool value)
 {
-    page->handle()->page->settings()->setAuthorAndUserStylesEnabled(value);
+    adapter->page->settings()->setAuthorAndUserStylesEnabled(value);
 }
 
-void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPageAdapter *adapter, bool enabled)
 {
-    page->d->smartInsertDeleteEnabled = enabled;
+    static_cast<EditorClientQt*>(adapter->page->editorClient())->setSmartInsertDeleteEnabled(enabled);
 }
 
 
-void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPageAdapter *adapter, bool enabled)
 {
-    page->d->selectTrailingWhitespaceEnabled = enabled;
+    static_cast<EditorClientQt*>(adapter->page->editorClient())->setSelectTrailingWhitespaceEnabled(enabled);
 }
 
 
-void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value)
+void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPageAdapter* adapter, const QString& name, const QString& value)
 {
-    page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+    adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
 }
 
-bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name)
+bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPageAdapter *adapter, const QString& name)
 {
-    return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+    return adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
 }
 
-bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, const QStringList& optionArray)
+bool DumpRenderTreeSupportQt::findString(QWebPageAdapter *adapter, const QString& string, const QStringList& optionArray)
 {
     // 1. Parse the options from the array
     WebCore::FindOptions options = 0;
@@ -473,7 +448,7 @@ bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string,
     }
 
     // 2. find the string
-    WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
     return frame && frame->editor()->findString(string, options);
 }
 
@@ -514,9 +489,9 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe
     return res;
 }
 
-QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
+QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter)
 {
-    WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
     QVariantList selectedRange;
     RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
 
@@ -538,9 +513,9 @@ QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
 
 }
 
-QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length)
+QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length)
 {
-    WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+    WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
     QVariantList rect;
 
     if ((location + length < location) && (location + length))
@@ -556,9 +531,9 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page,
     return rect;
 }
 
-bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId)
+bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrameAdapter *adapter, const QString& elementId)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     if (!coreFrame)
         return false;
 
@@ -574,9 +549,9 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame*
     return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
 }
 
-void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPage* page)
+void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPageAdapter* adapter)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     if (!corePage)
         return;
     corePage->settings()->setEditingBehaviorType(EditingWindowsBehavior);
@@ -676,15 +651,15 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b)
 #endif
 }
 
-QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
+QString DumpRenderTreeSupportQt::viewportAsText(QWebPageAdapter* adapter, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
 {
-    WebCore::ViewportArguments args = page->d->viewportArguments();
+    WebCore::ViewportArguments args = adapter->viewportArguments();
 
     float devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
     WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
-        /* desktop-width    */ 980,
-        /* device-width     */ deviceSize.width(),
-        /* device-height    */ deviceSize.height(),
+        /* desktop-width    */980,
+        /* device-width     */deviceSize.width(),
+        /* device-height    */deviceSize.height(),
         devicePixelRatio,
         availableSize);
     WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
@@ -692,72 +667,72 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c
 
     QString res;
     res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
-            static_cast<int>(conf.layoutSize.width()),
-            static_cast<int>(conf.layoutSize.height()),
-            conf.initialScale,
-            conf.minimumScale,
-            conf.maximumScale,
-            conf.userScalable);
+        static_cast<int>(conf.layoutSize.width()),
+        static_cast<int>(conf.layoutSize.height()),
+        conf.initialScale,
+        conf.minimumScale,
+        conf.maximumScale,
+        conf.userScalable);
 
     return res;
 }
 
-void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin)
+void DumpRenderTreeSupportQt::scalePageBy(QWebFrameAdapter* adapter, float scalefactor, const QPoint& origin)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     if (Page* page = coreFrame->page())
         page->setPageScaleFactor(scalefactor, origin);
 }
 
-void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPage* page, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPageAdapter* adapter, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
 {
 #if ENABLE(DEVICE_ORIENTATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->deviceOrientationClient());
     mockClient->setOrientation(DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
 #endif
 }
 
-void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page)
+void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPageAdapter* adapter)
 {
 #if ENABLE(GEOLOCATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->reset();
 #endif
 }
 
-void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool allowed)
+void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPageAdapter* adapter, bool allowed)
 {
 #if ENABLE(GEOLOCATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->setPermission(allowed);
 #endif
 }
 
-void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double latitude, double longitude, double accuracy)
+void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPageAdapter* adapter, double latitude, double longitude, double accuracy)
 {
 #if ENABLE(GEOLOCATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
 #endif
 }
 
-void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPage* page, const QString& message)
+void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPageAdapter* adapter, const QString& message)
 {
 #if ENABLE(GEOLOCATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client());
     mockClient->setPositionUnavailableError(message);
 #endif
 }
 
-int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPage* page)
+int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPageAdapter* adapter)
 {
 #if ENABLE(GEOLOCATION)
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
     return mockClient->numberOfPendingPermissionRequests();
 #else
@@ -794,9 +769,9 @@ QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(con
     return kids;
 }
 
-bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::shouldClose(QWebFrameAdapter *adapter)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     return coreFrame->loader()->shouldClose();
 }
 
@@ -805,7 +780,7 @@ void DumpRenderTreeSupportQt::clearScriptWorlds()
     m_worldMap.clear();
 }
 
-void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script)
+void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrameAdapter *adapter, int worldID, const QString& script)
 {
     QWebScriptWorld* scriptWorld;
     if (!worldID) {
@@ -816,7 +791,7 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in
     } else
         scriptWorld = m_worldMap.value(worldID);
 
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
 
     ScriptController* proxy = coreFrame->script();
 
@@ -825,14 +800,14 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in
     proxy->executeScriptInWorld(scriptWorld->world(), script, true);
 }
 
-void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode)
+void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPageAdapter* adapter, const QString& sourceCode)
 {
-    page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames);
+    adapter->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames);
 }
 
-void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPage* page)
+void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPageAdapter* adapter)
 {
-    page->handle()->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld());
+    adapter->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld());
 }
 
 void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title)
@@ -842,31 +817,31 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti
 #endif
 }
 
-void DumpRenderTreeSupportQt::setDefersLoading(QWebPage* page, bool flag)
+void DumpRenderTreeSupportQt::setDefersLoading(QWebPageAdapter* adapter, bool flag)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     if (corePage)
         corePage->setDefersLoading(flag);
 }
 
-void DumpRenderTreeSupportQt::goBack(QWebPage* page)
+void DumpRenderTreeSupportQt::goBack(QWebPageAdapter* adapter)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     if (corePage)
         corePage->goBack();
 }
 
 // API Candidate?
-QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
+QString DumpRenderTreeSupportQt::responseMimeType(QWebFrameAdapter* adapter)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
     return docLoader->responseMIMEType();
 }
 
-void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame)
+void DumpRenderTreeSupportQt::clearOpener(QWebFrameAdapter* adapter)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     coreFrame->loader()->setOpener(0);
 }
 
@@ -875,40 +850,16 @@ void DumpRenderTreeSupportQt::addURLToRedirect(const QString& origin, const QStr
     FrameLoaderClientQt::URLsToRedirect[origin] = destination;
 }
 
-void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPage* page, bool enable)
+void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPageAdapter* adapter, bool enable)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     if (corePage)
         corePage->settings()->setInteractiveFormValidationEnabled(enable);
 }
 
-#ifndef QT_NO_MENU
-static QStringList iterateContextMenu(QMenu* menu)
-{
-    if (!menu)
-        return QStringList();
-
-    QStringList items;
-    QList<QAction *> actions = menu->actions();
-    for (int i = 0; i < actions.count(); ++i) {
-        if (actions.at(i)->isSeparator())
-            items << QLatin1String("<separator>");
-        else
-            items << actions.at(i)->text();
-        if (actions.at(i)->menu())
-            items << iterateContextMenu(actions.at(i)->menu());
-    }
-    return items;
-}
-#endif
-
-QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page)
+QStringList DumpRenderTreeSupportQt::contextMenu(QWebPageAdapter* page)
 {
-#ifndef QT_NO_CONTEXTMENU
-    return iterateContextMenu(page->d->currentContextMenu.data());
-#else
-    return QStringList();
-#endif
+    return page->menuActionsAsText();
 }
 
 double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
@@ -916,18 +867,18 @@ double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
     return Settings::defaultMinDOMTimerInterval();
 }
 
-void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double interval)
+void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPageAdapter* adapter, double interval)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     if (!corePage)
         return;
 
     corePage->settings()->setMinDOMTimerInterval(interval);
 }
 
-bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl)
+bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPageAdapter *adapter, const QUrl& url, const QUrl& firstPartyUrl)
 {
-    Page* corePage = QWebPagePrivate::core(page);
+    Page* corePage = adapter->page;
     return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl);
 }
 
@@ -936,12 +887,12 @@ void DumpRenderTreeSupportQt::enableMockScrollbars()
     Settings::setMockScrollbarsEnabled(true);
 }
 
-QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
+QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrameAdapter* adapter, const QString& elementId)
 {
     QUrl res;
 
 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     if (!coreFrame)
         return res;
 
@@ -967,10 +918,10 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const
 }
 
 // API Candidate?
-void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
+void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrameAdapter* adapter, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
 {
     KURL kurl(baseUrl);
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     WebCore::ResourceRequest request(kurl);
     const QByteArray utf8 = html.toUtf8();
     WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
@@ -978,9 +929,9 @@ void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString&
     coreFrame->loader()->load(request, substituteData, false);
 }
 
-void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* text)
+void DumpRenderTreeSupportQt::confirmComposition(QWebPageAdapter *adapter, const char* text)
 {
-    Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+    Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
     if (!frame)
         return;
 
@@ -997,15 +948,9 @@ void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* tex
         editor->insertText(String::fromUTF8(text), 0);
 }
 
-QString DumpRenderTreeSupportQt::layerTreeAsText(QWebFrame* frame)
-{
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
-    return coreFrame->layerTreeAsText();
-}
-
-void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrame* frame)
+void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrameAdapter* adapter)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
     Q_ASSERT(window);
 
@@ -1022,9 +967,9 @@ void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context)
     WebCoreTestSupport::injectInternalsObject(context);
 }
 
-void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
+void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrameAdapter* adapter)
 {
-    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+    WebCore::Frame* coreFrame = adapter->frame;
     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
     Q_ASSERT(window);
 
@@ -1041,9 +986,9 @@ void DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context)
     WebCoreTestSupport::resetInternalsObject(context);
 }
 
-QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
+QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrameAdapter* adapter)
 {
-    Frame* frame = QWebFramePrivate::core(qframe);
+    Frame* frame = adapter->frame;
     PrintContext printContext(frame);
 
     QRect rect = frame->view()->frameRect();
@@ -1084,119 +1029,21 @@ QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
     return image;
 }
 
-void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrame* frame, bool enable)
+void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrameAdapter* adapter, bool enable)
 {
-    QWebFramePrivate::core(frame)->view()->setTracksRepaints(enable);
+    adapter->frame->view()->setTracksRepaints(enable);
 }
 
-bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrameAdapter* adapter)
 {
-    return QWebFramePrivate::core(frame)->view()->isTrackingRepaints();
+    return adapter->frame->view()->isTrackingRepaints();
 }
 
-void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrame* frame, QVector<QRect>& result)
+void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter, QVector<QRect>& result)
 {
-    Frame* coreFrame = QWebFramePrivate::core(frame);
+    Frame* coreFrame = adapter->frame;
     const Vector<IntRect>& rects = coreFrame->view()->trackedRepaintRects();
     result.resize(rects.size());
     for (size_t i = 0; i < rects.size(); ++i)
         result.append(rects[i]);
 }
-
-// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
-
-void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
-{
-    DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame);
-}
-
-void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame)
-{
-    DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame)
-{
-    DumpRenderTreeSupportQt::clearFrameName(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_garbageCollector_collect()
-{
-    DumpRenderTreeSupportQt::garbageCollectorCollect();
-}
-
-void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone)
-{
-    DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone);
-}
-
-int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount()
-{
-    return DumpRenderTreeSupportQt::javaScriptObjectsCount();
-}
-
-int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame)
-{
-    return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
-{
-    DumpRenderTreeSupportQt::overwritePluginDirectories();
-}
-
-bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId)
-{
-    return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId);
-}
-
-bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId)
-{
-    return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId);
-}
-
-void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists()
-{
-    DumpRenderTreeSupportQt::resetOriginAccessWhiteLists();
-}
-
-void QWEBKIT_EXPORT qt_drt_run(bool b)
-{
-    DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b);
-}
-
-void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
-{
-    DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains);
-}
-
-QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page)
-{
-    return DumpRenderTreeSupportQt::webPageGroupName(page);
-}
-
-void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName)
-{
-    DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName);
-}
-
-void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
-{
-    DumpRenderTreeSupportQt::dumpFrameLoader(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
-{
-    DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
-{
-    DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
-{
-    DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
-}
-
index d0600ffa7dae449f1810522a9c609f83421a63c9..72505b8d3520c7948d7468b2d6cb7a8e647ae6f5 100644 (file)
@@ -43,7 +43,8 @@ class QtDRTNodeRuntime;
 
 class QWebElement;
 class QWebFrame;
-class QWebPage;
+class QWebFrameAdapter;
+class QWebPageAdapter;
 class QWebHistoryItem;
 class QWebScriptWorld;
 
@@ -89,25 +90,23 @@ public:
 
     static void initialize();
 
-    static void executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value);
-    static bool isCommandEnabled(QWebPage* page, const QString& name);
-    static bool findString(QWebPage* page, const QString& string, const QStringList& optionArray);
-    static void setSmartInsertDeleteEnabled(QWebPage* page, bool enabled);
-    static void setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled);
-    static QVariantList selectedRange(QWebPage* page);
-    static QVariantList firstRectForCharacterRange(QWebPage* page, int location, int length);
-    static void confirmComposition(QWebPage*, const char* text);
+    static void executeCoreCommandByName(QWebPageAdapter*, const QString& name, const QString& value);
+    static bool isCommandEnabled(QWebPageAdapter*, const QString& name);
+    static bool findString(QWebPageAdapter*, const QString&, const QStringList& optionArray);
+    static void setSmartInsertDeleteEnabled(QWebPageAdapter*, bool enabled);
+    static void setSelectTrailingWhitespaceEnabled(QWebPageAdapter*, bool enabled);
+    static QVariantList selectedRange(QWebPageAdapter*);
+    static QVariantList firstRectForCharacterRange(QWebPageAdapter*, int location, int length);
+    static void confirmComposition(QWebPageAdapter*, const char* text);
 
-    static bool pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId);
-    static bool pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId);
-    static void suspendActiveDOMObjects(QWebFrame* frame);
-    static void resumeActiveDOMObjects(QWebFrame* frame);
+    static bool pauseAnimation(QWebFrameAdapter*, const QString& name, double time, const QString& elementId);
+    static bool pauseTransitionOfProperty(QWebFrameAdapter*, const QString& name, double time, const QString& elementId);
 
     static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme);
-    static void setFrameFlatteningEnabled(QWebPage*, bool);
-    static void setCaretBrowsingEnabled(QWebPage* page, bool value);
-    static void setAuthorAndUserStylesEnabled(QWebPage*, bool);
-    static void setDumpRenderTreeModeEnabled(bool b);
+    static void setFrameFlatteningEnabled(QWebPageAdapter*, bool);
+    static void setCaretBrowsingEnabled(QWebPageAdapter*, bool value);
+    static void setAuthorAndUserStylesEnabled(QWebPageAdapter*, bool);
+    static void setDumpRenderTreeModeEnabled(bool);
 
     static void garbageCollectorCollect();
     static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone);
@@ -115,20 +114,20 @@ public:
     static void setValueForUser(const QWebElement&, const QString& value);
     static int javaScriptObjectsCount();
     static void clearScriptWorlds();
-    static void evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script);
+    static void evaluateScriptInIsolatedWorld(QWebFrameAdapter*, int worldID, const QString& script);
 
-    static void webInspectorExecuteScript(QWebPage* page, long callId, const QString& script);
-    static void webInspectorShow(QWebPage* page);
-    static void webInspectorClose(QWebPage* page);
+    static void webInspectorExecuteScript(QWebPageAdapter*, long callId, const QString& script);
+    static void webInspectorShow(QWebPageAdapter*);
+    static void webInspectorClose(QWebPageAdapter*);
 
-    static QString webPageGroupName(QWebPage *page);
-    static void webPageSetGroupName(QWebPage* page, const QString& groupName);
-    static void clearFrameName(QWebFrame* frame);
+    static QString webPageGroupName(QWebPageAdapter*);
+    static void webPageSetGroupName(QWebPageAdapter*, const QString& groupName);
+    static void clearFrameName(QWebFrameAdapter*);
     static void overwritePluginDirectories();
-    static int numberOfActiveAnimations(QWebFrame*);
-    static bool hasDocumentElement(QWebFrame* frame);
-    static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId);
-    static void setWindowsBehaviorAsEditingBehavior(QWebPage*);
+    static int numberOfActiveAnimations(QWebFrameAdapter*);
+    static bool hasDocumentElement(QWebFrameAdapter*);
+    static bool elementDoesAutoCompleteForElementWithId(QWebFrameAdapter*, const QString& elementId);
+    static void setWindowsBehaviorAsEditingBehavior(QWebPageAdapter*);
 
     static void clearAllApplicationCaches();
 
@@ -136,86 +135,84 @@ public:
     static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
     static void resetOriginAccessWhiteLists();
 
-    static void setMockDeviceOrientation(QWebPage*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
+    static void setMockDeviceOrientation(QWebPageAdapter*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
 
-    static void resetGeolocationMock(QWebPage*);
-    static void setMockGeolocationPermission(QWebPage*, bool allowed);
-    static void setMockGeolocationPosition(QWebPage*, double latitude, double longitude, double accuracy);
-    static void setMockGeolocationPositionUnavailableError(QWebPage*, const QString& message);
-    static int numberOfPendingGeolocationPermissionRequests(QWebPage*);
+    static void resetGeolocationMock(QWebPageAdapter*);
+    static void setMockGeolocationPermission(QWebPageAdapter*, bool allowed);
+    static void setMockGeolocationPosition(QWebPageAdapter*, double latitude, double longitude, double accuracy);
+    static void setMockGeolocationPositionUnavailableError(QWebPageAdapter*, const QString& message);
+    static int numberOfPendingGeolocationPermissionRequests(QWebPageAdapter*);
 
     static int workerThreadCount();
 
     static QString markerTextForListItem(const QWebElement& listItem);
-    static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element);
+    static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement&);
 
-    static void dumpFrameLoader(bool b);
+    static void dumpFrameLoader(bool);
     static void dumpProgressFinishedCallback(bool);
-    static void dumpUserGestureInFrameLoader(bool b);
-    static void dumpResourceLoadCallbacks(bool b);
-    static void dumpResourceResponseMIMETypes(bool b);
+    static void dumpUserGestureInFrameLoader(bool);
+    static void dumpResourceLoadCallbacks(bool);
+    static void dumpResourceResponseMIMETypes(bool);
     static void dumpResourceLoadCallbacksPath(const QString& path);
     static void dumpWillCacheResponseCallbacks(bool);
-    static void setWillSendRequestReturnsNullOnRedirect(bool b);
-    static void setWillSendRequestReturnsNull(bool b);
-    static void setWillSendRequestClearHeaders(const QStringList& headers);
-    static void dumpHistoryCallbacks(bool b);
-    static void dumpVisitedLinksCallbacks(bool b);
+    static void setWillSendRequestReturnsNullOnRedirect(bool);
+    static void setWillSendRequestReturnsNull(bool);
+    static void setWillSendRequestClearHeaders(const QStringList&);
+    static void dumpHistoryCallbacks(bool);
+    static void dumpVisitedLinksCallbacks(bool);
 
-    static void setDeferMainResourceDataLoad(bool b);
+    static void setDeferMainResourceDataLoad(bool);
 
-    static void dumpEditingCallbacks(bool b);
-    static void dumpSetAcceptsEditing(bool b);
+    static void dumpEditingCallbacks(bool);
+    static void dumpSetAcceptsEditing(bool);
 
-    static void dumpNotification(bool b);
+    static void dumpNotification(bool);
+    static QString viewportAsText(QWebPageAdapter*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize);
 
-    static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem);
-    static bool isTargetItem(const QWebHistoryItem& historyItem);
-    static QString historyItemTarget(const QWebHistoryItem& historyItem);
+    static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem&);
+    static bool isTargetItem(const QWebHistoryItem&);
+    static QString historyItemTarget(const QWebHistoryItem&);
 
-    static bool shouldClose(QWebFrame* frame);
+    static bool shouldClose(QWebFrameAdapter*);
 
     static void setCustomPolicyDelegate(bool enabled, bool permissive);
 
-    static void addUserStyleSheet(QWebPage* page, const QString& sourceCode);
-    static void removeUserStyleSheets(QWebPage*);
+    static void addUserStyleSheet(QWebPageAdapter*, const QString& sourceCode);
+    static void removeUserStyleSheets(QWebPageAdapter*);
     static void simulateDesktopNotificationClick(const QString& title);
-    static QString viewportAsText(QWebPage*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize);
 
-    static void scalePageBy(QWebFrame*, float scale, const QPoint& origin);
+    static void scalePageBy(QWebFrameAdapter*, float scale, const QPoint& origin);
 
-    static QString responseMimeType(QWebFrame*);
-    static void clearOpener(QWebFrame*);
+    static QString responseMimeType(QWebFrameAdapter*);
+    static void clearOpener(QWebFrameAdapter*);
     static void addURLToRedirect(const QString& origin, const QString& destination);
-    static QStringList contextMenu(QWebPage*);
+    static QStringList contextMenu(QWebPageAdapter*);
 
     static double defaultMinimumTimerInterval(); // Not really tied to WebView
-    static void setMinimumTimerInterval(QWebPage*, double);
+    static void setMinimumTimerInterval(QWebPageAdapter*, double);
 
-    static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId);
-    static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
+    static QUrl mediaContentUrlByElementId(QWebFrameAdapter*, const QString& elementId);
+    static void setAlternateHtml(QWebFrameAdapter*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
 
-    static QString layerTreeAsText(QWebFrame*);
-
-    static void injectInternalsObject(QWebFrame*);
+    static void injectInternalsObject(QWebFrameAdapter*);
     static void injectInternalsObject(JSContextRef);
-    static void resetInternalsObject(QWebFrame*);
+    static void resetInternalsObject(QWebFrameAdapter*);
     static void resetInternalsObject(JSContextRef);
 
-    static void setInteractiveFormValidationEnabled(QWebPage*, bool);
+    static void setInteractiveFormValidationEnabled(QWebPageAdapter*, bool);
 
-    static void setDefersLoading(QWebPage*, bool flag);
-    static void goBack(QWebPage*);
+    static void setDefersLoading(QWebPageAdapter*, bool flag);
+    static void goBack(QWebPageAdapter*);
 
-    static bool thirdPartyCookiePolicyAllows(QWebPage*, const QUrl&, const QUrl& firstPartyUrl);
+    static bool thirdPartyCookiePolicyAllows(QWebPageAdapter*, const QUrl&, const QUrl& firstPartyUrl);
 
     static void enableMockScrollbars();
 
-    static QImage paintPagesWithBoundaries(QWebFrame*);
+    static QImage paintPagesWithBoundaries(QWebFrameAdapter*);
 
-    static void setTrackRepaintRects(QWebFrame*, bool enable);
-    static bool trackRepaintRects(QWebFrame*);
-    static void getTrackedRepaintRects(QWebFrame*, QVector<QRect>& result);
+    static void setTrackRepaintRects(QWebFrameAdapter*, bool enable);
+    static bool trackRepaintRects(QWebFrameAdapter*);
+    static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result);
 };
 
 #endif
index eb73c9e9d45516c1c977b4b3cb7c095cfd5ef5cd..78c36f2b9ba1eba35138c09b865719a41ce34c52 100644 (file)
@@ -32,7 +32,6 @@
 #include "EditorClientQt.h"
 
 #include "Document.h"
-#include "UndoStepQt.h"
 #include "Editor.h"
 #include "FocusController.h"
 #include "Frame.h"
@@ -44,6 +43,7 @@
 #include "Page.h"
 #include "Pasteboard.h"
 #include "PlatformKeyboardEvent.h"
+#include "QWebPageAdapter.h"
 #include "QWebPageClient.h"
 #include "Range.h"
 #include "Settings.h"
 #include "StylePropertySet.h"
 #include "WindowsKeyboardCodes.h"
 #include "qguiapplication.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
 
 #include <QClipboard>
-#include <QUndoStack>
+#include <QKeyEvent>
+#include <QKeySequence>
 #include <stdio.h>
 #include <wtf/OwnPtr.h>
 
@@ -80,8 +79,8 @@ static QString dumpRange(WebCore::Range *range)
     WebCore::ExceptionCode code;
 
     QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4")
-            .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
-            .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
+        .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
+        .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
 
     return str;
 }
@@ -104,7 +103,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range)
 
 bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element)
 {
-    if (QWebPagePrivate::drtRun)
+    if (QWebPageAdapter::drtRun)
         return element->getAttribute(classAttr) == "needsDeletionUI";
     return false;
 }
@@ -148,7 +147,7 @@ bool EditorClientQt::shouldInsertText(const String& string, Range* range, Editor
         };
 
         printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n",
-               QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]);
+            QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]);
     }
     return acceptsEditing;
 }
@@ -166,19 +165,18 @@ bool EditorClientQt::shouldChangeSelectedRange(Range* currentRange, Range* propo
         };
 
         printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n",
-               dumpRange(currentRange).toUtf8().constData(),
-               dumpRange(proposedRange).toUtf8().constData(),
-               affinitystring[selectionAffinity], boolstring[stillSelecting]);
+            dumpRange(currentRange).toUtf8().constData(),
+            dumpRange(proposedRange).toUtf8().constData(),
+            affinitystring[selectionAffinity], boolstring[stillSelecting]);
     }
     return acceptsEditing;
 }
 
-bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style,
-                                      WebCore::Range* range)
+bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style, WebCore::Range* range)
 {
     if (dumpEditingCallbacks)
         printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
-               QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
+            QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
     return acceptsEditing;
 }
 
@@ -199,9 +197,8 @@ void EditorClientQt::respondToChangedContents()
 {
     if (dumpEditingCallbacks)
         printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n");
-    m_page->d->updateEditorActions();
 
-    emit m_page->contentsChanged();
+    m_page->respondToChangedContents();
 }
 
 void EditorClientQt::respondToChangedSelection(Frame* frame)
@@ -220,8 +217,7 @@ void EditorClientQt::respondToChangedSelection(Frame* frame)
         Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
     }
 
-    m_page->d->updateEditorActions();
-    emit m_page->selectionChanged();
+    m_page->respondToChangedSelection();
     if (!frame->editor()->ignoreCompositionSelectionChange())
         emit m_page->microFocusChanged();
 }
@@ -250,10 +246,10 @@ bool EditorClientQt::selectWordBeforeMenuEvent()
 void EditorClientQt::registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep> step)
 {
 #ifndef QT_NO_UNDOSTACK
-    Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+    Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
     if (m_inUndoRedo || (frame && !frame->editor()->lastEditCommand() /* HACK!! Don't recreate undos */))
         return;
-    m_page->undoStack()->push(new UndoStepQt(step));
+    m_page->registerUndoStep(step);
 #endif // QT_NO_UNDOSTACK
 }
 
@@ -264,7 +260,7 @@ void EditorClientQt::registerRedoStep(WTF::PassRefPtr<WebCore::UndoStep>)
 void EditorClientQt::clearUndoRedoOperations()
 {
 #ifndef QT_NO_UNDOSTACK
-    return m_page->undoStack()->clear();
+    return m_page->clearUndoStack();
 #endif
 }
 
@@ -283,7 +279,7 @@ bool EditorClientQt::canUndo() const
 #ifdef QT_NO_UNDOSTACK
     return false;
 #else
-    return m_page->undoStack()->canUndo();
+    return m_page->canUndo();
 #endif
 }
 
@@ -292,7 +288,7 @@ bool EditorClientQt::canRedo() const
 #ifdef QT_NO_UNDOSTACK
     return false;
 #else
-    return m_page->undoStack()->canRedo();
+    return m_page->canRedo();
 #endif
 }
 
@@ -300,7 +296,7 @@ void EditorClientQt::undo()
 {
 #ifndef QT_NO_UNDOSTACK
     m_inUndoRedo = true;
-    m_page->undoStack()->undo();
+    m_page->undo();
     m_inUndoRedo = false;
 #endif
 }
@@ -309,7 +305,7 @@ void EditorClientQt::redo()
 {
 #ifndef QT_NO_UNDOSTACK
     m_inUndoRedo = true;
-    m_page->undoStack()->redo();
+    m_page->redo();
     m_inUndoRedo = false;
 #endif
 }
@@ -324,7 +320,7 @@ bool EditorClientQt::shouldInsertNode(Node* node, Range* range, EditorInsertActi
         };
 
         printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).toUtf8().constData(),
-               dumpRange(range).toUtf8().constData(), insertactionstring[action]);
+            dumpRange(range).toUtf8().constData(), insertactionstring[action]);
     }
     return acceptsEditing;
 }
@@ -336,18 +332,18 @@ void EditorClientQt::pageDestroyed()
 
 bool EditorClientQt::smartInsertDeleteEnabled()
 {
-    return m_page->d->smartInsertDeleteEnabled;
+    return m_smartInsertDeleteEnabled;
 }
 
 void EditorClientQt::toggleSmartInsertDelete()
 {
-    bool current = m_page->d->smartInsertDeleteEnabled;
-    m_page->d->smartInsertDeleteEnabled = !current;
+    bool current = m_smartInsertDeleteEnabled;
+    m_smartInsertDeleteEnabled = !current;
 }
 
 bool EditorClientQt::isSelectTrailingWhitespaceEnabled()
 {
-    return m_page->d->selectTrailingWhitespaceEnabled;
+    return m_selectTrailingWhitespaceEnabled;
 }
 
 void EditorClientQt::toggleContinuousSpellChecking()
@@ -416,7 +412,7 @@ const char* editorCommandForKeyDownEvent(const KeyboardEvent* event)
 
 void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
 {
-    Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+    Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
     if (!frame)
         return;
 
@@ -444,20 +440,19 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
         }
 
 #ifndef QT_NO_SHORTCUT
-        QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
-        if (action != QWebPage::NoWebAction && !doSpatialNavigation) {
-            const char* cmd = QWebPagePrivate::editorCommandForWebActions(action);
+        const char* cmd = m_page->editorCommandForKeyEvent(kevent->qtEvent());
+        if (cmd && !doSpatialNavigation) {
             // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
             // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
             // (e.g. Tab that inserts a Tab character, or Enter).
-            if (cmd && frame->editor()->command(cmd).isTextInsertion()
+            if (frame->editor()->command(cmd).isTextInsertion()
                 && kevent->type() == PlatformEvent::RawKeyDown)
                 return;
 
-            m_page->triggerAction(action);
+            m_page->triggerActionForKeyEvent(kevent->qtEvent());
             event->setDefaultHandled();
             return;
-        } else 
+        }
 #endif // QT_NO_SHORTCUT
         {
             String commandName = editorCommandForKeyDownEvent(event);
@@ -501,7 +496,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
     }
 
     // Non editable content.
-    if (m_page->handle()->page->settings()->caretBrowsingEnabled()) {
+    if (m_page->page->settings()->caretBrowsingEnabled()) {
         switch (kevent->windowsVirtualKeyCode()) {
         case VK_LEFT:
         case VK_RIGHT:
@@ -511,15 +506,13 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
         case VK_END:
             {
 #ifndef QT_NO_SHORTCUT
-                QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
-                ASSERT(action != QWebPage::NoWebAction);
-                m_page->triggerAction(action);
+                m_page->triggerActionForKeyEvent(kevent->qtEvent());
                 event->setDefaultHandled();
 #endif
                 return;
             }
         case VK_PRIOR: // PageUp
-        case VK_NEXT:  // PageDown
+        case VK_NEXT: // PageDown
             {
                 String commandName = editorCommandForKeyDownEvent(event);
                 ASSERT(!commandName.isEmpty());
@@ -532,7 +525,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
 
 #ifndef QT_NO_SHORTCUT
     if (kevent->qtEvent() == QKeySequence::Copy) {
-        m_page->triggerAction(QWebPage::Copy);
+        m_page->triggerCopyAction();
         event->setDefaultHandled();
         return;
     }
@@ -543,8 +536,12 @@ void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*)
 {
 }
 
-EditorClientQt::EditorClientQt(QWebPage* page)
-    : m_page(page), m_editing(false), m_inUndoRedo(false)
+EditorClientQt::EditorClientQt(QWebPageAdapter* pageAdapter)
+    : m_page(pageAdapter)
+    , m_editing(false)
+    , m_inUndoRedo(false)
+    , m_smartInsertDeleteEnabled(true)
+    , m_selectTrailingWhitespaceEnabled(false)
 {
 }
 
@@ -607,12 +604,12 @@ void EditorClientQt::willSetInputMethodState()
 
 void EditorClientQt::setInputMethodState(bool active)
 {
-    QWebPageClient* webPageClient = m_page->d->client.get();
+    QWebPageClient* webPageClient = m_page->client.data();
     if (webPageClient) {
         Qt::InputMethodHints hints;
 
         HTMLInputElement* inputElement = 0;
-        Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+        Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
         if (frame && frame->document() && frame->document()->focusedNode())
             if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag))
                 inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
index 863c67b7187dfd6503f60cc6d9746ee106ee4206..c49be4a403736ef0ac8062b31b90de21895d219c 100644 (file)
 #include <wtf/RefCounted.h>
 
 class QWebPage;
+class QWebPageAdapter;
 
 namespace WebCore {
 
 class EditorClientQt : public EditorClient {
 public:
-    EditorClientQt(QWebPage* page);
+    EditorClientQt(QWebPageAdapter*);
     
     virtual void pageDestroyed();
     virtual void frameWillDetachPage(Frame*) { }
@@ -109,14 +110,19 @@ public:
 
     bool isEditing() const;
 
+    void setSmartInsertDeleteEnabled(bool b) { m_smartInsertDeleteEnabled = b; }
+    void setSelectTrailingWhitespaceEnabled(bool b) { m_selectTrailingWhitespaceEnabled = b; }
+
     static bool dumpEditingCallbacks;
     static bool acceptsEditing;
 
 private:
     TextCheckerClientQt m_textCheckerClient;
-    QWebPage* m_page;
+    QWebPageAdapter* m_page;
     bool m_editing;
     bool m_inUndoRedo; // our undo stack works differently - don't re-enter!
+    bool m_smartInsertDeleteEnabled;
+    bool m_selectTrailingWhitespaceEnabled;
 };
 
 }
index 0731d93158a16f9730e841e20817a8822b4e6148..7a23ee2683c08b24306ca47c04647a6db26707c8 100644 (file)
 #include "PluginDatabase.h"
 #include "ProgressTracker.h"
 #include "QNetworkReplyHandler.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "QWebPageClient.h"
+#include "QtPluginWidgetAdapter.h"
 #include "RenderPart.h"
 #include "ResourceHandle.h"
 #include "ResourceHandleInternal.h"
 #include "Settings.h"
 #include "ViewportArguments.h"
 #include "WebEventConversion.h"
-
-#include "qwebframe.h"
-#include "qwebframe_p.h"
+#include "qwebhistory.h"
 #include "qwebhistory_p.h"
 #include "qwebhistoryinterface.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
 #include "qwebpluginfactory.h"
 
 #include <QCoreApplication>
 #include <QDebug>
 #include <QFileInfo>
-#include <QGraphicsScene>
-#include <QGraphicsWidget>
+#include <QMouseEvent>
 #include <QNetworkReply>
 #include <QNetworkRequest>
 #include <QStringList>
 #include <wtf/OwnPtr.h>
+#include <wtf/text/StringBuilder.h>
 
 static QMap<unsigned long, QString> dumpAssignedUrls;
 
 // Compare with the file "WebKit/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm".
 static QString drtDescriptionSuitableForTestResult(WebCore::Frame* webCoreFrame)
 {
-    QWebFrame* frame = QWebFramePrivate::kit(webCoreFrame);
-    QString name = frame->frameName();
+    QWebFrameAdapter* frame = QWebFrameAdapter::kit(webCoreFrame);
+    QString name = webCoreFrame->tree()->uniqueName();
 
-    bool isMainFrame = frame == frame->page()->mainFrame();
+    bool isMainFrame = frame == frame->pageAdapter->mainFrameAdapter();
     if (isMainFrame) {
         if (!name.isEmpty())
             return QString::fromLatin1("main frame \"%1\"").arg(name);
@@ -216,24 +215,24 @@ FrameLoaderClientQt::~FrameLoaderClientQt()
 {
 }
 
-void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame)
+void FrameLoaderClientQt::setFrame(QWebFrameAdapter* webFrame, Frame* frame)
 {
     m_webFrame = webFrame;
     m_frame = frame;
 
-    if (!m_webFrame || !m_webFrame->page()) {
+    if (!m_webFrame || !m_webFrame->pageAdapter) {
         qWarning("FrameLoaderClientQt::setFrame frame without Page!");
         return;
     }
 
     connect(this, SIGNAL(loadProgress(int)),
-            m_webFrame->page(), SIGNAL(loadProgress(int)));
+        m_webFrame->pageAdapter->handle(), SIGNAL(loadProgress(int)));
 
     connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
-            m_webFrame->page(), SIGNAL(unsupportedContent(QNetworkReply*)));
+        m_webFrame->pageAdapter->handle(), SIGNAL(unsupportedContent(QNetworkReply*)));
 
     connect(this, SIGNAL(titleChanged(QString)),
-            m_webFrame, SIGNAL(titleChanged(QString)));
+        m_webFrame->handle(), SIGNAL(titleChanged(QString)));
 }
 
 void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action)
@@ -261,11 +260,11 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
     ASSERT(m_frame);
     ASSERT(m_webFrame);
 
-    QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base);
+    QObject* qWebPage = m_webFrame->pageAdapter->handle();
+    QBrush brush = qWebPage->property("palette").value<QPalette>().brush(QPalette::Base);
     QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor();
 
-    QWebPage* page = m_webFrame->page();
-    const QSize preferredLayoutSize = page->preferredContentsSize();
+    const QSize preferredLayoutSize = qWebPage->property("preferredContentsSize").toSize();
 
     ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal);
     ScrollbarMode vScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Vertical);
@@ -275,17 +274,18 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
     // The HistoryController will update the scroll position later if needed.
     IntRect currentVisibleContentRect = m_frame->view() ? IntRect(IntPoint::zero(), m_frame->view()->fixedVisibleContentRect().size()) : IntRect();
 
-    m_frame->createView(m_webFrame->page()->viewportSize(),
-                        backgroundColor, !backgroundColor.alpha(),
-                        preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(),
-                        currentVisibleContentRect,
-                        preferredLayoutSize.isValid(),
-                        hScrollbar, hLock,
-                        vScrollbar, vLock);
+    m_frame->createView(qWebPage->property("viewportSize").toSize(),
+        backgroundColor, !backgroundColor.alpha(),
+        preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(),
+        currentVisibleContentRect,
+        preferredLayoutSize.isValid(),
+        hScrollbar, hLock,
+        vScrollbar, vLock);
 
     bool isMainFrame = m_frame == m_frame->page()->mainFrame();
-    if (isMainFrame && page->d->client) {
-        bool resizesToContents = page->d->client->viewResizesToContentsEnabled();
+    if (isMainFrame &&m_webFrame->pageAdapter->client) {
+        bool resizesToContents = m_webFrame->pageAdapter->client->viewResizesToContentsEnabled();
+
         m_frame->view()->setPaintsEntireContents(resizesToContents);
         m_frame->view()->setDelegatesScrolling(resizesToContents);
     }
@@ -392,8 +392,8 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage()
     if (!m_webFrame)
         return;
 
-    m_webFrame->d->emitUrlChanged();
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->emitUrlChanged();
+    m_webFrame->pageAdapter->updateNavigationActions();
 }
 
 
@@ -440,7 +440,7 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad()
         return;
     emitLoadStarted();
     postProgressEstimateChangedNotification();
-    emit m_webFrame->provisionalLoad();
+    m_webFrame->didStartProvisionalLoad();
 }
 
 
@@ -478,8 +478,8 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
     if (m_frame->tree()->parent() || !m_webFrame)
         return;
 
-    m_webFrame->d->emitUrlChanged();
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->emitUrlChanged();
+    m_webFrame->pageAdapter->updateNavigationActions();
 
     // We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle()
     // will be called very soon with the correct title.
@@ -490,7 +490,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
     if (!isMainFrame)
         return;
 
-    emit m_webFrame->page()->viewportChangeRequested();
+    emit m_webFrame->pageAdapter->emitViewportChangeRequested();
 }
 
 
@@ -499,7 +499,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
     if (dumpFrameLoaderCallbacks)
         printf("%s - didFinishDocumentLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
 
-    if (QWebPagePrivate::drtRun) {
+    if (QWebPageAdapter::drtRun) {
         int unloadEventCount = m_frame->document()->domWindow()->pendingUnloadEventListeners();
         if (unloadEventCount)
             printf("%s - has %u onunload handler(s)\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), unloadEventCount);
@@ -508,7 +508,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
     if (m_frame->tree()->parent() || !m_webFrame)
         return;
 
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->pageAdapter->updateNavigationActions();
 }
 
 
@@ -520,7 +520,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
     if (!m_webFrame)
         return;
 
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->pageAdapter->updateNavigationActions();
     emitLoadFinished(true);
 }
 
@@ -530,7 +530,7 @@ void FrameLoaderClientQt::dispatchDidLayout(LayoutMilestones milestones)
         return;
 
     if (milestones & DidFirstVisuallyNonEmptyLayout)
-        emit m_webFrame->initialLayoutCompleted();
+        m_webFrame->emitInitialLayoutCompleted();
 }
 
 void FrameLoaderClientQt::dispatchShow()
@@ -545,8 +545,7 @@ void FrameLoaderClientQt::cancelPolicyCheck()
 }
 
 
-void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function,
-                                                 PassRefPtr<FormState>)
+void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
 {
     notImplemented();
     // FIXME: This is surely too simple.
@@ -560,7 +559,7 @@ void FrameLoaderClientQt::postProgressStartedNotification()
         m_isOriginatingLoad = true;
     if (m_frame->tree()->parent() || !m_webFrame)
         return;
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->pageAdapter->updateNavigationActions();
 }
 
 void FrameLoaderClientQt::postProgressEstimateChangedNotification()
@@ -577,14 +576,11 @@ void FrameLoaderClientQt::postProgressFinishedNotification()
     // Send a mousemove event to:
     // (1) update the cursor to change according to whatever is underneath the mouse cursor right now;
     // (2) display the tool tip if the mouse hovers a node which has a tool tip.
-    if (m_frame && m_frame->eventHandler() && m_webFrame->page()) {
-        QWidget* view = m_webFrame->page()->view();
-        if (view && view->hasFocus()) {
-            QPoint localPos = view->mapFromGlobal(QCursor::pos());
-            if (view->rect().contains(localPos)) {
-                QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
-                m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0));
-            }
+    if (m_frame && m_frame->eventHandler() && m_webFrame) {
+        QPoint localPos;
+        if (m_webFrame->handleProgressFinished(&localPos)) {
+            QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+            m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0));
         }
     }
 }
@@ -655,7 +651,7 @@ void FrameLoaderClientQt::frameLoadCompleted()
     // Note that this can be called multiple times.
     if (!m_webFrame)
         return;
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->pageAdapter->updateNavigationActions();
 }
 
 
@@ -663,7 +659,7 @@ void FrameLoaderClientQt::restoreViewState()
 {
     if (!m_webFrame)
         return;
-    emit m_webFrame->page()->restoreFrameStateRequested(m_webFrame);
+    m_webFrame->pageAdapter->emitRestoreFrameStateRequested(m_webFrame);
 }
 
 
@@ -700,21 +696,23 @@ void FrameLoaderClientQt::setTitle(const StringWithDirection& title, const KURL&
 
 String FrameLoaderClientQt::userAgent(const KURL& url)
 {
-    if (m_webFrame) {
-        return m_webFrame->page()->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r'));
-    }
+    if (m_webFrame)
+        return m_webFrame->pageAdapter->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r'));
     return String();
 }
 
 void FrameLoaderClientQt::dispatchDidReceiveIcon()
 {
     if (m_webFrame)
-        emit m_webFrame->iconChanged();
+        m_webFrame->emitIconChanged();
 }
 
 void FrameLoaderClientQt::frameLoaderDestroyed()
 {
-    delete m_webFrame;
+    // Delete QWebFrame (handle()), which owns QWebFramePrivate, which
+    // _is_ a QWebFrameAdapter.
+    if (m_webFrame)
+        delete m_webFrame->handle();
     m_frame = 0;
     m_webFrame = 0;
 
@@ -732,7 +730,7 @@ void FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* w
         return;
 
     if (m_webFrame)
-        m_webFrame->d->didClearWindowObject();
+        m_webFrame->didClearWindowObject();
 }
 
 void FrameLoaderClientQt::documentElementAvailable()
@@ -744,7 +742,7 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const
 {
     if (m_frame->tree()->parent() || !m_webFrame)
         return;
-    m_webFrame->page()->d->updateNavigationActions();
+    m_webFrame->pageAdapter->updateNavigationActions();
 }
 
 void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
@@ -760,8 +758,8 @@ void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
 void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url)
 {
 #if ENABLE(ICONDATABASE)
-    if (m_webFrame && m_webFrame->url() == url)
-        emit m_webFrame->iconChanged();
+    if (m_webFrame && m_webFrame->url == url)
+        m_webFrame->emitIconChanged();
 #endif
 }
 
@@ -799,16 +797,16 @@ void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks()
     if (!loader->clientRedirectSourceForHistory().isNull()) {
         if (dumpHistoryCallbacks) {
             printf("WebView performed a client redirect from \"%s\" to \"%s\".\n",
-                  qPrintable(QString(loader->clientRedirectSourceForHistory())),
-                  qPrintable(QString(loader->clientRedirectDestinationForHistory())));
+                qPrintable(QString(loader->clientRedirectSourceForHistory())),
+                qPrintable(QString(loader->clientRedirectDestinationForHistory())));
         }
     }
 
     if (!loader->serverRedirectSourceForHistory().isNull()) {
         if (dumpHistoryCallbacks) {
             printf("WebView performed a server redirect from \"%s\" to \"%s\".\n",
-                  qPrintable(QString(loader->serverRedirectSourceForHistory())),
-                  qPrintable(QString(loader->serverRedirectDestinationForHistory())));
+                qPrintable(QString(loader->serverRedirectSourceForHistory())),
+                qPrintable(QString(loader->serverRedirectDestinationForHistory())));
         }
     }
 }
@@ -850,7 +848,7 @@ void FrameLoaderClientQt::didDetectXSS(const KURL&, bool)
 void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item)
 {
     QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item));
-    emit m_webFrame->page()->saveFrameStateRequested(m_webFrame, &historyItem);
+    m_webFrame->pageAdapter->emitSaveFrameStateRequested(m_webFrame, &historyItem);
 }
 
 bool FrameLoaderClientQt::canCachePage() const
@@ -896,7 +894,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c
 WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request)
 {
     ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().string(),
-            QCoreApplication::translate("QWebFrame", "Request cancelled", 0));
+        QCoreApplication::translate("QWebFrame", "Request cancelled", 0));
     error.setIsCancellation(true);
     return error;
 }
@@ -916,38 +914,38 @@ enum {
 WebCore::ResourceError FrameLoaderClientQt::blockedError(const WebCore::ResourceRequest& request)
 {
     return ResourceError("WebKitErrorDomain", WebKitErrorCannotUseRestrictedPort, request.url().string(),
-            QCoreApplication::translate("QWebFrame", "Request blocked", 0));
+        QCoreApplication::translate("QWebFrame", "Request blocked", 0));
 }
 
 
 WebCore::ResourceError FrameLoaderClientQt::cannotShowURLError(const WebCore::ResourceRequest& request)
 {
     return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowURL, request.url().string(),
-            QCoreApplication::translate("QWebFrame", "Cannot show URL", 0));
+        QCoreApplication::translate("QWebFrame", "Cannot show URL", 0));
 }
 
 WebCore::ResourceError FrameLoaderClientQt::interruptedForPolicyChangeError(const WebCore::ResourceRequest& request)
 {
     return ResourceError("WebKitErrorDomain", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(),
-            QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0));
+        QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0));
 }
 
 WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
 {
     return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowMIMEType, response.url().string(),
-            QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0));
+        QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0));
 }
 
 WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response)
 {
     return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(),
-            QCoreApplication::translate("QWebFrame", "File does not exist", 0));
+        QCoreApplication::translate("QWebFrame", "File does not exist", 0));
 }
 
 WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse& response)
 {
     return ResourceError("WebKit", WebKitErrorPluginWillHandleLoad, response.url().string(),
-                         QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0));
+        QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0));
 }
 
 bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError& error)
@@ -991,8 +989,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor
     QNetworkReplyHandler* handler = handle->getInternal()->m_job;
     QNetworkReply* reply = handler->release();
     if (reply) {
-        QWebPage* page = m_webFrame->page();
-        if (page->forwardUnsupportedContent())
+        if (m_webFrame->pageAdapter->forwardUnsupportedContent)
             emit unsupportedContent(reply);
         else
             reply->abort();
@@ -1024,9 +1021,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
 {
     if (dumpResourceLoadCallbacks)
         printf("%s - willSendRequest %s redirectResponse %s\n",
-               qPrintable(dumpAssignedUrls[identifier]),
-               qPrintable(drtDescriptionSuitableForTestResult(newRequest)),
-               (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse)));
+            qPrintable(dumpAssignedUrls[identifier]),
+            qPrintable(drtDescriptionSuitableForTestResult(newRequest)),
+            (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse)));
 
     if (sendRequestReturnsNull) {
         blockRequest(newRequest);
@@ -1043,11 +1040,11 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
     QString host = url.host();
     QString urlScheme = url.scheme().toLower();
 
-    if (QWebPagePrivate::drtRun
+    if (QWebPageAdapter::drtRun
         && !host.isEmpty()
         && (urlScheme == QLatin1String("http") || urlScheme == QLatin1String("https"))) {
 
-        QUrl testURL = m_webFrame->page()->mainFrame()->requestedUrl();
+        QUrl testURL = m_webFrame->pageAdapter->mainFrameAdapter()->frameLoaderClient->lastRequestedUrl();
         QString testHost = testURL.host();
         QString testURLScheme = testURL.scheme().toLower();
 
@@ -1061,9 +1058,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
     }
 
     for (int i = 0; i < sendRequestClearHeaders.size(); ++i)
-          newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString());
+        newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString());
 
-    if (QWebPagePrivate::drtRun) {
+    if (QWebPageAdapter::drtRun) {
         QMap<QString, QString>::const_iterator it = URLsToRedirect.constFind(url.toString());
         if (it != URLsToRedirect.constEnd())
             newRequest.setURL(QUrl(it.value()));
@@ -1094,17 +1091,17 @@ void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, u
     m_response = response;
     if (dumpWillCacheResponseCallbacks)
         printf("%s - willCacheResponse: called\n",
-               qPrintable(dumpAssignedUrls[identifier]));
+            qPrintable(dumpAssignedUrls[identifier]));
 
     if (dumpResourceLoadCallbacks)
         printf("%s - didReceiveResponse %s\n",
-               qPrintable(dumpAssignedUrls[identifier]),
-               qPrintable(drtDescriptionSuitableForTestResult(response)));
+            qPrintable(dumpAssignedUrls[identifier]),
+            qPrintable(drtDescriptionSuitableForTestResult(response)));
 
     if (dumpResourceResponseMIMETypes) {
         printf("%s has MIME type %s\n",
-               qPrintable(QString(response.url().lastPathComponent())),
-               qPrintable(QString(response.mimeType())));
+            qPrintable(QString(response.url().lastPathComponent())),
+            qPrintable(QString(response.mimeType())));
     }
 }
 
@@ -1116,15 +1113,15 @@ void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, uns
 {
     if (dumpResourceLoadCallbacks)
         printf("%s - didFinishLoading\n",
-               (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"));
+            (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"));
 }
 
 void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const WebCore::ResourceError& error)
 {
     if (dumpResourceLoadCallbacks)
         printf("%s - didFailLoadingWithError: %s\n",
-               (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"),
-               qPrintable(drtDescriptionSuitableForTestResult(error)));
+            (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"),
+            qPrintable(drtDescriptionSuitableForTestResult(error)));
 }
 
 bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int)
@@ -1135,27 +1132,19 @@ bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::Docume
 
 bool FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error)
 {
-    QWebPage* page = m_webFrame->page();
-    if (!page->supportsExtension(QWebPage::ErrorPageExtension))
+    QWebPageAdapter* page = m_webFrame->pageAdapter;
+    if (!page->supportsErrorPageExtension())
         return false;
-
-    QWebPage::ErrorPageExtensionOption option;
-    if (error.domain() == "QtNetwork")
-        option.domain = QWebPage::QtNetwork;
-    else if (error.domain() == "HTTP")
-        option.domain = QWebPage::Http;
-    else if (error.domain() == "WebKit")
-        option.domain = QWebPage::WebKit;
-    else
-        return false;
-
+    QWebPageAdapter::ErrorPageOption option;
     option.url = QUrl(error.failingURL());
     option.frame = m_webFrame;
+    option.domain = error.domain();
     option.error = error.errorCode();
     option.errorString = error.localizedDescription();
 
-    QWebPage::ErrorPageExtensionReturn output;
-    if (!page->extension(QWebPage::ErrorPageExtension, &option, &output))
+    QWebPageAdapter::ErrorPageReturn output;
+
+    if (!page->errorPageExtension(&option, &output))
         return false;
 
     KURL baseUrl(output.baseUrl);
@@ -1200,10 +1189,10 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage(const WebCore::Navigatio
 {
     if (!m_webFrame)
         return 0;
-    QWebPage *newPage = m_webFrame->page()->createWindow(QWebPage::WebBrowserWindow);
+    QWebPageAdapter* newPage = m_webFrame->pageAdapter->createWindow(/* modalDialog = */ false);
     if (!newPage)
         return 0;
-    return newPage->mainFrame()->d->frame;
+    return newPage->mainFrameAdapter()->frame;
 }
 
 void FrameLoaderClientQt::dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest&)
@@ -1230,9 +1219,8 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc
 {
     Q_ASSERT(m_webFrame);
     QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext()));
-    QWebPage* page = m_webFrame->page();
 
-    if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) {
+    if (!m_webFrame->pageAdapter->acceptNavigationRequest(0, r, (int)action.type())) {
         if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
             m_frame->loader()->resetMultipleFormSubmissionProtection();
 
@@ -1251,7 +1239,6 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
 {
     Q_ASSERT(m_webFrame);
     QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext()));
-    QWebPage*page = m_webFrame->page();
     PolicyAction result;
 
     // Currently, this is only enabled by DRT.
@@ -1260,27 +1247,27 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
         for (const Event* event = action.event(); event; event = event->underlyingEvent()) {
             if (event->isMouseEvent()) {
                 const MouseEvent* mouseEvent =  static_cast<const MouseEvent*>(event);
-                node = QWebFramePrivate::core(m_webFrame)->eventHandler()->hitTestResultAtPoint(
+                node = m_webFrame->frame->eventHandler()->hitTestResultAtPoint(
                     mouseEvent->absoluteLocation(), false).innerNonSharedNode();
                 break;
             }
         }
 
         printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n",
-               qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
-               (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
+            qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
+            (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
 
         if (policyDelegatePermissive)
             result = PolicyUse;
         else
             result = PolicyIgnore;
 
-        page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()));
+        m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type());
         callPolicyFunction(function, result);
         return;
     }
 
-    if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) {
+    if (!m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type())) {
         if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
             m_frame->loader()->resetMultipleFormSubmissionProtection();
 
@@ -1305,40 +1292,39 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request,
     if (!m_webFrame)
         return;
 
-    emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext()));
+    m_webFrame->pageAdapter->emitDownloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext()));
 }
 
-PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
-                                        const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
+PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
 {
     if (!m_webFrame)
         return 0;
 
     QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name);
 
-    if (url.isEmpty())
-        frameData.url = blankURL();
-    else
-        frameData.url = url;
-
     frameData.referrer = referrer;
     frameData.allowsScrolling = allowsScrolling;
     frameData.marginWidth = marginWidth;
     frameData.marginHeight = marginHeight;
 
-    QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData);
+    QWebFrameAdapter* childWebFrame = m_webFrame->createChildFrame(&frameData);
     // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
-    if (!webFrame.data()->d->frame->page()) {
+    if (!childWebFrame->frame->page()) {
+        QPointer<QObject> qWebFrame = childWebFrame->handle();
         frameData.frame.release();
-        ASSERT(webFrame.isNull());
+        ASSERT_UNUSED(qWebFrame, !qWebFrame);
         return 0;
     }
 
-    emit m_webFrame->page()->frameCreated(webFrame.data());
+    m_webFrame->pageAdapter->emitFrameCreated(childWebFrame);
 
     // FIXME: Set override encoding if we have one.
 
-    m_frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get());
+    KURL urlToLoad = url;
+    if (urlToLoad.isEmpty())
+        urlToLoad = blankURL();
+
+    m_frame->loader()->loadURLIntoChildFrame(urlToLoad, frameData.referrer, frameData.frame.get());
 
     // The frame's onload handler may have removed it from the document.
     if (!frameData.frame->tree()->parent())
@@ -1399,44 +1385,45 @@ static const CSSPropertyID qstyleSheetProperties[] = {
 
 const unsigned numqStyleSheetProperties = sizeof(qstyleSheetProperties) / sizeof(qstyleSheetProperties[0]);
 
-class QtPluginWidget: public Widget
-{
+class QtPluginWidget: public Widget {
 public:
-    QtPluginWidget(QWidget* w = 0): Widget(w) {}
+    QtPluginWidget(QtPluginWidgetAdapter* w)
+        : Widget(w->handle())
+        , m_adapter(w)
+    {
+        setBindingObject(w->handle());
+    }
+
     ~QtPluginWidget()
     {
-        if (platformWidget())
-            platformWidget()->deleteLater();
+        delete m_adapter;
     }
+
+    inline QtPluginWidgetAdapter* widgetAdapter() const
+    {
+        return m_adapter;
+    }
+
     virtual void invalidateRect(const IntRect& r)
     { 
         if (platformWidget())
-            static_cast<QWidget*>(platformWidget())->update(r);
+            widgetAdapter()->update(r);
     }
     virtual void frameRectsChanged()
     {
-        QWidget* widget = static_cast<QWidget*>(platformWidget());
+        QtPluginWidgetAdapter* widget = widgetAdapter();
         if (!widget)
             return;
-
-        IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
-        widget->setGeometry(windowRect);
+        QRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
 
         ScrollView* parentScrollView = parent();
-        if (!parentScrollView)
-            return;
-
-        ASSERT(parentScrollView->isFrameView());
-        IntRect clipRect(static_cast<FrameView*>(parentScrollView)->windowClipRect());
-        clipRect.move(-windowRect.x(), -windowRect.y());
-        clipRect.intersect(widget->rect());
-
-        QRegion clipRegion = QRegion(clipRect);
-        widget->setMask(clipRegion);
-
-        handleVisibility();
-
-        widget->update();
+        QRect clipRect;
+        if (parentScrollView) {
+            ASSERT(parentScrollView->isFrameView());
+            clipRect = static_cast<FrameView*>(parentScrollView)->windowClipRect();
+            clipRect.translate(-windowRect.x(), -windowRect.y());
+        }
+        widget->setGeometryAndClip(windowRect, clipRect, isVisible());
     }
 
     virtual void show()
@@ -1444,75 +1431,25 @@ public:
         Widget::show();
         handleVisibility();
     }
+    virtual void hide()
+    {
+        if (platformWidget())
+            widgetAdapter()->setVisible(false);
+    }
 
 private:
+    QtPluginWidgetAdapter* m_adapter;
+
     void handleVisibility()
     {
         if (!isVisible())
             return;
-
-        QWidget* widget = static_cast<QWidget*>(platformWidget());
-        // If setMask is set with an empty QRegion, no clipping will
-        // be performed, so in that case we hide the platformWidget.
-        QRegion mask = widget->mask();
-        widget->setVisible(!mask.isEmpty());
+        widgetAdapter()->setVisible(true);
     }
 };
 
-#if !defined(QT_NO_GRAPHICSVIEW)
-class QtPluginGraphicsWidget: public Widget
-{
-public:
-    static RefPtr<QtPluginGraphicsWidget> create(QGraphicsWidget* w = 0)
-    {
-        return adoptRef(new QtPluginGraphicsWidget(w));
-    }
 
-    ~QtPluginGraphicsWidget()
-    {
-        if (graphicsWidget)
-            graphicsWidget->deleteLater();
-    }
-    virtual void invalidateRect(const IntRect& r)
-    {
-        QGraphicsScene* scene = graphicsWidget ? graphicsWidget->scene() : 0;
-        if (scene)
-            scene->update(QRect(r));
-    }
-    virtual void frameRectsChanged()
-    {
-        if (!graphicsWidget)
-            return;
-
-        IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
-        graphicsWidget->setGeometry(QRect(windowRect));
-
-        // FIXME: Make the code handle clipping of graphics widgets.
-    }
-    virtual void show()
-    {
-        if (graphicsWidget)
-            graphicsWidget->show();
-    }
-    virtual void hide()
-    {
-        if (graphicsWidget)
-            graphicsWidget->hide();
-    }
-private:
-    QtPluginGraphicsWidget(QGraphicsWidget* w = 0)
-        : Widget(0)
-        , graphicsWidget(w)
-    {
-        setBindingObject(graphicsWidget);
-    }
-
-    QGraphicsWidget* graphicsWidget;
-};
-#endif // QT_NO_GRAPHICSVIEW
-
-PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
-                                          const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
 {
     // qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.string() << mimeType;
     // qDebug()<<"------\t url = "<<url.string();
@@ -1535,72 +1472,55 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
     QString urlStr(url.string());
     QUrl qurl = urlStr;
 
-    QObject* object = 0;
+    QObject* pluginAdapter = 0;
 
     if (mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget") {
-        object = m_webFrame->page()->createPlugin(classid, qurl, params, values);
+        pluginAdapter = m_webFrame->pageAdapter->createPlugin(classid, qurl, params, values);
 #ifndef QT_NO_STYLE_STYLESHEET
-        QWidget* widget = qobject_cast<QWidget*>(object);
+        QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter);
         if (widget && mimeType == "application/x-qt-styled-widget") {
 
-            QString styleSheet = element->getAttribute("style");
+            StringBuilder styleSheet;
+            styleSheet.append(element->getAttribute("style"));
             if (!styleSheet.isEmpty())
-                styleSheet += QLatin1Char(';');
+                styleSheet.append(';');
 
             for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
                 CSSPropertyID property = qstyleSheetProperties[i];
 
-                styleSheet += QString::fromLatin1(getPropertyName(property));
-                styleSheet += QLatin1Char(':');
-                styleSheet += CSSComputedStyleDeclaration::create(element)->getPropertyValue(property);
-                styleSheet += QLatin1Char(';');
+                styleSheet.append(getPropertyName(property));
+                styleSheet.append(':');
+                styleSheet.append(CSSComputedStyleDeclaration::create(element)->getPropertyValue(property));
+                styleSheet.append(';');
             }
 
-            widget->setStyleSheet(styleSheet);
+            widget->setStyleSheet(styleSheet.toString());
         }
 #endif // QT_NO_STYLE_STYLESHEET
     }
 
-    if (!object) {
-        QWebPluginFactory* factory = m_webFrame->page()->pluginFactory();
+    if (!pluginAdapter) {
+        QWebPluginFactory* factory = m_webFrame->pageAdapter->pluginFactory;
         if (factory)
-            object = factory->create(mimeType, qurl, params, values);
+            pluginAdapter = m_webFrame->pageAdapter->adapterForWidget(factory->create(mimeType, qurl, params, values));
     }
-
-    if (object) {
-        QWidget* widget = qobject_cast<QWidget*>(object);
+    if (pluginAdapter) {
+        QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter);
         if (widget) {
-            QWidget* parentWidget = 0;
-            if (m_webFrame->page()->d->client)
-                parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent());
+            QObject* parentWidget = 0;
+            if (m_webFrame->pageAdapter->client)
+                parentWidget = m_webFrame->pageAdapter->client->pluginParent();
             if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
-                widget->setParent(parentWidget);
-            widget->hide();
-            RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget());
-            w->setPlatformWidget(widget);
+                widget->setWidgetParent(parentWidget);
+            widget->setVisible(false);
+            RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget(widget));
             // Make sure it's invisible until properly placed into the layout.
             w->setFrameRect(IntRect(0, 0, 0, 0));
             return w;
         }
 
-#if !defined(QT_NO_GRAPHICSVIEW)
-        QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object);
-        if (graphicsWidget) {
-            QGraphicsObject* parentWidget = 0;
-            if (m_webFrame->page()->d->client)
-                parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent());
-            graphicsWidget->hide();
-            if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
-                graphicsWidget->setParentItem(parentWidget);
-            RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget);
-            // Make sure it's invisible until properly placed into the layout.
-            w->setFrameRect(IntRect(0, 0, 0, 0));
-            return w;
-        }
-#endif // QT_NO_GRAPHICSVIEW
-
         // FIXME: Make things work for widgetless plugins as well.
-        delete object;
+        delete pluginAdapter;
     }
 #if ENABLE(NETSCAPE_PLUGIN_API)
     else { // NPAPI Plugins
@@ -1632,8 +1552,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
         m_hasSentResponseToPlugin = false;
 }
 
-PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url,
-                                                    const Vector<String>& paramNames, const Vector<String>& paramValues)
+PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues)
 {
     return createPlugin(pluginSize, element, url, paramNames, paramValues, "application/x-java-applet", true);
 }
@@ -1645,23 +1564,26 @@ String FrameLoaderClientQt::overrideMediaType() const
 
 QString FrameLoaderClientQt::chooseFile(const QString& oldFile)
 {
-    return m_webFrame->page()->chooseFile(m_webFrame, oldFile);
+    QStringList result = m_webFrame->pageAdapter->chooseFiles(m_webFrame, /*allowMulti*/ false, (QStringList() << oldFile));
+    return result.isEmpty() ? QString() : result.first();
 }
 
 PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext()
 {
-    QVariant value = m_webFrame->page()->property("_q_MIMESniffingDisabled");
+    QVariant value = m_webFrame->pageAdapter->handle()->property("_q_MIMESniffingDisabled");
     bool MIMESniffingDisabled = value.isValid() && value.toBool();
 
-    return FrameNetworkingContextQt::create(m_frame, m_webFrame, !MIMESniffingDisabled, m_webFrame->page()->networkAccessManager());
+    return FrameNetworkingContextQt::create(m_frame, m_webFrame->handle(), !MIMESniffingDisabled);
+}
+
+QWebFrameAdapter* FrameLoaderClientQt::webFrame() const
+{
+    return m_webFrame;
 }
 
 void FrameLoaderClientQt::emitLoadStarted()
 {
-    QWebPage* webPage = m_webFrame->page();
-    if (m_isOriginatingLoad && webPage)
-        emit webPage->loadStarted();
-    emit m_webFrame->loadStarted();
+    m_webFrame->emitLoadStarted(m_isOriginatingLoad);
 }
 
 void FrameLoaderClientQt::emitLoadFinished(bool ok)
@@ -1670,10 +1592,7 @@ void FrameLoaderClientQt::emitLoadFinished(bool ok)
     const bool wasOriginatingLoad = m_isOriginatingLoad;
     m_isOriginatingLoad = false;
 
-    QWebPage* webPage = m_webFrame->page();
-    if (wasOriginatingLoad && webPage)
-        emit webPage->loadFinished(ok);
-    emit m_webFrame->loadFinished(ok);
+    m_webFrame->emitLoadFinished(wasOriginatingLoad, ok);
 }
 
 }
index 03102de3e2b3acfc6874b0ee8ba1550cda4ba32c..a965de0fbb7a6e287c6033fd61d793967b107eaf 100644 (file)
 #ifndef FrameLoaderClientQt_h
 #define FrameLoaderClientQt_h
 
-
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "KURL.h"
-#include "WebCore/plugins/PluginView.h"
 #include "ResourceError.h"
 #include "ResourceResponse.h"
+#include "WebCore/plugins/PluginView.h"
 #include <QUrl>
 #include <qobject.h>
 #include <wtf/Forward.h>
@@ -49,6 +48,7 @@ class QNetworkReply;
 QT_END_NAMESPACE
 
 class QWebFrame;
+class QWebFrameAdapter;
 
 namespace WebCore {
 
@@ -65,8 +65,8 @@ struct LoadErrorResetToken;
 class FrameLoaderClientQt : public QObject, public FrameLoaderClient {
     Q_OBJECT
 
-    friend class ::QWebFrame;
-    void callPolicyFunction(FramePolicyFunction function, PolicyAction action);
+    friend class ::QWebFrameAdapter;
+    void callPolicyFunction(FramePolicyFunction, PolicyAction);
     bool callErrorPageExtension(const ResourceError&);
 
 Q_SIGNALS:
@@ -79,7 +79,7 @@ public:
     ~FrameLoaderClientQt();
     virtual void frameLoaderDestroyed();
 
-    void setFrame(QWebFrame* webFrame, Frame* frame);
+    void setFrame(QWebFrameAdapter*, Frame*);
 
     virtual bool hasWebView() const; // mainly for assertions
 
@@ -128,9 +128,9 @@ public:
     virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
     virtual void dispatchShow();
 
-    virtual void dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
-    virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&);
-    virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>);
+    virtual void dispatchDecidePolicyForResponse(FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
+    virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&);
+    virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>);
     virtual void cancelPolicyCheck();
 
     virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&);
@@ -204,8 +204,7 @@ public:
     virtual bool canCachePage() const;
     virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 
-    virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
-                               const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+    virtual PassRefPtr<Frame> createFrame(const KURL&, const String& name, HTMLFrameOwnerElement*, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
     virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
     virtual void recreatePlugin(Widget*) { }
     virtual void redirectDataToPlugin(Widget* pluginWidget);
@@ -227,6 +226,8 @@ public:
 
     const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; }
 
+    QWebFrameAdapter* webFrame() const;
+
     static bool dumpFrameLoaderCallbacks;
     static bool dumpProgressFinishedCallback;
     static bool dumpUserGestureInFrameLoaderCallbacks;
@@ -251,7 +252,7 @@ private:
     void emitLoadFinished(bool ok);
 
     Frame *m_frame;
-    QWebFrame *m_webFrame;
+    QWebFrameAdapter *m_webFrame;
     ResourceResponse m_response;
 
     // Plugin view to redirect data to
index 7e99624b583963104c20606616ef9fdee0e00fca..0745a1a36e2634c9a891dcd55990b90bd401343d 100644 (file)
 */
 
 #include "config.h"
-
 #include "FrameNetworkingContextQt.h"
 
-#include "qwebframe.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
+#include "QWebPageAdapter.h"
+#include "qwebsettings.h"
+
 #include <QNetworkAccessManager>
 #include <QNetworkCookie>
 #include <QNetworkCookieJar>
 
 namespace WebCore {
 
-FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager)
+FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled)
     : FrameNetworkingContext(frame)
     , m_originatingObject(originatingObject)
-    , m_networkAccessManager(networkAccessManager)
     , m_mimeSniffingEnabled(mimeSniffingEnabled)
 {
 }
 
-PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager)
+PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled)
 {
-    return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled, networkAccessManager));
+    return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled));
 }
 
 QObject* FrameNetworkingContextQt::originatingObject() const
@@ -50,7 +48,7 @@ QObject* FrameNetworkingContextQt::originatingObject() const
 
 QNetworkAccessManager* FrameNetworkingContextQt::networkAccessManager() const
 {
-    return (qobject_cast<QWebFrame*>(m_originatingObject))->page()->networkAccessManager();
+    return QWebPageAdapter::kit(frame()->page())->networkAccessManager();
 }
 
 bool FrameNetworkingContextQt::mimeSniffingEnabled() const
index c95e630ac214dddc9d688a933c0c79ef69884d0a..b58abe48d9b8be7ff9a3ab56dd0703506f50cfc2 100644 (file)
@@ -26,10 +26,10 @@ namespace WebCore {
 
 class FrameNetworkingContextQt : public FrameNetworkingContext {
 public:
-    static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*);
+    static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled);
 
 private:
-    FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*);
+    FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled);
 
     virtual QObject* originatingObject() const;
     virtual QNetworkAccessManager* networkAccessManager() const;
@@ -37,7 +37,6 @@ private:
     virtual bool thirdPartyCookiePolicyPermission(const QUrl&) const;
 
     QObject* m_originatingObject;
-    QNetworkAccessManager* m_networkAccessManager;
     bool m_mimeSniffingEnabled;
 };
 
index 3b244c657332f982907861d5e474d84f7a114ad2..25e357aba52d42ec6a1debe73a290e87b9d4364b 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "ChromeClientQt.h"
 #if USE(QT_MULTIMEDIA)
-#include "FullScreenVideoWidget.h"
 #include "MediaPlayerPrivateQt.h"
 #endif
 #include "HTMLNames.h"
 #endif
 
 #if USE(QT_MULTIMEDIA)
-#include <QGraphicsVideoItem>
 #include <QMediaPlayer>
 #endif
-#include <QWidget>
 
 namespace WebCore {
 
@@ -90,49 +87,6 @@ void GStreamerFullScreenVideoHandler::exitFullScreen()
 }
 #endif
 
-#if USE(QT_MULTIMEDIA)
-bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false;
-
-DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
-    : QWebFullScreenVideoHandler()
-    , m_fullScreenWidget(new FullScreenVideoWidget)
-{
-    connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed()));
-    m_fullScreenWidget->hide();
-
-    m_fullScreenWidget->close();
-}
-
-DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler()
-{
-    delete m_fullScreenWidget;
-}
-
-bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const
-{
-    static bool initialized = false;
-    if (!initialized) {
-        QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO");
-        if (!forceFullScreen.isEmpty())
-            s_shouldForceFullScreenVideoPlayback = true;
-
-        initialized = true;
-    }
-
-    return s_shouldForceFullScreenVideoPlayback;
-}
-
-void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player)
-{
-    m_fullScreenWidget->show(player);
-}
-
-void DefaultFullScreenVideoHandler::exitFullScreen()
-{
-    m_fullScreenWidget->close();
-}
-#endif
-
 FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
     : m_chromeClient(chromeClient)
     , m_videoElement(0)
@@ -140,10 +94,7 @@ FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
     Q_ASSERT(m_chromeClient);
 
 #if USE(QT_MULTIMEDIA)
-    m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler().leakPtr();
-    if (!m_FullScreenVideoHandler)
-        m_FullScreenVideoHandler = new DefaultFullScreenVideoHandler;
-
+    m_FullScreenVideoHandler = m_chromeClient->createFullScreenVideoHandler();
     if (m_FullScreenVideoHandler)
         connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose()));
 #endif
index 34bc90c0d8c93cea56dfd04fd818ba645f741a19..81a288da572d32e16caeb7f5634a889aec3b6c57 100644 (file)
@@ -65,25 +65,6 @@ private:
 };
 #endif
 
-// We do not use ENABLE or USE because moc does not expand these macros.
-#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
-class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
-    Q_OBJECT
-public:
-    DefaultFullScreenVideoHandler();
-    virtual ~DefaultFullScreenVideoHandler();
-    bool requiresFullScreenForVideoPlayback() const;
-
-public Q_SLOTS:
-    void enterFullScreen(QMediaPlayer*);
-    void exitFullScreen();
-
-private:
-    static bool s_shouldForceFullScreenVideoPlayback;
-    FullScreenVideoWidget *m_fullScreenWidget;
-};
-#endif
-
 class FullScreenVideoQt : public QObject {
     Q_OBJECT
 public:
index bb5e2b9f612f6550cbfed12fd83bb3c07e75744b..4105d02c62257c549906fec515f4f76d4ea8b7d1 100644 (file)
@@ -25,6 +25,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
 #include "FullScreenVideoWidget.h"
 
 #include <QApplication>
@@ -35,7 +36,7 @@
 
 static const int gHideMouseCursorDelay = 3000;
 
-namespace WebCore {
+namespace WebKit {
 
 FullScreenVideoWidget::FullScreenVideoWidget()
     : QVideoWidget()
index 7e7f8df1c6e1c027003183fb623cbe18012cd9db..201cc49d1e412e987b6e41cc503dd22e3d476a17 100644 (file)
@@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE
 class QMediaPlayer;
 QT_END_NAMESPACE
 
-namespace WebCore {
+namespace WebKit {
 
 class FullScreenVideoWidget : public QVideoWidget {
     Q_OBJECT
index b6b4d70bd10a87c8319fe1978c769d12b6999386..26d1b407a8cb03be155fc818fe9286cc8653a3dd 100644 (file)
 #include "GeolocationPosition.h"
 #include "HTMLFormElement.h"
 #include "Page.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 
 #include <QtLocation/QGeoPositionInfoSource>
 
@@ -44,8 +42,8 @@ namespace WebCore {
 
 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service";
 
-GeolocationClientQt::GeolocationClientQt(const QWebPage* page)
-    : m_page(page)
+GeolocationClientQt::GeolocationClientQt(const QWebPageAdapter* page)
+    : m_webPage(page)
     , m_lastPosition(0)
     , m_location(0)
 {
@@ -85,12 +83,9 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo& geoPosition)
 
     double timeStampInSeconds = geoPosition.timestamp().toMSecsSinceEpoch() / 1000;
 
-    m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude,
-                                                 accuracy, providesAltitude, altitude,
-                                                 providesAltitudeAccuracy, altitudeAccuracy,
-                                                 providesHeading, heading, providesSpeed, speed);
+    m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
 
-    WebCore::Page* page = QWebPagePrivate::core(m_page);
+    WebCore::Page* page = m_webPage->page;
     GeolocationController::from(page)->positionChanged(m_lastPosition.get());
 }
 
@@ -100,7 +95,7 @@ void GeolocationClientQt::startUpdating()
         connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
 
     if (!m_location) {
-        WebCore::Page* page = QWebPagePrivate::core(m_page);
+        WebCore::Page* page = m_webPage->page;
         RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage);
         GeolocationController::from(page)->errorOccurred(error.get());
         return;
@@ -124,14 +119,14 @@ void GeolocationClientQt::setEnableHighAccuracy(bool)
 void GeolocationClientQt::requestPermission(Geolocation* geolocation)
 {
     ASSERT(geolocation);
-    QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame());
+    QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame());
     GeolocationPermissionClientQt::geolocationPermissionClient()->requestGeolocationPermissionForFrame(webFrame, geolocation);
 }
 
 void GeolocationClientQt::cancelPermissionRequest(Geolocation* geolocation)
 {
     ASSERT(geolocation);
-    QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame());
+    QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame());
     GeolocationPermissionClientQt::geolocationPermissionClient()->cancelGeolocationPermissionRequestForFrame(webFrame, geolocation);
 }
 
index 2e94bdebc2bd578d5f1f41fcf6b1b03303832af2..c2287867fbe90d9cf476103a36c7e2383bd364c8 100644 (file)
 
 #include "GeolocationClient.h"
 
+#include <QGeoPositionInfo>
 #include <QObject>
 #include <wtf/RefPtr.h>
 
-#include <QtLocation/QGeoPositionInfo>
 QT_BEGIN_NAMESPACE
 class QGeoPositionInfoSource;
 QT_END_NAMESPACE
 
 
-class QWebPage;
+class QWebPageAdapter;
 
 namespace WebCore {
 
@@ -46,7 +46,7 @@ class GeolocationClientQt : public QObject, public GeolocationClient {
     Q_OBJECT
 
 public:
-    GeolocationClientQt(const QWebPage*);
+    GeolocationClientQt(const QWebPageAdapter*);
     virtual ~GeolocationClientQt();
 
     virtual void geolocationDestroyed();
@@ -63,7 +63,7 @@ private Q_SLOTS:
     void positionUpdated(const QGeoPositionInfo&);
 
 private:
-    const QWebPage* m_page;
+    const QWebPageAdapter* m_webPage;
     RefPtr<GeolocationPosition> m_lastPosition;
     QGeoPositionInfoSource* m_location;
 };
index 7500e993fdb9ffbee10a3f86a068c53fd83d889f..04e47688a6002091a4a90178ff1735f1d7b37244 100644 (file)
 #include "GeolocationPermissionClientQt.h"
 
 #include "Geolocation.h"
-
-#include "qwebframe.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "qwebkitglobal.h"
-#include "qwebpage.h"
 
 namespace WebCore {
 
@@ -60,36 +59,30 @@ GeolocationPermissionClientQt::~GeolocationPermissionClientQt()
 {
 }
 
-void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrame* webFrame, Geolocation* listener)
+void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrameAdapter* webFrame, Geolocation* listener)
 {
     m_pendingPermissionRequests.insert(webFrame, listener);
 
-    QWebPage* page = webFrame->page();
-    emit page->featurePermissionRequested(webFrame, QWebPage::Geolocation);
+    QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page());
+    page->geolocationPermissionRequested(webFrame);
 }
 
 
-void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrame* webFrame, Geolocation* listener)
+void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter* webFrame, Geolocation* listener)
 {
     m_pendingPermissionRequests.remove(webFrame);
 
-    QWebPage* page = webFrame->page();
-    emit page->featurePermissionRequestCanceled(webFrame, QWebPage::Geolocation);
+    QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page());
+    page->geolocationPermissionRequestCancelled(webFrame);
 }
 
-void GeolocationPermissionClientQt::setPermission(QWebFrame* webFrame, QWebPage::PermissionPolicy permission)
+void GeolocationPermissionClientQt::setPermission(QWebFrameAdapter* webFrame, bool granted)
 {  
     if (!m_pendingPermissionRequests.contains(webFrame)) 
         return;
 
     Geolocation* listener = m_pendingPermissionRequests.value(webFrame);
-
-    if (permission == QWebPage::PermissionGrantedByUser)
-        listener->setIsAllowed(true);
-    else if (permission == QWebPage::PermissionDeniedByUser)
-        listener->setIsAllowed(false);
-    else
-        return;
+    listener->setIsAllowed(granted);
 
     m_pendingPermissionRequests.remove(webFrame);
 }
index 1b4540d87b644b76bac50cbdc0902f107ddcc57a..71183b497fa978cc500cc5587661e977a040951c 100644 (file)
 #if ENABLE(GEOLOCATION)
 
 #include "Geolocation.h"
-#include "qwebpage.h"
 
 #include <QHash>
 
-class QWebFrame;
-class QWebPage;
+class QWebFrameAdapter;
+class QWebPageAdapter;
 
 namespace WebCore {
 
@@ -48,13 +47,13 @@ public:
     GeolocationPermissionClientQt();
     ~GeolocationPermissionClientQt();
 
-    void requestGeolocationPermissionForFrame(QWebFrame*, Geolocation*);
-    void cancelGeolocationPermissionRequestForFrame(QWebFrame*, Geolocation*);
-    void setPermission(QWebFrame*, QWebPage::PermissionPolicy);
+    void requestGeolocationPermissionForFrame(QWebFrameAdapter*, Geolocation*);
+    void cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter*, Geolocation*);
+    void setPermission(QWebFrameAdapter*, bool /*granted*/);
 
     static GeolocationPermissionClientQt* geolocationPermissionClient();
 private:
-    QHash<QWebFrame*, Geolocation*> m_pendingPermissionRequests;
+    QHash<QWebFrameAdapter*, Geolocation*> m_pendingPermissionRequests;
 };
 
 }
index d6065c14e5a64219cc114950ac9c76c72d954a15..e75b852fe18f8cc7793bac5b01edb1804247e10a 100644 (file)
 
 #include "qwebelement_p.h"
 #include <JavaScriptCore/runtime/InitializeThreading.h>
-#include <QApplication>
-#include <QStyle>
 #include <wtf/MainThread.h>
 
 namespace WebKit {
 
-// Called also from WebKit2's WebProcess.
-Q_DECL_EXPORT void initializeWebKit2Theme()
+static QtStyleFactoryFunction initCallback = 0;
+
+void setWebKitWidgetsInitCallback(QtStyleFactoryFunction callback)
 {
-    if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") {
-        WebCore::RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
+    initCallback = callback;
+}
+
+// Called also from WebKit2's WebProcess
+Q_DECL_EXPORT void initializeWebKitQt()
+{
+    if (initCallback) {
+        WebCore::RenderThemeQStyle::setStyleFactoryFunction(initCallback);
         WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle);
     }
+
+    WebCore::initializeWebCoreQt();
+}
+
+Q_DECL_EXPORT void setImagePlatformResource(const char* name, const QPixmap& pixmap)
+{
+    WebCore::Image::setPlatformResource(name, pixmap);
 }
 
 }
@@ -79,18 +91,10 @@ void initializeWebCoreQt()
     PlatformStrategiesQt::initialize();
     QtWebElementRuntime::initialize();
 
-    RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
-    RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle);
-
 #if USE(QTKIT)
     InitWebCoreSystemInterface();
 #endif
 
-    // QWebSettings::SearchCancelButtonGraphic
-    Image::setPlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
-    // QWebSettings::SearchCancelButtonPressedGraphic
-    Image::setPlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
-
     initialized = true;
 }
 
index df1aaf776271ffb78af0207433dcbba5f74d8bdc..e84e0dad2ed551b9ecc8269ed88a599de1bf78af 100644 (file)
 #ifndef InitWebCoreQt_h
 #define InitWebCoreQt_h
 
+#include "qimage.h"
+
+namespace WebCore {
+class Page;
+class QStyleFacade;
+}
+typedef WebCore::QStyleFacade* (*QtStyleFactoryFunction)(WebCore::Page*);
+
+namespace WebKit {
+
+void setWebKitWidgetsInitCallback(QtStyleFactoryFunction);
+void initializeWebKitQt();
+void setImagePlatformResource(const char* /* name */, const QPixmap&);
+
+}
+
 namespace WebCore {
 
 void initializeWebCoreQt();
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp
new file mode 100644 (file)
index 0000000..7188603
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "InitWebKitQt.h"
+
+#include "InitWebCoreQt.h"
+
+#include "QStyleFacadeImp.h"
+
+#include <QApplication>
+#include <QStyle>
+
+namespace WebKit {
+
+Q_DECL_EXPORT void initializeWebKitWidgets()
+{
+    static bool initialized = false;
+    if (initialized)
+        return;
+
+    setWebKitWidgetsInitCallback(QStyleFacadeImp::create);
+    initializeWebKitQt();
+
+    // QWebSettings::SearchCancelButtonGraphic
+    setImagePlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
+    // QWebSettings::SearchCancelButtonPressedGraphic
+    setImagePlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
+
+    initialized = true;
+}
+
+}
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h
new file mode 100644 (file)
index 0000000..b2f5711
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef InitWebKitQt_h
+#define InitWebKitQt_h
+
+namespace WebKit {
+
+void initializeWebKitWidgets();
+
+}
+#endif
index 025ad659da032a328c61ac6ef4914804003898fc..1bfaa7b7078ff0d76918af9e62411172877772f0 100644 (file)
 #include "InspectorServerQt.h"
 #include "NotImplemented.h"
 #include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "ScriptDebugServer.h"
-#include "qwebinspector.h"
-#include "qwebinspector_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
-#include "qwebview.h"
+#include <QCoreApplication>
+#include <QFile>
+#include <QNetworkRequest>
+#include <QSettings>
+#include <QUrl>
+#include <QVariant>
 #include <wtf/text/CString.h>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFile>
-#include <QtCore/QSettings>
-#include <QtCore/QVariant>
 
 namespace WebCore {
 
 static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/");
 static const QLatin1String settingStorageTypeSuffix(".type");
 
-class InspectorClientWebPage : public QWebPage {
-    Q_OBJECT
-    friend class InspectorClientQt;
-public:
-    InspectorClientWebPage(QObject* parent = 0)
-        : QWebPage(parent)
-    {
-        connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared()));
-    }
-
-    QWebPage* createWindow(QWebPage::WebWindowType)
-    {
-        QWebView* view = new QWebView;
-        QWebPage* page = new QWebPage;
-        view->setPage(page);
-        view->setAttribute(Qt::WA_DeleteOnClose);
-        return page;
-    }
-
-public Q_SLOTS:
-    void javaScriptWindowObjectCleared() 
-    {
-#ifndef QT_NO_PROPERTIES
-        QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects");
-        if (!inspectorJavaScriptWindowObjects.isValid())
-            return;
-        QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap();
-        QWebFrame* frame = mainFrame();
-        QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin();
-        for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) {
-            QString name = it.key();
-            QVariant value = it.value();
-            QObject* obj = value.value<QObject*>();
-            frame->addToJavaScriptWindowObject(name, obj);
-        }
-#endif
-    }
-};
-
 namespace {
 
 #if ENABLE(INSPECTOR)
@@ -112,7 +72,7 @@ public:
         if (qsettings.status() == QSettings::AccessError) {
             // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called
             qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].",
-                     qPrintable(static_cast<QString>(name)));
+                qPrintable(static_cast<QString>(name)));
             return String();
         }
 
@@ -134,7 +94,7 @@ public:
         QSettings qsettings;
         if (qsettings.status() == QSettings::AccessError) {
             qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].",
-                     qPrintable(static_cast<QString>(name)));
+                qPrintable(static_cast<QString>(name)));
             return;
         }
 
@@ -175,7 +135,7 @@ private:
 
 }
 
-InspectorClientQt::InspectorClientQt(QWebPage* page)
+InspectorClientQt::InspectorClientQt(QWebPageAdapter* page)
     : m_inspectedWebPage(page)
     , m_frontendWebPage(0)
     , m_frontendClient(0)
@@ -204,12 +164,12 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC
 {
     WebCore::InspectorFrontendChannel* frontendChannel = 0;
 #if ENABLE(INSPECTOR)
-    OwnPtr<QWebView> inspectorView = adoptPtr(new QWebView);
-    // FIXME: Where does inspectorPage get deleted?
-    InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView.get());
-    inspectorView->setPage(inspectorPage);
+    QObject* view = 0;
+    QWebPageAdapter* inspectorPage = 0;
+    m_inspectedWebPage->createWebInspector(&view, &inspectorPage);
+    OwnPtr<QObject> inspectorView = adoptPtr(view);
 
-    QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector();
+    QObject* inspector = m_inspectedWebPage->inspectorHandle();
     // Remote frontend was attached.
     if (m_remoteFrontEndChannel)
         return 0;
@@ -228,21 +188,20 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC
 #ifndef QT_NO_PROPERTIES
     QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects");
     if (inspectorJavaScriptWindowObjects.isValid())
-        inspectorPage->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects);
+        inspectorPage->handle()->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects);
 #endif
-    inspectorView->page()->mainFrame()->load(inspectorUrl);
-    m_inspectedWebPage->d->inspectorFrontend = inspectorView.get();
-    inspector->d->setFrontend(inspectorView.get());
+    inspectorPage->mainFrameAdapter()->load(QNetworkRequest(inspectorUrl));
+    m_inspectedWebPage->setInspectorFrontend(inspectorView.get());
 
     // Is 'controller' the same object as 'inspectorController' (which appears to be unused)?
-    InspectorController* controller = inspectorView->page()->d->page->inspectorController();
-    OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), this));
+    InspectorController* controller = inspectorPage->page->inspectorController();
+    OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), inspectorPage->page, this));
     m_frontendClient = frontendClient.get();
     controller->setInspectorFrontendClient(frontendClient.release());
     m_frontendWebPage = inspectorPage;
 
     // Web Inspector should not belong to any other page groups since it is a specialized debugger window.
-    m_frontendWebPage->handle()->page->setGroupName("__WebInspectorPageGroup__");
+    m_frontendWebPage->page->setGroupName("__WebInspectorPageGroup__");
     frontendChannel = this;
 #endif
     return frontendChannel;
@@ -273,7 +232,7 @@ void InspectorClientQt::attachAndReplaceRemoteFrontend(InspectorServerRequestHan
 {
 #if ENABLE(INSPECTOR)
     m_remoteFrontEndChannel = channel;
-    m_inspectedWebPage->d->inspectorController()->connectFrontend(this);
+    m_inspectedWebPage->page->inspectorController()->connectFrontend(this);
 #endif
 }
 
@@ -281,7 +240,7 @@ void InspectorClientQt::detachRemoteFrontend()
 {
 #if ENABLE(INSPECTOR)
     m_remoteFrontEndChannel = 0;
-    m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
+    m_inspectedWebPage->page->inspectorController()->disconnectFrontend();
 #endif
 }
 
@@ -292,9 +251,9 @@ void InspectorClientQt::highlight()
 
 void InspectorClientQt::hideHighlight()
 {
-    WebCore::Frame* frame = m_inspectedWebPage->d->page->mainFrame();
+    WebCore::Frame* frame = m_inspectedWebPage->page->mainFrame();
     if (frame) {
-        QRect rect = m_inspectedWebPage->mainFrame()->geometry();
+        QRect rect = m_inspectedWebPage->mainFrameAdapter()->frameRect();
         if (!rect.isEmpty())
             frame->view()->invalidateRect(rect);
     }
@@ -311,7 +270,7 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message)
     if (!m_frontendWebPage)
         return false;
 
-    Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage);
+    Page* frontendPage = m_frontendWebPage->page;
     return doDispatchMessageOnFrontendPage(frontendPage, message);
 #else
     return false;
@@ -319,8 +278,8 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message)
 }
 
 #if ENABLE(INSPECTOR)
-InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient)
-    : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, adoptPtr(new InspectorFrontendSettingsQt()))
+InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt* inspectorClient)
+    : InspectorFrontendClientLocal(inspectedWebPage->page->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsQt()))
     , m_inspectedWebPage(inspectedWebPage)
     , m_inspectorView(inspectorView)
     , m_destroyingInspectorView(false)
@@ -386,10 +345,8 @@ void InspectorFrontendClientQt::inspectedURLChanged(const String& newURL)
 
 void InspectorFrontendClientQt::updateWindowTitle()
 {
-    if (m_inspectedWebPage->d->inspector) {
-        QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL);
-        m_inspectedWebPage->d->inspector->setWindowTitle(caption);
-    }
+    QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL);
+    m_inspectedWebPage->setInspectorWindowTitle(caption);
 }
 
 void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorController)
@@ -399,20 +356,20 @@ void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorControl
     m_destroyingInspectorView = true;
 
     // Inspected page may have already been destroyed.
-    if (m_inspectedWebPage && m_inspectedWebPage->d->inspector) {
+    if (m_inspectedWebPage) {
         // Clear reference from QWebInspector to the frontend view.
-        m_inspectedWebPage->d->inspector->d->setFrontend(0);
+        m_inspectedWebPage->setInspectorFrontend(0);
     }
 
 #if ENABLE(INSPECTOR)
     if (notifyInspectorController)
-        m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
+        m_inspectedWebPage->page->inspectorController()->disconnectFrontend();
 #endif
     if (m_inspectorClient)
         m_inspectorClient->releaseFrontendPage();
 
     // Clear pointer before deleting WebView to avoid recursive calls to its destructor.
-    OwnPtr<QWebView> inspectorView = m_inspectorView.release();
+    OwnPtr<QObject> inspectorView = m_inspectorView.release();
 }
 
 void InspectorFrontendClientQt::inspectorClientDestroyed()
@@ -424,4 +381,3 @@ void InspectorFrontendClientQt::inspectorClientDestroyed()
 #endif
 }
 
-#include "InspectorClientQt.moc"
index 49ba000ad1a0dedfc45fa4e8ee328efabe87a736..c6da4d61c57427d84b75ca7b870c6be31aacd487 100644 (file)
 #include "InspectorClient.h"
 #include "InspectorFrontendChannel.h"
 #include "InspectorFrontendClientLocal.h"
-#include <QtCore/QString>
+
+#include <QObject>
+#include <QString>
 #include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 
+class QWebPageAdapter;
 class QWebPage;
 class QWebView;
 
@@ -48,7 +51,7 @@ class Page;
 
 class InspectorClientQt : public InspectorClient, public InspectorFrontendChannel {
 public:
-    InspectorClientQt(QWebPage*);
+    InspectorClientQt(QWebPageAdapter*);
 
     virtual void inspectorDestroyed();
 
@@ -67,8 +70,8 @@ public:
     void detachRemoteFrontend();
 
 private:
-    QWebPage* m_inspectedWebPage;
-    QWebPage* m_frontendWebPage;
+    QWebPageAdapter* m_inspectedWebPage;
+    QWebPageAdapter* m_frontendWebPage;
     InspectorFrontendClientQt* m_frontendClient;
     bool m_remoteInspector;
     InspectorServerRequestHandlerQt* m_remoteFrontEndChannel;
@@ -78,7 +81,7 @@ private:
 
 class InspectorFrontendClientQt : public InspectorFrontendClientLocal {
 public:
-    InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient);
+    InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt*);
     virtual ~InspectorFrontendClientQt();
 
     virtual void frontendLoaded();
@@ -93,7 +96,7 @@ public:
     virtual void attachWindow();
     virtual void detachWindow();
 
-    virtual void setAttachedWindowHeight(unsigned height);
+    virtual void setAttachedWindowHeight(unsigned);
 
     virtual void inspectedURLChanged(const String& newURL);
 
@@ -102,8 +105,8 @@ public:
 private:
     void updateWindowTitle();
     void destroyInspectorView(bool notifyInspectorController);
-    QWebPage* m_inspectedWebPage;
-    OwnPtr<QWebView> m_inspectorView;
+    QWebPageAdapter* m_inspectedWebPage;
+    OwnPtr<QObject> m_inspectorView;
     QString m_inspectedURL;
     bool m_destroyingInspectorView;
     InspectorClientQt* m_inspectorClient;
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp
new file mode 100644 (file)
index 0000000..dc4730b
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorClientWebPage.h"
+
+#include <qwebframe.h>
+
+using namespace WebKit;
+
+InspectorClientWebPage::InspectorClientWebPage()
+{
+    QWebView* view = new QWebView;
+    view->setPage(this);
+    setParent(view);
+    connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared()));
+}
+
+QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType)
+{
+    QWebView* view = new QWebView;
+    QWebPage* page = new QWebPage;
+    view->setPage(page);
+    view->setAttribute(Qt::WA_DeleteOnClose);
+    return page;
+}
+
+void InspectorClientWebPage::javaScriptWindowObjectCleared()
+{
+    QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects");
+    if (!inspectorJavaScriptWindowObjects.isValid())
+        return;
+    QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap();
+    QWebFrame* frame = mainFrame();
+    QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin();
+    for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) {
+        QString name = it.key();
+        QVariant value = it.value();
+        QObject* obj = value.value<QObject*>();
+        frame->addToJavaScriptWindowObject(name, obj);
+    }
+}
+
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h
new file mode 100644 (file)
index 0000000..887f29b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef InspectorClientWebPage_h
+#define InspectorClientWebPage_h
+
+#include <qwebpage.h>
+#include <qwebview.h>
+
+namespace WebKit {
+
+class InspectorClientWebPage : public QWebPage {
+    Q_OBJECT
+    friend class InspectorClientQt;
+public:
+    InspectorClientWebPage();
+
+    QWebPage* createWindow(QWebPage::WebWindowType);
+
+public Q_SLOTS:
+    void javaScriptWindowObjectCleared();
+};
+
+} // namespace WebKit
+
+#endif // InspectorClientWebPage_h
index 65bbad0f0940d7ddfdb565d768719f4b0450b90c..abf9c3f78702f2e135daaa673153cd499a55fa21 100644 (file)
 #include "InspectorClientQt.h"
 #include "InspectorController.h"
 #include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "qhttpheader_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
 #include <QFile>
 #include <QString>
 #include <QStringList>
 #include <QTcpServer>
 #include <QTcpSocket>
 #include <QUrl>
-#include <QWidget>
 #include <qendian.h>
 #include <wtf/SHA1.h>
 #include <wtf/text/Base64.h>
@@ -224,12 +223,11 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
         // If no path is specified, generate an index page.
         if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) {
             QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n");
-            for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin();
-                 it != m_server->m_inspectorClients.end(); 
-                 ++it) {
+            for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); it != m_server->m_inspectorClients.end(); ++it) {
+
                 indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
-                                 .arg(it.key())
-                                 .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString()));
+                    .arg(it.key())
+                    .arg(QUrl(it.value()->m_inspectedWebPage->mainFrameAdapter()->url).toString()));
             }
             indexHtml.append(QLatin1String("</ul></body></html>"));
             response = indexHtml.toLatin1();
@@ -356,8 +354,8 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead()
         
 #if ENABLE(INSPECTOR)
         if (m_inspectorClient) {
-          InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController();
-          inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
+            InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->page->inspectorController();
+            inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
         }
 #endif
 
index b0bb0c79d58c19528fc488cb09485b9023785ba5..2754b58d907f953fc2d72058d4fb1088858a6b7d 100644 (file)
@@ -45,8 +45,8 @@ public:
 
     void listen(quint16 port);
 
-    void registerClient(InspectorClientQt* client);
-    void unregisterClient(InspectorClientQt* client);
+    void registerClient(InspectorClientQt*);
+    void unregisterClient(InspectorClientQt*);
 
     void close();
     InspectorClientQt* inspectorClientForPage(int pageNum);
@@ -70,7 +70,7 @@ class InspectorServerRequestHandlerQt : public QObject {
     Q_OBJECT
 public:
 
-    InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server);
+    InspectorServerRequestHandlerQt(QTcpSocket* tcpConnection, InspectorServerQt*);
     virtual ~InspectorServerRequestHandlerQt();
     virtual int webSocketSend(const QString& message);
     virtual int webSocketSend(const char *payload, size_t length);
index 56ed0b4cb7ce265b6bbccaa338f6cd7d3f445ca0..06840c455b8850929661644df3c0c8b9e8683045 100644 (file)
 #include "NotificationPresenterClientQt.h"
 
 #include "Document.h"
-#include "DumpRenderTreeSupportQt.h"
 #include "EventNames.h"
 #include "KURL.h"
 #include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
 #include "QtPlatformPlugin.h"
 #include "ScriptExecutionContext.h"
 #include "SecurityOrigin.h"
 #include "UserGestureIndicator.h"
-
-#include "qwebframe_p.h"
 #include "qwebkitglobal.h"
-#include "qwebpage.h"
 
 namespace WebCore {
 
@@ -72,10 +70,6 @@ NotificationWrapper::NotificationWrapper()
     , m_displayEventTimer(this, &NotificationWrapper::sendDisplayEvent)
 {
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#ifndef QT_NO_SYSTEMTRAYICON
-    m_notificationIcon = nullptr;
-#endif
     m_presenter = nullptr;
 #endif
 }
@@ -209,7 +203,6 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
 #ifndef QT_NO_SYSTEMTRAYICON
         if (!dumpNotification)
             wrapper->m_closeTimer.startOneShot(notificationTimeout);
-            wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon());
 #endif
     }
 
@@ -227,9 +220,9 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
     }
 
 #ifndef QT_NO_SYSTEMTRAYICON
-    wrapper->connect(wrapper->m_notificationIcon.get(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked()));
-    wrapper->m_notificationIcon->show();
-    wrapper->m_notificationIcon->showMessage(notification->title(), notification->body());
+    wrapper->connect(m_systemTrayIcon.data(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked()));
+    QMetaObject::invokeMethod(m_systemTrayIcon.data(), "show");
+    QMetaObject::invokeMethod(m_systemTrayIcon.data(), "showMessage", Q_ARG(QString, notification->title()), Q_ARG(QString, notification->body()));
 #endif
 }
 
@@ -324,11 +317,10 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co
         CallbacksInfo info;
         info.m_frame = toFrame(context);
         info.m_callbacks.append(cb);
-        m_pendingPermissionRequests.insert(context, info);
 
         if (toPage(context) && toFrame(context)) {
             m_pendingPermissionRequests.insert(context, info);
-            emit toPage(context)->featurePermissionRequested(toFrame(context), QWebPage::Notifications);
+            toPage(context)->notificationsPermissionRequested(toFrame(context));
         }
     }
 }
@@ -346,10 +338,10 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC
     if (iter == m_pendingPermissionRequests.end())
         return;
 
-    QWebFrame* frame = iter.value().m_frame;
+    QWebFrameAdapter* frame = iter.value().m_frame;
     if (!frame)
         return;
-    QWebPage* page = frame->page();
+    QWebPageAdapter* page = QWebPageAdapter::kit(frame->frame->page());
     m_pendingPermissionRequests.erase(iter);
 
     if (!page)
@@ -358,7 +350,7 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC
     if (dumpNotification)
         printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());
 
-    emit page->featurePermissionRequestCanceled(frame, QWebPage::Notifications);
+    page->notificationsPermissionRequestCancelled(frame);
 }
 
 void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame)
@@ -436,13 +428,13 @@ void NotificationPresenterClientQt::dumpShowText(Notification* notification)
         printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData());
     else {
         printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
-                notification->dir() == "rtl" ? "(RTL)" : "",
+            notification->dir() == "rtl" ? "(RTL)" : "",
             QString(notification->iconURL().string()).toUtf8().constData(), QString(notification->title()).toUtf8().constData(),
             QString(notification->body()).toUtf8().constData());
     }
 }
 
-QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
+QWebPageAdapter* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
 {
     if (!context || context->isWorkerContext())
         return 0;
@@ -453,10 +445,10 @@ QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
     if (!page || !page->mainFrame())
         return 0;
 
-    return QWebFramePrivate::kit(page->mainFrame())->page();
+    return QWebPageAdapter::kit(page);
 }
 
-QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context)
+QWebFrameAdapter* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context)
 {
     if (!context || context->isWorkerContext())
         return 0;
@@ -465,7 +457,7 @@ QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* contex
     if (!document || !document->frame())
         return 0;
 
-    return QWebFramePrivate::kit(document->frame());
+    return QWebFrameAdapter::kit(document->frame());
 }
 
 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
index 5819b4d8013c4086d01e72616baf4fea7da689b7..78668f35f5764b1d971bae89acf4ce3b93bae3ed 100644 (file)
 #include "NotificationClient.h"
 #include "QtPlatformPlugin.h"