WKView being inside WKWebView leads to weird API issues
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Oct 2015 22:48:32 +0000 (22:48 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Oct 2015 22:48:32 +0000 (22:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150174

Reviewed by Anders Carlsson.

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
(-[WKView prepareContentInRect:]):
(-[WKView initWithFrame:processPool:configuration:webView:]):
(-[WKView pageRef]):
(-[WKView _web_immediateActionAnimationControllerForHitTestResultInternal:withType:userData:]):
(-[WKView dealloc]): Deleted.
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::page):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver initWithView:impl:]):
(-[WKWindowVisibilityObserver dealloc]):
(-[WKWindowVisibilityObserver _activeSpaceDidChange:]):
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::~WebViewImpl):
(WebKit::WebViewImpl::setDrawsBackground):
(WebKit::WebViewImpl::drawsBackground):
(WebKit::WebViewImpl::setDrawsTransparentBackground):
(WebKit::WebViewImpl::drawsTransparentBackground):
(WebKit::WebViewImpl::isOpaque):
(WebKit::WebViewImpl::acceptsFirstMouse):
(WebKit::WebViewImpl::becomeFirstResponder):
(WebKit::WebViewImpl::resignFirstResponder):
(WebKit::WebViewImpl::viewWillStartLiveResize):
(WebKit::WebViewImpl::viewDidEndLiveResize):
(WebKit::WebViewImpl::updateWindowAndViewFrames):
(WebKit::WebViewImpl::setFixedLayoutSize):
(WebKit::WebViewImpl::fixedLayoutSize):
(WebKit::WebViewImpl::isUsingUISideCompositing):
(WebKit::WebViewImpl::setDrawingAreaSize):
(WebKit::WebViewImpl::forceAsyncDrawingAreaSizeUpdate):
(WebKit::WebViewImpl::waitForAsyncDrawingAreaSizeUpdate):
(WebKit::WebViewImpl::updateLayer):
(WebKit::WebViewImpl::drawRect):
(WebKit::WebViewImpl::dispatchSetTopContentInset):
(WebKit::WebViewImpl::prepareContentInRect):
(WebKit::WebViewImpl::updateViewExposedRect):
(WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
(WebKit::WebViewImpl::minimumSizeForAutoLayout):
(WebKit::WebViewImpl::setShouldExpandToViewHeightForAutoLayout):
(WebKit::WebViewImpl::shouldExpandToViewHeightForAutoLayout):
(WebKit::WebViewImpl::setIntrinsicContentSize):
(WebKit::WebViewImpl::setViewScale):
(WebKit::WebViewImpl::viewScale):
(WebKit::WebViewImpl::supportsArbitraryLayoutModes):
(WebKit::WebViewImpl::setOverrideDeviceScaleFactor):
(WebKit::WebViewImpl::windowDidOrderOffScreen):
(WebKit::WebViewImpl::windowDidOrderOnScreen):
(WebKit::WebViewImpl::windowDidBecomeKey):
(WebKit::WebViewImpl::windowDidResignKey):
(WebKit::WebViewImpl::windowDidMiniaturize):
(WebKit::WebViewImpl::windowDidDeminiaturize):
(WebKit::WebViewImpl::windowDidChangeBackingProperties):
(WebKit::WebViewImpl::windowDidChangeScreen):
(WebKit::WebViewImpl::windowDidChangeLayerHosting):
(WebKit::WebViewImpl::windowDidChangeOcclusionState):
(WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent):
(WebKit::WebViewImpl::windowResizeMouseLocationIsInVisibleScrollerThumb):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::viewDidChangeBackingProperties):
(WebKit::WebViewImpl::viewDidHide):
(WebKit::WebViewImpl::viewDidUnhide):
(WebKit::WebViewImpl::activeSpaceDidChange):
(WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
(WebKit::WebViewImpl::setUnderlayColor):
(WebKit::WebViewImpl::underlayColor):
(WebKit::WebViewImpl::pageExtendedBackgroundColor):
(WebKit::WebViewImpl::setOverlayScrollbarStyle):
(WebKit::WebViewImpl::overlayScrollbarStyle):
(WebKit::WebViewImpl::endDeferringViewInWindowChanges):
(WebKit::WebViewImpl::endDeferringViewInWindowChangesSync):
(WebKit::WebViewImpl::prepareForMoveToWindow):
(WebKit::WebViewImpl::updateSecureInputState):
(WebKit::WebViewImpl::setPluginComplexTextInputState):
(WebKit::WebViewImpl::handlePluginComplexTextInputKeyDown):
(WebKit::WebViewImpl::handleAcceptedAlternativeText):
(WebKit::WebViewImpl::pressureChangeWithEvent):
(WebKit::WebViewImpl::isEditable):
(WebKit::WebViewImpl::executeEditCommandForSelector):
(WebKit::WebViewImpl::writeSelectionToPasteboard):
(WebKit::WebViewImpl::readSelectionFromPasteboard):
(WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
(WebKit::WebViewImpl::centerSelectionInVisibleArea):
(WebKit::WebViewImpl::updateFontPanelIfNeeded):
(WebKit::WebViewImpl::changeFontFromFontPanel):
(WebKit::WebViewImpl::validateUserInterfaceItem):
(WebKit::WebViewImpl::startSpeaking):
(WebKit::WebViewImpl::showGuessPanel):
(WebKit::WebViewImpl::checkSpelling):
(WebKit::WebViewImpl::changeSpelling):
(WebKit::WebViewImpl::toggleContinuousSpellChecking):
(WebKit::WebViewImpl::setGrammarCheckingEnabled):
(WebKit::WebViewImpl::toggleGrammarChecking):
(WebKit::WebViewImpl::toggleAutomaticSpellingCorrection):
(WebKit::WebViewImpl::toggleSmartInsertDelete):
(WebKit::WebViewImpl::setAutomaticQuoteSubstitutionEnabled):
(WebKit::WebViewImpl::toggleAutomaticQuoteSubstitution):
(WebKit::WebViewImpl::setAutomaticDashSubstitutionEnabled):
(WebKit::WebViewImpl::toggleAutomaticDashSubstitution):
(WebKit::WebViewImpl::setAutomaticLinkDetectionEnabled):
(WebKit::WebViewImpl::toggleAutomaticLinkDetection):
(WebKit::WebViewImpl::setAutomaticTextReplacementEnabled):
(WebKit::WebViewImpl::toggleAutomaticTextReplacement):
(WebKit::WebViewImpl::uppercaseWord):
(WebKit::WebViewImpl::lowercaseWord):
(WebKit::WebViewImpl::capitalizeWord):
(WebKit::WebViewImpl::preferencesDidChange):
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
(WebKit::WebViewImpl::quickLookWithEvent):
(WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
(WebKit::WebViewImpl::didChangeContentSize):
(WebKit::WebViewImpl::setIgnoresNonWheelEvents):
(WebKit::WebViewImpl::updateRemoteAccessibilityRegistration):
(WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
(WebKit::WebViewImpl::stringForToolTip):
(WebKit::WebViewImpl::setInspectorAttachmentView):
(WebKit::WebViewImpl::remoteObjectRegistry):
(WebKit::WebViewImpl::browsingContextController):
(WebKit::WebViewImpl::draggedImage):
(WebKit::WebViewImpl::draggingEntered):
(WebKit::WebViewImpl::draggingUpdated):
(WebKit::WebViewImpl::draggingExited):
(WebKit::WebViewImpl::performDragOperation):
(WebKit::WebViewImpl::takeViewSnapshot):
(WebKit::WebViewImpl::saveBackForwardSnapshotForCurrentItem):
(WebKit::WebViewImpl::saveBackForwardSnapshotForItem):
(WebKit::WebViewImpl::setAllowsBackForwardNavigationGestures):
(WebKit::WebViewImpl::setMagnification):
(WebKit::WebViewImpl::magnification):
(WebKit::WebViewImpl::scrollWheel):
(WebKit::WebViewImpl::swipeWithEvent):
(WebKit::WebViewImpl::magnifyWithEvent):
(WebKit::WebViewImpl::rotateWithEvent):
(WebKit::WebViewImpl::doCommandBySelector):
(WebKit::WebViewImpl::insertText):
(WebKit::WebViewImpl::selectedRangeWithCompletionHandler):
(WebKit::WebViewImpl::markedRangeWithCompletionHandler):
(WebKit::WebViewImpl::hasMarkedTextWithCompletionHandler):
(WebKit::WebViewImpl::attributedSubstringForProposedRange):
(WebKit::WebViewImpl::firstRectForCharacterRange):
(WebKit::WebViewImpl::characterIndexForPoint):
(WebKit::WebViewImpl::inputContext):
(WebKit::WebViewImpl::unmarkText):
(WebKit::WebViewImpl::setMarkedText):
(WebKit::WebViewImpl::performKeyEquivalent):
(WebKit::WebViewImpl::keyUp):
(WebKit::WebViewImpl::keyDown):
(WebKit::WebViewImpl::flagsChanged):
(WebKit::WebViewImpl::executeSavedKeypressCommands):
(WebKit::WebViewImpl::selectedRange):
(WebKit::WebViewImpl::hasMarkedText):
(WebKit::WebViewImpl::markedRange):
(WebKit::WebViewImpl::setContentPreparationRect): Deleted.
(WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResultFromViewOnly): Deleted.
(WebKit::WebViewImpl::destroyRemoteObjectRegistry): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::scrollPinningBehavior):
(WebKit::WebPageProxy::overlayScrollbarStyle):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):
* UIProcess/WebProcessPool.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::createDrawingAreaProxy):
(WebKit::PageClientImpl::viewSize):
(WebKit::PageClientImpl::activeView):
(WebKit::PageClientImpl::activeWindow):
(WebKit::PageClientImpl::isViewFocused):
(WebKit::PageClientImpl::makeFirstResponder):
(WebKit::PageClientImpl::isViewVisible):
(WebKit::PageClientImpl::colorSpace):
(WebKit::PageClientImpl::processDidExit):
(WebKit::PageClientImpl::pageClosed):
(WebKit::PageClientImpl::didRelaunchProcess):
(WebKit::PageClientImpl::preferencesDidChange):
(WebKit::PageClientImpl::toolTipChanged):
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
(WebKit::PageClientImpl::didChangeContentSize):
(WebKit::PageClientImpl::setCursor):
(WebKit::PageClientImpl::registerEditCommand):
(WebKit::PageClientImpl::registerInsertionUndoGrouping):
(WebKit::PageClientImpl::clearAllEditCommands):
(WebKit::PageClientImpl::canUndoRedo):
(WebKit::PageClientImpl::executeUndoRedo):
(WebKit::PageClientImpl::setDragImage):
(WebKit::PageClientImpl::setPromisedDataForImage):
(WebKit::PageClientImpl::setPromisedDataForAttachment):
(WebKit::PageClientImpl::updateSecureInputState):
(WebKit::PageClientImpl::resetSecureInputState):
(WebKit::PageClientImpl::notifyInputContextAboutDiscardedComposition):
(WebKit::PageClientImpl::convertToDeviceSpace):
(WebKit::PageClientImpl::convertToUserSpace):
(WebKit::PageClientImpl::screenToRootView):
(WebKit::PageClientImpl::rootViewToScreen):
(WebKit::PageClientImpl::doneWithKeyEvent):
(WebKit::PageClientImpl::createPopupMenuProxy):
(WebKit::PageClientImpl::createContextMenuProxy):
(WebKit::PageClientImpl::createColorPicker):
(WebKit::PageClientImpl::setTextIndicator):
(WebKit::PageClientImpl::clearTextIndicator):
(WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
(WebKit::PageClientImpl::accessibilityWebProcessTokenReceived):
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::exitAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
(WebKit::PageClientImpl::setAcceleratedCompositingRootLayer):
(WebKit::PageClientImpl::acceleratedCompositingRootLayer):
(WebKit::PageClientImpl::takeViewSnapshot):
(WebKit::PageClientImpl::selectionDidChange):
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
(WebKit::PageClientImpl::gestureEventWasNotHandledByWebCore):
(WebKit::PageClientImpl::pluginFocusOrWindowFocusChanged):
(WebKit::PageClientImpl::setPluginComplexTextInputState):
(WebKit::PageClientImpl::didPerformDictionaryLookup):
(WebKit::PageClientImpl::dismissContentRelativeChildWindows):
(WebKit::PageClientImpl::showCorrectionPanel):
(WebKit::PageClientImpl::recordAutocorrectionResponse):
(WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
(WebKit::PageClientImpl::intrinsicContentSizeDidChange):
(WebKit::PageClientImpl::executeSavedCommandBySelector):
(WebKit::PageClientImpl::showDictationAlternativeUI):
(WebKit::PageClientImpl::closeFullScreenManager):
(WebKit::PageClientImpl::isFullScreen):
(WebKit::PageClientImpl::enterFullScreen):
(WebKit::PageClientImpl::exitFullScreen):
(WebKit::PageClientImpl::beganEnterFullScreen):
(WebKit::PageClientImpl::beganExitFullScreen):
(WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
(WebKit::PageClientImpl::didFinishLoadForMainFrame):
(WebKit::PageClientImpl::didFailLoadForMainFrame):
(WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
(WebKit::PageClientImpl::removeNavigationGestureSnapshot):
(WebKit::PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates):
(WebKit::PageClientImpl::didPerformImmediateActionHitTest):
(WebKit::PageClientImpl::immediateActionAnimationControllerForHitTestResult):
(WebKit::PageClientImpl::showPlatformContextMenu):
(WebKit::PageClientImpl::refView):
(WebKit::PageClientImpl::derefView):
(WebKit::PageClientImpl::startWindowDrag):
(WebKit::PageClientImpl::platformWindow):
(WebKit::PageClientImpl::inspectorAttachmentView):
(WebKit::PageClientImpl::remoteObjectRegistry):
* UIProcess/mac/WebColorPickerMac.h:
* UIProcess/mac/WebColorPickerMac.mm:
(WebKit::WebColorPickerMac::create):
(WebKit::WebColorPickerMac::WebColorPickerMac):
(-[WKColorPopoverMac initWithFrame:inView:]):
* UIProcess/mac/WebContextMenuProxyMac.h:
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
* UIProcess/mac/WebPopupMenuProxyMac.h:
(WebKit::WebPopupMenuProxyMac::create):
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac):
Move ownership of WebPageProxy and PageClientImpl to WebViewImpl.

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

15 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/UIProcess/mac/PageClientImpl.h
Source/WebKit2/UIProcess/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/mac/WebColorPickerMac.h
Source/WebKit2/UIProcess/mac/WebColorPickerMac.mm
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm

index b923939be9dcaa43a203be21ee40da5257e6b720..8e81e8c239d0d296615bbbe557da5ac117a64d35 100644 (file)
@@ -1,3 +1,267 @@
+2015-10-30  Tim Horton  <timothy_horton@apple.com>
+
+        WKView being inside WKWebView leads to weird API issues
+        https://bugs.webkit.org/show_bug.cgi?id=150174
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
+        (-[WKView prepareContentInRect:]):
+        (-[WKView initWithFrame:processPool:configuration:webView:]):
+        (-[WKView pageRef]):
+        (-[WKView _web_immediateActionAnimationControllerForHitTestResultInternal:withType:userData:]):
+        (-[WKView dealloc]): Deleted.
+        * UIProcess/Cocoa/WebViewImpl.h:
+        (WebKit::WebViewImpl::page):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (-[WKWindowVisibilityObserver initWithView:impl:]):
+        (-[WKWindowVisibilityObserver dealloc]):
+        (-[WKWindowVisibilityObserver _activeSpaceDidChange:]):
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::~WebViewImpl):
+        (WebKit::WebViewImpl::setDrawsBackground):
+        (WebKit::WebViewImpl::drawsBackground):
+        (WebKit::WebViewImpl::setDrawsTransparentBackground):
+        (WebKit::WebViewImpl::drawsTransparentBackground):
+        (WebKit::WebViewImpl::isOpaque):
+        (WebKit::WebViewImpl::acceptsFirstMouse):
+        (WebKit::WebViewImpl::becomeFirstResponder):
+        (WebKit::WebViewImpl::resignFirstResponder):
+        (WebKit::WebViewImpl::viewWillStartLiveResize):
+        (WebKit::WebViewImpl::viewDidEndLiveResize):
+        (WebKit::WebViewImpl::updateWindowAndViewFrames):
+        (WebKit::WebViewImpl::setFixedLayoutSize):
+        (WebKit::WebViewImpl::fixedLayoutSize):
+        (WebKit::WebViewImpl::isUsingUISideCompositing):
+        (WebKit::WebViewImpl::setDrawingAreaSize):
+        (WebKit::WebViewImpl::forceAsyncDrawingAreaSizeUpdate):
+        (WebKit::WebViewImpl::waitForAsyncDrawingAreaSizeUpdate):
+        (WebKit::WebViewImpl::updateLayer):
+        (WebKit::WebViewImpl::drawRect):
+        (WebKit::WebViewImpl::dispatchSetTopContentInset):
+        (WebKit::WebViewImpl::prepareContentInRect):
+        (WebKit::WebViewImpl::updateViewExposedRect):
+        (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
+        (WebKit::WebViewImpl::minimumSizeForAutoLayout):
+        (WebKit::WebViewImpl::setShouldExpandToViewHeightForAutoLayout):
+        (WebKit::WebViewImpl::shouldExpandToViewHeightForAutoLayout):
+        (WebKit::WebViewImpl::setIntrinsicContentSize):
+        (WebKit::WebViewImpl::setViewScale):
+        (WebKit::WebViewImpl::viewScale):
+        (WebKit::WebViewImpl::supportsArbitraryLayoutModes):
+        (WebKit::WebViewImpl::setOverrideDeviceScaleFactor):
+        (WebKit::WebViewImpl::windowDidOrderOffScreen):
+        (WebKit::WebViewImpl::windowDidOrderOnScreen):
+        (WebKit::WebViewImpl::windowDidBecomeKey):
+        (WebKit::WebViewImpl::windowDidResignKey):
+        (WebKit::WebViewImpl::windowDidMiniaturize):
+        (WebKit::WebViewImpl::windowDidDeminiaturize):
+        (WebKit::WebViewImpl::windowDidChangeBackingProperties):
+        (WebKit::WebViewImpl::windowDidChangeScreen):
+        (WebKit::WebViewImpl::windowDidChangeLayerHosting):
+        (WebKit::WebViewImpl::windowDidChangeOcclusionState):
+        (WebKit::WebViewImpl::shouldDelayWindowOrderingForEvent):
+        (WebKit::WebViewImpl::windowResizeMouseLocationIsInVisibleScrollerThumb):
+        (WebKit::WebViewImpl::viewDidMoveToWindow):
+        (WebKit::WebViewImpl::viewDidChangeBackingProperties):
+        (WebKit::WebViewImpl::viewDidHide):
+        (WebKit::WebViewImpl::viewDidUnhide):
+        (WebKit::WebViewImpl::activeSpaceDidChange):
+        (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
+        (WebKit::WebViewImpl::setUnderlayColor):
+        (WebKit::WebViewImpl::underlayColor):
+        (WebKit::WebViewImpl::pageExtendedBackgroundColor):
+        (WebKit::WebViewImpl::setOverlayScrollbarStyle):
+        (WebKit::WebViewImpl::overlayScrollbarStyle):
+        (WebKit::WebViewImpl::endDeferringViewInWindowChanges):
+        (WebKit::WebViewImpl::endDeferringViewInWindowChangesSync):
+        (WebKit::WebViewImpl::prepareForMoveToWindow):
+        (WebKit::WebViewImpl::updateSecureInputState):
+        (WebKit::WebViewImpl::setPluginComplexTextInputState):
+        (WebKit::WebViewImpl::handlePluginComplexTextInputKeyDown):
+        (WebKit::WebViewImpl::handleAcceptedAlternativeText):
+        (WebKit::WebViewImpl::pressureChangeWithEvent):
+        (WebKit::WebViewImpl::isEditable):
+        (WebKit::WebViewImpl::executeEditCommandForSelector):
+        (WebKit::WebViewImpl::writeSelectionToPasteboard):
+        (WebKit::WebViewImpl::readSelectionFromPasteboard):
+        (WebKit::WebViewImpl::validRequestorForSendAndReturnTypes):
+        (WebKit::WebViewImpl::centerSelectionInVisibleArea):
+        (WebKit::WebViewImpl::updateFontPanelIfNeeded):
+        (WebKit::WebViewImpl::changeFontFromFontPanel):
+        (WebKit::WebViewImpl::validateUserInterfaceItem):
+        (WebKit::WebViewImpl::startSpeaking):
+        (WebKit::WebViewImpl::showGuessPanel):
+        (WebKit::WebViewImpl::checkSpelling):
+        (WebKit::WebViewImpl::changeSpelling):
+        (WebKit::WebViewImpl::toggleContinuousSpellChecking):
+        (WebKit::WebViewImpl::setGrammarCheckingEnabled):
+        (WebKit::WebViewImpl::toggleGrammarChecking):
+        (WebKit::WebViewImpl::toggleAutomaticSpellingCorrection):
+        (WebKit::WebViewImpl::toggleSmartInsertDelete):
+        (WebKit::WebViewImpl::setAutomaticQuoteSubstitutionEnabled):
+        (WebKit::WebViewImpl::toggleAutomaticQuoteSubstitution):
+        (WebKit::WebViewImpl::setAutomaticDashSubstitutionEnabled):
+        (WebKit::WebViewImpl::toggleAutomaticDashSubstitution):
+        (WebKit::WebViewImpl::setAutomaticLinkDetectionEnabled):
+        (WebKit::WebViewImpl::toggleAutomaticLinkDetection):
+        (WebKit::WebViewImpl::setAutomaticTextReplacementEnabled):
+        (WebKit::WebViewImpl::toggleAutomaticTextReplacement):
+        (WebKit::WebViewImpl::uppercaseWord):
+        (WebKit::WebViewImpl::lowercaseWord):
+        (WebKit::WebViewImpl::capitalizeWord):
+        (WebKit::WebViewImpl::preferencesDidChange):
+        (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
+        (WebKit::WebViewImpl::quickLookWithEvent):
+        (WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
+        (WebKit::WebViewImpl::didChangeContentSize):
+        (WebKit::WebViewImpl::setIgnoresNonWheelEvents):
+        (WebKit::WebViewImpl::updateRemoteAccessibilityRegistration):
+        (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
+        (WebKit::WebViewImpl::stringForToolTip):
+        (WebKit::WebViewImpl::setInspectorAttachmentView):
+        (WebKit::WebViewImpl::remoteObjectRegistry):
+        (WebKit::WebViewImpl::browsingContextController):
+        (WebKit::WebViewImpl::draggedImage):
+        (WebKit::WebViewImpl::draggingEntered):
+        (WebKit::WebViewImpl::draggingUpdated):
+        (WebKit::WebViewImpl::draggingExited):
+        (WebKit::WebViewImpl::performDragOperation):
+        (WebKit::WebViewImpl::takeViewSnapshot):
+        (WebKit::WebViewImpl::saveBackForwardSnapshotForCurrentItem):
+        (WebKit::WebViewImpl::saveBackForwardSnapshotForItem):
+        (WebKit::WebViewImpl::setAllowsBackForwardNavigationGestures):
+        (WebKit::WebViewImpl::setMagnification):
+        (WebKit::WebViewImpl::magnification):
+        (WebKit::WebViewImpl::scrollWheel):
+        (WebKit::WebViewImpl::swipeWithEvent):
+        (WebKit::WebViewImpl::magnifyWithEvent):
+        (WebKit::WebViewImpl::rotateWithEvent):
+        (WebKit::WebViewImpl::doCommandBySelector):
+        (WebKit::WebViewImpl::insertText):
+        (WebKit::WebViewImpl::selectedRangeWithCompletionHandler):
+        (WebKit::WebViewImpl::markedRangeWithCompletionHandler):
+        (WebKit::WebViewImpl::hasMarkedTextWithCompletionHandler):
+        (WebKit::WebViewImpl::attributedSubstringForProposedRange):
+        (WebKit::WebViewImpl::firstRectForCharacterRange):
+        (WebKit::WebViewImpl::characterIndexForPoint):
+        (WebKit::WebViewImpl::inputContext):
+        (WebKit::WebViewImpl::unmarkText):
+        (WebKit::WebViewImpl::setMarkedText):
+        (WebKit::WebViewImpl::performKeyEquivalent):
+        (WebKit::WebViewImpl::keyUp):
+        (WebKit::WebViewImpl::keyDown):
+        (WebKit::WebViewImpl::flagsChanged):
+        (WebKit::WebViewImpl::executeSavedKeypressCommands):
+        (WebKit::WebViewImpl::selectedRange):
+        (WebKit::WebViewImpl::hasMarkedText):
+        (WebKit::WebViewImpl::markedRange):
+        (WebKit::WebViewImpl::setContentPreparationRect): Deleted.
+        (WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResultFromViewOnly): Deleted.
+        (WebKit::WebViewImpl::destroyRemoteObjectRegistry): Deleted.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::scrollPinningBehavior):
+        (WebKit::WebPageProxy::overlayScrollbarStyle):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::PageClientImpl):
+        (WebKit::PageClientImpl::createDrawingAreaProxy):
+        (WebKit::PageClientImpl::viewSize):
+        (WebKit::PageClientImpl::activeView):
+        (WebKit::PageClientImpl::activeWindow):
+        (WebKit::PageClientImpl::isViewFocused):
+        (WebKit::PageClientImpl::makeFirstResponder):
+        (WebKit::PageClientImpl::isViewVisible):
+        (WebKit::PageClientImpl::colorSpace):
+        (WebKit::PageClientImpl::processDidExit):
+        (WebKit::PageClientImpl::pageClosed):
+        (WebKit::PageClientImpl::didRelaunchProcess):
+        (WebKit::PageClientImpl::preferencesDidChange):
+        (WebKit::PageClientImpl::toolTipChanged):
+        (WebKit::PageClientImpl::didCommitLoadForMainFrame):
+        (WebKit::PageClientImpl::didChangeContentSize):
+        (WebKit::PageClientImpl::setCursor):
+        (WebKit::PageClientImpl::registerEditCommand):
+        (WebKit::PageClientImpl::registerInsertionUndoGrouping):
+        (WebKit::PageClientImpl::clearAllEditCommands):
+        (WebKit::PageClientImpl::canUndoRedo):
+        (WebKit::PageClientImpl::executeUndoRedo):
+        (WebKit::PageClientImpl::setDragImage):
+        (WebKit::PageClientImpl::setPromisedDataForImage):
+        (WebKit::PageClientImpl::setPromisedDataForAttachment):
+        (WebKit::PageClientImpl::updateSecureInputState):
+        (WebKit::PageClientImpl::resetSecureInputState):
+        (WebKit::PageClientImpl::notifyInputContextAboutDiscardedComposition):
+        (WebKit::PageClientImpl::convertToDeviceSpace):
+        (WebKit::PageClientImpl::convertToUserSpace):
+        (WebKit::PageClientImpl::screenToRootView):
+        (WebKit::PageClientImpl::rootViewToScreen):
+        (WebKit::PageClientImpl::doneWithKeyEvent):
+        (WebKit::PageClientImpl::createPopupMenuProxy):
+        (WebKit::PageClientImpl::createContextMenuProxy):
+        (WebKit::PageClientImpl::createColorPicker):
+        (WebKit::PageClientImpl::setTextIndicator):
+        (WebKit::PageClientImpl::clearTextIndicator):
+        (WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
+        (WebKit::PageClientImpl::accessibilityWebProcessTokenReceived):
+        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer):
+        (WebKit::PageClientImpl::acceleratedCompositingRootLayer):
+        (WebKit::PageClientImpl::takeViewSnapshot):
+        (WebKit::PageClientImpl::selectionDidChange):
+        (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
+        (WebKit::PageClientImpl::gestureEventWasNotHandledByWebCore):
+        (WebKit::PageClientImpl::pluginFocusOrWindowFocusChanged):
+        (WebKit::PageClientImpl::setPluginComplexTextInputState):
+        (WebKit::PageClientImpl::didPerformDictionaryLookup):
+        (WebKit::PageClientImpl::dismissContentRelativeChildWindows):
+        (WebKit::PageClientImpl::showCorrectionPanel):
+        (WebKit::PageClientImpl::recordAutocorrectionResponse):
+        (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange):
+        (WebKit::PageClientImpl::intrinsicContentSizeDidChange):
+        (WebKit::PageClientImpl::executeSavedCommandBySelector):
+        (WebKit::PageClientImpl::showDictationAlternativeUI):
+        (WebKit::PageClientImpl::closeFullScreenManager):
+        (WebKit::PageClientImpl::isFullScreen):
+        (WebKit::PageClientImpl::enterFullScreen):
+        (WebKit::PageClientImpl::exitFullScreen):
+        (WebKit::PageClientImpl::beganEnterFullScreen):
+        (WebKit::PageClientImpl::beganExitFullScreen):
+        (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
+        (WebKit::PageClientImpl::didFinishLoadForMainFrame):
+        (WebKit::PageClientImpl::didFailLoadForMainFrame):
+        (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
+        (WebKit::PageClientImpl::removeNavigationGestureSnapshot):
+        (WebKit::PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates):
+        (WebKit::PageClientImpl::didPerformImmediateActionHitTest):
+        (WebKit::PageClientImpl::immediateActionAnimationControllerForHitTestResult):
+        (WebKit::PageClientImpl::showPlatformContextMenu):
+        (WebKit::PageClientImpl::refView):
+        (WebKit::PageClientImpl::derefView):
+        (WebKit::PageClientImpl::startWindowDrag):
+        (WebKit::PageClientImpl::platformWindow):
+        (WebKit::PageClientImpl::inspectorAttachmentView):
+        (WebKit::PageClientImpl::remoteObjectRegistry):
+        * UIProcess/mac/WebColorPickerMac.h:
+        * UIProcess/mac/WebColorPickerMac.mm:
+        (WebKit::WebColorPickerMac::create):
+        (WebKit::WebColorPickerMac::WebColorPickerMac):
+        (-[WKColorPopoverMac initWithFrame:inView:]):
+        * UIProcess/mac/WebContextMenuProxyMac.h:
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
+        * UIProcess/mac/WebPopupMenuProxyMac.h:
+        (WebKit::WebPopupMenuProxyMac::create):
+        * UIProcess/mac/WebPopupMenuProxyMac.mm:
+        (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac):
+        Move ownership of WebPageProxy and PageClientImpl to WebViewImpl.
+
 2015-10-30  Alex Christensen  <achristensen@webkit.org>
 
         Fix Mac CMake build after rr191810.
 2015-10-30  Alex Christensen  <achristensen@webkit.org>
 
         Fix Mac CMake build after rr191810.
index 17e9bf1011f9911b790dd691c63a06fd5ed15185..55a35b49a490f9d1128e19187c4183a8a3023d8a 100644 (file)
  */
 
 #import "config.h"
  */
 
 #import "config.h"
-#import "WKView.h"
+#import "WKViewInternal.h"
 
 #if PLATFORM(MAC)
 
 
 #if PLATFORM(MAC)
 
-#if USE(DICTATION_ALTERNATIVES)
-#import <AppKit/NSTextAlternatives.h>
-#import <AppKit/NSAttributedString.h>
-#endif
-
-#import "APILegacyContextHistoryClient.h"
+#import "APIHitTestResult.h"
 #import "APIPageConfiguration.h"
 #import "APIPageConfiguration.h"
-#import "AppKitSPI.h"
-#import "AttributedString.h"
-#import "DataReference.h"
-#import "EditingRange.h"
-#import "EditorState.h"
-#import "LayerTreeContext.h"
-#import "Logging.h"
-#import "NativeWebKeyboardEvent.h"
-#import "NativeWebMouseEvent.h"
-#import "NativeWebWheelEvent.h"
-#import "PageClientImpl.h"
-#import "PasteboardTypes.h"
-#import "StringUtilities.h"
-#import "TextChecker.h"
-#import "TextCheckerState.h"
-#import "WKAPICast.h"
-#import "WKFullScreenWindowController.h"
-#import "WKLayoutMode.h"
-#import "WKProcessPoolInternal.h"
-#import "WKStringCF.h"
-#import "WKTextInputWindowController.h"
-#import "WKViewInternal.h"
-#import "WKViewPrivate.h"
-#import "WKWebView.h"
-#import "WebBackForwardList.h"
-#import "WebEventFactory.h"
-#import "WebHitTestResultData.h"
+#import "WKBrowsingContextGroupPrivate.h"
+#import "WKProcessGroupPrivate.h"
+#import "WebBackForwardListItem.h"
 #import "WebKit2Initialize.h"
 #import "WebKit2Initialize.h"
-#import "WebPage.h"
 #import "WebPageGroup.h"
 #import "WebPageGroup.h"
-#import "WebPageProxy.h"
-#import "WebPreferences.h"
 #import "WebProcessPool.h"
 #import "WebProcessPool.h"
-#import "WebProcessProxy.h"
-#import "WebSystemInterface.h"
 #import "WebViewImpl.h"
 #import "WebViewImpl.h"
-#import <QuartzCore/QuartzCore.h>
-#import <WebCore/AXObjectCache.h>
-#import <WebCore/ColorMac.h>
-#import <WebCore/CoreGraphicsSPI.h>
-#import <WebCore/DataDetectorsSPI.h>
-#import <WebCore/DragController.h>
-#import <WebCore/DragData.h>
-#import <WebCore/FloatRect.h>
-#import <WebCore/Image.h>
-#import <WebCore/IntRect.h>
-#import <WebCore/FileSystem.h>
-#import <WebCore/KeyboardEvent.h>
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/NSMenuSPI.h>
-#import <WebCore/PlatformEventFactoryMac.h>
-#import <WebCore/PlatformScreen.h>
-#import <WebCore/Region.h>
-#import <WebCore/RuntimeApplicationChecks.h>
-#import <WebCore/SharedBuffer.h>
-#import <WebCore/TextAlternativeWithRange.h>
-#import <WebCore/TextIndicator.h>
-#import <WebCore/TextIndicatorWindow.h>
-#import <WebCore/TextUndoInsertionMarkupMac.h>
-#import <WebCore/WebCoreCALayerExtras.h>
-#import <WebCore/WebCoreFullScreenPlaceholderView.h>
-#import <WebCore/WebCoreFullScreenWindow.h>
-#import <WebCore/WebCoreNSStringExtras.h>
-#import <WebKitSystemInterface.h>
-#import <sys/stat.h>
-#import <wtf/RefPtr.h>
-#import <wtf/RetainPtr.h>
-#import <wtf/RunLoop.h>
-
-/* API internals. */
-#import "WKBrowsingContextGroupPrivate.h"
-#import "WKProcessGroupPrivate.h"
 
 using namespace WebKit;
 using namespace WebCore;
 
 
 using namespace WebKit;
 using namespace WebCore;
 
-#if USE(ASYNC_NSTEXTINPUTCLIENT)
-@interface NSTextInputContext (WKNSTextInputContextDetails)
-- (void)handleEvent:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-- (void)handleEventByInputMethod:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-- (BOOL)handleEventByKeyboardLayout:(NSEvent *)event;
-@end
-#endif
-
 @interface WKViewData : NSObject {
 @public
 @interface WKViewData : NSObject {
 @public
-    std::unique_ptr<PageClientImpl> _pageClient;
-    RefPtr<WebPageProxy> _page;
     std::unique_ptr<WebViewImpl> _impl;
 }
 
     std::unique_ptr<WebViewImpl> _impl;
 }
 
@@ -145,29 +65,18 @@ using namespace WebCore;
 
 - (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView
 {
 
 - (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView
 {
-    return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:relatedView ? toAPI(relatedView->_data->_page.get()) : nil];
+    return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:relatedView ? relatedView.pageRef : nil];
 }
 
 #endif // WK_API_ENABLED
 
 - (void)dealloc
 {
 }
 
 #endif // WK_API_ENABLED
 
 - (void)dealloc
 {
-#if WK_API_ENABLED
-    _data->_impl->destroyRemoteObjectRegistry();
-#endif
-
-    _data->_page->close();
-
     _data->_impl = nullptr;
 
     [_data release];
     _data = nil;
 
     _data->_impl = nullptr;
 
     [_data release];
     _data = nil;
 
-    NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
-    [workspaceNotificationCenter removeObserver:self name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
-
-    WebProcessPool::statistics().wkViewCount--;
-
     [super dealloc];
 }
 
     [super dealloc];
 }
 
@@ -235,8 +144,7 @@ using namespace WebCore;
 
 - (void)prepareContentInRect:(NSRect)rect
 {
 
 - (void)prepareContentInRect:(NSRect)rect
 {
-    _data->_impl->setContentPreparationRect(NSRectToCGRect(rect));
-    _data->_impl->updateViewExposedRect();
+    _data->_impl->prepareContentInRect(NSRectToCGRect(rect));
 }
 
 - (void)setFrameSize:(NSSize)size
 }
 
 - (void)setFrameSize:(NSSize)size
@@ -1007,33 +915,10 @@ Some other editing-related methods still unimplemented:
     if (!self)
         return nil;
 
     if (!self)
         return nil;
 
-    [NSApp registerServicesMenuSendTypes:PasteboardTypes::forSelection() returnTypes:PasteboardTypes::forEditing()];
-
     InitializeWebKit2();
 
     _data = [[WKViewData alloc] init];
     InitializeWebKit2();
 
     _data = [[WKViewData alloc] init];
-
-    _data->_pageClient = std::make_unique<PageClientImpl>(self, webView);
-    _data->_page = processPool.createWebPage(*_data->_pageClient, WTF::move(configuration));
-
-    _data->_impl = std::make_unique<WebViewImpl>(self, *_data->_page, *_data->_pageClient);
-    static_cast<PageClientImpl&>(*_data->_pageClient).setImpl(*_data->_impl);
-
-    _data->_page->setAddsVisitedLinks(processPool.historyClient().addsVisitedLinks());
-
-    _data->_page->initializeWebPage();
-
-    _data->_impl->registerDraggedTypes();
-
-    self.wantsLayer = YES;
-
-    // Explicitly set the layer contents placement so AppKit will make sure that our layer has masksToBounds set to YES.
-    self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
-
-    WebProcessPool::statistics().wkViewCount++;
-
-    NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
-    [workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
+    _data->_impl = std::make_unique<WebViewImpl>(self, webView, processPool, WTF::move(configuration));
 
     return self;
 }
 
     return self;
 }
@@ -1101,7 +986,7 @@ Some other editing-related methods still unimplemented:
 
 - (WKPageRef)pageRef
 {
 
 - (WKPageRef)pageRef
 {
-    return toAPI(_data->_page.get());
+    return toAPI(&_data->_impl->page());
 }
 
 - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef
 }
 
 - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef
@@ -1474,6 +1359,11 @@ static _WKOverlayScrollbarStyle toAPIScrollbarStyle(WTF::Optional<WebCore::Scrol
     _data->_impl->setDidMoveSwipeSnapshotCallback(callback);
 }
 
     _data->_impl->setDidMoveSwipeSnapshotCallback(callback);
 }
 
+- (id)_web_immediateActionAnimationControllerForHitTestResultInternal:(API::HitTestResult*)hitTestResult withType:(uint32_t)type userData:(API::Object*)userData
+{
+    return [self _immediateActionAnimationControllerForHitTestResult:toAPI(hitTestResult) withType:type userData:toAPI(userData)];
+}
+
 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData
 {
     return nil;
 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData
 {
     return nil;
index a232b9586639c1c5c814d7f1bf58de6092ca54fc..c874c0a5760d6466ba6dbb5f86ea337ca0309042 100644 (file)
@@ -46,6 +46,7 @@ OBJC_CLASS WKEditorUndoTargetObjC;
 OBJC_CLASS WKFullScreenWindowController;
 OBJC_CLASS WKImmediateActionController;
 OBJC_CLASS WKViewLayoutStrategy;
 OBJC_CLASS WKFullScreenWindowController;
 OBJC_CLASS WKImmediateActionController;
 OBJC_CLASS WKViewLayoutStrategy;
+OBJC_CLASS WKWebView;
 OBJC_CLASS WKWindowVisibilityObserver;
 OBJC_CLASS _WKThumbnailView;
 
 OBJC_CLASS WKWindowVisibilityObserver;
 OBJC_CLASS _WKThumbnailView;
 
@@ -67,13 +68,15 @@ OBJC_CLASS _WKThumbnailView;
 // They're not actually optional.
 @optional
 
 // They're not actually optional.
 @optional
 
-- (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData;
+- (id)_web_immediateActionAnimationControllerForHitTestResultInternal:(API::HitTestResult*)hitTestResult withType:(uint32_t)type userData:(API::Object*)userData;
+
 - (void)_prepareForImmediateActionAnimation;
 - (void)_cancelImmediateActionAnimation;
 - (void)_completeImmediateActionAnimation;
 - (void)_dismissContentRelativeChildWindows;
 - (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)animate;
 - (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event;
 - (void)_prepareForImmediateActionAnimation;
 - (void)_cancelImmediateActionAnimation;
 - (void)_completeImmediateActionAnimation;
 - (void)_dismissContentRelativeChildWindows;
 - (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)animate;
 - (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event;
+- (void)_didChangeContentSize:(NSSize)newSize;
 
 @end
 
 
 @end
 
@@ -83,6 +86,7 @@ struct KeyPressCommand;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
+class PageClientImpl;
 class DrawingAreaProxy;
 class ViewGestureController;
 class WebEditCommandProxy;
 class DrawingAreaProxy;
 class ViewGestureController;
 class WebEditCommandProxy;
@@ -106,12 +110,14 @@ class WebViewImpl {
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(WebViewImpl);
 public:
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(WebViewImpl);
 public:
-    WebViewImpl(NSView <WebViewImplDelegate> *, WebPageProxy&, PageClient&);
+    WebViewImpl(NSView <WebViewImplDelegate> *, WKWebView *outerWebView, WebProcessPool&, Ref<API::PageConfiguration>&&);
 
     ~WebViewImpl();
 
     NSWindow *window();
 
 
     ~WebViewImpl();
 
     NSWindow *window();
 
+    WebPageProxy& page() { return m_page.get(); }
+
     void processDidExit();
     void pageClosed();
     void didRelaunchProcess();
     void processDidExit();
     void pageClosed();
     void didRelaunchProcess();
@@ -160,7 +166,7 @@ public:
     void setTopContentInset(CGFloat);
     CGFloat topContentInset() const { return m_topContentInset; }
 
     void setTopContentInset(CGFloat);
     CGFloat topContentInset() const { return m_topContentInset; }
 
-    void setContentPreparationRect(CGRect);
+    void prepareContentInRect(CGRect);
     void updateViewExposedRect();
     void setClipsToVisibleRect(bool);
     bool clipsToVisibleRect() const { return m_clipsToVisibleRect; }
     void updateViewExposedRect();
     void setClipsToVisibleRect(bool);
     bool clipsToVisibleRect() const { return m_clipsToVisibleRect; }
@@ -318,12 +324,12 @@ public:
     void prepareForDictionaryLookup();
     void setAllowsLinkPreview(bool);
     bool allowsLinkPreview() const { return m_allowsLinkPreview; }
     void prepareForDictionaryLookup();
     void setAllowsLinkPreview(bool);
     bool allowsLinkPreview() const { return m_allowsLinkPreview; }
-    void* immediateActionAnimationControllerForHitTestResult(WKHitTestResultRef, uint32_t type, WKTypeRef userData);
-    void* immediateActionAnimationControllerForHitTestResultFromViewOnly(WKHitTestResultRef, uint32_t type, WKTypeRef userData);
+    void* immediateActionAnimationControllerForHitTestResult(API::HitTestResult*, uint32_t type, API::Object* userData);
     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object* userData);
     void prepareForImmediateActionAnimation();
     void cancelImmediateActionAnimation();
     void completeImmediateActionAnimation();
     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object* userData);
     void prepareForImmediateActionAnimation();
     void cancelImmediateActionAnimation();
     void completeImmediateActionAnimation();
+    void didChangeContentSize(CGSize);
 
     void setIgnoresNonWheelEvents(bool);
     bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
 
     void setIgnoresNonWheelEvents(bool);
     bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
@@ -363,7 +369,6 @@ public:
     NSView *inspectorAttachmentView();
 
     _WKRemoteObjectRegistry *remoteObjectRegistry();
     NSView *inspectorAttachmentView();
 
     _WKRemoteObjectRegistry *remoteObjectRegistry();
-    void destroyRemoteObjectRegistry(); // FIXME: Temporary. Can fold in after we move ownership of WebPageProxy here.
 
     WKBrowsingContextController *browsingContextController();
 #endif // WK_API_ENABLED
 
     WKBrowsingContextController *browsingContextController();
 #endif // WK_API_ENABLED
@@ -504,8 +509,8 @@ private:
     void mouseDraggedInternal(NSEvent *);
 
     NSView <WebViewImplDelegate> *m_view;
     void mouseDraggedInternal(NSEvent *);
 
     NSView <WebViewImplDelegate> *m_view;
-    WebPageProxy& m_page;
-    PageClient& m_pageClient;
+    std::unique_ptr<PageClient> m_pageClient;
+    Ref<WebPageProxy> m_page;
 
     WeakPtrFactory<WebViewImpl> m_weakPtrFactory;
 
 
     WeakPtrFactory<WebViewImpl> m_weakPtrFactory;
 
index f487149437d72ce01f95ffd7a7e44edec4ab74bf..5c5d38b9693c812b1c66bbfb6e11319f768ff124 100644 (file)
@@ -28,6 +28,7 @@
 
 #if PLATFORM(MAC)
 
 
 #if PLATFORM(MAC)
 
+#import "APILegacyContextHistoryClient.h"
 #import "AppKitSPI.h"
 #import "ColorSpaceData.h"
 #import "GenericCallback.h"
 #import "AppKitSPI.h"
 #import "ColorSpaceData.h"
 #import "GenericCallback.h"
@@ -37,6 +38,7 @@
 #import "NativeWebMouseEvent.h"
 #import "NativeWebWheelEvent.h"
 #import "PageClient.h"
 #import "NativeWebMouseEvent.h"
 #import "NativeWebWheelEvent.h"
 #import "PageClient.h"
+#import "PageClientImpl.h"
 #import "PasteboardTypes.h"
 #import "RemoteLayerTreeDrawingAreaProxy.h"
 #import "RemoteObjectRegistry.h"
 #import "PasteboardTypes.h"
 #import "RemoteLayerTreeDrawingAreaProxy.h"
 #import "RemoteObjectRegistry.h"
@@ -121,6 +123,9 @@ SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
     _view = view;
     _impl = &impl;
 
     _view = view;
     _impl = &impl;
 
+    NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
+    [workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
+
     return self;
 }
 
     return self;
 }
 
@@ -129,6 +134,9 @@ SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
     if (canLoadLUNotificationPopoverWillClose())
         [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
 
     if (canLoadLUNotificationPopoverWillClose())
         [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
 
+    NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
+    [workspaceNotificationCenter removeObserver:self name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
+
     [super dealloc];
 }
 
     [super dealloc];
 }
 
@@ -287,6 +295,11 @@ static void* keyValueObservingContext = &keyValueObservingContext;
     _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
 }
 
     _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
 }
 
+- (void)_activeSpaceDidChange:(NSNotification *)notification
+{
+    _impl->activeSpaceDidChange();
+}
+
 @end
 
 @interface WKEditCommandObjC : NSObject {
 @end
 
 @interface WKEditCommandObjC : NSObject {
@@ -427,21 +440,25 @@ static NSTrackingAreaOptions trackingAreaOptions()
     return options;
 }
 
     return options;
 }
 
-WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WebPageProxy& page, PageClient& pageClient)
+WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WKWebView *outerWebView, WebProcessPool& processPool, Ref<API::PageConfiguration>&& configuration)
     : m_view(view)
     : m_view(view)
-    , m_page(page)
-    , m_pageClient(pageClient)
+    , m_pageClient(std::make_unique<PageClientImpl>(view, outerWebView))
+    , m_page(processPool.createWebPage(*m_pageClient, WTF::move(configuration)))
     , m_weakPtrFactory(this)
     , m_weakPtrFactory(this)
-    , m_needsViewFrameInWindowCoordinates(m_page.preferences().pluginsEnabled())
+    , m_needsViewFrameInWindowCoordinates(m_page->preferences().pluginsEnabled())
     , m_intrinsicContentSize(CGSizeMake(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric))
     , m_layoutStrategy([WKViewLayoutStrategy layoutStrategyWithPage:m_page view:m_view viewImpl:*this mode:kWKLayoutModeViewSize])
     , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
     , m_windowVisibilityObserver(adoptNS([[WKWindowVisibilityObserver alloc] initWithView:view impl:*this]))
     , m_primaryTrackingArea(adoptNS([[NSTrackingArea alloc] initWithRect:m_view.frame options:trackingAreaOptions() owner:m_view userInfo:nil]))
 {
     , m_intrinsicContentSize(CGSizeMake(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric))
     , m_layoutStrategy([WKViewLayoutStrategy layoutStrategyWithPage:m_page view:m_view viewImpl:*this mode:kWKLayoutModeViewSize])
     , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
     , m_windowVisibilityObserver(adoptNS([[WKWindowVisibilityObserver alloc] initWithView:view impl:*this]))
     , m_primaryTrackingArea(adoptNS([[NSTrackingArea alloc] initWithRect:m_view.frame options:trackingAreaOptions() owner:m_view userInfo:nil]))
 {
+    static_cast<PageClientImpl&>(*m_pageClient).setImpl(*this);
+
+    [NSApp registerServicesMenuSendTypes:PasteboardTypes::forSelection() returnTypes:PasteboardTypes::forEditing()];
+
     [m_view addTrackingArea:m_primaryTrackingArea.get()];
 
     [m_view addTrackingArea:m_primaryTrackingArea.get()];
 
-    m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+    m_page->setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
@@ -451,10 +468,32 @@ WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WebPageProxy& page,
         [m_immediateActionGestureRecognizer setDelaysPrimaryMouseButtonEvents:NO];
     }
 #endif
         [m_immediateActionGestureRecognizer setDelaysPrimaryMouseButtonEvents:NO];
     }
 #endif
+
+
+    m_page->setAddsVisitedLinks(processPool.historyClient().addsVisitedLinks());
+
+    m_page->initializeWebPage();
+
+    registerDraggedTypes();
+
+    m_view.wantsLayer = YES;
+
+    // Explicitly set the layer contents placement so AppKit will make sure that our layer has masksToBounds set to YES.
+    m_view.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
+
+    WebProcessPool::statistics().wkViewCount++;
 }
 
 WebViewImpl::~WebViewImpl()
 {
 }
 
 WebViewImpl::~WebViewImpl()
 {
+#if WK_API_ENABLED
+    if (m_remoteObjectRegistry) {
+        m_page->process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page->pageID());
+        [m_remoteObjectRegistry _invalidate];
+        m_remoteObjectRegistry = nil;
+    }
+#endif
+
     ASSERT(!m_inSecureInputState);
 
 #if WK_API_ENABLED
     ASSERT(!m_inSecureInputState);
 
 #if WK_API_ENABLED
@@ -466,6 +505,11 @@ WebViewImpl::~WebViewImpl()
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     [m_immediateActionController willDestroyView:m_view];
 #endif
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     [m_immediateActionController willDestroyView:m_view];
 #endif
+
+    m_page->close();
+
+    WebProcessPool::statistics().wkViewCount--;
+
 }
 
 NSWindow *WebViewImpl::window()
 }
 
 NSWindow *WebViewImpl::window()
@@ -497,27 +541,27 @@ void WebViewImpl::didRelaunchProcess()
 
 void WebViewImpl::setDrawsBackground(bool drawsBackground)
 {
 
 void WebViewImpl::setDrawsBackground(bool drawsBackground)
 {
-    m_page.setDrawsBackground(drawsBackground);
+    m_page->setDrawsBackground(drawsBackground);
 }
 
 bool WebViewImpl::drawsBackground() const
 {
 }
 
 bool WebViewImpl::drawsBackground() const
 {
-    return m_page.drawsBackground();
+    return m_page->drawsBackground();
 }
 
 void WebViewImpl::setDrawsTransparentBackground(bool drawsTransparentBackground)
 {
 }
 
 void WebViewImpl::setDrawsTransparentBackground(bool drawsTransparentBackground)
 {
-    m_page.setDrawsTransparentBackground(drawsTransparentBackground);
+    m_page->setDrawsTransparentBackground(drawsTransparentBackground);
 }
 
 bool WebViewImpl::drawsTransparentBackground() const
 {
 }
 
 bool WebViewImpl::drawsTransparentBackground() const
 {
-    return m_page.drawsTransparentBackground();
+    return m_page->drawsTransparentBackground();
 }
 
 bool WebViewImpl::isOpaque() const
 {
 }
 
 bool WebViewImpl::isOpaque() const
 {
-    return m_page.drawsBackground();
+    return m_page->drawsBackground();
 }
 
 bool WebViewImpl::acceptsFirstMouse(NSEvent *event)
 }
 
 bool WebViewImpl::acceptsFirstMouse(NSEvent *event)
@@ -531,7 +575,7 @@ bool WebViewImpl::acceptsFirstMouse(NSEvent *event)
         return false;
 
     setLastMouseDownEvent(event);
         return false;
 
     setLastMouseDownEvent(event);
-    bool result = m_page.acceptsFirstMouse(event.eventNumber, WebEventFactory::createWebMouseEvent(event, m_lastPressureEvent.get(), m_view));
+    bool result = m_page->acceptsFirstMouse(event.eventNumber, WebEventFactory::createWebMouseEvent(event, m_lastPressureEvent.get(), m_view));
     setLastMouseDownEvent(nil);
     return result;
 }
     setLastMouseDownEvent(nil);
     return result;
 }
@@ -555,9 +599,9 @@ bool WebViewImpl::becomeFirstResponder()
     m_inBecomeFirstResponder = true;
 
     updateSecureInputState();
     m_inBecomeFirstResponder = true;
 
     updateSecureInputState();
-    m_page.viewStateDidChange(WebCore::ViewState::IsFocused);
+    m_page->viewStateDidChange(WebCore::ViewState::IsFocused);
     // Restore the selection in the editable region if resigning first responder cleared selection.
     // Restore the selection in the editable region if resigning first responder cleared selection.
-    m_page.restoreSelectionInFocusedEditableElement();
+    m_page->restoreSelectionInFocusedEditableElement();
 
     m_inBecomeFirstResponder = false;
 
 
     m_inBecomeFirstResponder = false;
 
@@ -566,7 +610,7 @@ bool WebViewImpl::becomeFirstResponder()
         NSEvent *keyboardEvent = nil;
         if ([event type] == NSKeyDown || [event type] == NSKeyUp)
             keyboardEvent = event;
         NSEvent *keyboardEvent = nil;
         if ([event type] == NSKeyDown || [event type] == NSKeyUp)
             keyboardEvent = event;
-        m_page.setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, { }), [](WebKit::CallbackBase::Error) { });
+        m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, { }), [](WebKit::CallbackBase::Error) { });
     }
     return true;
 }
     }
     return true;
 }
@@ -589,20 +633,20 @@ bool WebViewImpl::resignFirstResponder()
     m_inResignFirstResponder = true;
 
 #if USE(ASYNC_NSTEXTINPUTCLIENT)
     m_inResignFirstResponder = true;
 
 #if USE(ASYNC_NSTEXTINPUTCLIENT)
-    m_page.confirmCompositionAsync();
+    m_page->confirmCompositionAsync();
 #else
 #else
-    if (m_page.editorState().hasComposition && !m_page.editorState().shouldIgnoreCompositionSelectionChange)
-        m_page.cancelComposition();
+    if (m_page->editorState().hasComposition && !m_page->editorState().shouldIgnoreCompositionSelectionChange)
+        m_page->cancelComposition();
 #endif
 
     notifyInputContextAboutDiscardedComposition();
 
     resetSecureInputState();
 
 #endif
 
     notifyInputContextAboutDiscardedComposition();
 
     resetSecureInputState();
 
-    if (!m_page.maintainsInactiveSelection())
-        m_page.clearSelection();
+    if (!m_page->maintainsInactiveSelection())
+        m_page->clearSelection();
 
 
-    m_page.viewStateDidChange(WebCore::ViewState::IsFocused);
+    m_page->viewStateDidChange(WebCore::ViewState::IsFocused);
     
     m_inResignFirstResponder = false;
     
     
     m_inResignFirstResponder = false;
     
@@ -620,14 +664,14 @@ bool WebViewImpl::isFocused() const
 
 void WebViewImpl::viewWillStartLiveResize()
 {
 
 void WebViewImpl::viewWillStartLiveResize()
 {
-    m_page.viewWillStartLiveResize();
+    m_page->viewWillStartLiveResize();
 
     [m_layoutStrategy willStartLiveResize];
 }
 
 void WebViewImpl::viewDidEndLiveResize()
 {
 
     [m_layoutStrategy willStartLiveResize];
 }
 
 void WebViewImpl::viewDidEndLiveResize()
 {
-    m_page.viewWillEndLiveResize();
+    m_page->viewWillEndLiveResize();
 
     [m_layoutStrategy didEndLiveResize];
 }
 
     [m_layoutStrategy didEndLiveResize];
 }
@@ -701,18 +745,18 @@ void WebViewImpl::updateWindowAndViewFrames()
             accessibilityPosition = [[weakThis->m_view accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
 #pragma clang diagnostic pop
         
             accessibilityPosition = [[weakThis->m_view accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
 #pragma clang diagnostic pop
         
-        weakThis->m_page.windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
+        weakThis->m_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
     });
 }
 
 void WebViewImpl::setFixedLayoutSize(CGSize fixedLayoutSize)
 {
     });
 }
 
 void WebViewImpl::setFixedLayoutSize(CGSize fixedLayoutSize)
 {
-    m_page.setFixedLayoutSize(WebCore::expandedIntSize(WebCore::FloatSize(fixedLayoutSize)));
+    m_page->setFixedLayoutSize(WebCore::expandedIntSize(WebCore::FloatSize(fixedLayoutSize)));
 }
 
 CGSize WebViewImpl::fixedLayoutSize() const
 {
 }
 
 CGSize WebViewImpl::fixedLayoutSize() const
 {
-    return m_page.fixedLayoutSize();
+    return m_page->fixedLayoutSize();
 }
 
 std::unique_ptr<WebKit::DrawingAreaProxy> WebViewImpl::createDrawingAreaProxy()
 }
 
 std::unique_ptr<WebKit::DrawingAreaProxy> WebViewImpl::createDrawingAreaProxy()
@@ -725,16 +769,16 @@ std::unique_ptr<WebKit::DrawingAreaProxy> WebViewImpl::createDrawingAreaProxy()
 
 bool WebViewImpl::isUsingUISideCompositing() const
 {
 
 bool WebViewImpl::isUsingUISideCompositing() const
 {
-    auto* drawingArea = m_page.drawingArea();
+    auto* drawingArea = m_page->drawingArea();
     return drawingArea && drawingArea->type() == DrawingAreaTypeRemoteLayerTree;
 }
 
 void WebViewImpl::setDrawingAreaSize(CGSize size)
 {
     return drawingArea && drawingArea->type() == DrawingAreaTypeRemoteLayerTree;
 }
 
 void WebViewImpl::setDrawingAreaSize(CGSize size)
 {
-    if (!m_page.drawingArea())
+    if (!m_page->drawingArea())
         return;
 
         return;
 
-    m_page.drawingArea()->setSize(WebCore::IntSize(size), WebCore::IntSize(), WebCore::IntSize(m_resizeScrollOffset));
+    m_page->drawingArea()->setSize(WebCore::IntSize(size), WebCore::IntSize(), WebCore::IntSize(m_resizeScrollOffset));
     m_resizeScrollOffset = CGSizeZero;
 }
 
     m_resizeScrollOffset = CGSizeZero;
 }
 
@@ -755,7 +799,7 @@ void WebViewImpl::forceAsyncDrawingAreaSizeUpdate(CGSize size)
     // If a geometry update is pending the new update won't be sent. Poll without waiting for any
     // pending did-update message now, such that the new update can be sent. We do so after setting
     // the drawing area size such that the latest update is sent.
     // If a geometry update is pending the new update won't be sent. Poll without waiting for any
     // pending did-update message now, such that the new update can be sent. We do so after setting
     // the drawing area size such that the latest update is sent.
-    if (DrawingAreaProxy* drawingArea = m_page.drawingArea())
+    if (DrawingAreaProxy* drawingArea = m_page->drawingArea())
         drawingArea->waitForPossibleGeometryUpdate(std::chrono::milliseconds::zero());
 #else
     ASSERT_NOT_REACHED();
         drawingArea->waitForPossibleGeometryUpdate(std::chrono::milliseconds::zero());
 #else
     ASSERT_NOT_REACHED();
@@ -766,7 +810,7 @@ void WebViewImpl::waitForAsyncDrawingAreaSizeUpdate()
 {
     // This SPI is only used on 10.9 and below, and is incompatible with the fence-based drawing area size synchronization in 10.10+.
 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
 {
     // This SPI is only used on 10.9 and below, and is incompatible with the fence-based drawing area size synchronization in 10.10+.
 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
-    if (DrawingAreaProxy* drawingArea = m_page.drawingArea()) {
+    if (DrawingAreaProxy* drawingArea = m_page->drawingArea()) {
         // If a geometry update is still pending then the action of receiving the
         // first geometry update may result in another update being scheduled -
         // we should wait for this to complete too.
         // If a geometry update is still pending then the action of receiving the
         // first geometry update may result in another update being scheduled -
         // we should wait for this to complete too.
@@ -792,14 +836,14 @@ void WebViewImpl::updateLayer()
     if (frameSizeUpdatesDisabled())
         return;
 
     if (frameSizeUpdatesDisabled())
         return;
 
-    if (DrawingAreaProxy* drawingArea = m_page.drawingArea())
+    if (DrawingAreaProxy* drawingArea = m_page->drawingArea())
         drawingArea->waitForPossibleGeometryUpdate();
 }
 
 void WebViewImpl::drawRect(CGRect rect)
 {
     LOG(Printing, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
         drawingArea->waitForPossibleGeometryUpdate();
 }
 
 void WebViewImpl::drawRect(CGRect rect)
 {
     LOG(Printing, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-    m_page.endPrinting();
+    m_page->endPrinting();
 }
 
 bool WebViewImpl::canChangeFrameLayout(WebFrameProxy& frame)
 }
 
 bool WebViewImpl::canChangeFrameLayout(WebFrameProxy& frame)
@@ -869,13 +913,15 @@ void WebViewImpl::dispatchSetTopContentInset()
         return;
 
     m_didScheduleSetTopContentInset = false;
         return;
 
     m_didScheduleSetTopContentInset = false;
-    m_page.setTopContentInset(m_topContentInset);
+    m_page->setTopContentInset(m_topContentInset);
 }
 
 }
 
-void WebViewImpl::setContentPreparationRect(CGRect rect)
+void WebViewImpl::prepareContentInRect(CGRect rect)
 {
     m_contentPreparationRect = rect;
     m_useContentPreparationRectForVisibleRect = true;
 {
     m_contentPreparationRect = rect;
     m_useContentPreparationRectForVisibleRect = true;
+
+    updateViewExposedRect();
 }
 
 void WebViewImpl::updateViewExposedRect()
 }
 
 void WebViewImpl::updateViewExposedRect()
@@ -885,7 +931,7 @@ void WebViewImpl::updateViewExposedRect()
     if (m_useContentPreparationRectForVisibleRect)
         exposedRect = CGRectUnion(m_contentPreparationRect, exposedRect);
 
     if (m_useContentPreparationRectForVisibleRect)
         exposedRect = CGRectUnion(m_contentPreparationRect, exposedRect);
 
-    if (auto drawingArea = m_page.drawingArea())
+    if (auto drawingArea = m_page->drawingArea())
         drawingArea->setExposedRect(m_clipsToVisibleRect ? WebCore::FloatRect(exposedRect) : WebCore::FloatRect::infiniteRect());
 }
 
         drawingArea->setExposedRect(m_clipsToVisibleRect ? WebCore::FloatRect(exposedRect) : WebCore::FloatRect::infiniteRect());
 }
 
@@ -899,25 +945,25 @@ void WebViewImpl::setMinimumSizeForAutoLayout(CGSize minimumSizeForAutoLayout)
 {
     bool expandsToFit = minimumSizeForAutoLayout.width > 0;
 
 {
     bool expandsToFit = minimumSizeForAutoLayout.width > 0;
 
-    m_page.setMinimumLayoutSize(WebCore::IntSize(minimumSizeForAutoLayout));
-    m_page.setMainFrameIsScrollable(!expandsToFit);
+    m_page->setMinimumLayoutSize(WebCore::IntSize(minimumSizeForAutoLayout));
+    m_page->setMainFrameIsScrollable(!expandsToFit);
 
     setClipsToVisibleRect(expandsToFit);
 }
 
 CGSize WebViewImpl::minimumSizeForAutoLayout() const
 {
 
     setClipsToVisibleRect(expandsToFit);
 }
 
 CGSize WebViewImpl::minimumSizeForAutoLayout() const
 {
-    return m_page.minimumLayoutSize();
+    return m_page->minimumLayoutSize();
 }
 
 void WebViewImpl::setShouldExpandToViewHeightForAutoLayout(bool shouldExpandToViewHeightForAutoLayout)
 {
 }
 
 void WebViewImpl::setShouldExpandToViewHeightForAutoLayout(bool shouldExpandToViewHeightForAutoLayout)
 {
-    m_page.setAutoSizingShouldExpandToViewHeight(shouldExpandToViewHeightForAutoLayout);
+    m_page->setAutoSizingShouldExpandToViewHeight(shouldExpandToViewHeightForAutoLayout);
 }
 
 bool WebViewImpl::shouldExpandToViewHeightForAutoLayout() const
 {
 }
 
 bool WebViewImpl::shouldExpandToViewHeightForAutoLayout() const
 {
-    return m_page.autoSizingShouldExpandToViewHeight();
+    return m_page->autoSizingShouldExpandToViewHeight();
 }
 
 void WebViewImpl::setIntrinsicContentSize(CGSize intrinsicContentSize)
 }
 
 void WebViewImpl::setIntrinsicContentSize(CGSize intrinsicContentSize)
@@ -927,7 +973,7 @@ void WebViewImpl::setIntrinsicContentSize(CGSize intrinsicContentSize)
     // so that autolayout will know to provide space for us.
 
     CGSize intrinsicContentSizeAcknowledgingFlexibleWidth = intrinsicContentSize;
     // so that autolayout will know to provide space for us.
 
     CGSize intrinsicContentSizeAcknowledgingFlexibleWidth = intrinsicContentSize;
-    if (intrinsicContentSize.width < m_page.minimumLayoutSize().width())
+    if (intrinsicContentSize.width < m_page->minimumLayoutSize().width())
         intrinsicContentSizeAcknowledgingFlexibleWidth.width = NSViewNoInstrinsicMetric;
 
     m_intrinsicContentSize = intrinsicContentSizeAcknowledgingFlexibleWidth;
         intrinsicContentSizeAcknowledgingFlexibleWidth.width = NSViewNoInstrinsicMetric;
 
     m_intrinsicContentSize = intrinsicContentSizeAcknowledgingFlexibleWidth;
@@ -949,13 +995,13 @@ void WebViewImpl::setViewScale(CGFloat viewScale)
     if (viewScale <= 0 || isnan(viewScale) || isinf(viewScale))
         [NSException raise:NSInvalidArgumentException format:@"View scale should be a positive number"];
 
     if (viewScale <= 0 || isnan(viewScale) || isinf(viewScale))
         [NSException raise:NSInvalidArgumentException format:@"View scale should be a positive number"];
 
-    m_page.scaleView(viewScale);
+    m_page->scaleView(viewScale);
     [m_layoutStrategy didChangeViewScale];
 }
 
 CGFloat WebViewImpl::viewScale() const
 {
     [m_layoutStrategy didChangeViewScale];
 }
 
 CGFloat WebViewImpl::viewScale() const
 {
-    return m_page.viewScaleFactor();
+    return m_page->viewScaleFactor();
 }
 
 WKLayoutMode WebViewImpl::layoutMode() const
 }
 
 WKLayoutMode WebViewImpl::layoutMode() const
@@ -982,7 +1028,7 @@ bool WebViewImpl::supportsArbitraryLayoutModes() const
     if ([m_fullScreenWindowController isFullScreen])
         return false;
 
     if ([m_fullScreenWindowController isFullScreen])
         return false;
 
-    WebFrameProxy* frame = m_page.mainFrame();
+    WebFrameProxy* frame = m_page->mainFrame();
     if (!frame)
         return true;
 
     if (!frame)
         return true;
 
@@ -1015,7 +1061,7 @@ void WebViewImpl::updateSupportsArbitraryLayoutModes()
 void WebViewImpl::setOverrideDeviceScaleFactor(CGFloat deviceScaleFactor)
 {
     m_overrideDeviceScaleFactor = deviceScaleFactor;
 void WebViewImpl::setOverrideDeviceScaleFactor(CGFloat deviceScaleFactor)
 {
     m_overrideDeviceScaleFactor = deviceScaleFactor;
-    m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+    m_page->setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
 }
 
 float WebViewImpl::intrinsicDeviceScaleFactor() const
 }
 
 float WebViewImpl::intrinsicDeviceScaleFactor() const
@@ -1031,19 +1077,19 @@ float WebViewImpl::intrinsicDeviceScaleFactor() const
 
 void WebViewImpl::windowDidOrderOffScreen()
 {
 
 void WebViewImpl::windowDidOrderOffScreen()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible | WebCore::ViewState::WindowIsActive);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible | WebCore::ViewState::WindowIsActive);
 }
 
 void WebViewImpl::windowDidOrderOnScreen()
 {
 }
 
 void WebViewImpl::windowDidOrderOnScreen()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible | WebCore::ViewState::WindowIsActive);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible | WebCore::ViewState::WindowIsActive);
 }
 
 void WebViewImpl::windowDidBecomeKey(NSWindow *keyWindow)
 {
     if (keyWindow == m_view.window || keyWindow == m_view.window.attachedSheet) {
         updateSecureInputState();
 }
 
 void WebViewImpl::windowDidBecomeKey(NSWindow *keyWindow)
 {
     if (keyWindow == m_view.window || keyWindow == m_view.window.attachedSheet) {
         updateSecureInputState();
-        m_page.viewStateDidChange(WebCore::ViewState::WindowIsActive);
+        m_page->viewStateDidChange(WebCore::ViewState::WindowIsActive);
     }
 }
 
     }
 }
 
@@ -1051,18 +1097,18 @@ void WebViewImpl::windowDidResignKey(NSWindow *formerKeyWindow)
 {
     if (formerKeyWindow == m_view.window || formerKeyWindow == m_view.window.attachedSheet) {
         updateSecureInputState();
 {
     if (formerKeyWindow == m_view.window || formerKeyWindow == m_view.window.attachedSheet) {
         updateSecureInputState();
-        m_page.viewStateDidChange(WebCore::ViewState::WindowIsActive);
+        m_page->viewStateDidChange(WebCore::ViewState::WindowIsActive);
     }
 }
 
 void WebViewImpl::windowDidMiniaturize()
 {
     }
 }
 
 void WebViewImpl::windowDidMiniaturize()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 void WebViewImpl::windowDidDeminiaturize()
 {
 }
 
 void WebViewImpl::windowDidDeminiaturize()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 void WebViewImpl::windowDidMove()
 }
 
 void WebViewImpl::windowDidMove()
@@ -1081,30 +1127,30 @@ void WebViewImpl::windowDidChangeBackingProperties(CGFloat oldBackingScaleFactor
     if (oldBackingScaleFactor == newBackingScaleFactor)
         return;
 
     if (oldBackingScaleFactor == newBackingScaleFactor)
         return;
 
-    m_page.setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
+    m_page->setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
 }
 
 void WebViewImpl::windowDidChangeScreen()
 {
     NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
 }
 
 void WebViewImpl::windowDidChangeScreen()
 {
     NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
-    m_page.windowScreenDidChange((PlatformDisplayID)[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
+    m_page->windowScreenDidChange((PlatformDisplayID)[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
 }
 
 void WebViewImpl::windowDidChangeLayerHosting()
 {
 }
 
 void WebViewImpl::windowDidChangeLayerHosting()
 {
-    m_page.layerHostingModeDidChange();
+    m_page->layerHostingModeDidChange();
 }
 
 void WebViewImpl::windowDidChangeOcclusionState()
 {
 }
 
 void WebViewImpl::windowDidChangeOcclusionState()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 bool WebViewImpl::shouldDelayWindowOrderingForEvent(NSEvent *event)
 {
     // If this is the active window or we don't have a range selection, there is no need to perform additional checks
     // and we can avoid making a synchronous call to the WebProcess.
 }
 
 bool WebViewImpl::shouldDelayWindowOrderingForEvent(NSEvent *event)
 {
     // If this is the active window or we don't have a range selection, there is no need to perform additional checks
     // and we can avoid making a synchronous call to the WebProcess.
-    if (m_view.window.isKeyWindow || m_page.editorState().selectionIsNone || !m_page.editorState().selectionIsRange)
+    if (m_view.window.isKeyWindow || m_page->editorState().selectionIsNone || !m_page->editorState().selectionIsRange)
         return false;
 
     // There's a chance that responding to this event will run a nested event loop, and
         return false;
 
     // There's a chance that responding to this event will run a nested event loop, and
@@ -1116,7 +1162,7 @@ bool WebViewImpl::shouldDelayWindowOrderingForEvent(NSEvent *event)
         return false;
 
     setLastMouseDownEvent(event);
         return false;
 
     setLastMouseDownEvent(event);
-    bool result = m_page.shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, m_lastPressureEvent.get(), m_view));
+    bool result = m_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, m_lastPressureEvent.get(), m_view));
     setLastMouseDownEvent(nil);
     return result;
 }
     setLastMouseDownEvent(nil);
     return result;
 }
@@ -1124,7 +1170,7 @@ bool WebViewImpl::shouldDelayWindowOrderingForEvent(NSEvent *event)
 bool WebViewImpl::windowResizeMouseLocationIsInVisibleScrollerThumb(CGPoint point)
 {
     NSPoint localPoint = [m_view convertPoint:NSPointFromCGPoint(point) fromView:nil];
 bool WebViewImpl::windowResizeMouseLocationIsInVisibleScrollerThumb(CGPoint point)
 {
     NSPoint localPoint = [m_view convertPoint:NSPointFromCGPoint(point) fromView:nil];
-    NSRect visibleThumbRect = NSRect(m_page.visibleScrollerThumbRect());
+    NSRect visibleThumbRect = NSRect(m_page->visibleScrollerThumbRect());
     return NSMouseInRect(localPoint, visibleThumbRect, m_view.isFlipped);
 }
 
     return NSMouseInRect(localPoint, visibleThumbRect, m_view.isFlipped);
 }
 
@@ -1156,12 +1202,12 @@ void WebViewImpl::viewDidMoveToWindow()
             m_viewInWindowChangeWasDeferred = true;
         else
             viewStateChanges |= WebCore::ViewState::IsInWindow;
             m_viewInWindowChangeWasDeferred = true;
         else
             viewStateChanges |= WebCore::ViewState::IsInWindow;
-        m_page.viewStateDidChange(viewStateChanges);
+        m_page->viewStateDidChange(viewStateChanges);
 
         updateWindowAndViewFrames();
 
         // FIXME(135509) This call becomes unnecessary once 135509 is fixed; remove.
 
         updateWindowAndViewFrames();
 
         // FIXME(135509) This call becomes unnecessary once 135509 is fixed; remove.
-        m_page.layerHostingModeDidChange();
+        m_page->layerHostingModeDidChange();
 
         if (!m_flagsChangedEventMonitor) {
             auto weakThis = createWeakPtr();
 
         if (!m_flagsChangedEventMonitor) {
             auto weakThis = createWeakPtr();
@@ -1184,7 +1230,7 @@ void WebViewImpl::viewDidMoveToWindow()
             m_viewInWindowChangeWasDeferred = true;
         else
             viewStateChanges |= WebCore::ViewState::IsInWindow;
             m_viewInWindowChangeWasDeferred = true;
         else
             viewStateChanges |= WebCore::ViewState::IsInWindow;
-        m_page.viewStateDidChange(viewStateChanges);
+        m_page->viewStateDidChange(viewStateChanges);
 
         [NSEvent removeMonitor:m_flagsChangedEventMonitor];
         m_flagsChangedEventMonitor = nil;
 
         [NSEvent removeMonitor:m_flagsChangedEventMonitor];
         m_flagsChangedEventMonitor = nil;
@@ -1197,7 +1243,7 @@ void WebViewImpl::viewDidMoveToWindow()
 #endif
     }
 
 #endif
     }
 
-    m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+    m_page->setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
 }
 
 void WebViewImpl::viewDidChangeBackingProperties()
 }
 
 void WebViewImpl::viewDidChangeBackingProperties()
@@ -1207,23 +1253,23 @@ void WebViewImpl::viewDidChangeBackingProperties()
         return;
 
     m_colorSpace = nullptr;
         return;
 
     m_colorSpace = nullptr;
-    if (DrawingAreaProxy *drawingArea = m_page.drawingArea())
+    if (DrawingAreaProxy *drawingArea = m_page->drawingArea())
         drawingArea->colorSpaceDidChange();
 }
 
 void WebViewImpl::viewDidHide()
 {
         drawingArea->colorSpaceDidChange();
 }
 
 void WebViewImpl::viewDidHide()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 void WebViewImpl::viewDidUnhide()
 {
 }
 
 void WebViewImpl::viewDidUnhide()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 void WebViewImpl::activeSpaceDidChange()
 {
 }
 
 void WebViewImpl::activeSpaceDidChange()
 {
-    m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+    m_page->viewStateDidChange(WebCore::ViewState::IsVisible);
 }
 
 NSView *WebViewImpl::hitTest(CGPoint point)
 }
 
 NSView *WebViewImpl::hitTest(CGPoint point)
@@ -1241,7 +1287,7 @@ void WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent(NSEvent *flagsChan
         modifierFlags:flagsChangedEvent.modifierFlags timestamp:flagsChangedEvent.timestamp windowNumber:flagsChangedEvent.windowNumber
         context:flagsChangedEvent.context eventNumber:0 clickCount:0 pressure:0];
     NativeWebMouseEvent webEvent(fakeEvent, m_lastPressureEvent.get(), m_view);
         modifierFlags:flagsChangedEvent.modifierFlags timestamp:flagsChangedEvent.timestamp windowNumber:flagsChangedEvent.windowNumber
         context:flagsChangedEvent.context eventNumber:0 clickCount:0 pressure:0];
     NativeWebMouseEvent webEvent(fakeEvent, m_lastPressureEvent.get(), m_view);
-    m_page.handleMouseEvent(webEvent);
+    m_page->handleMouseEvent(webEvent);
 }
 
 ColorSpaceData WebViewImpl::colorSpace()
 }
 
 ColorSpaceData WebViewImpl::colorSpace()
@@ -1263,12 +1309,12 @@ ColorSpaceData WebViewImpl::colorSpace()
 
 void WebViewImpl::setUnderlayColor(NSColor *underlayColor)
 {
 
 void WebViewImpl::setUnderlayColor(NSColor *underlayColor)
 {
-    m_page.setUnderlayColor(WebCore::colorFromNSColor(underlayColor));
+    m_page->setUnderlayColor(WebCore::colorFromNSColor(underlayColor));
 }
 
 NSColor *WebViewImpl::underlayColor() const
 {
 }
 
 NSColor *WebViewImpl::underlayColor() const
 {
-    WebCore::Color webColor = m_page.underlayColor();
+    WebCore::Color webColor = m_page->underlayColor();
     if (!webColor.isValid())
         return nil;
 
     if (!webColor.isValid())
         return nil;
 
@@ -1277,7 +1323,7 @@ NSColor *WebViewImpl::underlayColor() const
 
 NSColor *WebViewImpl::pageExtendedBackgroundColor() const
 {
 
 NSColor *WebViewImpl::pageExtendedBackgroundColor() const
 {
-    WebCore::Color color = m_page.pageExtendedBackgroundColor();
+    WebCore::Color color = m_page->pageExtendedBackgroundColor();
     if (!color.isValid())
         return nil;
 
     if (!color.isValid())
         return nil;
 
@@ -1286,12 +1332,12 @@ NSColor *WebViewImpl::pageExtendedBackgroundColor() const
 
 void WebViewImpl::setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle)
 {
 
 void WebViewImpl::setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle)
 {
-    m_page.setOverlayScrollbarStyle(scrollbarStyle);
+    m_page->setOverlayScrollbarStyle(scrollbarStyle);
 }
 
 WTF::Optional<WebCore::ScrollbarOverlayStyle> WebViewImpl::overlayScrollbarStyle() const
 {
 }
 
 WTF::Optional<WebCore::ScrollbarOverlayStyle> WebViewImpl::overlayScrollbarStyle() const
 {
-    return m_page.overlayScrollbarStyle();
+    return m_page->overlayScrollbarStyle();
 }
 
 void WebViewImpl::beginDeferringViewInWindowChanges()
 }
 
 void WebViewImpl::beginDeferringViewInWindowChanges()
@@ -1315,7 +1361,7 @@ void WebViewImpl::endDeferringViewInWindowChanges()
 
     if (m_viewInWindowChangeWasDeferred) {
         dispatchSetTopContentInset();
 
     if (m_viewInWindowChangeWasDeferred) {
         dispatchSetTopContentInset();
-        m_page.viewStateDidChange(WebCore::ViewState::IsInWindow);
+        m_page->viewStateDidChange(WebCore::ViewState::IsInWindow);
         m_viewInWindowChangeWasDeferred = false;
     }
 }
         m_viewInWindowChangeWasDeferred = false;
     }
 }
@@ -1331,7 +1377,7 @@ void WebViewImpl::endDeferringViewInWindowChangesSync()
 
     if (m_viewInWindowChangeWasDeferred) {
         dispatchSetTopContentInset();
 
     if (m_viewInWindowChangeWasDeferred) {
         dispatchSetTopContentInset();
-        m_page.viewStateDidChange(WebCore::ViewState::IsInWindow);
+        m_page->viewStateDidChange(WebCore::ViewState::IsInWindow);
         m_viewInWindowChangeWasDeferred = false;
     }
 }
         m_viewInWindowChangeWasDeferred = false;
     }
 }
@@ -1346,7 +1392,7 @@ void WebViewImpl::prepareForMoveToWindow(NSWindow *targetWindow, std::function<v
     m_shouldDeferViewInWindowChanges = false;
 
     auto weakThis = createWeakPtr();
     m_shouldDeferViewInWindowChanges = false;
 
     auto weakThis = createWeakPtr();
-    m_page.installViewStateChangeCompletionHandler([weakThis, completionHandler]() {
+    m_page->installViewStateChangeCompletionHandler([weakThis, completionHandler]() {
         completionHandler();
 
         if (!weakThis)
         completionHandler();
 
         if (!weakThis)
@@ -1357,7 +1403,7 @@ void WebViewImpl::prepareForMoveToWindow(NSWindow *targetWindow, std::function<v
     });
 
     dispatchSetTopContentInset();
     });
 
     dispatchSetTopContentInset();
-    m_page.viewStateDidChange(WebCore::ViewState::IsInWindow, false, WebPageProxy::ViewStateChangeDispatchMode::Immediate);
+    m_page->viewStateDidChange(WebCore::ViewState::IsInWindow, false, WebPageProxy::ViewStateChangeDispatchMode::Immediate);
     m_viewInWindowChangeWasDeferred = false;
 }
 
     m_viewInWindowChangeWasDeferred = false;
 }
 
@@ -1372,7 +1418,7 @@ void WebViewImpl::updateSecureInputState()
     }
     // WKView has a single input context for all editable areas (except for plug-ins).
     NSTextInputContext *context = [m_view _superInputContext];
     }
     // WKView has a single input context for all editable areas (except for plug-ins).
     NSTextInputContext *context = [m_view _superInputContext];
-    bool isInPasswordField = m_page.editorState().isInPasswordField;
+    bool isInPasswordField = m_page->editorState().isInPasswordField;
 
     if (isInPasswordField) {
         if (!m_inSecureInputState)
 
     if (isInPasswordField) {
         if (!m_inSecureInputState)
@@ -1418,7 +1464,7 @@ void WebViewImpl::setPluginComplexTextInputState(PluginComplexTextInputState plu
         return;
 
     // Send back an empty string to the plug-in. This will disable text input.
         return;
 
     // Send back an empty string to the plug-in. This will disable text input.
-    m_page.sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, String());
+    m_page->sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, String());
 }
 
 void WebViewImpl::setPluginComplexTextInputStateAndIdentifier(PluginComplexTextInputState pluginComplexTextInputState, uint64_t pluginComplexTextInputIdentifier)
 }
 
 void WebViewImpl::setPluginComplexTextInputStateAndIdentifier(PluginComplexTextInputState pluginComplexTextInputState, uint64_t pluginComplexTextInputIdentifier)
@@ -1455,7 +1501,7 @@ bool WebViewImpl::handlePluginComplexTextInputKeyDown(NSEvent *event)
     BOOL didHandleEvent = [[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:&string];
 
     if (string) {
     BOOL didHandleEvent = [[WKTextInputWindowController sharedTextInputWindowController] interpretKeyEvent:event usingLegacyCocoaTextInput:usingLegacyCocoaTextInput string:&string];
 
     if (string) {
-        m_page.sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, string);
+        m_page->sendComplexTextInputToPlugin(m_pluginComplexTextInputIdentifier, string);
 
         if (!usingLegacyCocoaTextInput)
             m_pluginComplexTextInputState = PluginComplexTextInputDisabled;
 
         if (!usingLegacyCocoaTextInput)
             m_pluginComplexTextInputState = PluginComplexTextInputDisabled;
@@ -1522,7 +1568,7 @@ bool WebViewImpl::tryPostProcessPluginComplexTextInputKeyDown(NSEvent *event)
 
 void WebViewImpl::handleAcceptedAlternativeText(const String& acceptedAlternative)
 {
 
 void WebViewImpl::handleAcceptedAlternativeText(const String& acceptedAlternative)
 {
-    m_page.handleAlternativeTextUIResult(acceptedAlternative);
+    m_page->handleAlternativeTextUIResult(acceptedAlternative);
 }
 
 
 }
 
 
@@ -1546,7 +1592,7 @@ void WebViewImpl::pressureChangeWithEvent(NSEvent *event)
         return;
 
     NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view);
         return;
 
     NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view);
-    m_page.handleMouseEvent(webEvent);
+    m_page->handleMouseEvent(webEvent);
 
     m_lastPressureEvent = event;
 #endif
 
     m_lastPressureEvent = event;
 #endif
@@ -1596,7 +1642,7 @@ NSWindow *WebViewImpl::createFullScreenWindow()
 
 bool WebViewImpl::isEditable() const
 {
 
 bool WebViewImpl::isEditable() const
 {
-    return m_page.isEditable();
+    return m_page->isEditable();
 }
 
 typedef HashMap<SEL, String> SelectorNameMap;
 }
 
 typedef HashMap<SEL, String> SelectorNameMap;
@@ -1661,7 +1707,7 @@ bool WebViewImpl::executeSavedCommandBySelector(SEL selector)
 
 void WebViewImpl::executeEditCommandForSelector(SEL selector, const String& argument)
 {
 
 void WebViewImpl::executeEditCommandForSelector(SEL selector, const String& argument)
 {
-    m_page.executeEditCommand(commandNameForSelector(selector), argument);
+    m_page->executeEditCommand(commandNameForSelector(selector), argument);
 }
 
 void WebViewImpl::registerEditCommand(RefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
 }
 
 void WebViewImpl::registerEditCommand(RefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
@@ -1688,9 +1734,9 @@ bool WebViewImpl::writeSelectionToPasteboard(NSPasteboard *pasteboard, NSArray *
     [pasteboard declareTypes:types owner:nil];
     for (size_t i = 0; i < numTypes; ++i) {
         if ([[types objectAtIndex:i] isEqualTo:NSStringPboardType])
     [pasteboard declareTypes:types owner:nil];
     for (size_t i = 0; i < numTypes; ++i) {
         if ([[types objectAtIndex:i] isEqualTo:NSStringPboardType])
-            [pasteboard setString:m_page.stringSelectionForPasteboard() forType:NSStringPboardType];
+            [pasteboard setString:m_page->stringSelectionForPasteboard() forType:NSStringPboardType];
         else {
         else {
-            RefPtr<WebCore::SharedBuffer> buffer = m_page.dataSelectionForPasteboard([types objectAtIndex:i]);
+            RefPtr<WebCore::SharedBuffer> buffer = m_page->dataSelectionForPasteboard([types objectAtIndex:i]);
             [pasteboard setData:buffer ? buffer->createNSData().get() : nil forType:[types objectAtIndex:i]];
         }
     }
             [pasteboard setData:buffer ? buffer->createNSData().get() : nil forType:[types objectAtIndex:i]];
         }
     }
@@ -1699,12 +1745,12 @@ bool WebViewImpl::writeSelectionToPasteboard(NSPasteboard *pasteboard, NSArray *
 
 bool WebViewImpl::readSelectionFromPasteboard(NSPasteboard *pasteboard)
 {
 
 bool WebViewImpl::readSelectionFromPasteboard(NSPasteboard *pasteboard)
 {
-    return m_page.readSelectionFromPasteboard([pasteboard name]);
+    return m_page->readSelectionFromPasteboard([pasteboard name]);
 }
 
 id WebViewImpl::validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType)
 {
 }
 
 id WebViewImpl::validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType)
 {
-    EditorState editorState = m_page.editorState();
+    EditorState editorState = m_page->editorState();
     bool isValidSendType = false;
 
     if (sendType && !editorState.selectionIsNone) {
     bool isValidSendType = false;
 
     if (sendType && !editorState.selectionIsNone) {
@@ -1728,7 +1774,7 @@ id WebViewImpl::validRequestorForSendAndReturnTypes(NSString *sendType, NSString
 
 void WebViewImpl::centerSelectionInVisibleArea()
 {
 
 void WebViewImpl::centerSelectionInVisibleArea()
 {
-    m_page.centerSelectionInVisibleArea();
+    m_page->centerSelectionInVisibleArea();
 }
 
 void WebViewImpl::selectionDidChange()
 }
 
 void WebViewImpl::selectionDidChange()
@@ -1743,11 +1789,11 @@ void WebViewImpl::startObservingFontPanel()
 
 void WebViewImpl::updateFontPanelIfNeeded()
 {
 
 void WebViewImpl::updateFontPanelIfNeeded()
 {
-    const EditorState& editorState = m_page.editorState();
+    const EditorState& editorState = m_page->editorState();
     if (editorState.selectionIsNone || !editorState.isContentEditable)
         return;
     if ([NSFontPanel sharedFontPanelExists] && [[NSFontPanel sharedFontPanel] isVisible]) {
     if (editorState.selectionIsNone || !editorState.isContentEditable)
         return;
     if ([NSFontPanel sharedFontPanelExists] && [[NSFontPanel sharedFontPanel] isVisible]) {
-        m_page.fontAtSelection([](const String& fontName, double fontSize, bool selectionHasMultipleFonts, WebKit::CallbackBase::Error error) {
+        m_page->fontAtSelection([](const String& fontName, double fontSize, bool selectionHasMultipleFonts, WebKit::CallbackBase::Error error) {
             NSFont *font = [NSFont fontWithName:fontName size:fontSize];
             if (font)
                 [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:selectionHasMultipleFonts];
             NSFont *font = [NSFont fontWithName:fontName size:fontSize];
             if (font)
                 [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:selectionHasMultipleFonts];
@@ -1761,7 +1807,7 @@ void WebViewImpl::changeFontFromFontPanel()
     NSFont *font = [fontManager convertFont:fontManager.selectedFont];
     if (!font)
         return;
     NSFont *font = [fontManager convertFont:fontManager.selectedFont];
     if (!font)
         return;
-    m_page.setFont(font.familyName, font.pointSize, font.fontDescriptor.symbolicTraits);
+    m_page->setFont(font.familyName, font.pointSize, font.fontDescriptor.symbolicTraits);
 }
 
 static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item)
 }
 
 static NSMenuItem *menuItem(id <NSValidatedUserInterfaceItem> item)
@@ -1785,11 +1831,11 @@ bool WebViewImpl::validateUserInterfaceItem(id <NSValidatedUserInterfaceItem> it
     if (action == @selector(showGuessPanel:)) {
         if (NSMenuItem *menuItem = WebKit::menuItem(item))
             [menuItem setTitle:WebCore::contextMenuItemTagShowSpellingPanel(![[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible])];
     if (action == @selector(showGuessPanel:)) {
         if (NSMenuItem *menuItem = WebKit::menuItem(item))
             [menuItem setTitle:WebCore::contextMenuItemTagShowSpellingPanel(![[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible])];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(checkSpelling:) || action == @selector(changeSpelling:))
     }
 
     if (action == @selector(checkSpelling:) || action == @selector(changeSpelling:))
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
 
     if (action == @selector(toggleContinuousSpellChecking:)) {
         bool enabled = TextChecker::isContinuousSpellCheckingAllowed();
 
     if (action == @selector(toggleContinuousSpellChecking:)) {
         bool enabled = TextChecker::isContinuousSpellCheckingAllowed();
@@ -1807,54 +1853,54 @@ bool WebViewImpl::validateUserInterfaceItem(id <NSValidatedUserInterfaceItem> it
     if (action == @selector(toggleAutomaticSpellingCorrection:)) {
         bool checked = TextChecker::state().isAutomaticSpellingCorrectionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
     if (action == @selector(toggleAutomaticSpellingCorrection:)) {
         bool checked = TextChecker::state().isAutomaticSpellingCorrectionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(orderFrontSubstitutionsPanel:)) {
         if (NSMenuItem *menuItem = WebKit::menuItem(item))
             [menuItem setTitle:WebCore::contextMenuItemTagShowSubstitutions(![[[NSSpellChecker sharedSpellChecker] substitutionsPanel] isVisible])];
     }
 
     if (action == @selector(orderFrontSubstitutionsPanel:)) {
         if (NSMenuItem *menuItem = WebKit::menuItem(item))
             [menuItem setTitle:WebCore::contextMenuItemTagShowSubstitutions(![[[NSSpellChecker sharedSpellChecker] substitutionsPanel] isVisible])];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(toggleSmartInsertDelete:)) {
     }
 
     if (action == @selector(toggleSmartInsertDelete:)) {
-        bool checked = m_page.isSmartInsertDeleteEnabled();
+        bool checked = m_page->isSmartInsertDeleteEnabled();
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(toggleAutomaticQuoteSubstitution:)) {
         bool checked = TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
     }
 
     if (action == @selector(toggleAutomaticQuoteSubstitution:)) {
         bool checked = TextChecker::state().isAutomaticQuoteSubstitutionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(toggleAutomaticDashSubstitution:)) {
         bool checked = TextChecker::state().isAutomaticDashSubstitutionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
     }
 
     if (action == @selector(toggleAutomaticDashSubstitution:)) {
         bool checked = TextChecker::state().isAutomaticDashSubstitutionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(toggleAutomaticLinkDetection:)) {
         bool checked = TextChecker::state().isAutomaticLinkDetectionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
     }
 
     if (action == @selector(toggleAutomaticLinkDetection:)) {
         bool checked = TextChecker::state().isAutomaticLinkDetectionEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(toggleAutomaticTextReplacement:)) {
         bool checked = TextChecker::state().isAutomaticTextReplacementEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
     }
 
     if (action == @selector(toggleAutomaticTextReplacement:)) {
         bool checked = TextChecker::state().isAutomaticTextReplacementEnabled;
         [menuItem(item) setState:checked ? NSOnState : NSOffState];
-        return m_page.editorState().isContentEditable;
+        return m_page->editorState().isContentEditable;
     }
 
     if (action == @selector(uppercaseWord:) || action == @selector(lowercaseWord:) || action == @selector(capitalizeWord:))
     }
 
     if (action == @selector(uppercaseWord:) || action == @selector(lowercaseWord:) || action == @selector(capitalizeWord:))
-        return m_page.editorState().selectionIsRange && m_page.editorState().isContentEditable;
+        return m_page->editorState().selectionIsRange && m_page->editorState().isContentEditable;
 
     if (action == @selector(stopSpeaking:))
         return [NSApp isSpeaking];
 
     // The centerSelectionInVisibleArea: selector is enabled if there's a selection range or if there's an insertion point in an editable area.
     if (action == @selector(centerSelectionInVisibleArea:))
 
     if (action == @selector(stopSpeaking:))
         return [NSApp isSpeaking];
 
     // The centerSelectionInVisibleArea: selector is enabled if there's a selection range or if there's an insertion point in an editable area.
     if (action == @selector(centerSelectionInVisibleArea:))
-        return m_page.editorState().selectionIsRange || (m_page.editorState().isContentEditable && !m_page.editorState().selectionIsNone);
+        return m_page->editorState().selectionIsRange || (m_page->editorState().isContentEditable && !m_page->editorState().selectionIsNone);
 
     // Next, handle editor commands. Start by returning true for anything that is not an editor command.
     // Returning true is the default thing to do in an AppKit validate method for any selector that is not recognized.
 
     // Next, handle editor commands. Start by returning true for anything that is not an editor command.
     // Returning true is the default thing to do in an AppKit validate method for any selector that is not recognized.
@@ -1870,7 +1916,7 @@ bool WebViewImpl::validateUserInterfaceItem(id <NSValidatedUserInterfaceItem> it
         // FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time
         // we asked for the same command; there is no guarantee the answer is still valid.
         auto weakThis = createWeakPtr();
         // FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time
         // we asked for the same command; there is no guarantee the answer is still valid.
         auto weakThis = createWeakPtr();
-        m_page.validateCommand(commandName, [weakThis](const String& commandName, bool isEnabled, int32_t state, WebKit::CallbackBase::Error error) {
+        m_page->validateCommand(commandName, [weakThis](const String& commandName, bool isEnabled, int32_t state, WebKit::CallbackBase::Error error) {
             if (!weakThis)
                 return;
 
             if (!weakThis)
                 return;
 
@@ -1901,7 +1947,7 @@ void WebViewImpl::setUserInterfaceItemState(NSString *commandName, bool enabled,
 
 void WebViewImpl::startSpeaking()
 {
 
 void WebViewImpl::startSpeaking()
 {
-    m_page.getSelectionOrContentsAsString([](const String& string, WebKit::CallbackBase::Error error) {
+    m_page->getSelectionOrContentsAsString([](const String& string, WebKit::CallbackBase::Error error) {
         if (error != WebKit::CallbackBase::Error::None)
             return;
         if (!string)
         if (error != WebKit::CallbackBase::Error::None)
             return;
         if (!string)
@@ -1930,20 +1976,20 @@ void WebViewImpl::showGuessPanel(id sender)
         return;
     }
 
         return;
     }
 
-    m_page.advanceToNextMisspelling(true);
+    m_page->advanceToNextMisspelling(true);
     [spellingPanel orderFront:sender];
 }
 
 void WebViewImpl::checkSpelling()
 {
     [spellingPanel orderFront:sender];
 }
 
 void WebViewImpl::checkSpelling()
 {
-    m_page.advanceToNextMisspelling(false);
+    m_page->advanceToNextMisspelling(false);
 }
 
 void WebViewImpl::changeSpelling(id sender)
 {
     NSString *word = [[sender selectedCell] stringValue];
 
 }
 
 void WebViewImpl::changeSpelling(id sender)
 {
     NSString *word = [[sender selectedCell] stringValue];
 
-    m_page.changeSpellingToWord(word);
+    m_page->changeSpellingToWord(word);
 }
 
 void WebViewImpl::toggleContinuousSpellChecking()
 }
 
 void WebViewImpl::toggleContinuousSpellChecking()
@@ -1951,7 +1997,7 @@ void WebViewImpl::toggleContinuousSpellChecking()
     bool spellCheckingEnabled = !TextChecker::state().isContinuousSpellCheckingEnabled;
     TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled);
 
     bool spellCheckingEnabled = !TextChecker::state().isContinuousSpellCheckingEnabled;
     TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled);
 
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 bool WebViewImpl::isGrammarCheckingEnabled()
 }
 
 bool WebViewImpl::isGrammarCheckingEnabled()
@@ -1965,7 +2011,7 @@ void WebViewImpl::setGrammarCheckingEnabled(bool flag)
         return;
 
     TextChecker::setGrammarCheckingEnabled(flag);
         return;
 
     TextChecker::setGrammarCheckingEnabled(flag);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleGrammarChecking()
 }
 
 void WebViewImpl::toggleGrammarChecking()
@@ -1973,14 +2019,14 @@ void WebViewImpl::toggleGrammarChecking()
     bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled;
     TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled);
 
     bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled;
     TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled);
 
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleAutomaticSpellingCorrection()
 {
     TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
 
 }
 
 void WebViewImpl::toggleAutomaticSpellingCorrection()
 {
     TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::state().isAutomaticSpellingCorrectionEnabled);
 
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::orderFrontSubstitutionsPanel(id sender)
 }
 
 void WebViewImpl::orderFrontSubstitutionsPanel(id sender)
@@ -2001,7 +2047,7 @@ void WebViewImpl::orderFrontSubstitutionsPanel(id sender)
 
 void WebViewImpl::toggleSmartInsertDelete()
 {
 
 void WebViewImpl::toggleSmartInsertDelete()
 {
-    m_page.setSmartInsertDeleteEnabled(!m_page.isSmartInsertDeleteEnabled());
+    m_page->setSmartInsertDeleteEnabled(!m_page->isSmartInsertDeleteEnabled());
 }
 
 bool WebViewImpl::isAutomaticQuoteSubstitutionEnabled()
 }
 
 bool WebViewImpl::isAutomaticQuoteSubstitutionEnabled()
@@ -2015,13 +2061,13 @@ void WebViewImpl::setAutomaticQuoteSubstitutionEnabled(bool flag)
         return;
 
     TextChecker::setAutomaticQuoteSubstitutionEnabled(flag);
         return;
 
     TextChecker::setAutomaticQuoteSubstitutionEnabled(flag);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleAutomaticQuoteSubstitution()
 {
     TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
 }
 
 void WebViewImpl::toggleAutomaticQuoteSubstitution()
 {
     TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 bool WebViewImpl::isAutomaticDashSubstitutionEnabled()
 }
 
 bool WebViewImpl::isAutomaticDashSubstitutionEnabled()
@@ -2035,13 +2081,13 @@ void WebViewImpl::setAutomaticDashSubstitutionEnabled(bool flag)
         return;
 
     TextChecker::setAutomaticDashSubstitutionEnabled(flag);
         return;
 
     TextChecker::setAutomaticDashSubstitutionEnabled(flag);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleAutomaticDashSubstitution()
 {
     TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
 }
 
 void WebViewImpl::toggleAutomaticDashSubstitution()
 {
     TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 bool WebViewImpl::isAutomaticLinkDetectionEnabled()
 }
 
 bool WebViewImpl::isAutomaticLinkDetectionEnabled()
@@ -2055,13 +2101,13 @@ void WebViewImpl::setAutomaticLinkDetectionEnabled(bool flag)
         return;
 
     TextChecker::setAutomaticLinkDetectionEnabled(flag);
         return;
 
     TextChecker::setAutomaticLinkDetectionEnabled(flag);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleAutomaticLinkDetection()
 {
     TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
 }
 
 void WebViewImpl::toggleAutomaticLinkDetection()
 {
     TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 bool WebViewImpl::isAutomaticTextReplacementEnabled()
 }
 
 bool WebViewImpl::isAutomaticTextReplacementEnabled()
@@ -2075,33 +2121,33 @@ void WebViewImpl::setAutomaticTextReplacementEnabled(bool flag)
         return;
     
     TextChecker::setAutomaticTextReplacementEnabled(flag);
         return;
     
     TextChecker::setAutomaticTextReplacementEnabled(flag);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::toggleAutomaticTextReplacement()
 {
     TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
 }
 
 void WebViewImpl::toggleAutomaticTextReplacement()
 {
     TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
-    m_page.process().updateTextCheckerState();
+    m_page->process().updateTextCheckerState();
 }
 
 void WebViewImpl::uppercaseWord()
 {
 }
 
 void WebViewImpl::uppercaseWord()
 {
-    m_page.uppercaseWord();
+    m_page->uppercaseWord();
 }
 
 void WebViewImpl::lowercaseWord()
 {
 }
 
 void WebViewImpl::lowercaseWord()
 {
-    m_page.lowercaseWord();
+    m_page->lowercaseWord();
 }
 
 void WebViewImpl::capitalizeWord()
 {
 }
 
 void WebViewImpl::capitalizeWord()
 {
-    m_page.capitalizeWord();
+    m_page->capitalizeWord();
 }
 
 void WebViewImpl::preferencesDidChange()
 {
 }
 
 void WebViewImpl::preferencesDidChange()
 {
-    BOOL needsViewFrameInWindowCoordinates = m_page.preferences().pluginsEnabled();
+    BOOL needsViewFrameInWindowCoordinates = m_page->preferences().pluginsEnabled();
 
     if (!!needsViewFrameInWindowCoordinates == !!m_needsViewFrameInWindowCoordinates)
         return;
 
     if (!!needsViewFrameInWindowCoordinates == !!m_needsViewFrameInWindowCoordinates)
         return;
@@ -2171,7 +2217,7 @@ void WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly()
     [m_immediateActionController dismissContentRelativeChildWindows];
 #endif
     
     [m_immediateActionController dismissContentRelativeChildWindows];
 #endif
     
-    m_pageClient.dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeTextIgnored);
+    m_pageClient->dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeTextIgnored);
 }
 
 void WebViewImpl::hideWordDefinitionWindow()
 }
 
 void WebViewImpl::hideWordDefinitionWindow()
@@ -2192,7 +2238,7 @@ void WebViewImpl::quickLookWithEvent(NSEvent *event)
 #endif
 
     NSPoint locationInViewCoordinates = [m_view convertPoint:[event locationInWindow] fromView:nil];
 #endif
 
     NSPoint locationInViewCoordinates = [m_view convertPoint:[event locationInWindow] fromView:nil];
-    m_page.performDictionaryLookupAtLocation(WebCore::FloatPoint(locationInViewCoordinates));
+    m_page->performDictionaryLookupAtLocation(WebCore::FloatPoint(locationInViewCoordinates));
 }
 
 void WebViewImpl::prepareForDictionaryLookup()
 }
 
 void WebViewImpl::prepareForDictionaryLookup()
@@ -2220,14 +2266,9 @@ void WebViewImpl::setAllowsLinkPreview(bool allowsLinkPreview)
 #endif
 }
 
 #endif
 }
 
-void* WebViewImpl::immediateActionAnimationControllerForHitTestResult(WKHitTestResultRef hitTestResult, uint32_t type, WKTypeRef userData)
+void* WebViewImpl::immediateActionAnimationControllerForHitTestResult(API::HitTestResult* hitTestResult, uint32_t type, API::Object* userData)
 {
 {
-    return [m_view _immediateActionAnimationControllerForHitTestResult:hitTestResult withType:type userData:userData];
-}
-
-void* WebViewImpl::immediateActionAnimationControllerForHitTestResultFromViewOnly(WKHitTestResultRef hitTestResult, uint32_t type, WKTypeRef userData)
-{
-    return nil;
+    return [m_view _web_immediateActionAnimationControllerForHitTestResultInternal:hitTestResult withType:type userData:userData];
 }
 
 void WebViewImpl::didPerformImmediateActionHitTest(const WebHitTestResultData& result, bool contentPreventsDefault, API::Object* userData)
 }
 
 void WebViewImpl::didPerformImmediateActionHitTest(const WebHitTestResultData& result, bool contentPreventsDefault, API::Object* userData)
@@ -2252,13 +2293,18 @@ void WebViewImpl::completeImmediateActionAnimation()
     [m_view _completeImmediateActionAnimation];
 }
 
     [m_view _completeImmediateActionAnimation];
 }
 
+void WebViewImpl::didChangeContentSize(CGSize newSize)
+{
+    [m_view _didChangeContentSize:NSSizeFromCGSize(newSize)];
+}
+
 void WebViewImpl::setIgnoresNonWheelEvents(bool ignoresNonWheelEvents)
 {
     if (m_ignoresNonWheelEvents == ignoresNonWheelEvents)
         return;
 
     m_ignoresNonWheelEvents = ignoresNonWheelEvents;
 void WebViewImpl::setIgnoresNonWheelEvents(bool ignoresNonWheelEvents)
 {
     if (m_ignoresNonWheelEvents == ignoresNonWheelEvents)
         return;
 
     m_ignoresNonWheelEvents = ignoresNonWheelEvents;
-    m_page.setShouldDispatchFakeMouseMoveEvents(!ignoresNonWheelEvents);
+    m_page->setShouldDispatchFakeMouseMoveEvents(!ignoresNonWheelEvents);
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     if (ignoresNonWheelEvents)
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     if (ignoresNonWheelEvents)
@@ -2294,7 +2340,7 @@ void WebViewImpl::updateRemoteAccessibilityRegistration(bool registerProcess)
     // away, that information is not present in WebProcess
     pid_t pid = 0;
     if (registerProcess)
     // away, that information is not present in WebProcess
     pid_t pid = 0;
     if (registerProcess)
-        pid = m_page.process().processIdentifier();
+        pid = m_page->process().processIdentifier();
     else if (!registerProcess) {
         pid = WKAXRemoteProcessIdentifier(m_remoteAccessibilityChild.get());
         m_remoteAccessibilityChild = nil;
     else if (!registerProcess) {
         pid = WKAXRemoteProcessIdentifier(m_remoteAccessibilityChild.get());
         m_remoteAccessibilityChild = nil;
@@ -2310,7 +2356,7 @@ void WebViewImpl::accessibilityRegisterUIProcessTokens()
     NSData *remoteWindowToken = WKAXRemoteTokenForElement(m_view.window);
     IPC::DataReference elementToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteElementToken bytes]), [remoteElementToken length]);
     IPC::DataReference windowToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteWindowToken bytes]), [remoteWindowToken length]);
     NSData *remoteWindowToken = WKAXRemoteTokenForElement(m_view.window);
     IPC::DataReference elementToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteElementToken bytes]), [remoteElementToken length]);
     IPC::DataReference windowToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteWindowToken bytes]), [remoteWindowToken length]);
-    m_page.registerUIProcessAccessibilityTokens(elementToken, windowToken);
+    m_page->registerUIProcessAccessibilityTokens(elementToken, windowToken);
 }
 
 id WebViewImpl::accessibilityFocusedUIElement()
 }
 
 id WebViewImpl::accessibilityFocusedUIElement()
@@ -2462,7 +2508,7 @@ void WebViewImpl::sendToolTipMouseEntered()
 
 NSString *WebViewImpl::stringForToolTip(NSToolTipTag tag)
 {
 
 NSString *WebViewImpl::stringForToolTip(NSToolTipTag tag)
 {
-    return nsStringFromWebCoreString(m_page.toolTip());
+    return nsStringFromWebCoreString(m_page->toolTip());
 }
 
 void WebViewImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
 }
 
 void WebViewImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
@@ -2560,7 +2606,7 @@ void WebViewImpl::setInspectorAttachmentView(NSView *newView)
         return;
 
     m_inspectorAttachmentView = newView;
         return;
 
     m_inspectorAttachmentView = newView;
-    m_page.inspector()->attachmentViewDidChange(oldView ? oldView : m_view, newView ? newView : m_view);
+    m_page->inspector()->attachmentViewDidChange(oldView ? oldView : m_view, newView ? newView : m_view);
 }
 
 NSView *WebViewImpl::inspectorAttachmentView()
 }
 
 NSView *WebViewImpl::inspectorAttachmentView()
@@ -2573,26 +2619,16 @@ _WKRemoteObjectRegistry *WebViewImpl::remoteObjectRegistry()
 {
     if (!m_remoteObjectRegistry) {
         m_remoteObjectRegistry = adoptNS([[_WKRemoteObjectRegistry alloc] _initWithMessageSender:m_page]);
 {
     if (!m_remoteObjectRegistry) {
         m_remoteObjectRegistry = adoptNS([[_WKRemoteObjectRegistry alloc] _initWithMessageSender:m_page]);
-        m_page.process().processPool().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page.pageID(), [m_remoteObjectRegistry remoteObjectRegistry]);
+        m_page->process().processPool().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page->pageID(), [m_remoteObjectRegistry remoteObjectRegistry]);
     }
 
     return m_remoteObjectRegistry.get();
 }
 
     }
 
     return m_remoteObjectRegistry.get();
 }
 
-void WebViewImpl::destroyRemoteObjectRegistry()
-{
-    if (!m_remoteObjectRegistry)
-        return;
-
-    m_page.process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page.pageID());
-    [m_remoteObjectRegistry _invalidate];
-    m_remoteObjectRegistry = nil;
-}
-
 WKBrowsingContextController *WebViewImpl::browsingContextController()
 {
     if (!m_browsingContextController)
 WKBrowsingContextController *WebViewImpl::browsingContextController()
 {
     if (!m_browsingContextController)
-        m_browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(&m_page)]);
+        m_browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(m_page.ptr())]);
 
     return m_browsingContextController.get();
 }
 
     return m_browsingContextController.get();
 }
@@ -2610,7 +2646,7 @@ void WebViewImpl::draggedImage(NSImage *image, CGPoint endPoint, NSDragOperation
     // Prevent queued mouseDragged events from coming after the drag and fake mouseUp event.
     m_ignoresMouseDraggedEvents = true;
 
     // Prevent queued mouseDragged events from coming after the drag and fake mouseUp event.
     m_ignoresMouseDraggedEvents = true;
 
-    m_page.dragEnded(WebCore::IntPoint(windowMouseLoc), WebCore::globalPoint(windowMouseLoc, m_view.window), operation);
+    m_page->dragEnded(WebCore::IntPoint(windowMouseLoc), WebCore::globalPoint(windowMouseLoc, m_view.window), operation);
 }
 
 static WebCore::DragApplicationFlags applicationFlagsForDrag(NSView *view, id <NSDraggingInfo> draggingInfo)
 }
 
 static WebCore::DragApplicationFlags applicationFlagsForDrag(NSView *view, id <NSDraggingInfo> draggingInfo)
@@ -2634,8 +2670,8 @@ NSDragOperation WebViewImpl::draggingEntered(id <NSDraggingInfo> draggingInfo)
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
 
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
 
-    m_page.resetCurrentDragInformation();
-    m_page.dragEntered(dragData, draggingInfo.draggingPasteboard.name);
+    m_page->resetCurrentDragInformation();
+    m_page->dragEntered(dragData, draggingInfo.draggingPasteboard.name);
     return NSDragOperationCopy;
 }
 
     return NSDragOperationCopy;
 }
 
@@ -2644,11 +2680,11 @@ NSDragOperation WebViewImpl::draggingUpdated(id <NSDraggingInfo> draggingInfo)
     WebCore::IntPoint client([m_view convertPoint:draggingInfo.draggingLocation fromView:nil]);
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
     WebCore::IntPoint client([m_view convertPoint:draggingInfo.draggingLocation fromView:nil]);
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
-    m_page.dragUpdated(dragData, draggingInfo.draggingPasteboard.name);
+    m_page->dragUpdated(dragData, draggingInfo.draggingPasteboard.name);
 
 
-    NSInteger numberOfValidItemsForDrop = m_page.currentDragNumberOfFilesToBeAccepted();
+    NSInteger numberOfValidItemsForDrop = m_page->currentDragNumberOfFilesToBeAccepted();
     NSDraggingFormation draggingFormation = NSDraggingFormationNone;
     NSDraggingFormation draggingFormation = NSDraggingFormationNone;
-    if (m_page.currentDragIsOverFileInput() && numberOfValidItemsForDrop > 0)
+    if (m_page->currentDragIsOverFileInput() && numberOfValidItemsForDrop > 0)
         draggingFormation = NSDraggingFormationList;
 
     if (draggingInfo.numberOfValidItemsForDrop != numberOfValidItemsForDrop)
         draggingFormation = NSDraggingFormationList;
 
     if (draggingInfo.numberOfValidItemsForDrop != numberOfValidItemsForDrop)
@@ -2656,7 +2692,7 @@ NSDragOperation WebViewImpl::draggingUpdated(id <NSDraggingInfo> draggingInfo)
     if (draggingInfo.draggingFormation != draggingFormation)
         [draggingInfo setDraggingFormation:draggingFormation];
 
     if (draggingInfo.draggingFormation != draggingFormation)
         [draggingInfo setDraggingFormation:draggingFormation];
 
-    return m_page.currentDragOperation();
+    return m_page->currentDragOperation();
 }
 
 void WebViewImpl::draggingExited(id <NSDraggingInfo> draggingInfo)
 }
 
 void WebViewImpl::draggingExited(id <NSDraggingInfo> draggingInfo)
@@ -2664,8 +2700,8 @@ void WebViewImpl::draggingExited(id <NSDraggingInfo> draggingInfo)
     WebCore::IntPoint client([m_view convertPoint:draggingInfo.draggingLocation fromView:nil]);
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
     WebCore::IntPoint client([m_view convertPoint:draggingInfo.draggingLocation fromView:nil]);
     WebCore::IntPoint global(WebCore::globalPoint(draggingInfo.draggingLocation, m_view.window));
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
-    m_page.dragExited(dragData, draggingInfo.draggingPasteboard.name);
-    m_page.resetCurrentDragInformation();
+    m_page->dragExited(dragData, draggingInfo.draggingPasteboard.name);
+    m_page->resetCurrentDragInformation();
 }
 
 bool WebViewImpl::prepareForDragOperation(id <NSDraggingInfo>)
 }
 
 bool WebViewImpl::prepareForDragOperation(id <NSDraggingInfo>)
@@ -2723,12 +2759,12 @@ bool WebViewImpl::performDragOperation(id <NSDraggingInfo> draggingInfo)
     SandboxExtension::Handle sandboxExtensionHandle;
     bool createdExtension = maybeCreateSandboxExtensionFromPasteboard(draggingInfo.draggingPasteboard, sandboxExtensionHandle);
     if (createdExtension)
     SandboxExtension::Handle sandboxExtensionHandle;
     bool createdExtension = maybeCreateSandboxExtensionFromPasteboard(draggingInfo.draggingPasteboard, sandboxExtensionHandle);
     if (createdExtension)
-        m_page.process().willAcquireUniversalFileReadSandboxExtension();
+        m_page->process().willAcquireUniversalFileReadSandboxExtension();
 
     SandboxExtension::HandleArray sandboxExtensionForUpload;
     createSandboxExtensionsForFileUpload(draggingInfo.draggingPasteboard, sandboxExtensionForUpload);
 
 
     SandboxExtension::HandleArray sandboxExtensionForUpload;
     createSandboxExtensionsForFileUpload(draggingInfo.draggingPasteboard, sandboxExtensionForUpload);
 
-    m_page.performDragOperation(dragData, draggingInfo.draggingPasteboard.name, sandboxExtensionHandle, sandboxExtensionForUpload);
+    m_page->performDragOperation(dragData, draggingInfo.draggingPasteboard.name, sandboxExtensionHandle, sandboxExtensionForUpload);
 
     return true;
 }
 
     return true;
 }
@@ -2959,7 +2995,7 @@ RefPtr<ViewSnapshot> WebViewImpl::takeViewSnapshot()
         windowCaptureRect = boundsForCustomSwipeViews;
     else {
         NSRect unobscuredBounds = m_view.bounds;
         windowCaptureRect = boundsForCustomSwipeViews;
     else {
         NSRect unobscuredBounds = m_view.bounds;
-        float topContentInset = m_page.topContentInset();
+        float topContentInset = m_page->topContentInset();
         unobscuredBounds.origin.y += topContentInset;
         unobscuredBounds.size.height -= topContentInset;
         windowCaptureRect = [m_view convertRect:unobscuredBounds toView:nil];
         unobscuredBounds.origin.y += topContentInset;
         unobscuredBounds.size.height -= topContentInset;
         windowCaptureRect = [m_view convertRect:unobscuredBounds toView:nil];
@@ -2984,12 +3020,12 @@ RefPtr<ViewSnapshot> WebViewImpl::takeViewSnapshot()
 
 void WebViewImpl::saveBackForwardSnapshotForCurrentItem()
 {
 
 void WebViewImpl::saveBackForwardSnapshotForCurrentItem()
 {
-    m_page.recordNavigationSnapshot();
+    m_page->recordNavigationSnapshot();
 }
 
 void WebViewImpl::saveBackForwardSnapshotForItem(WebBackForwardListItem& item)
 {
 }
 
 void WebViewImpl::saveBackForwardSnapshotForItem(WebBackForwardListItem& item)
 {
-    m_page.recordNavigationSnapshot(item);
+    m_page->recordNavigationSnapshot(item);
 }
 
 ViewGestureController& WebViewImpl::ensureGestureController()
 }
 
 ViewGestureController& WebViewImpl::ensureGestureController()
@@ -3002,8 +3038,8 @@ ViewGestureController& WebViewImpl::ensureGestureController()
 void WebViewImpl::setAllowsBackForwardNavigationGestures(bool allowsBackForwardNavigationGestures)
 {
     m_allowsBackForwardNavigationGestures = allowsBackForwardNavigationGestures;
 void WebViewImpl::setAllowsBackForwardNavigationGestures(bool allowsBackForwardNavigationGestures)
 {
     m_allowsBackForwardNavigationGestures = allowsBackForwardNavigationGestures;
-    m_page.setShouldRecordNavigationSnapshots(allowsBackForwardNavigationGestures);
-    m_page.setShouldUseImplicitRubberBandControl(allowsBackForwardNavigationGestures);
+    m_page->setShouldRecordNavigationSnapshots(allowsBackForwardNavigationGestures);
+    m_page->setShouldUseImplicitRubberBandControl(allowsBackForwardNavigationGestures);
 }
 
 void WebViewImpl::setAllowsMagnification(bool allowsMagnification)
 }
 
 void WebViewImpl::setAllowsMagnification(bool allowsMagnification)
@@ -3018,7 +3054,7 @@ void WebViewImpl::setMagnification(double magnification, CGPoint centerPoint)
 
     dismissContentRelativeChildWindowsWithAnimation(false);
 
 
     dismissContentRelativeChildWindowsWithAnimation(false);
 
-    m_page.scalePageInViewCoordinates(magnification, WebCore::roundedIntPoint(centerPoint));
+    m_page->scalePageInViewCoordinates(magnification, WebCore::roundedIntPoint(centerPoint));
 }
 
 void WebViewImpl::setMagnification(double magnification)
 }
 
 void WebViewImpl::setMagnification(double magnification)
@@ -3029,14 +3065,14 @@ void WebViewImpl::setMagnification(double magnification)
     dismissContentRelativeChildWindowsWithAnimation(false);
 
     WebCore::FloatPoint viewCenter(NSMidX([m_view bounds]), NSMidY([m_view bounds]));
     dismissContentRelativeChildWindowsWithAnimation(false);
 
     WebCore::FloatPoint viewCenter(NSMidX([m_view bounds]), NSMidY([m_view bounds]));
-    m_page.scalePageInViewCoordinates(magnification, roundedIntPoint(viewCenter));
+    m_page->scalePageInViewCoordinates(magnification, roundedIntPoint(viewCenter));
 }
 
 double WebViewImpl::magnification() const
 {
     if (m_gestureController)
         return m_gestureController->magnification();
 }
 
 double WebViewImpl::magnification() const
 {
     if (m_gestureController)
         return m_gestureController->magnification();
-    return m_page.pageScaleFactor();
+    return m_page->pageScaleFactor();
 }
 
 void WebViewImpl::setCustomSwipeViews(NSArray *customSwipeViews)
 }
 
 void WebViewImpl::setCustomSwipeViews(NSArray *customSwipeViews)
@@ -3094,7 +3130,7 @@ void WebViewImpl::scrollWheel(NSEvent *event)
         return;
 
     NativeWebWheelEvent webEvent = NativeWebWheelEvent(event, m_view);
         return;
 
     NativeWebWheelEvent webEvent = NativeWebWheelEvent(event, m_view);
-    m_page.handleWheelEvent(webEvent);
+    m_page->handleWheelEvent(webEvent);
 }
 
 void WebViewImpl::swipeWithEvent(NSEvent *event)
 }
 
 void WebViewImpl::swipeWithEvent(NSEvent *event)
@@ -3108,9 +3144,9 @@ void WebViewImpl::swipeWithEvent(NSEvent *event)
     }
 
     if (event.deltaX > 0.0)
     }
 
     if (event.deltaX > 0.0)
-        m_page.goBack();
+        m_page->goBack();
     else if (event.deltaX < 0.0)
     else if (event.deltaX < 0.0)
-        m_page.goForward();
+        m_page->goForward();
     else
         [m_view _superSwipeWithEvent:event];
 }
     else
         [m_view _superSwipeWithEvent:event];
 }
@@ -3120,7 +3156,7 @@ void WebViewImpl::magnifyWithEvent(NSEvent *event)
     if (!m_allowsMagnification) {
 #if ENABLE(MAC_GESTURE_EVENTS)
         NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
     if (!m_allowsMagnification) {
 #if ENABLE(MAC_GESTURE_EVENTS)
         NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
-        m_page.handleGestureEvent(webEvent);
+        m_page->handleGestureEvent(webEvent);
 #endif
         [m_view _superMagnifyWithEvent:event];
         return;
 #endif
         [m_view _superMagnifyWithEvent:event];
         return;
@@ -3137,7 +3173,7 @@ void WebViewImpl::magnifyWithEvent(NSEvent *event)
     }
 
     NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
     }
 
     NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
-    m_page.handleGestureEvent(webEvent);
+    m_page->handleGestureEvent(webEvent);
 #else
     gestureController.handleMagnificationGestureEvent(event, [m_view convertPoint:event.locationInWindow fromView:nil]);
 #endif
 #else
     gestureController.handleMagnificationGestureEvent(event, [m_view convertPoint:event.locationInWindow fromView:nil]);
 #endif
@@ -3169,7 +3205,7 @@ void WebViewImpl::setLastMouseDownEvent(NSEvent *event)
 void WebViewImpl::rotateWithEvent(NSEvent *event)
 {
     NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
 void WebViewImpl::rotateWithEvent(NSEvent *event)
 {
     NativeWebGestureEvent webEvent = NativeWebGestureEvent(event, m_view);
-    m_page.handleGestureEvent(webEvent);
+    m_page->handleGestureEvent(webEvent);
 }
 #endif
 
 }
 #endif
 
@@ -3320,7 +3356,7 @@ void WebViewImpl::doCommandBySelector(SEL selector)
         WebCore::KeypressCommand command(NSStringFromSelector(selector));
         keypressCommands->append(command);
         LOG(TextInput, "...stored");
         WebCore::KeypressCommand command(NSStringFromSelector(selector));
         keypressCommands->append(command);
         LOG(TextInput, "...stored");
-        m_page.registerKeypressCommandName(command.commandName);
+        m_page->registerKeypressCommandName(command.commandName);
     } else {
         // FIXME: Send the command to Editor synchronously and only send it along the
         // responder chain if it's a selector that does not correspond to an editing command.
     } else {
         // FIXME: Send the command to Editor synchronously and only send it along the
         // responder chain if it's a selector that does not correspond to an editing command.
@@ -3373,16 +3409,16 @@ void WebViewImpl::insertText(id string, NSRange replacementRange)
         WebCore::KeypressCommand command("insertText:", text);
         keypressCommands->append(command);
         LOG(TextInput, "...stored");
         WebCore::KeypressCommand command("insertText:", text);
         keypressCommands->append(command);
         LOG(TextInput, "...stored");
-        m_page.registerKeypressCommandName(command.commandName);
+        m_page->registerKeypressCommandName(command.commandName);
         return;
     }
 
     String eventText = text;
     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
     if (!dictationAlternatives.isEmpty())
         return;
     }
 
     String eventText = text;
     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
     if (!dictationAlternatives.isEmpty())
-        m_page.insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup);
+        m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup);
     else
     else
-        m_page.insertTextAsync(eventText, replacementRange, registerUndoGroup);
+        m_page->insertTextAsync(eventText, replacementRange, registerUndoGroup);
 }
 
 void WebViewImpl::selectedRangeWithCompletionHandler(void(^completionHandlerPtr)(NSRange selectedRange))
 }
 
 void WebViewImpl::selectedRangeWithCompletionHandler(void(^completionHandlerPtr)(NSRange selectedRange))
@@ -3390,7 +3426,7 @@ void WebViewImpl::selectedRangeWithCompletionHandler(void(^completionHandlerPtr)
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "selectedRange");
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "selectedRange");
-    m_page.getSelectedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
+    m_page->getSelectedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
         void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...selectedRange failed.");
         void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...selectedRange failed.");
@@ -3411,7 +3447,7 @@ void WebViewImpl::markedRangeWithCompletionHandler(void(^completionHandlerPtr)(N
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "markedRange");
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "markedRange");
-    m_page.getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
+    m_page->getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
         void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...markedRange failed.");
         void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...markedRange failed.");
@@ -3432,7 +3468,7 @@ void WebViewImpl::hasMarkedTextWithCompletionHandler(void(^completionHandlerPtr)
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "hasMarkedText");
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "hasMarkedText");
-    m_page.getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
+    m_page->getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, WebKit::CallbackBase::Error error) {
         void (^completionHandlerBlock)(BOOL) = (void (^)(BOOL))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...hasMarkedText failed.");
         void (^completionHandlerBlock)(BOOL) = (void (^)(BOOL))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...hasMarkedText failed.");
@@ -3450,7 +3486,7 @@ void WebViewImpl::attributedSubstringForProposedRange(NSRange proposedRange, voi
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "attributedSubstringFromRange:(%u, %u)", proposedRange.location, proposedRange.length);
     auto completionHandler = adoptNS([completionHandlerPtr copy]);
 
     LOG(TextInput, "attributedSubstringFromRange:(%u, %u)", proposedRange.location, proposedRange.length);
-    m_page.attributedSubstringForCharacterRangeAsync(proposedRange, [completionHandler](const AttributedString& string, const EditingRange& actualRange, WebKit::CallbackBase::Error error) {
+    m_page->attributedSubstringForCharacterRangeAsync(proposedRange, [completionHandler](const AttributedString& string, const EditingRange& actualRange, WebKit::CallbackBase::Error error) {
         void (^completionHandlerBlock)(NSAttributedString *, NSRange) = (void (^)(NSAttributedString *, NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...attributedSubstringFromRange failed.");
         void (^completionHandlerBlock)(NSAttributedString *, NSRange) = (void (^)(NSAttributedString *, NSRange))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...attributedSubstringFromRange failed.");
@@ -3481,7 +3517,7 @@ void WebViewImpl::firstRectForCharacterRange(NSRange range, void(^completionHand
     }
 
     auto weakThis = createWeakPtr();
     }
 
     auto weakThis = createWeakPtr();
-    m_page.firstRectForCharacterRangeAsync(range, [weakThis, completionHandler](const WebCore::IntRect& rect, const EditingRange& actualRange, WebKit::CallbackBase::Error error) {
+    m_page->firstRectForCharacterRangeAsync(range, [weakThis, completionHandler](const WebCore::IntRect& rect, const EditingRange& actualRange, WebKit::CallbackBase::Error error) {
         if (!weakThis)
             return;
 
         if (!weakThis)
             return;
 
@@ -3515,7 +3551,7 @@ void WebViewImpl::characterIndexForPoint(NSPoint point, void(^completionHandlerP
 #pragma clang diagnostic pop
     point = [m_view convertPoint:point fromView:nil];  // the point is relative to the main frame
 
 #pragma clang diagnostic pop
     point = [m_view convertPoint:point fromView:nil];  // the point is relative to the main frame
 
-    m_page.characterIndexForPointAsync(WebCore::IntPoint(point), [completionHandler](uint64_t result, WebKit::CallbackBase::Error error) {
+    m_page->characterIndexForPointAsync(WebCore::IntPoint(point), [completionHandler](uint64_t result, WebKit::CallbackBase::Error error) {
         void (^completionHandlerBlock)(NSUInteger) = (void (^)(NSUInteger))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...characterIndexForPoint failed.");
         void (^completionHandlerBlock)(NSUInteger) = (void (^)(NSUInteger))completionHandler.get();
         if (error != WebKit::CallbackBase::Error::None) {
             LOG(TextInput, "    ...characterIndexForPoint failed.");
@@ -3537,7 +3573,7 @@ NSTextInputContext *WebViewImpl::inputContext()
     }
 
     // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
     }
 
     // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
-    if (!m_page.editorState().isContentEditable)
+    if (!m_page->editorState().isContentEditable)
         return nil;
 
     return [m_view _superInputContext];
         return nil;
 
     return [m_view _superInputContext];
@@ -3547,7 +3583,7 @@ void WebViewImpl::unmarkText()
 {
     LOG(TextInput, "unmarkText");
 
 {
     LOG(TextInput, "unmarkText");
 
-    m_page.confirmCompositionAsync();
+    m_page->confirmCompositionAsync();
 }
 
 void WebViewImpl::setMarkedText(id string, NSRange selectedRange, NSRange replacementRange)
 }
 
 void WebViewImpl::setMarkedText(id string, NSRange selectedRange, NSRange replacementRange)
@@ -3570,17 +3606,17 @@ void WebViewImpl::setMarkedText(id string, NSRange selectedRange, NSRange replac
     if (inSecureInputState()) {
         // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField.
         // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard.
     if (inSecureInputState()) {
         // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField.
         // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard.
-        ASSERT(!m_page.editorState().hasComposition);
+        ASSERT(!m_page->editorState().hasComposition);
         notifyInputContextAboutDiscardedComposition();
         // FIXME: We should store the command to handle it after DOM event processing, as it's regular keyboard input now, not a composition.
         if ([text length] == 1 && isASCII([text characterAtIndex:0]))
         notifyInputContextAboutDiscardedComposition();
         // FIXME: We should store the command to handle it after DOM event processing, as it's regular keyboard input now, not a composition.
         if ([text length] == 1 && isASCII([text characterAtIndex:0]))
-            m_page.insertTextAsync(text, replacementRange);
+            m_page->insertTextAsync(text, replacementRange);
         else
             NSBeep();
         return;
     }
 
         else
             NSBeep();
         return;
     }
 
-    m_page.setCompositionAsync(text, underlines, selectedRange, replacementRange);
+    m_page->setCompositionAsync(text, underlines, selectedRange, replacementRange);
 }
 
 // Synchronous NSTextInputClient is still implemented to catch spurious sync calls. Remove when that is no longer needed.
 }
 
 // Synchronous NSTextInputClient is still implemented to catch spurious sync calls. Remove when that is no longer needed.
@@ -3653,7 +3689,7 @@ bool WebViewImpl::performKeyEquivalent(NSEvent *event)
     // FIXME: Why is the firstResponder check needed?
     if (m_view == m_view.window.firstResponder) {
         interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
     // FIXME: Why is the firstResponder check needed?
     if (m_view == m_view.window.firstResponder) {
         interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
-            m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+            m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
         });
         return YES;
     }
         });
         return YES;
     }
@@ -3670,7 +3706,7 @@ void WebViewImpl::keyUp(NSEvent *event)
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
         ASSERT(!handledByInputMethod || commands.isEmpty());
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
         ASSERT(!handledByInputMethod || commands.isEmpty());
-        m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     });
 }
 
     });
 }
 
@@ -3697,7 +3733,7 @@ void WebViewImpl::keyDown(NSEvent *event)
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
         ASSERT(!handledByInputMethod || commands.isEmpty());
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
         ASSERT(!handledByInputMethod || commands.isEmpty());
-        m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     });
 }
 
     });
 }
 
@@ -3713,7 +3749,7 @@ void WebViewImpl::flagsChanged(NSEvent *event)
         return;
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
         return;
 
     interpretKeyEvent(event, ^(BOOL handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands) {
-        m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
     });
 }
 
     });
 }
 
@@ -3769,7 +3805,7 @@ void WebViewImpl::executeSavedKeypressCommands()
     LOG(TextInput, "Executing %u saved keypress commands...", parameters->commands->size());
 
     parameters->executingSavedKeypressCommands = true;
     LOG(TextInput, "Executing %u saved keypress commands...", parameters->commands->size());
 
     parameters->executingSavedKeypressCommands = true;
-    parameters->eventInterpretationHadSideEffects |= m_page.executeKeypressCommands(*parameters->commands);
+    parameters->eventInterpretationHadSideEffects |= m_page->executeKeypressCommands(*parameters->commands);
     parameters->commands->clear();
     parameters->executingSavedKeypressCommands = false;
 
     parameters->commands->clear();
     parameters->executingSavedKeypressCommands = false;
 
@@ -3785,13 +3821,13 @@ void WebViewImpl::doCommandBySelector(SEL selector)
         parameters->consumedByIM = false;
 
     // As in insertText:replacementRange:, we assume that the call comes from an input method if there is marked text.
         parameters->consumedByIM = false;
 
     // As in insertText:replacementRange:, we assume that the call comes from an input method if there is marked text.
-    bool isFromInputMethod = m_page.editorState().hasComposition;
+    bool isFromInputMethod = m_page->editorState().hasComposition;
 
     if (parameters && !isFromInputMethod) {
         WebCore::KeypressCommand command(NSStringFromSelector(selector));
         parameters->commands->append(command);
         LOG(TextInput, "...stored");
 
     if (parameters && !isFromInputMethod) {
         WebCore::KeypressCommand command(NSStringFromSelector(selector));
         parameters->commands->append(command);
         LOG(TextInput, "...stored");
-        m_page.registerKeypressCommandName(command.commandName);
+        m_page->registerKeypressCommandName(command.commandName);
     } else {
         // FIXME: Send the command to Editor synchronously and only send it along the
         // responder chain if it's a selector that does not correspond to an editing command.
     } else {
         // FIXME: Send the command to Editor synchronously and only send it along the
         // responder chain if it's a selector that does not correspond to an editing command.
@@ -3821,7 +3857,7 @@ void WebViewImpl::insertText(id string, NSRange replacementRange)
         parameters->consumedByIM = false;
 
     NSString *text;
         parameters->consumedByIM = false;
 
     NSString *text;
-    bool isFromInputMethod = m_page.editorState().hasComposition;
+    bool isFromInputMethod = m_page->editorState().hasComposition;
 
     Vector<WebCore::TextAlternativeWithRange> dictationAlternatives;
 
 
     Vector<WebCore::TextAlternativeWithRange> dictationAlternatives;
 
@@ -3845,7 +3881,7 @@ void WebViewImpl::insertText(id string, NSRange replacementRange)
         ASSERT(replacementRange.location == NSNotFound);
         WebCore::KeypressCommand command("insertText:", text);
         parameters->commands->append(command);
         ASSERT(replacementRange.location == NSNotFound);
         WebCore::KeypressCommand command("insertText:", text);
         parameters->commands->append(command);
-        m_page.registerKeypressCommandName(command.commandName);
+        m_page->registerKeypressCommandName(command.commandName);
         return;
     }
 
         return;
     }
 
@@ -3853,9 +3889,9 @@ void WebViewImpl::insertText(id string, NSRange replacementRange)
     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
     bool eventHandled;
     if (!dictationAlternatives.isEmpty())
     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
     bool eventHandled;
     if (!dictationAlternatives.isEmpty())
-        eventHandled = m_page.insertDictatedText(eventText, replacementRange, dictationAlternatives);
+        eventHandled = m_page->insertDictatedText(eventText, replacementRange, dictationAlternatives);
     else
     else
-        eventHandled = m_page.insertText(eventText, replacementRange);
+        eventHandled = m_page->insertText(eventText, replacementRange);
 
     if (parameters)
         parameters->eventInterpretationHadSideEffects |= eventHandled;
 
     if (parameters)
         parameters->eventInterpretationHadSideEffects |= eventHandled;
@@ -3869,7 +3905,7 @@ NSTextInputContext *WebViewImpl::inputContext()
         return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
 
     // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
         return [[WKTextInputWindowController sharedTextInputWindowController] inputContext];
 
     // Disable text input machinery when in non-editable content. An invisible inline input area affects performance, and can prevent Expose from working.
-    if (!m_page.editorState().isContentEditable)
+    if (!m_page->editorState().isContentEditable)
         return nil;
 
     return [m_view _superInputContext];
         return nil;
 
     return [m_view _superInputContext];
@@ -3880,7 +3916,7 @@ NSRange WebViewImpl::selectedRange()
     executeSavedKeypressCommands();
 
     EditingRange selectedRange;
     executeSavedKeypressCommands();
 
     EditingRange selectedRange;
-    m_page.getSelectedRange(selectedRange);
+    m_page->getSelectedRange(selectedRange);
 
     NSRange result = selectedRange;
     if (result.location == NSNotFound)
 
     NSRange result = selectedRange;
     if (result.location == NSNotFound)
@@ -3897,15 +3933,15 @@ bool WebViewImpl::hasMarkedText()
 
     BOOL result;
     if (parameters) {
 
     BOOL result;
     if (parameters) {
-        result = m_page.editorState().hasComposition;
+        result = m_page->editorState().hasComposition;
         if (result) {
             // A saved command can confirm a composition, but it cannot start a new one.
             executeSavedKeypressCommands();
         if (result) {
             // A saved command can confirm a composition, but it cannot start a new one.
             executeSavedKeypressCommands();
-            result = m_page.editorState().hasComposition;
+            result = m_page->editorState().hasComposition;
         }
     } else {
         EditingRange markedRange;
         }
     } else {
         EditingRange markedRange;
-        m_page.getMarkedRange(markedRange);
+        m_page->getMarkedRange(markedRange);
         result = markedRange.location != notFound;
     }
 
         result = markedRange.location != notFound;
     }
 
@@ -3926,7 +3962,7 @@ void WebViewImpl::unmarkText()
         parameters->consumedByIM = false;
     }
 
         parameters->consumedByIM = false;
     }
 
-    m_page.confirmComposition();
+    m_page->confirmComposition();
 }
 
 void WebViewImpl::setMarkedText(id string, NSRange newSelectedRange, NSRange replacementRange)
 }
 
 void WebViewImpl::setMarkedText(id string, NSRange newSelectedRange, NSRange replacementRange)
@@ -3955,19 +3991,19 @@ void WebViewImpl::setMarkedText(id string, NSRange newSelectedRange, NSRange rep
     } else
         text = string;
 
     } else
         text = string;
 
-    if (m_page.editorState().isInPasswordField) {
+    if (m_page->editorState().isInPasswordField) {
         // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField.
         // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard.
         // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField.
         // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard.
-        ASSERT(!m_page.editorState().hasComposition);
+        ASSERT(!m_page->editorState().hasComposition);
         notifyInputContextAboutDiscardedComposition();
         if ([text length] == 1 && [[text decomposedStringWithCanonicalMapping] characterAtIndex:0] < 0x80) {
         notifyInputContextAboutDiscardedComposition();
         if ([text length] == 1 && [[text decomposedStringWithCanonicalMapping] characterAtIndex:0] < 0x80) {
-            m_page.insertText(text, replacementRange);
+            m_page->insertText(text, replacementRange);
         } else
             NSBeep();
         return;
     }
 
         } else
             NSBeep();
         return;
     }
 
-    m_page.setComposition(text, underlines, newSelectedRange, replacementRange);
+    m_page->setComposition(text, underlines, newSelectedRange, replacementRange);
 }
 
 NSRange WebViewImpl::markedRange()
 }
 
 NSRange WebViewImpl::markedRange()
@@ -3975,7 +4011,7 @@ NSRange WebViewImpl::markedRange()
     executeSavedKeypressCommands();
 
     EditingRange markedRange;
     executeSavedKeypressCommands();
 
     EditingRange markedRange;
-    m_page.getMarkedRange(markedRange);
+    m_page->getMarkedRange(markedRange);
 
     NSRange result = markedRange;
     if (result.location == NSNotFound)
 
     NSRange result = markedRange;
     if (result.location == NSNotFound)
@@ -3990,16 +4026,16 @@ NSAttributedString *WebViewImpl::attributedSubstringForProposedRange(NSRange pro
 {
     executeSavedKeypressCommands();
 
 {
     executeSavedKeypressCommands();
 
-    if (!m_page.editorState().isContentEditable) {
+    if (!m_page->editorState().isContentEditable) {
         LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", proposedRange.location, proposedRange.length);
         return nil;
     }
 
         LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", proposedRange.location, proposedRange.length);
         return nil;
     }
 
-    if (m_page.editorState().isInPasswordField)
+    if (m_page->editorState().isInPasswordField)
         return nil;
 
     AttributedString result;
         return nil;
 
     AttributedString result;
-    m_page.getAttributedSubstringFromRange(proposedRange, result);
+    m_page->getAttributedSubstringFromRange(proposedRange, result);
 
     if (actualRange) {
         *actualRange = proposedRange;
 
     if (actualRange) {
         *actualRange = proposedRange;
@@ -4023,7 +4059,7 @@ NSUInteger WebViewImpl::characterIndexForPoint(NSPoint point)
 #pragma clang diagnostic pop
     point = [m_view convertPoint:point fromView:nil];  // the point is relative to the main frame
     
 #pragma clang diagnostic pop
     point = [m_view convertPoint:point fromView:nil];  // the point is relative to the main frame
     
-    uint64_t result = m_page.characterIndexForPoint(WebCore::IntPoint(point));
+    uint64_t result = m_page->characterIndexForPoint(WebCore::IntPoint(point));
     if (result == notFound)
         result = NSNotFound;
     LOG(TextInput, "characterIndexForPoint:(%f, %f) -> %u", point.x, point.y, result);
     if (result == notFound)
         result = NSNotFound;
     LOG(TextInput, "characterIndexForPoint:(%f, %f) -> %u", point.x, point.y, result);
@@ -4047,7 +4083,7 @@ NSRect WebViewImpl::firstRectForCharacterRange(NSRange range, NSRangePointer act
         return NSZeroRect;
     }
 
         return NSZeroRect;
     }
 
-    NSRect resultRect = m_page.firstRectForCharacterRange(range);
+    NSRect resultRect = m_page->firstRectForCharacterRange(range);
     resultRect = [m_view convertRect:resultRect toView:nil];
     resultRect = [m_view.window convertRectToScreen:resultRect];
 
     resultRect = [m_view convertRect:resultRect toView:nil];
     resultRect = [m_view.window convertRectToScreen:resultRect];
 
@@ -4093,7 +4129,7 @@ bool WebViewImpl::performKeyEquivalent(NSEvent *event)
     if (m_view == m_view.window.firstResponder) {
         Vector<WebCore::KeypressCommand> commands;
         bool handledByInputMethod = interpretKeyEvent(event, commands);
     if (m_view == m_view.window.firstResponder) {
         Vector<WebCore::KeypressCommand> commands;
         bool handledByInputMethod = interpretKeyEvent(event, commands);
-        m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+        m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
         return true;
     }
     
         return true;
     }
     
@@ -4107,7 +4143,7 @@ void WebViewImpl::keyUp(NSEvent *event)
 
     LOG(TextInput, "keyUp:%p %@", event, event);
     // We don't interpret the keyUp event, as this breaks key bindings (see <https://bugs.webkit.org/show_bug.cgi?id=130100>).
 
     LOG(TextInput, "keyUp:%p %@", event, event);
     // We don't interpret the keyUp event, as this breaks key bindings (see <https://bugs.webkit.org/show_bug.cgi?id=130100>).
-    m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, false, { }));
+    m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, false, { }));
 }
 
 void WebViewImpl::keyDown(NSEvent *event)
 }
 
 void WebViewImpl::keyDown(NSEvent *event)
@@ -4145,7 +4181,7 @@ void WebViewImpl::keyDown(NSEvent *event)
         handledByInputMethod = false;
     }
 
         handledByInputMethod = false;
     }
 
-    m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
+    m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, handledByInputMethod, commands));
 }
 
 void WebViewImpl::flagsChanged(NSEvent *event)
 }
 
 void WebViewImpl::flagsChanged(NSEvent *event)
@@ -4164,7 +4200,7 @@ void WebViewImpl::flagsChanged(NSEvent *event)
     if (eventKeyCodeIsZeroOrNumLockOrFn(event))
         return;
 
     if (eventKeyCodeIsZeroOrNumLockOrFn(event))
         return;
 
-    m_page.handleKeyboardEvent(NativeWebKeyboardEvent(event, false, { }));
+    m_page->handleKeyboardEvent(NativeWebKeyboardEvent(event, false, { }));
 }
 
 #endif // USE(ASYNC_NSTEXTINPUTCLIENT)
 }
 
 #endif // USE(ASYNC_NSTEXTINPUTCLIENT)
@@ -4185,13 +4221,13 @@ void WebViewImpl::flagsChanged(NSEvent *event)
                     LOG(TextInput, "%s was handled by text input context", String(#EventName).substring(0, String(#EventName).find("Internal")).ascii().data()); \
                 else { \
                     NativeWebMouseEvent webEvent(retainedEvent.get(), weakThis->m_lastPressureEvent.get(), weakThis->m_view); \
                     LOG(TextInput, "%s was handled by text input context", String(#EventName).substring(0, String(#EventName).find("Internal")).ascii().data()); \
                 else { \
                     NativeWebMouseEvent webEvent(retainedEvent.get(), weakThis->m_lastPressureEvent.get(), weakThis->m_view); \
-                    weakThis->m_page.handleMouseEvent(webEvent); \
+                    weakThis->m_page->handleMouseEvent(webEvent); \
                 } \
             }]; \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
                 } \
             }]; \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
-        m_page.handleMouseEvent(webEvent); \
+        m_page->handleMouseEvent(webEvent); \
     }
 #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(EventName) \
     void WebViewImpl::EventName(NSEvent *event) \
     }
 #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(EventName) \
     void WebViewImpl::EventName(NSEvent *event) \
@@ -4208,13 +4244,13 @@ void WebViewImpl::flagsChanged(NSEvent *event)
                     LOG(TextInput, "%s was handled by text input context", String(#EventName).substring(0, String(#EventName).find("Internal")).ascii().data()); \
                 else { \
                     NativeWebMouseEvent webEvent(retainedEvent.get(), weakThis->m_lastPressureEvent.get(), weakThis->m_view); \
                     LOG(TextInput, "%s was handled by text input context", String(#EventName).substring(0, String(#EventName).find("Internal")).ascii().data()); \
                 else { \
                     NativeWebMouseEvent webEvent(retainedEvent.get(), weakThis->m_lastPressureEvent.get(), weakThis->m_view); \
-                    weakThis->m_page.handleMouseEvent(webEvent); \
+                    weakThis->m_page->handleMouseEvent(webEvent); \
                 } \
             }]; \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
                 } \
             }]; \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
-        m_page.handleMouseEvent(webEvent); \
+        m_page->handleMouseEvent(webEvent); \
     }
     
 #else // USE(ASYNC_NSTEXTINPUTCLIENT)
     }
     
 #else // USE(ASYNC_NSTEXTINPUTCLIENT)
@@ -4228,7 +4264,7 @@ void WebViewImpl::flagsChanged(NSEvent *event)
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
-        m_page.handleMouseEvent(webEvent); \
+        m_page->handleMouseEvent(webEvent); \
     }
 #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(EventName) \
     void WebViewImpl::EventName(NSEvent *event) \
     }
 #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(EventName) \
     void WebViewImpl::EventName(NSEvent *event) \
@@ -4240,7 +4276,7 @@ void WebViewImpl::flagsChanged(NSEvent *event)
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
             return; \
         } \
         NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view); \
-        m_page.handleMouseEvent(webEvent); \
+        m_page->handleMouseEvent(webEvent); \
     }
 #endif // USE(ASYNC_NSTEXTINPUTCLIENT)
 
     }
 #endif // USE(ASYNC_NSTEXTINPUTCLIENT)
 
index cfbdb442f117ee4ac34a0dfdd0f72758465e9899..5a946868020f9d630ffc64832f81a3d81e539d21 100644 (file)
@@ -986,10 +986,10 @@ public:
     void didSaveToPageCache();
         
     void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
     void didSaveToPageCache();
         
     void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
-    WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
+    WebCore::ScrollPinningBehavior scrollPinningBehavior() const { return m_scrollPinningBehavior; }
 
     void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle>);
 
     void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle>);
-    WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() { return m_scrollbarOverlayStyle; }
+    WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const { return m_scrollbarOverlayStyle; }
 
     bool shouldRecordNavigationSnapshots() const { return m_shouldRecordNavigationSnapshots; }
     void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
 
     bool shouldRecordNavigationSnapshots() const { return m_shouldRecordNavigationSnapshots; }
     void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
index d44dac0050cd4ede0f62156e03afecff211776dc..a29a533b4dea08c7d1132eca7e55bdd3ec051ac8 100644 (file)
@@ -836,7 +836,7 @@ WebProcessProxy& WebProcessPool::createNewWebProcessRespectingProcessCountLimit(
     return *process;
 }
 
     return *process;
 }
 
-PassRefPtr<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API::PageConfiguration>&& pageConfiguration)
+Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API::PageConfiguration>&& pageConfiguration)
 {
     if (!pageConfiguration->pageGroup())
         pageConfiguration->setPageGroup(m_defaultPageGroup.ptr());
 {
     if (!pageConfiguration->pageGroup())
         pageConfiguration->setPageGroup(m_defaultPageGroup.ptr());
index 5f3e26700bacdbb51f4de23ccff69c2fce81c698..cff06f10be98df2d804da4be69381bc586d5a1a1 100644 (file)
@@ -171,7 +171,7 @@ public:
 
     API::WebsiteDataStore* websiteDataStore() const { return m_websiteDataStore.get(); }
 
 
     API::WebsiteDataStore* websiteDataStore() const { return m_websiteDataStore.get(); }
 
-    PassRefPtr<WebPageProxy> createWebPage(PageClient&, Ref<API::PageConfiguration>&&);
+    Ref<WebPageProxy> createWebPage(PageClient&, Ref<API::PageConfiguration>&&);
 
     const String& injectedBundlePath() const { return m_configuration->injectedBundlePath(); }
 
 
     const String& injectedBundlePath() const { return m_configuration->injectedBundlePath(); }
 
index d186a12fdc84745f13d5a4b9523105fc81ac838c..4a91c049881e70a47eea45fd60037743c33a441c 100644 (file)
@@ -51,7 +51,7 @@ class PageClientImpl final : public PageClient
 #endif
     {
 public:
 #endif
     {
 public:
-    PageClientImpl(WKView *, WKWebView *);
+    PageClientImpl(NSView *, WKWebView *);
     virtual ~PageClientImpl();
 
     // FIXME: Eventually WebViewImpl should become the PageClient.
     virtual ~PageClientImpl();
 
     // FIXME: Eventually WebViewImpl should become the PageClient.
@@ -224,7 +224,7 @@ private:
     virtual _WKRemoteObjectRegistry *remoteObjectRegistry() override;
 #endif
 
     virtual _WKRemoteObjectRegistry *remoteObjectRegistry() override;
 #endif
 
-    WKView *m_wkView;
+    NSView *m_view;
     WKWebView *m_webView;
     WebViewImpl* m_impl { nullptr };
 #if USE(AUTOCORRECTION_PANEL)
     WKWebView *m_webView;
     WebViewImpl* m_impl { nullptr };
 #if USE(AUTOCORRECTION_PANEL)
index d4f0ab33b96790a8fbcabbcab640785aea2755c7..0513cad5dabb0fc3704b2f48761d18f459bae236 100644 (file)
@@ -93,8 +93,8 @@ using namespace WebKit;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-PageClientImpl::PageClientImpl(WKView* wkView, WKWebView *webView)
-    : m_wkView(wkView)
+PageClientImpl::PageClientImpl(NSView* view, WKWebView *webView)
+    : m_view(view)
     , m_webView(webView)
 #if USE(DICTATION_ALTERNATIVES)
     , m_alternativeTextUIController(std::make_unique<AlternativeTextUIController>())
     , m_webView(webView)
 #if USE(DICTATION_ALTERNATIVES)
     , m_alternativeTextUIController(std::make_unique<AlternativeTextUIController>())
@@ -141,27 +141,27 @@ void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPo
 
 IntSize PageClientImpl::viewSize()
 {
 
 IntSize PageClientImpl::viewSize()
 {
-    return IntSize([m_wkView bounds].size);
+    return IntSize([m_view bounds].size);
 }
 
 NSView *PageClientImpl::activeView() const
 {
 #if WK_API_ENABLED
 }
 
 NSView *PageClientImpl::activeView() const
 {
 #if WK_API_ENABLED
-    return m_wkView._thumbnailView ? (NSView *)m_wkView._thumbnailView : (NSView *)m_wkView;
+    return (m_impl && m_impl->thumbnailView()) ? (NSView *)m_impl->thumbnailView() : m_view;
 #else
 #else
-    return m_wkView;
+    return m_view;
 #endif
 }
 
 NSWindow *PageClientImpl::activeWindow() const
 {
 #if WK_API_ENABLED
 #endif
 }
 
 NSWindow *PageClientImpl::activeWindow() const
 {
 #if WK_API_ENABLED
-    if (m_wkView._thumbnailView)
-        return m_wkView._thumbnailView.window;
+    if (m_impl && m_impl->thumbnailView())
+        return m_impl->thumbnailView().window;
 #endif
     if (m_impl && m_impl->targetWindowForMovePreparation())
         return m_impl->targetWindowForMovePreparation();
 #endif
     if (m_impl && m_impl->targetWindowForMovePreparation())
         return m_impl->targetWindowForMovePreparation();
-    return m_wkView.window;
+    return m_view.window;
 }
 
 bool PageClientImpl::isViewWindowActive()
 }
 
 bool PageClientImpl::isViewWindowActive()
@@ -182,7 +182,7 @@ bool PageClientImpl::isViewFocused()
 
 void PageClientImpl::makeFirstResponder()
 {
 
 void PageClientImpl::makeFirstResponder()
 {
-     [[m_wkView window] makeFirstResponder:m_wkView];
+     [[m_view window] makeFirstResponder:m_view];
 }
     
 bool PageClientImpl::isViewVisible()
 }
     
 bool PageClientImpl::isViewVisible()
@@ -287,7 +287,7 @@ void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
 
 void PageClientImpl::didChangeContentSize(const WebCore::IntSize& newSize)
 {
 
 void PageClientImpl::didChangeContentSize(const WebCore::IntSize& newSize)
 {
-    [m_wkView _didChangeContentSize:newSize];
+    m_impl->didChangeContentSize(newSize);
 }
 
 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
 }
 
 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
@@ -297,10 +297,10 @@ void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
     if ([NSApp _cursorRectCursor])
         return;
 
     if ([NSApp _cursorRectCursor])
         return;
 
-    if (!m_wkView)
+    if (!m_view)
         return;
 
         return;
 
-    NSWindow *window = [m_wkView window];
+    NSWindow *window = [m_view window];
     if (!window)
         return;
 
     if (!window)
         return;
 
@@ -331,7 +331,7 @@ void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpComm
 #if USE(INSERTION_UNDO_GROUPING)
 void PageClientImpl::registerInsertionUndoGrouping()
 {
 #if USE(INSERTION_UNDO_GROUPING)
 void PageClientImpl::registerInsertionUndoGrouping()
 {
-    registerInsertionUndoGroupingWithUndoManager([m_wkView undoManager]);
+    registerInsertionUndoGroupingWithUndoManager([m_view undoManager]);
 }
 #endif
 
 }
 #endif
 
@@ -342,12 +342,12 @@ void PageClientImpl::clearAllEditCommands()
 
 bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
 {
 
 bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
 {
-    return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] canUndo] : [[m_wkView undoManager] canRedo];
+    return (undoOrRedo == WebPageProxy::Undo) ? [[m_view undoManager] canUndo] : [[m_view undoManager] canRedo];
 }
 
 void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
 {
 }
 
 void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
 {
-    return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] undo] : [[m_wkView undoManager] redo];
+    return (undoOrRedo == WebPageProxy::Undo) ? [[m_view undoManager] undo] : [[m_view undoManager] redo];
 }
 
 void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
 }
 
 void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
@@ -355,16 +355,16 @@ void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<Sha
     RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
     RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
     IntSize size([dragNSImage size]);
     RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
     RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
     IntSize size([dragNSImage size]);
-    size.scale(1.0 / toImpl([m_wkView pageRef])->deviceScaleFactor());
+    size.scale(1.0 / m_impl->page().deviceScaleFactor());
     [dragNSImage setSize:size];
 
 #if WK_API_ENABLED
     if (m_webView) {
     [dragNSImage setSize:size];
 
 #if WK_API_ENABLED
     if (m_webView) {
-        NSPoint webViewPosition = [m_wkView convertPoint:clientPosition toView:m_webView];
+        NSPoint webViewPosition = [m_view convertPoint:clientPosition toView:m_webView];
         m_impl->dragImageForView(m_webView, dragNSImage.get(), webViewPosition, isLinkDrag);
     } else
 #endif
         m_impl->dragImageForView(m_webView, dragNSImage.get(), webViewPosition, isLinkDrag);
     } else
 #endif
-        m_impl->dragImageForView(m_wkView, dragNSImage.get(), clientPosition, isLinkDrag);
+        m_impl->dragImageForView(m_view, dragNSImage.get(), clientPosition, isLinkDrag);
 }
 
 void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL, PassRefPtr<SharedBuffer> archiveBuffer)
 }
 
 void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL, PassRefPtr<SharedBuffer> archiveBuffer)
@@ -405,30 +405,30 @@ void PageClientImpl::notifyApplicationAboutInputContextChange()
 
 FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
 {
 
 FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
 {
-    return toDeviceSpace(rect, [m_wkView window]);
+    return toDeviceSpace(rect, [m_view window]);
 }
 
 FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
 {
 }
 
 FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
 {
-    return toUserSpace(rect, [m_wkView window]);
+    return toUserSpace(rect, [m_view window]);
 }
    
 IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
 {
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 }
    
 IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
 {
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    NSPoint windowCoord = [[m_wkView window] convertScreenToBase:point];
+    NSPoint windowCoord = [[m_view window] convertScreenToBase:point];
 #pragma clang diagnostic pop
 #pragma clang diagnostic pop
-    return IntPoint([m_wkView convertPoint:windowCoord fromView:nil]);
+    return IntPoint([m_view convertPoint:windowCoord fromView:nil]);
 }
     
 IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
 {
     NSRect tempRect = rect;
 }
     
 IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
 {
     NSRect tempRect = rect;
-    tempRect = [m_wkView convertRect:tempRect toView:nil];
+    tempRect = [m_view convertRect:tempRect toView:nil];
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    tempRect.origin = [[m_wkView window] convertBaseToScreen:tempRect.origin];
+    tempRect.origin = [[m_view window] convertBaseToScreen:tempRect.origin];
 #pragma clang diagnostic pop
     return enclosingIntRect(tempRect);
 }
 #pragma clang diagnostic pop
     return enclosingIntRect(tempRect);
 }
@@ -440,20 +440,20 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
 
 RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy& page)
 {
 
 RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy& page)
 {
-    return WebPopupMenuProxyMac::create(m_wkView, page);
+    return WebPopupMenuProxyMac::create(m_view, page);
 }
 
 #if ENABLE(CONTEXT_MENUS)
 std::unique_ptr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy& page, const ContextMenuContextData& context, const UserData& userData)
 {
 }
 
 #if ENABLE(CONTEXT_MENUS)
 std::unique_ptr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy& page, const ContextMenuContextData& context, const UserData& userData)
 {
-    return std::make_unique<WebContextMenuProxyMac>(m_wkView, page, context, userData);
+    return std::make_unique<WebContextMenuProxyMac>(m_view, page, context, userData);
 }
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
 RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor,  const WebCore::IntRect& rect)
 {
 }
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
 RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor,  const WebCore::IntRect& rect)
 {
-    return WebColorPickerMac::create(page, initialColor, rect, m_wkView);
+    return WebColorPickerMac::create(page, initialColor, rect, m_view);
 }
 #endif
 
 }
 #endif
 
@@ -531,7 +531,7 @@ void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&
 #if ENABLE(MAC_GESTURE_EVENTS)
 void PageClientImpl::gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent& event)
 {
 #if ENABLE(MAC_GESTURE_EVENTS)
 void PageClientImpl::gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent& event)
 {
-    [m_wkView _gestureEventWasNotHandledByWebCore:event.nativeEvent()];
+    m_impl->gestureEventWasNotHandledByWebCore(event.nativeEvent());
 }
 #endif
 
 }
 #endif
 
@@ -549,14 +549,14 @@ void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dicti
 {
     m_impl->prepareForDictionaryLookup();
 
 {
     m_impl->prepareForDictionaryLookup();
 
-    DictionaryLookup::showPopup(dictionaryPopupInfo, m_wkView, [this](TextIndicator& textIndicator) {
+    DictionaryLookup::showPopup(dictionaryPopupInfo, m_view, [this](TextIndicator& textIndicator) {
         m_impl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
     });
 }
 
 void PageClientImpl::dismissContentRelativeChildWindows(bool withAnimation)
 {
         m_impl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
     });
 }
 
 void PageClientImpl::dismissContentRelativeChildWindows(bool withAnimation)
 {
-    [m_wkView _dismissContentRelativeChildWindowsWithAnimation:withAnimation];
+    m_impl->dismissContentRelativeChildWindowsWithAnimation(withAnimation);
 }
 
 void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
 }
 
 void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
@@ -564,7 +564,7 @@ void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRe
 #if USE(AUTOCORRECTION_PANEL)
     if (!isViewVisible() || !isViewInWindow())
         return;
 #if USE(AUTOCORRECTION_PANEL)
     if (!isViewVisible() || !isViewInWindow())
         return;
-    m_correctionPanel.show(m_wkView, *m_impl, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
+    m_correctionPanel.show(m_view, *m_impl, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
 #endif
 }
 
 #endif
 }
 
@@ -587,7 +587,7 @@ String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAl
 void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
 {
     NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
 void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
 {
     NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
-    CorrectionPanel::recordAutocorrectionResponse(m_wkView, m_impl->spellCheckerDocumentTag(), response, replacedString, replacementString);
+    CorrectionPanel::recordAutocorrectionResponse(m_view, m_impl->spellCheckerDocumentTag(), response, replacedString, replacementString);
 }
 
 void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
 }
 
 void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
@@ -599,7 +599,7 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
     else
         options |= NSTrackingActiveInKeyWindow;
 
     else
         options |= NSTrackingActiveInKeyWindow;
 
-    RetainPtr<NSTrackingArea> trackingArea = adoptNS([[NSTrackingArea alloc] initWithRect:[m_wkView frame] options:options owner:m_wkView userInfo:nil]);
+    RetainPtr<NSTrackingArea> trackingArea = adoptNS([[NSTrackingArea alloc] initWithRect:[m_view frame] options:options owner:m_view userInfo:nil]);
     m_impl->setPrimaryTrackingArea(trackingArea.get());
 }
 
     m_impl->setPrimaryTrackingArea(trackingArea.get());
 }
 
@@ -635,7 +635,7 @@ void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundi
 {
     if (!isViewVisible() || !isViewInWindow())
         return;
 {
     if (!isViewVisible() || !isViewInWindow())
         return;
-    m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
+    m_alternativeTextUIController->showAlternatives(m_view, boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
         m_impl->handleAcceptedAlternativeText(acceptedAlternative);
     });
 }
         m_impl->handleAcceptedAlternativeText(acceptedAlternative);
     });
 }
@@ -783,7 +783,7 @@ void PageClientImpl::didChangeBackgroundColor()
 
 CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
 {
 
 CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
 {
-    CALayer *windowContentLayer = static_cast<NSView *>(m_wkView.window.contentView).layer;
+    CALayer *windowContentLayer = static_cast<NSView *>(m_view.window.contentView).layer;
     ASSERT(windowContentLayer);
 
     return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
     ASSERT(windowContentLayer);
 
     return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
@@ -802,12 +802,12 @@ void* PageClientImpl::immediateActionAnimationControllerForHitTestResult(RefPtr<
     if (m_webView)
         return [m_webView _immediateActionAnimationControllerForHitTestResult:wrapper(*hitTestResult) withType:(_WKImmediateActionType)type userData:(id)(userData.get())];
 #endif
     if (m_webView)
         return [m_webView _immediateActionAnimationControllerForHitTestResult:wrapper(*hitTestResult) withType:(_WKImmediateActionType)type userData:(id)(userData.get())];
 #endif
-    return m_impl->immediateActionAnimationControllerForHitTestResult(toAPI(hitTestResult.get()), type, toAPI(userData.get()));
+    return m_impl->immediateActionAnimationControllerForHitTestResult(hitTestResult.get(), type, userData.get());
 }
 
 void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
 {
 }
 
 void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
 {
-    [menu popUpMenuPositioningItem:nil atLocation:location inView:m_wkView];
+    [menu popUpMenuPositioningItem:nil atLocation:location inView:m_view];
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -819,12 +819,12 @@ WebCore::WebMediaSessionManager& PageClientImpl::mediaSessionManager()
 
 void PageClientImpl::refView()
 {
 
 void PageClientImpl::refView()
 {
-    CFRetain(m_wkView);
+    CFRetain(m_view);
 }
 
 void PageClientImpl::derefView()
 {
 }
 
 void PageClientImpl::derefView()
 {
-    CFRelease(m_wkView);
+    CFRelease(m_view);
 }
 
 void PageClientImpl::startWindowDrag()
 }
 
 void PageClientImpl::startWindowDrag()
index cf2f6e860255627d148e8b7ce563e269546637e1..45787299f1bd6485cc186ccec3766a198fd2223c 100644 (file)
@@ -37,7 +37,6 @@
 #if USE(APPKIT)
 
 #import "WebColorPicker.h"
 #if USE(APPKIT)
 
 #import "WebColorPicker.h"
-#import "WKView.h"
 #import <WebCore/IntRect.h>
 #include <wtf/RetainPtr.h>
 
 #import <WebCore/IntRect.h>
 #include <wtf/RetainPtr.h>
 
@@ -60,7 +59,7 @@ namespace WebKit {
     
 class WebColorPickerMac : public WebColorPicker {
 public:        
     
 class WebColorPickerMac : public WebColorPicker {
 public:        
-    static Ref<WebColorPickerMac> create(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, WKView*);
+    static Ref<WebColorPickerMac> create(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, NSView*);
     ~WebColorPickerMac();
 
     virtual void endPicker() override;
     ~WebColorPickerMac();
 
     virtual void endPicker() override;
@@ -70,7 +69,7 @@ public:
     void didChooseColor(const WebCore::Color&);
 
 private:
     void didChooseColor(const WebCore::Color&);
 
 private:
-    WebColorPickerMac(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, WKView*);
+    WebColorPickerMac(WebColorPicker::Client*, const WebCore::Color&, const WebCore::IntRect&, NSView*);
     RetainPtr<NSObject<WKColorPickerUIMac> > m_colorPickerUI;
 };
 
     RetainPtr<NSObject<WKColorPickerUIMac> > m_colorPickerUI;
 };
 
index 26ac69fed669d95d6e6e5dc199f34fb7161e8af7..8e0027066b4b600375c7f32f4e283ac2e7883000 100644 (file)
@@ -58,7 +58,7 @@ using namespace WebKit;
     WebColorPickerMac *_picker;
     RetainPtr<NSPopoverColorWell> _popoverWell;
 }
     WebColorPickerMac *_picker;
     RetainPtr<NSPopoverColorWell> _popoverWell;
 }
-- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(WKView *)view;
+- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(NSView *)view;
 @end
 
 #else
 @end
 
 #else
@@ -75,7 +75,7 @@ using namespace WebKit;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-Ref<WebColorPickerMac> WebColorPickerMac::create(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, WKView* view)
+Ref<WebColorPickerMac> WebColorPickerMac::create(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, NSView* view)
 {
     return adoptRef(*new WebColorPickerMac(client, initialColor, rect, view));
 }
 {
     return adoptRef(*new WebColorPickerMac(client, initialColor, rect, view));
 }
@@ -86,7 +86,7 @@ WebColorPickerMac::~WebColorPickerMac()
         endPicker();
 }
 
         endPicker();
 }
 
-WebColorPickerMac::WebColorPickerMac(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, WKView* view)
+WebColorPickerMac::WebColorPickerMac(WebColorPicker::Client* client, const WebCore::Color& initialColor, const WebCore::IntRect& rect, NSView* view)
     : WebColorPicker(client)
 {
 #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
     : WebColorPicker(client)
 {
 #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
@@ -136,7 +136,7 @@ void WebColorPickerMac::showColorPicker(const WebCore::Color& color)
 #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
 
 @implementation WKColorPopoverMac
 #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
 
 @implementation WKColorPopoverMac
-- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(WKView *)view
+- (id)initWithFrame:(const WebCore::IntRect &)rect inView:(NSView *)view
 {
     if(!(self = [super init]))
         return self;
 {
     if(!(self = [super init]))
         return self;
index 1b2b076e39b4eb188d3c58199b7444c2db0f7b7b..bdd17edec764025fe602fccf306dd106c5a06e4a 100644 (file)
@@ -32,8 +32,8 @@
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS NSPopUpButtonCell;
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS NSPopUpButtonCell;
+OBJC_CLASS NSView;
 OBJC_CLASS NSWindow;
 OBJC_CLASS NSWindow;
-OBJC_CLASS WKView;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
@@ -44,7 +44,7 @@ class WebPageProxy;
 
 class WebContextMenuProxyMac : public WebContextMenuProxy {
 public:
 
 class WebContextMenuProxyMac : public WebContextMenuProxy {
 public:
-    WebContextMenuProxyMac(WKView*, WebPageProxy&, const ContextMenuContextData&, const UserData&);
+    WebContextMenuProxyMac(NSView*, WebPageProxy&, const ContextMenuContextData&, const UserData&);
     ~WebContextMenuProxyMac();
 
     void contextMenuItemSelected(const WebContextMenuItemData&);
     ~WebContextMenuProxyMac();
 
     void contextMenuItemSelected(const WebContextMenuItemData&);
@@ -71,7 +71,7 @@ private:
 
     RetainPtr<NSMenu> m_menu;
 
 
     RetainPtr<NSMenu> m_menu;
 
-    WKView* m_webView;
+    NSView* m_webView;
     WebPageProxy& m_page;
 };
 
     WebPageProxy& m_page;
 };
 
index e2c01d792771880466fe2c85f97aed786fc9640d..520ee63709049d094c342cf69a4b47312b33e9ab 100644 (file)
@@ -36,7 +36,6 @@
 #import "ShareableBitmap.h"
 #import "StringUtilities.h"
 #import "WKSharingServicePickerDelegate.h"
 #import "ShareableBitmap.h"
 #import "StringUtilities.h"
 #import "WKSharingServicePickerDelegate.h"
-#import "WKView.h"
 #import "WebContextMenuItem.h"
 #import "WebContextMenuItemData.h"
 #import "WebProcessProxy.h"
 #import "WebContextMenuItem.h"
 #import "WebContextMenuItemData.h"
 #import "WebProcessProxy.h"
@@ -152,7 +151,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebContextMenuProxyMac::WebContextMenuProxyMac(WKView* webView, WebPageProxy& page, const ContextMenuContextData& context, const UserData& userData)
+WebContextMenuProxyMac::WebContextMenuProxyMac(NSView* webView, WebPageProxy& page, const ContextMenuContextData& context, const UserData& userData)
     : WebContextMenuProxy(context, userData)
     , m_webView(webView)
     , m_page(page)
     : WebContextMenuProxy(context, userData)
     , m_webView(webView)
     , m_page(page)
index 9fde8e38a068036c69b5e11accbde036e531e4c0..fb1ecc092c2c4f930e30a54fea06e2b01c7e6b82 100644 (file)
@@ -40,7 +40,7 @@ class WebPageProxy;
 
 class WebPopupMenuProxyMac : public WebPopupMenuProxy {
 public:
 
 class WebPopupMenuProxyMac : public WebPopupMenuProxy {
 public:
-    static Ref<WebPopupMenuProxyMac> create(WKView *webView, WebPopupMenuProxy::Client& client)
+    static Ref<WebPopupMenuProxyMac> create(NSView *webView, WebPopupMenuProxy::Client& client)
     {
         return adoptRef(*new WebPopupMenuProxyMac(webView, client));
     }
     {
         return adoptRef(*new WebPopupMenuProxyMac(webView, client));
     }
@@ -51,12 +51,12 @@ public:
     virtual void cancelTracking() override;
 
 private:
     virtual void cancelTracking() override;
 
 private:
-    WebPopupMenuProxyMac(WKView *, WebPopupMenuProxy::Client&);
+    WebPopupMenuProxyMac(NSView *, WebPopupMenuProxy::Client&);
 
     void populate(const Vector<WebPopupItem>&, NSFont *, WebCore::TextDirection);
 
     RetainPtr<NSPopUpButtonCell> m_popup;
 
     void populate(const Vector<WebPopupItem>&, NSFont *, WebCore::TextDirection);
 
     RetainPtr<NSPopUpButtonCell> m_popup;
-    WKView *m_webView;
+    NSView *m_webView;
     bool m_wasCanceled;
 };
 
     bool m_wasCanceled;
 };
 
index 48d4926d7b487c661b5edc78b83cf7dafc444d60..d333cda2ce97e2a3f3f8461d07d575e29f2a3dd6 100644 (file)
@@ -32,7 +32,6 @@
 #import "PageClientImpl.h"
 #import "PlatformPopupMenuData.h"
 #import "StringUtilities.h"
 #import "PageClientImpl.h"
 #import "PlatformPopupMenuData.h"
 #import "StringUtilities.h"
-#import "WKView.h"
 #import "WebPopupItem.h"
 #import <WebKitSystemInterface.h>
 
 #import "WebPopupItem.h"
 #import <WebKitSystemInterface.h>
 
@@ -40,7 +39,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView *webView, WebPopupMenuProxy::Client& client)
+WebPopupMenuProxyMac::WebPopupMenuProxyMac(NSView *webView, WebPopupMenuProxy::Client& client)
     : WebPopupMenuProxy(client)
     , m_webView(webView)
     , m_wasCanceled(false)
     : WebPopupMenuProxy(client)
     , m_webView(webView)
     , m_wasCanceled(false)