<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191499] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191499">191499</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-10-23 10:57:33 -0700 (Fri, 23 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 renewGState]):
(-[WKView writeSelectionToPasteboard:types:]):
(-[WKView centerSelectionInVisibleArea:]):
(-[WKView scrollWheel:]):
(-[WKView swipeWithEvent:]):
(-[WKView mouseMoved:]):
(-[WKView mouseDown:]):
(-[WKView mouseUp:]):
(-[WKView mouseDragged:]):
(-[WKView pressureChangeWithEvent:]):
(-[WKView acceptsFirstMouse:]):
(-[WKView shouldDelayWindowOrderingForEvent:]):
(-[WKView performKeyEquivalent:]):
(-[WKView keyUp:]):
(-[WKView keyDown:]):
(-[WKView flagsChanged:]):
(-[WKView _superQuickLookWithEvent:]):
(-[WKView _addFontPanelObserver]):
(-[WKView viewWillMoveToWindow:]):
(-[WKView viewDidMoveToWindow]):
(-[WKView viewDidChangeBackingProperties]):
(-[WKView enableAccessibilityIfNecessary]):
(-[WKView quickLookWithEvent:]):
(-[WKView _colorSpace]):
(-[WKView _didRelaunchProcess]):
(-[WKView _setTextIndicator:]):
(-[WKView _setTextIndicator:withLifetime:]):
(-[WKView _clearTextIndicatorWithAnimation:]):
(-[WKView _setTextIndicatorAnimationProgress:]):
(-[WKView initWithFrame:processPool:configuration:webView:]):
(-[WKView _didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
(-[WKView _internalImmediateActionAnimationControllerForHitTestResult:withType:userData:]):
(-[WKView _internalPrepareForImmediateActionAnimation]):
(-[WKView _internalCancelImmediateActionAnimation]):
(-[WKView _internalCompleteImmediateActionAnimation]):
(-[WKView _internalDismissContentRelativeChildWindowsWithAnimation:]):
(-[WKView beginDeferringViewInWindowChanges]):
(-[WKView endDeferringViewInWindowChanges]):
(-[WKView endDeferringViewInWindowChangesSync]):
(-[WKView _prepareForMoveToWindow:withCompletionHandler:]):
(-[WKView isDeferringViewInWindowChanges]):
(-[WKView allowsLinkPreview]):
(-[WKView setAllowsLinkPreview:]):
(-[WKView _setIgnoresAllEvents:]):
(-[WKView _setIgnoresNonWheelMouseEvents:]):
(-[WKView _setIgnoresNonWheelEvents:]):
(-[WKView _ignoresNonWheelEvents]):
(-[WKView _ignoresAllEvents]):
(-[WKView _setOverrideDeviceScaleFactor:]):
(-[WKView _overrideDeviceScaleFactor]):
(-[WKView _setTopContentInset:]):
(-[WKView _topContentInset]):
(-[WKView _dismissContentRelativeChildWindows]):
(-[WKView _dismissContentRelativeChildWindowsWithAnimation:]):
(-[WKView _setAutomaticallyAdjustsContentInsets:]):
(-[WKView _automaticallyAdjustsContentInsets]):
(-[WKWindowVisibilityObserver initWithView:]): Deleted.
(-[WKWindowVisibilityObserver startObserving:]): Deleted.
(-[WKWindowVisibilityObserver stopObserving:]): Deleted.
(-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]): Deleted.
(-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]): Deleted.
(-[WKView dealloc]): Deleted.
(-[WKView _updateWindowAndViewFrames]): Deleted.
(-[WKView updateFontPanelIfNeeded]): Deleted.
(-[WKView _selectionChanged]): Deleted.
(-[WKView addWindowObserversForWindow:]): Deleted.
(-[WKView removeWindowObservers]): Deleted.
(-[WKView doWindowDidChangeScreen]): Deleted.
(-[WKView _windowDidBecomeKey:]): Deleted.
(-[WKView _windowDidChangeScreen:]): Deleted.
(-[WKView _windowDidChangeLayerHosting:]): Deleted.
(-[WKView _windowDidResignKey:]): Deleted.
(-[WKView _windowDidMiniaturize:]): Deleted.
(-[WKView _windowDidDeminiaturize:]): Deleted.
(-[WKView _windowDidMove:]): Deleted.
(-[WKView _windowDidResize:]): Deleted.
(-[WKView _windowDidOrderOffScreen:]): Deleted.
(-[WKView _windowDidOrderOnScreen:]): Deleted.
(-[WKView _windowDidChangeBackingProperties:]): Deleted.
(-[WKView _windowDidChangeOcclusionState:]): Deleted.
(-[WKView _prepareForDictionaryLookup]): Deleted.
(-[WKView _dictionaryLookupPopoverWillClose:]): Deleted.
(-[WKView _accessibilityRegisterUIProcessTokens]): Deleted.
(-[WKView _postFakeMouseMovedEventForFlagsChangedEvent:]): Deleted.
(-[WKView _intrinsicDeviceScaleFactor]): Deleted.
(-[WKView _preferencesDidChange]): Deleted.
(-[WKView _targetWindowForMovePreparation]): Deleted.
(-[WKView _updateContentInsetsIfAutomatic]): Deleted.
(-[WKView observeValueForKeyPath:ofObject:change:context:]): Deleted.
(-[WKView _dispatchSetTopContentInset]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::automaticallyAdjustsContentInsets):
(WebKit::WebViewImpl::topContentInset):
(WebKit::WebViewImpl::overrideDeviceScaleFactor):
(WebKit::WebViewImpl::isDeferringViewInWindowChanges):
(WebKit::WebViewImpl::targetWindowForMovePreparation):
(WebKit::WebViewImpl::lastPressureEvent):
(WebKit::WebViewImpl::allowsLinkPreview):
(WebKit::WebViewImpl::ignoresNonWheelEvents):
(WebKit::WebViewImpl::ignoresAllEvents):
(WebKit::WebViewImpl::createWeakPtr):
* UIProcess/Cocoa/WebViewImpl.mm:
(SOFT_LINK_CONSTANT_MAY_FAIL):
(-[WKWindowVisibilityObserver initWithView:impl:]):
(-[WKWindowVisibilityObserver dealloc]):
(-[WKWindowVisibilityObserver startObserving:]):
(-[WKWindowVisibilityObserver stopObserving:]):
(-[WKWindowVisibilityObserver startObservingFontPanel]):
(-[WKWindowVisibilityObserver startObservingLookupDismissal]):
(-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]):
(-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]):
(-[WKWindowVisibilityObserver _windowDidBecomeKey:]):
(-[WKWindowVisibilityObserver _windowDidResignKey:]):
(-[WKWindowVisibilityObserver _windowDidMiniaturize:]):
(-[WKWindowVisibilityObserver _windowDidDeminiaturize:]):
(-[WKWindowVisibilityObserver _windowDidMove:]):
(-[WKWindowVisibilityObserver _windowDidResize:]):
(-[WKWindowVisibilityObserver _windowDidChangeBackingProperties:]):
(-[WKWindowVisibilityObserver _windowDidChangeScreen:]):
(-[WKWindowVisibilityObserver _windowDidChangeLayerHosting:]):
(-[WKWindowVisibilityObserver _windowDidChangeOcclusionState:]):
(-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]):
(-[WKEditCommandObjC initWithWebEditCommandProxy:]):
(-[WKEditCommandObjC command]):
(-[WKEditorUndoTargetObjC undoEditing:]):
(-[WKEditorUndoTargetObjC redoEditing:]):
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::~WebViewImpl):
(WebKit::WebViewImpl::becomeFirstResponder):
(WebKit::WebViewImpl::resignFirstResponder):
(WebKit::WebViewImpl::renewGState):
(WebKit::WebViewImpl::updateWindowAndViewFrames):
(WebKit::WebViewImpl::setAutomaticallyAdjustsContentInsets):
(WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
(WebKit::WebViewImpl::setTopContentInset):
(WebKit::WebViewImpl::dispatchSetTopContentInset):
(WebKit::WebViewImpl::setOverrideDeviceScaleFactor):
(WebKit::WebViewImpl::intrinsicDeviceScaleFactor):
(WebKit::WebViewImpl::windowDidOrderOffScreen):
(WebKit::WebViewImpl::windowDidOrderOnScreen):
(WebKit::WebViewImpl::windowDidBecomeKey):
(WebKit::WebViewImpl::windowDidResignKey):
(WebKit::WebViewImpl::windowDidMiniaturize):
(WebKit::WebViewImpl::windowDidDeminiaturize):
(WebKit::WebViewImpl::windowDidMove):
(WebKit::WebViewImpl::windowDidResize):
(WebKit::WebViewImpl::windowDidChangeBackingProperties):
(WebKit::WebViewImpl::windowDidChangeScreen):
(WebKit::WebViewImpl::windowDidChangeLayerHosting):
(WebKit::WebViewImpl::windowDidChangeOcclusionState):
(WebKit::WebViewImpl::viewWillMoveToWindow):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::viewDidChangeBackingProperties):
(WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
(WebKit::WebViewImpl::colorSpace):
(WebKit::WebViewImpl::beginDeferringViewInWindowChanges):
(WebKit::WebViewImpl::endDeferringViewInWindowChanges):
(WebKit::WebViewImpl::endDeferringViewInWindowChangesSync):
(WebKit::WebViewImpl::prepareForMoveToWindow):
(WebKit::WebViewImpl::pressureChangeWithEvent):
(WebKit::WebViewImpl::isEditable):
(WebKit::WebViewImpl::executeEditCommand):
(WebKit::WebViewImpl::registerEditCommand):
(WebKit::WebViewImpl::clearAllEditCommands):
(WebKit::WebViewImpl::writeSelectionToPasteboard):
(WebKit::WebViewImpl::centerSelectionInVisibleArea):
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::startObservingFontPanel):
(WebKit::WebViewImpl::updateFontPanelIfNeeded):
(WebKit::WebViewImpl::preferencesDidChange):
(WebKit::WebViewImpl::setTextIndicator):
(WebKit::WebViewImpl::clearTextIndicatorWithAnimation):
(WebKit::WebViewImpl::setTextIndicatorAnimationProgress):
(WebKit::WebViewImpl::dismissContentRelativeChildWindows):
(WebKit::WebViewImpl::quickLookWithEvent):
(WebKit::WebViewImpl::prepareForDictionaryLookup):
(WebKit::WebViewImpl::setAllowsLinkPreview):
(WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
(WebKit::WebViewImpl::prepareForImmediateActionAnimation):
(WebKit::WebViewImpl::cancelImmediateActionAnimation):
(WebKit::WebViewImpl::completeImmediateActionAnimation):
(WebKit::WebViewImpl::setIgnoresNonWheelEvents):
(WebKit::WebViewImpl::setIgnoresAllEvents):
(WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::activeWindow):
(WebKit::PageClientImpl::preferencesDidChange):
(WebKit::PageClientImpl::registerEditCommand):
(WebKit::PageClientImpl::clearAllEditCommands):
(WebKit::PageClientImpl::selectionDidChange):
(WebKit::PageClientImpl::didPerformDictionaryLookup):
(-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
(-[WKEditCommandObjC command]): Deleted.
(-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
(-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
(WebKit::PageClientImpl::PageClientImpl): Deleted.
Move more things to WebViewImpl.
This also introduces an unfortunate pattern that is required for things which
clients override on WKView, where we have a flow like this:
- somebody (PageClient, etc.) calls WebViewImpl::x
- WebViewImpl::x does nothing except call [WKView _x]
- [WKView _x] calls WebViewImpl::xFromViewOnly, which does the real work
As long as no clients call the -FromViewOnly variant, this will mean that
all callers are bottlenecked through the overridable WKView method.
How this works with WKWebView, I am not sure yet.
* UIProcess/mac/WKImmediateActionController.h:
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController initWithPage:view:viewImpl:recognizer:]):
(-[WKImmediateActionController willDestroyView:]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
(-[WKImmediateActionController menuItem:viewAtScreenPoint:]):
(-[WKImmediateActionController menuItem:previewItemAtPoint:]):
(-[WKImmediateActionController menuItem:itemFrameForPoint:]):
(-[WKImmediateActionController menuItem:maxSizeForPoint:]):
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
(-[WKImmediateActionController _animationControllerForText]):
(-[WKImmediateActionController initWithPage:view:recognizer:]): Deleted.
Keep a generic NSView, use the WebViewImpl for WK*View related things.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplmm">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllerh">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/ChangeLog        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -1,3 +1,237 @@
</span><ins>+2015-10-23 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 renewGState]):
+ (-[WKView writeSelectionToPasteboard:types:]):
+ (-[WKView centerSelectionInVisibleArea:]):
+ (-[WKView scrollWheel:]):
+ (-[WKView swipeWithEvent:]):
+ (-[WKView mouseMoved:]):
+ (-[WKView mouseDown:]):
+ (-[WKView mouseUp:]):
+ (-[WKView mouseDragged:]):
+ (-[WKView pressureChangeWithEvent:]):
+ (-[WKView acceptsFirstMouse:]):
+ (-[WKView shouldDelayWindowOrderingForEvent:]):
+ (-[WKView performKeyEquivalent:]):
+ (-[WKView keyUp:]):
+ (-[WKView keyDown:]):
+ (-[WKView flagsChanged:]):
+ (-[WKView _superQuickLookWithEvent:]):
+ (-[WKView _addFontPanelObserver]):
+ (-[WKView viewWillMoveToWindow:]):
+ (-[WKView viewDidMoveToWindow]):
+ (-[WKView viewDidChangeBackingProperties]):
+ (-[WKView enableAccessibilityIfNecessary]):
+ (-[WKView quickLookWithEvent:]):
+ (-[WKView _colorSpace]):
+ (-[WKView _didRelaunchProcess]):
+ (-[WKView _setTextIndicator:]):
+ (-[WKView _setTextIndicator:withLifetime:]):
+ (-[WKView _clearTextIndicatorWithAnimation:]):
+ (-[WKView _setTextIndicatorAnimationProgress:]):
+ (-[WKView initWithFrame:processPool:configuration:webView:]):
+ (-[WKView _didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
+ (-[WKView _internalImmediateActionAnimationControllerForHitTestResult:withType:userData:]):
+ (-[WKView _internalPrepareForImmediateActionAnimation]):
+ (-[WKView _internalCancelImmediateActionAnimation]):
+ (-[WKView _internalCompleteImmediateActionAnimation]):
+ (-[WKView _internalDismissContentRelativeChildWindowsWithAnimation:]):
+ (-[WKView beginDeferringViewInWindowChanges]):
+ (-[WKView endDeferringViewInWindowChanges]):
+ (-[WKView endDeferringViewInWindowChangesSync]):
+ (-[WKView _prepareForMoveToWindow:withCompletionHandler:]):
+ (-[WKView isDeferringViewInWindowChanges]):
+ (-[WKView allowsLinkPreview]):
+ (-[WKView setAllowsLinkPreview:]):
+ (-[WKView _setIgnoresAllEvents:]):
+ (-[WKView _setIgnoresNonWheelMouseEvents:]):
+ (-[WKView _setIgnoresNonWheelEvents:]):
+ (-[WKView _ignoresNonWheelEvents]):
+ (-[WKView _ignoresAllEvents]):
+ (-[WKView _setOverrideDeviceScaleFactor:]):
+ (-[WKView _overrideDeviceScaleFactor]):
+ (-[WKView _setTopContentInset:]):
+ (-[WKView _topContentInset]):
+ (-[WKView _dismissContentRelativeChildWindows]):
+ (-[WKView _dismissContentRelativeChildWindowsWithAnimation:]):
+ (-[WKView _setAutomaticallyAdjustsContentInsets:]):
+ (-[WKView _automaticallyAdjustsContentInsets]):
+ (-[WKWindowVisibilityObserver initWithView:]): Deleted.
+ (-[WKWindowVisibilityObserver startObserving:]): Deleted.
+ (-[WKWindowVisibilityObserver stopObserving:]): Deleted.
+ (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]): Deleted.
+ (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]): Deleted.
+ (-[WKView dealloc]): Deleted.
+ (-[WKView _updateWindowAndViewFrames]): Deleted.
+ (-[WKView updateFontPanelIfNeeded]): Deleted.
+ (-[WKView _selectionChanged]): Deleted.
+ (-[WKView addWindowObserversForWindow:]): Deleted.
+ (-[WKView removeWindowObservers]): Deleted.
+ (-[WKView doWindowDidChangeScreen]): Deleted.
+ (-[WKView _windowDidBecomeKey:]): Deleted.
+ (-[WKView _windowDidChangeScreen:]): Deleted.
+ (-[WKView _windowDidChangeLayerHosting:]): Deleted.
+ (-[WKView _windowDidResignKey:]): Deleted.
+ (-[WKView _windowDidMiniaturize:]): Deleted.
+ (-[WKView _windowDidDeminiaturize:]): Deleted.
+ (-[WKView _windowDidMove:]): Deleted.
+ (-[WKView _windowDidResize:]): Deleted.
+ (-[WKView _windowDidOrderOffScreen:]): Deleted.
+ (-[WKView _windowDidOrderOnScreen:]): Deleted.
+ (-[WKView _windowDidChangeBackingProperties:]): Deleted.
+ (-[WKView _windowDidChangeOcclusionState:]): Deleted.
+ (-[WKView _prepareForDictionaryLookup]): Deleted.
+ (-[WKView _dictionaryLookupPopoverWillClose:]): Deleted.
+ (-[WKView _accessibilityRegisterUIProcessTokens]): Deleted.
+ (-[WKView _postFakeMouseMovedEventForFlagsChangedEvent:]): Deleted.
+ (-[WKView _intrinsicDeviceScaleFactor]): Deleted.
+ (-[WKView _preferencesDidChange]): Deleted.
+ (-[WKView _targetWindowForMovePreparation]): Deleted.
+ (-[WKView _updateContentInsetsIfAutomatic]): Deleted.
+ (-[WKView observeValueForKeyPath:ofObject:change:context:]): Deleted.
+ (-[WKView _dispatchSetTopContentInset]): Deleted.
+ * UIProcess/API/mac/WKViewInternal.h:
+ * UIProcess/Cocoa/WebViewImpl.h:
+ (WebKit::WebViewImpl::automaticallyAdjustsContentInsets):
+ (WebKit::WebViewImpl::topContentInset):
+ (WebKit::WebViewImpl::overrideDeviceScaleFactor):
+ (WebKit::WebViewImpl::isDeferringViewInWindowChanges):
+ (WebKit::WebViewImpl::targetWindowForMovePreparation):
+ (WebKit::WebViewImpl::lastPressureEvent):
+ (WebKit::WebViewImpl::allowsLinkPreview):
+ (WebKit::WebViewImpl::ignoresNonWheelEvents):
+ (WebKit::WebViewImpl::ignoresAllEvents):
+ (WebKit::WebViewImpl::createWeakPtr):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (SOFT_LINK_CONSTANT_MAY_FAIL):
+ (-[WKWindowVisibilityObserver initWithView:impl:]):
+ (-[WKWindowVisibilityObserver dealloc]):
+ (-[WKWindowVisibilityObserver startObserving:]):
+ (-[WKWindowVisibilityObserver stopObserving:]):
+ (-[WKWindowVisibilityObserver startObservingFontPanel]):
+ (-[WKWindowVisibilityObserver startObservingLookupDismissal]):
+ (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]):
+ (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]):
+ (-[WKWindowVisibilityObserver _windowDidBecomeKey:]):
+ (-[WKWindowVisibilityObserver _windowDidResignKey:]):
+ (-[WKWindowVisibilityObserver _windowDidMiniaturize:]):
+ (-[WKWindowVisibilityObserver _windowDidDeminiaturize:]):
+ (-[WKWindowVisibilityObserver _windowDidMove:]):
+ (-[WKWindowVisibilityObserver _windowDidResize:]):
+ (-[WKWindowVisibilityObserver _windowDidChangeBackingProperties:]):
+ (-[WKWindowVisibilityObserver _windowDidChangeScreen:]):
+ (-[WKWindowVisibilityObserver _windowDidChangeLayerHosting:]):
+ (-[WKWindowVisibilityObserver _windowDidChangeOcclusionState:]):
+ (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
+ (-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]):
+ (-[WKEditCommandObjC initWithWebEditCommandProxy:]):
+ (-[WKEditCommandObjC command]):
+ (-[WKEditorUndoTargetObjC undoEditing:]):
+ (-[WKEditorUndoTargetObjC redoEditing:]):
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::~WebViewImpl):
+ (WebKit::WebViewImpl::becomeFirstResponder):
+ (WebKit::WebViewImpl::resignFirstResponder):
+ (WebKit::WebViewImpl::renewGState):
+ (WebKit::WebViewImpl::updateWindowAndViewFrames):
+ (WebKit::WebViewImpl::setAutomaticallyAdjustsContentInsets):
+ (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
+ (WebKit::WebViewImpl::setTopContentInset):
+ (WebKit::WebViewImpl::dispatchSetTopContentInset):
+ (WebKit::WebViewImpl::setOverrideDeviceScaleFactor):
+ (WebKit::WebViewImpl::intrinsicDeviceScaleFactor):
+ (WebKit::WebViewImpl::windowDidOrderOffScreen):
+ (WebKit::WebViewImpl::windowDidOrderOnScreen):
+ (WebKit::WebViewImpl::windowDidBecomeKey):
+ (WebKit::WebViewImpl::windowDidResignKey):
+ (WebKit::WebViewImpl::windowDidMiniaturize):
+ (WebKit::WebViewImpl::windowDidDeminiaturize):
+ (WebKit::WebViewImpl::windowDidMove):
+ (WebKit::WebViewImpl::windowDidResize):
+ (WebKit::WebViewImpl::windowDidChangeBackingProperties):
+ (WebKit::WebViewImpl::windowDidChangeScreen):
+ (WebKit::WebViewImpl::windowDidChangeLayerHosting):
+ (WebKit::WebViewImpl::windowDidChangeOcclusionState):
+ (WebKit::WebViewImpl::viewWillMoveToWindow):
+ (WebKit::WebViewImpl::viewDidMoveToWindow):
+ (WebKit::WebViewImpl::viewDidChangeBackingProperties):
+ (WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
+ (WebKit::WebViewImpl::colorSpace):
+ (WebKit::WebViewImpl::beginDeferringViewInWindowChanges):
+ (WebKit::WebViewImpl::endDeferringViewInWindowChanges):
+ (WebKit::WebViewImpl::endDeferringViewInWindowChangesSync):
+ (WebKit::WebViewImpl::prepareForMoveToWindow):
+ (WebKit::WebViewImpl::pressureChangeWithEvent):
+ (WebKit::WebViewImpl::isEditable):
+ (WebKit::WebViewImpl::executeEditCommand):
+ (WebKit::WebViewImpl::registerEditCommand):
+ (WebKit::WebViewImpl::clearAllEditCommands):
+ (WebKit::WebViewImpl::writeSelectionToPasteboard):
+ (WebKit::WebViewImpl::centerSelectionInVisibleArea):
+ (WebKit::WebViewImpl::selectionDidChange):
+ (WebKit::WebViewImpl::startObservingFontPanel):
+ (WebKit::WebViewImpl::updateFontPanelIfNeeded):
+ (WebKit::WebViewImpl::preferencesDidChange):
+ (WebKit::WebViewImpl::setTextIndicator):
+ (WebKit::WebViewImpl::clearTextIndicatorWithAnimation):
+ (WebKit::WebViewImpl::setTextIndicatorAnimationProgress):
+ (WebKit::WebViewImpl::dismissContentRelativeChildWindows):
+ (WebKit::WebViewImpl::quickLookWithEvent):
+ (WebKit::WebViewImpl::prepareForDictionaryLookup):
+ (WebKit::WebViewImpl::setAllowsLinkPreview):
+ (WebKit::WebViewImpl::immediateActionAnimationControllerForHitTestResult):
+ (WebKit::WebViewImpl::prepareForImmediateActionAnimation):
+ (WebKit::WebViewImpl::cancelImmediateActionAnimation):
+ (WebKit::WebViewImpl::completeImmediateActionAnimation):
+ (WebKit::WebViewImpl::setIgnoresNonWheelEvents):
+ (WebKit::WebViewImpl::setIgnoresAllEvents):
+ (WebKit::WebViewImpl::accessibilityRegisterUIProcessTokens):
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::activeWindow):
+ (WebKit::PageClientImpl::preferencesDidChange):
+ (WebKit::PageClientImpl::registerEditCommand):
+ (WebKit::PageClientImpl::clearAllEditCommands):
+ (WebKit::PageClientImpl::selectionDidChange):
+ (WebKit::PageClientImpl::didPerformDictionaryLookup):
+ (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
+ (-[WKEditCommandObjC command]): Deleted.
+ (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
+ (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
+ (WebKit::PageClientImpl::PageClientImpl): Deleted.
+ Move more things to WebViewImpl.
+ This also introduces an unfortunate pattern that is required for things which
+ clients override on WKView, where we have a flow like this:
+ - somebody (PageClient, etc.) calls WebViewImpl::x
+ - WebViewImpl::x does nothing except call [WKView _x]
+ - [WKView _x] calls WebViewImpl::xFromViewOnly, which does the real work
+ As long as no clients call the -FromViewOnly variant, this will mean that
+ all callers are bottlenecked through the overridable WKView method.
+ How this works with WKWebView, I am not sure yet.
+
+ * UIProcess/mac/WKImmediateActionController.h:
+ * UIProcess/mac/WKImmediateActionController.mm:
+ (-[WKImmediateActionController initWithPage:view:viewImpl:recognizer:]):
+ (-[WKImmediateActionController willDestroyView:]):
+ (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
+ (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+ (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+ (-[WKImmediateActionController menuItem:viewAtScreenPoint:]):
+ (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
+ (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
+ (-[WKImmediateActionController menuItem:maxSizeForPoint:]):
+ (-[WKImmediateActionController _animationControllerForDataDetectedText]):
+ (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
+ (-[WKImmediateActionController _animationControllerForText]):
+ (-[WKImmediateActionController initWithPage:view:recognizer:]): Deleted.
+ Keep a generic NSView, use the WebViewImpl for WK*View related things.
+
</ins><span class="cx"> 2015-10-22 Joonghun Park <jh718.park@samsung.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Fix build break since r191471
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #import "APILegacyContextHistoryClient.h"
</span><span class="cx"> #import "APIPageConfiguration.h"
</span><span class="cx"> #import "AttributedString.h"
</span><del>-#import "ColorSpaceData.h"
</del><span class="cx"> #import "DataReference.h"
</span><span class="cx"> #import "EditingRange.h"
</span><span class="cx"> #import "EditorState.h"
</span><span class="lines">@@ -59,7 +58,6 @@
</span><span class="cx"> #import "ViewSnapshotStore.h"
</span><span class="cx"> #import "WKAPICast.h"
</span><span class="cx"> #import "WKFullScreenWindowController.h"
</span><del>-#import "WKImmediateActionController.h"
</del><span class="cx"> #import "WKLayoutMode.h"
</span><span class="cx"> #import "WKPrintingView.h"
</span><span class="cx"> #import "WKProcessPoolInternal.h"
</span><span class="lines">@@ -96,15 +94,12 @@
</span><span class="cx"> #import <WebCore/FileSystem.h>
</span><span class="cx"> #import <WebCore/KeyboardEvent.h>
</span><span class="cx"> #import <WebCore/LocalizedStrings.h>
</span><del>-#import <WebCore/LookupSPI.h>
-#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
</del><span class="cx"> #import <WebCore/NSMenuSPI.h>
</span><span class="cx"> #import <WebCore/PlatformEventFactoryMac.h>
</span><span class="cx"> #import <WebCore/PlatformScreen.h>
</span><span class="cx"> #import <WebCore/Region.h>
</span><span class="cx"> #import <WebCore/RuntimeApplicationChecks.h>
</span><span class="cx"> #import <WebCore/SharedBuffer.h>
</span><del>-#import <WebCore/SoftLinking.h>
</del><span class="cx"> #import <WebCore/TextAlternativeWithRange.h>
</span><span class="cx"> #import <WebCore/TextIndicator.h>
</span><span class="cx"> #import <WebCore/TextIndicatorWindow.h>
</span><span class="lines">@@ -149,8 +144,6 @@
</span><span class="cx"> CGError CGSGetScreenRectForWindow(CGSConnectionID cid, CGSWindowID wid, CGRect *rect);
</span><span class="cx"> };
</span><span class="cx">
</span><del>-SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
-
</del><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -171,8 +164,6 @@
</span><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-@class WKWindowVisibilityObserver;
-
</del><span class="cx"> @interface WKViewData : NSObject {
</span><span class="cx"> @public
</span><span class="cx"> std::unique_ptr<PageClientImpl> _pageClient;
</span><span class="lines">@@ -200,8 +191,6 @@
</span><span class="cx"> // For asynchronous validation.
</span><span class="cx"> ValidationMap _validationMap;
</span><span class="cx">
</span><del>- std::unique_ptr<TextIndicatorWindow> _textIndicatorWindow;
-
</del><span class="cx"> // We keep here the event when resending it to
</span><span class="cx"> // the application to distinguish the case of a new event from one
</span><span class="cx"> // that has been already sent to WebCore.
</span><span class="lines">@@ -223,52 +212,23 @@
</span><span class="cx"> NSEvent *_pressureEvent;
</span><span class="cx"> BOOL _ignoringMouseDraggedEvents;
</span><span class="cx">
</span><del>- id _flagsChangedEventMonitor;
-
</del><span class="cx"> BOOL _hasSpellCheckerDocumentTag;
</span><span class="cx"> NSInteger _spellCheckerDocumentTag;
</span><span class="cx">
</span><del>- BOOL _shouldDeferViewInWindowChanges;
- NSWindow *_targetWindowForMovePreparation;
-
- BOOL _viewInWindowChangeWasDeferred;
-
- BOOL _needsViewFrameInWindowCoordinates;
- BOOL _didScheduleWindowAndViewFrameUpdate;
-
- RetainPtr<NSColorSpace> _colorSpace;
-
</del><span class="cx"> RefPtr<WebCore::Image> _promisedImage;
</span><span class="cx"> String _promisedFilename;
</span><span class="cx"> String _promisedURL;
</span><span class="cx">
</span><span class="cx"> BOOL _windowOcclusionDetectionEnabled;
</span><span class="cx">
</span><del>- RetainPtr<WKWindowVisibilityObserver> _windowVisibilityObserver;
-
</del><span class="cx"> std::unique_ptr<ViewGestureController> _gestureController;
</span><span class="cx"> BOOL _allowsMagnification;
</span><del>- BOOL _ignoresNonWheelEvents;
- BOOL _ignoresAllEvents;
</del><span class="cx"> BOOL _allowsBackForwardNavigationGestures;
</span><del>- BOOL _allowsLinkPreview;
</del><span class="cx">
</span><span class="cx"> RetainPtr<CALayer> _rootLayer;
</span><span class="cx">
</span><del>- BOOL _didScheduleSetTopContentInset;
- CGFloat _topContentInset;
</del><span class="cx"> CGFloat _totalHeightOfBanners;
</span><span class="cx">
</span><del>- CGFloat _overrideDeviceScaleFactor;
-
- BOOL _didRegisterForLookupPopoverCloseNotifications;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- BOOL _automaticallyAdjustsContentInsets;
- RetainPtr<WKImmediateActionController> _immediateActionController;
- RetainPtr<NSImmediateActionGestureRecognizer> _immediateActionGestureRecognizer;
-#endif
-
</del><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> _WKThumbnailView *_thumbnailView;
</span><span class="cx"> #endif
</span><span class="lines">@@ -279,54 +239,6 @@
</span><span class="cx"> @implementation WKViewData
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-@interface WKWindowVisibilityObserver : NSObject {
- WKView *_view;
-}
-
-- (instancetype)initWithView:(WKView *)view;
-- (void)startObserving:(NSWindow *)window;
-- (void)stopObserving:(NSWindow *)window;
-@end
-
-@implementation WKWindowVisibilityObserver
-
-- (instancetype)initWithView:(WKView *)view
-{
- self = [super init];
- if (!self)
- return nil;
-
- _view = view;
- return self;
-}
-
-- (void)startObserving:(NSWindow *)window
-{
- // An NSView derived object such as WKView cannot observe these notifications, because NSView itself observes them.
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:)
- name:@"NSWindowDidOrderOffScreenNotification" object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:)
- name:@"_NSWindowDidBecomeVisible" object:window];
-}
-
-- (void)stopObserving:(NSWindow *)window
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window];
-}
-
-- (void)_windowDidOrderOnScreen:(NSNotification *)notification
-{
- [_view _windowDidOrderOnScreen:notification];
-}
-
-- (void)_windowDidOrderOffScreen:(NSNotification *)notification
-{
- [_view _windowDidOrderOffScreen:notification];
-}
-
-@end
-
</del><span class="cx"> @interface WKResponderChainSink : NSResponder {
</span><span class="cx"> NSResponder *_lastResponderInChain;
</span><span class="cx"> bool _didReceiveUnhandledCommand;
</span><span class="lines">@@ -369,10 +281,6 @@
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [_data->_immediateActionController willDestroyView:self];
-#endif
-
</del><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> if (_data->_remoteObjectRegistry) {
</span><span class="cx"> _data->_page->process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _data->_page->pageID());
</span><span class="lines">@@ -394,9 +302,6 @@
</span><span class="cx"> NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
</span><span class="cx"> [workspaceNotificationCenter removeObserver:self name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
</span><span class="cx">
</span><del>- if (canLoadLUNotificationPopoverWillClose())
- [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
-
</del><span class="cx"> WebProcessPool::statistics().wkViewCount--;
</span><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="lines">@@ -481,48 +386,9 @@
</span><span class="cx"> _data->_impl->setFrameSize(NSSizeToCGSize(size));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_updateWindowAndViewFrames
-{
- if (_data->_impl->clipsToVisibleRect())
- _data->_impl->updateViewExposedRect();
-
- if (_data->_didScheduleWindowAndViewFrameUpdate)
- return;
-
- _data->_didScheduleWindowAndViewFrameUpdate = YES;
-
- dispatch_async(dispatch_get_main_queue(), ^{
- _data->_didScheduleWindowAndViewFrameUpdate = NO;
-
- NSRect viewFrameInWindowCoordinates = NSZeroRect;
- NSPoint accessibilityPosition = NSZeroPoint;
-
- if (_data->_needsViewFrameInWindowCoordinates)
- viewFrameInWindowCoordinates = [self convertRect:self.frame toView:nil];
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- if (WebCore::AXObjectCache::accessibilityEnabled())
- accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
-#pragma clang diagnostic pop
-
- _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
- });
-}
-
</del><span class="cx"> - (void)renewGState
</span><span class="cx"> {
</span><del>- if (_data->_textIndicatorWindow)
- [self _dismissContentRelativeChildWindowsWithAnimation:NO];
-
- // Update the view frame.
- if ([self window])
- [self _updateWindowAndViewFrames];
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [self _updateContentInsetsIfAutomatic];
-#endif
-
</del><ins>+ _data->_impl->renewGState();
</ins><span class="cx"> [super renewGState];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -578,7 +444,7 @@
</span><span class="cx">
</span><span class="cx"> // Editing commands
</span><span class="cx">
</span><del>-#define WEBCORE_COMMAND(command) - (void)command:(id)sender { _data->_page->executeEditCommand(commandNameForSelector(_cmd)); }
</del><ins>+#define WEBCORE_COMMAND(command) - (void)command:(id)sender { _data->_impl->executeEditCommand(commandNameForSelector(_cmd)); }
</ins><span class="cx">
</span><span class="cx"> WEBCORE_COMMAND(alignCenter)
</span><span class="cx"> WEBCORE_COMMAND(alignJustified)
</span><span class="lines">@@ -687,22 +553,12 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
</span><span class="cx"> {
</span><del>- size_t numTypes = [types count];
- [pasteboard declareTypes:types owner:nil];
- for (size_t i = 0; i < numTypes; ++i) {
- if ([[types objectAtIndex:i] isEqualTo:NSStringPboardType])
- [pasteboard setString:_data->_page->stringSelectionForPasteboard() forType:NSStringPboardType];
- else {
- RefPtr<SharedBuffer> buffer = _data->_page->dataSelectionForPasteboard([types objectAtIndex:i]);
- [pasteboard setData:buffer ? buffer->createNSData().get() : nil forType:[types objectAtIndex:i]];
- }
- }
- return YES;
</del><ins>+ return _data->_impl->writeSelectionToPasteboard(pasteboard, types);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)centerSelectionInVisibleArea:(id)sender
</span><span class="cx"> {
</span><del>- _data->_page->centerSelectionInVisibleArea();
</del><ins>+ _data->_impl->centerSelectionInVisibleArea();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This method is needed to support Mac OS X services.
</span><span class="lines">@@ -740,25 +596,6 @@
</span><span class="cx">
</span><span class="cx"> // Font panel support.
</span><span class="cx">
</span><del>-- (void)updateFontPanelIfNeeded
-{
- const EditorState& editorState = _data->_page->editorState();
- if (editorState.selectionIsNone || !editorState.isContentEditable)
- return;
- if ([NSFontPanel sharedFontPanelExists] && [[NSFontPanel sharedFontPanel] isVisible]) {
- _data->_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];
- });
- }
-}
-
-- (void)_selectionChanged
-{
- [self updateFontPanelIfNeeded];
-}
-
</del><span class="cx"> - (void)changeFont:(id)sender
</span><span class="cx"> {
</span><span class="cx"> NSFontManager *fontManager = [NSFontManager sharedFontManager];
</span><span class="lines">@@ -1145,64 +982,64 @@
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER(Selector) \
</span><span class="cx"> - (void)Selector:(NSEvent *)theEvent \
</span><span class="cx"> { \
</span><del>- if (_data->_ignoresNonWheelEvents) \
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents()) \
</ins><span class="cx"> return; \
</span><span class="cx"> if (NSTextInputContext *context = [self inputContext]) { \
</span><span class="cx"> [context handleEvent:theEvent completionHandler:^(BOOL handled) { \
</span><span class="cx"> if (handled) \
</span><span class="cx"> LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
</span><span class="cx"> else { \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> } \
</span><span class="cx"> }]; \
</span><span class="cx"> return; \
</span><span class="cx"> } \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> }
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(Selector) \
</span><span class="cx"> - (void)Selector:(NSEvent *)theEvent \
</span><span class="cx"> { \
</span><del>- if (_data->_ignoresNonWheelEvents) \
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents()) \
</ins><span class="cx"> return; \
</span><span class="cx"> if (NSTextInputContext *context = [self inputContext]) { \
</span><span class="cx"> [context handleEvent:theEvent completionHandler:^(BOOL handled) { \
</span><span class="cx"> if (handled) \
</span><span class="cx"> LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
</span><span class="cx"> else { \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> } \
</span><span class="cx"> }]; \
</span><span class="cx"> return; \
</span><span class="cx"> } \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> }
</span><span class="cx"> #else
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER(Selector) \
</span><span class="cx"> - (void)Selector:(NSEvent *)theEvent \
</span><span class="cx"> { \
</span><del>- if (_data->_ignoresNonWheelEvents) \
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents()) \
</ins><span class="cx"> return; \
</span><span class="cx"> if ([[self inputContext] handleEvent:theEvent]) { \
</span><span class="cx"> LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
</span><span class="cx"> return; \
</span><span class="cx"> } \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> }
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(Selector) \
</span><span class="cx"> - (void)Selector:(NSEvent *)theEvent \
</span><span class="cx"> { \
</span><del>- if (_data->_ignoresNonWheelEvents) \
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents()) \
</ins><span class="cx"> return; \
</span><span class="cx"> if ([[self inputContext] handleEvent:theEvent]) { \
</span><span class="cx"> LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
</span><span class="cx"> return; \
</span><span class="cx"> } \
</span><del>- NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
</del><ins>+ NativeWebMouseEvent webEvent(theEvent, _data->_impl->lastPressureEvent(), self); \
</ins><span class="cx"> _data->_page->handleMouseEvent(webEvent); \
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -1233,7 +1070,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)scrollWheel:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresAllEvents)
</del><ins>+ if (_data->_impl->ignoresAllEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (event.phase == NSEventPhaseBegan)
</span><span class="lines">@@ -1251,7 +1088,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)swipeWithEvent:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!_data->_allowsBackForwardNavigationGestures) {
</span><span class="lines">@@ -1269,7 +1106,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)mouseMoved:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // When a view is first responder, it gets mouse moved events even when the mouse is outside its visible rect.
</span><span class="lines">@@ -1281,7 +1118,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)mouseDown:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> [self _setMouseDownEvent:event];
</span><span class="lines">@@ -1292,7 +1129,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)mouseUp:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> [self _setMouseDownEvent:nil];
</span><span class="lines">@@ -1301,7 +1138,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)mouseDragged:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (_data->_ignoringMouseDraggedEvents)
</span><span class="lines">@@ -1311,22 +1148,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)pressureChangeWithEvent:(NSEvent *)event
</span><span class="cx"> {
</span><del>-#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
- if (event == _data->_pressureEvent)
- return;
-
- if (_data->_ignoresNonWheelEvents)
- return;
-
- if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded)
- return;
-
- NativeWebMouseEvent webEvent(event, _data->_pressureEvent, self);
- _data->_page->handleMouseEvent(webEvent);
-
- [_data->_pressureEvent release];
- _data->_pressureEvent = [event retain];
-#endif
</del><ins>+ _data->_impl->pressureChangeWithEvent(event);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)acceptsFirstMouse:(NSEvent *)event
</span><span class="lines">@@ -1340,7 +1162,7 @@
</span><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> [self _setMouseDownEvent:event];
</span><del>- bool result = _data->_page->acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, _data->_pressureEvent, self));
</del><ins>+ bool result = _data->_page->acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, _data->_impl->lastPressureEvent(), self));
</ins><span class="cx"> [self _setMouseDownEvent:nil];
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -1361,7 +1183,7 @@
</span><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> [self _setMouseDownEvent:event];
</span><del>- bool result = _data->_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, _data->_pressureEvent, self));
</del><ins>+ bool result = _data->_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, _data->_impl->lastPressureEvent(), self));
</ins><span class="cx"> [self _setMouseDownEvent:nil];
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -1793,7 +1615,7 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)performKeyEquivalent:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="lines">@@ -1833,7 +1655,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)keyUp:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "keyUp:%p %@", theEvent, theEvent);
</span><span class="lines">@@ -1846,7 +1668,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)keyDown:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "keyDown:%p %@%s", theEvent, theEvent, (theEvent == _data->_keyDownEventBeingResent) ? " (re-sent)" : "");
</span><span class="lines">@@ -1873,7 +1695,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)flagsChanged:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "flagsChanged:%p %@", theEvent, theEvent);
</span><span class="lines">@@ -2236,7 +2058,7 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)performKeyEquivalent:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return NO;
</span><span class="cx">
</span><span class="cx"> // There's a chance that responding to this event will run a nested event loop, and
</span><span class="lines">@@ -2276,7 +2098,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)keyUp:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "keyUp:%p %@", theEvent, theEvent);
</span><span class="lines">@@ -2286,7 +2108,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)keyDown:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "keyDown:%p %@%s", theEvent, theEvent, (theEvent == _data->_keyDownEventBeingResent) ? " (re-sent)" : "");
</span><span class="lines">@@ -2324,7 +2146,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)flagsChanged:(NSEvent *)theEvent
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
</del><ins>+ if (_data->_impl->ignoresNonWheelEvents())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(TextInput, "flagsChanged:%p %@", theEvent, theEvent);
</span><span class="lines">@@ -2350,6 +2172,11 @@
</span><span class="cx"> return [super inputContext];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_superQuickLookWithEvent:(NSEvent *)event
+{
+ [super quickLookWithEvent:event];
+}
+
</ins><span class="cx"> - (NSArray *)validAttributesForMarkedText
</span><span class="cx"> {
</span><span class="cx"> static NSArray *validAttributes;
</span><span class="lines">@@ -2524,221 +2351,21 @@
</span><span class="cx"> return NSMouseInRect(localPoint, visibleThumbRect, [self isFlipped]);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-static void* keyValueObservingContext = &keyValueObservingContext;
-#endif
-
-- (void)addWindowObserversForWindow:(NSWindow *)window
-{
- if (window) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:)
- name:NSWindowDidBecomeKeyNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:)
- name:NSWindowDidResignKeyNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMiniaturize:)
- name:NSWindowDidMiniaturizeNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:)
- name:NSWindowDidDeminiaturizeNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMove:)
- name:NSWindowDidMoveNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:)
- name:NSWindowDidResizeNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:)
- name:NSWindowDidChangeBackingPropertiesNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:)
- name:NSWindowDidChangeScreenNotification object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeLayerHosting:)
- name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeOcclusionState:)
- name:NSWindowDidChangeOcclusionStateNotification object:window];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
- [window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
-#endif
- [_data->_windowVisibilityObserver startObserving:window];
- }
-}
-
</del><span class="cx"> - (void)_addFontPanelObserver
</span><span class="cx"> {
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:0 context:keyValueObservingContext];
-#endif
</del><ins>+ _data->_impl->startObservingFontPanel();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)removeWindowObservers
-{
- NSWindow *window = _data->_targetWindowForMovePreparation ? _data->_targetWindowForMovePreparation : [self window];
- if (!window)
- return;
-
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMiniaturizeNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMoveNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (_data->_page->isEditable())
- [[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext];
- [window removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
- [window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
-#endif
- [_data->_windowVisibilityObserver stopObserving:window];
-}
-
</del><span class="cx"> - (void)viewWillMoveToWindow:(NSWindow *)window
</span><span class="cx"> {
</span><del>- // If we're in the middle of preparing to move to a window, we should only be moved to that window.
- ASSERT(!_data->_targetWindowForMovePreparation || (_data->_targetWindowForMovePreparation == window));
-
- NSWindow *currentWindow = [self window];
- if (window == currentWindow)
- return;
-
- _data->_pageClient->viewWillMoveToAnotherWindow();
-
- [self removeWindowObservers];
- [self addWindowObserversForWindow:window];
</del><ins>+ _data->_impl->viewWillMoveToWindow(window);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)viewDidMoveToWindow
</span><span class="cx"> {
</span><del>- NSWindow *window = _data->_targetWindowForMovePreparation ? _data->_targetWindowForMovePreparation : self.window;
-
- if (window) {
- [self doWindowDidChangeScreen];
-
- ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
- if ([self isDeferringViewInWindowChanges])
- _data->_viewInWindowChangeWasDeferred = YES;
- else
- viewStateChanges |= ViewState::IsInWindow;
- _data->_page->viewStateDidChange(viewStateChanges);
-
- [self _updateWindowAndViewFrames];
-
- // FIXME(135509) This call becomes unnecessary once 135509 is fixed; remove.
- _data->_page->layerHostingModeDidChange();
-
- if (!_data->_flagsChangedEventMonitor) {
- _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
- [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
- return flagsChangedEvent;
- }];
- }
-
- [self _accessibilityRegisterUIProcessTokens];
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (_data->_immediateActionGestureRecognizer && ![[self gestureRecognizers] containsObject:_data->_immediateActionGestureRecognizer.get()] && !_data->_ignoresNonWheelEvents && _data->_allowsLinkPreview)
- [self addGestureRecognizer:_data->_immediateActionGestureRecognizer.get()];
-#endif
- } else {
- ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
- if ([self isDeferringViewInWindowChanges])
- _data->_viewInWindowChangeWasDeferred = YES;
- else
- viewStateChanges |= ViewState::IsInWindow;
- _data->_page->viewStateDidChange(viewStateChanges);
-
- [NSEvent removeMonitor:_data->_flagsChangedEventMonitor];
- _data->_flagsChangedEventMonitor = nil;
-
- [self _dismissContentRelativeChildWindowsWithAnimation:NO];
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (_data->_immediateActionGestureRecognizer)
- [self removeGestureRecognizer:_data->_immediateActionGestureRecognizer.get()];
-#endif
- }
-
- _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
</del><ins>+ _data->_impl->viewDidMoveToWindow();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)doWindowDidChangeScreen
-{
- NSWindow *window = _data->_targetWindowForMovePreparation ? _data->_targetWindowForMovePreparation : self.window;
- _data->_page->windowScreenDidChange((PlatformDisplayID)[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
-}
-
-- (void)_windowDidBecomeKey:(NSNotification *)notification
-{
- NSWindow *keyWindow = [notification object];
- if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) {
- _data->_impl->updateSecureInputState();
- _data->_page->viewStateDidChange(ViewState::WindowIsActive);
- }
-}
-
-- (void)_windowDidChangeScreen:(NSNotification *)notification
-{
- [self doWindowDidChangeScreen];
-}
-
-- (void)_windowDidChangeLayerHosting:(NSNotification *)notification
-{
- _data->_page->layerHostingModeDidChange();
-}
-
-- (void)_windowDidResignKey:(NSNotification *)notification
-{
- NSWindow *formerKeyWindow = [notification object];
- if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) {
- _data->_impl->updateSecureInputState();
- _data->_page->viewStateDidChange(ViewState::WindowIsActive);
- }
-}
-
-- (void)_windowDidMiniaturize:(NSNotification *)notification
-{
- _data->_page->viewStateDidChange(ViewState::IsVisible);
-}
-
-- (void)_windowDidDeminiaturize:(NSNotification *)notification
-{
- _data->_page->viewStateDidChange(ViewState::IsVisible);
-}
-
-- (void)_windowDidMove:(NSNotification *)notification
-{
- [self _updateWindowAndViewFrames];
-}
-
-- (void)_windowDidResize:(NSNotification *)notification
-{
- [self _updateWindowAndViewFrames];
-}
-
-- (void)_windowDidOrderOffScreen:(NSNotification *)notification
-{
- _data->_page->viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
-}
-
-- (void)_windowDidOrderOnScreen:(NSNotification *)notification
-{
- _data->_page->viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
-}
-
-- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
-{
- CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:NSBackingPropertyOldScaleFactorKey] doubleValue];
- CGFloat newBackingScaleFactor = [self _intrinsicDeviceScaleFactor];
- if (oldBackingScaleFactor == newBackingScaleFactor)
- return;
-
- _data->_page->setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
-}
-
-- (void)_windowDidChangeOcclusionState:(NSNotification *)notification
-{
- _data->_page->viewStateDidChange(ViewState::IsVisible);
-}
-
</del><span class="cx"> - (void)drawRect:(NSRect)rect
</span><span class="cx"> {
</span><span class="cx"> LOG(Printing, "drawRect: x:%g, y:%g, width:%g, height:%g", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
</span><span class="lines">@@ -2769,13 +2396,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)viewDidChangeBackingProperties
</span><span class="cx"> {
</span><del>- NSColorSpace *colorSpace = [[self window] colorSpace];
- if ([colorSpace isEqualTo:_data->_colorSpace.get()])
- return;
-
- _data->_colorSpace = nullptr;
- if (DrawingAreaProxy *drawingArea = _data->_page->drawingArea())
- drawingArea->colorSpaceDidChange();
</del><ins>+ _data->_impl->viewDidChangeBackingProperties();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_activeSpaceDidChange:(NSNotification *)notification
</span><span class="lines">@@ -2783,32 +2404,6 @@
</span><span class="cx"> _data->_page->viewStateDidChange(ViewState::IsVisible);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_prepareForDictionaryLookup
-{
- if (_data->_didRegisterForLookupPopoverCloseNotifications)
- return;
-
- _data->_didRegisterForLookupPopoverCloseNotifications = YES;
-
- if (canLoadLUNotificationPopoverWillClose())
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
-}
-
-- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
-{
- [self _clearTextIndicatorWithAnimation:TextIndicatorWindowDismissalAnimation::None];
-}
-
-- (void)_accessibilityRegisterUIProcessTokens
-{
- // Initialize remote accessibility when the window connection has been established.
- NSData *remoteElementToken = WKAXRemoteTokenForElement(self);
- NSData *remoteWindowToken = WKAXRemoteTokenForElement([self 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]);
- _data->_page->registerUIProcessAccessibilityTokens(elementToken, windowToken);
-}
-
</del><span class="cx"> - (void)_updateRemoteAccessibilityRegistration:(BOOL)registerProcess
</span><span class="cx"> {
</span><span class="cx"> // When the tree is connected/disconnected, the remote accessibility registration
</span><span class="lines">@@ -2833,7 +2428,7 @@
</span><span class="cx"> // After enabling accessibility update the window frame on the web process so that the
</span><span class="cx"> // correct accessibility position is transmitted (when AX is off, that position is not calculated).
</span><span class="cx"> WebCore::AXObjectCache::enableAccessibility();
</span><del>- [self _updateWindowAndViewFrames];
</del><ins>+ _data->_impl->updateWindowAndViewFrames();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id)accessibilityFocusedUIElement
</span><span class="lines">@@ -2888,45 +2483,14 @@
</span><span class="cx"> return hitView;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent
-{
- NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:[[flagsChangedEvent window] mouseLocationOutsideOfEventStream]
- modifierFlags:[flagsChangedEvent modifierFlags] timestamp:[flagsChangedEvent timestamp] windowNumber:[flagsChangedEvent windowNumber]
- context:[flagsChangedEvent context] eventNumber:0 clickCount:0 pressure:0];
- NativeWebMouseEvent webEvent(fakeEvent, _data->_pressureEvent, self);
- _data->_page->handleMouseEvent(webEvent);
-}
-
</del><span class="cx"> - (NSInteger)conversationIdentifier
</span><span class="cx"> {
</span><span class="cx"> return (NSInteger)self;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (float)_intrinsicDeviceScaleFactor
-{
- if (_data->_overrideDeviceScaleFactor)
- return _data->_overrideDeviceScaleFactor;
- if (_data->_targetWindowForMovePreparation)
- return [_data->_targetWindowForMovePreparation backingScaleFactor];
- if (NSWindow *window = [self window])
- return [window backingScaleFactor];
- return [[NSScreen mainScreen] backingScaleFactor];
-}
-
</del><span class="cx"> - (void)quickLookWithEvent:(NSEvent *)event
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents)
- return;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (_data->_immediateActionGestureRecognizer) {
- [super quickLookWithEvent:event];
- return;
- }
-#endif
-
- NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil];
- _data->_page->performDictionaryLookupAtLocation(FloatPoint(locationInViewCoordinates.x, locationInViewCoordinates.y));
</del><ins>+ _data->_impl->quickLookWithEvent(event);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
</span><span class="lines">@@ -2939,19 +2503,7 @@
</span><span class="cx">
</span><span class="cx"> - (WebKit::ColorSpaceData)_colorSpace
</span><span class="cx"> {
</span><del>- if (!_data->_colorSpace) {
- if (_data->_targetWindowForMovePreparation)
- _data->_colorSpace = [_data->_targetWindowForMovePreparation colorSpace];
- else if (NSWindow *window = [self window])
- _data->_colorSpace = [window colorSpace];
- else
- _data->_colorSpace = [[NSScreen mainScreen] colorSpace];
- }
-
- ColorSpaceData colorSpaceData;
- colorSpaceData.cgColorSpace = [_data->_colorSpace CGColorSpace];
-
- return colorSpaceData;
</del><ins>+ return _data->_impl->colorSpace();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_processDidExit
</span><span class="lines">@@ -2973,21 +2525,9 @@
</span><span class="cx">
</span><span class="cx"> - (void)_didRelaunchProcess
</span><span class="cx"> {
</span><del>- [self _accessibilityRegisterUIProcessTokens];
</del><ins>+ _data->_impl->accessibilityRegisterUIProcessTokens();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_preferencesDidChange
-{
- BOOL needsViewFrameInWindowCoordinates = _data->_page->preferences().pluginsEnabled();
-
- if (!!needsViewFrameInWindowCoordinates == !!_data->_needsViewFrameInWindowCoordinates)
- return;
-
- _data->_needsViewFrameInWindowCoordinates = needsViewFrameInWindowCoordinates;
- if ([self window])
- [self _updateWindowAndViewFrames];
-}
-
</del><span class="cx"> - (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState
</span><span class="cx"> {
</span><span class="cx"> ValidationVector items = _data->_validationMap.take(commandName);
</span><span class="lines">@@ -3164,33 +2704,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_setTextIndicator:(TextIndicator&)textIndicator
-{
- [self _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
-}
-
-- (void)_setTextIndicator:(TextIndicator&)textIndicator withLifetime:(TextIndicatorWindowLifetime)lifetime
-{
- if (!_data->_textIndicatorWindow)
- _data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
-
- NSRect textBoundingRectInScreenCoordinates = [self.window convertRectToScreen:[self convertRect:textIndicator.textBoundingRectInRootViewCoordinates() toView:nil]];
- _data->_textIndicatorWindow->setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), lifetime);
-}
-
-- (void)_clearTextIndicatorWithAnimation:(TextIndicatorWindowDismissalAnimation)animation
-{
- if (_data->_textIndicatorWindow)
- _data->_textIndicatorWindow->clearTextIndicator(animation);
- _data->_textIndicatorWindow = nullptr;
-}
-
-- (void)_setTextIndicatorAnimationProgress:(float)progress
-{
- if (_data->_textIndicatorWindow)
- _data->_textIndicatorWindow->setAnimationProgress(progress);
-}
-
</del><span class="cx"> - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
</span><span class="cx"> {
</span><span class="cx"> [rootLayer web_disableAllActions];
</span><span class="lines">@@ -3522,12 +3035,6 @@
</span><span class="cx"> return [NSArray arrayWithObject:[path lastPathComponent]];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
-- (NSWindow *)_targetWindowForMovePreparation
-{
- return _data->_targetWindowForMovePreparation;
-}
-
</del><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> - (BOOL)_hasFullScreenWindowController
</span><span class="cx"> {
</span><span class="lines">@@ -3556,11 +3063,6 @@
</span><span class="cx"> return ![sink didReceiveUnhandledCommand];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize
-{
- _data->_impl->setIntrinsicContentSize(NSSizeToCGSize(intrinsicContentSize));
-}
-
</del><span class="cx"> - (NSInteger)spellCheckerDocumentTag
</span><span class="cx"> {
</span><span class="cx"> if (!_data->_hasSpellCheckerDocumentTag) {
</span><span class="lines">@@ -3621,23 +3123,17 @@
</span><span class="cx"> _data->_pageClient = std::make_unique<PageClientImpl>(self, webView);
</span><span class="cx"> _data->_page = processPool.createWebPage(*_data->_pageClient, WTF::move(configuration));
</span><span class="cx">
</span><del>- _data->_impl = std::make_unique<WebViewImpl>(self, *_data->_page);
- static_cast<PageClientImpl*>(_data->_pageClient.get())->setImpl(*_data->_impl);
</del><ins>+ _data->_impl = std::make_unique<WebViewImpl>(self, *_data->_page, *_data->_pageClient);
+ static_cast<PageClientImpl&>(*_data->_pageClient).setImpl(*_data->_impl);
</ins><span class="cx">
</span><span class="cx"> _data->_page->setAddsVisitedLinks(processPool.historyClient().addsVisitedLinks());
</span><span class="cx">
</span><del>- _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
</del><span class="cx"> _data->_page->initializeWebPage();
</span><span class="cx">
</span><span class="cx"> _data->_mouseDownEvent = nil;
</span><del>- _data->_pressureEvent = nil;
</del><span class="cx"> _data->_ignoringMouseDraggedEvents = NO;
</span><span class="cx"> _data->_windowOcclusionDetectionEnabled = YES;
</span><span class="cx">
</span><del>- _data->_windowVisibilityObserver = adoptNS([[WKWindowVisibilityObserver alloc] initWithView:self]);
-
- _data->_needsViewFrameInWindowCoordinates = _data->_page->preferences().pluginsEnabled();
-
</del><span class="cx"> [self _registerDraggedTypes];
</span><span class="cx">
</span><span class="cx"> self.wantsLayer = YES;
</span><span class="lines">@@ -3650,17 +3146,6 @@
</span><span class="cx"> NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
</span><span class="cx"> [workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- _data->_allowsLinkPreview = YES;
-
- if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
- _data->_immediateActionGestureRecognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] init]);
- _data->_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:*_data->_page view:self recognizer:_data->_immediateActionGestureRecognizer.get()]);
- [_data->_immediateActionGestureRecognizer setDelegate:_data->_immediateActionController.get()];
- [_data->_immediateActionGestureRecognizer setDelaysPrimaryMouseButtonEvents:NO];
- }
-#endif
-
</del><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3705,42 +3190,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // WK_API_ENABLED
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-- (void)_updateContentInsetsIfAutomatic
-{
- if (!self._automaticallyAdjustsContentInsets)
- return;
-
- if ((self.window.styleMask & NSFullSizeContentViewWindowMask) && !self.window.titlebarAppearsTransparent && ![self enclosingScrollView]) {
- NSRect contentLayoutRect = [self convertRect:self.window.contentLayoutRect fromView:nil];
- CGFloat newTopContentInset = NSMaxY(contentLayoutRect) - NSHeight(contentLayoutRect);
- if (self._topContentInset != newTopContentInset)
- self._topContentInset = newTopContentInset;
- } else
- self._topContentInset = 0;
-}
-
-#endif
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (context != keyValueObservingContext) {
- [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
- return;
- }
-
- if ([keyPath isEqualToString:@"visible"] && [NSFontPanel sharedFontPanelExists] && object == [NSFontPanel sharedFontPanel]) {
- [self updateFontPanelIfNeeded];
- return;
- }
- if ([keyPath isEqualToString:@"contentLayoutRect"] || [keyPath isEqualToString:@"titlebarAppearsTransparent"])
- [self _updateContentInsetsIfAutomatic];
-#endif
-}
-
-
</del><span class="cx"> - (void)_didFirstVisuallyNonEmptyLayoutForMainFrame
</span><span class="cx"> {
</span><span class="cx"> if (_data->_gestureController)
</span><span class="lines">@@ -3783,15 +3232,6 @@
</span><span class="cx"> _data->_gestureController->removeSwipeSnapshot();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-- (void)_didPerformImmediateActionHitTest:(const WebHitTestResultData&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData
-{
- [_data->_immediateActionController didPerformImmediateActionHitTest:hitTestResult contentPreventsDefault:contentPreventsDefault userData:userData];
-}
-
-#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
</del><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
</span><span class="cx"> - (void)_startWindowDrag
</span><span class="cx"> {
</span><span class="lines">@@ -3993,72 +3433,29 @@
</span><span class="cx"> return _data->_impl->createFullScreenWindow();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// FIXME: All of these "DeferringViewInWindowChanges" methods should be able to be removed once clients are weaned off of them.
</del><span class="cx"> - (void)beginDeferringViewInWindowChanges
</span><span class="cx"> {
</span><del>- if (_data->_shouldDeferViewInWindowChanges) {
- NSLog(@"beginDeferringViewInWindowChanges was called while already deferring view-in-window changes!");
- return;
- }
-
- _data->_shouldDeferViewInWindowChanges = YES;
</del><ins>+ _data->_impl->beginDeferringViewInWindowChanges();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)endDeferringViewInWindowChanges
</span><span class="cx"> {
</span><del>- if (!_data->_shouldDeferViewInWindowChanges) {
- NSLog(@"endDeferringViewInWindowChanges was called without beginDeferringViewInWindowChanges!");
- return;
- }
-
- _data->_shouldDeferViewInWindowChanges = NO;
-
- if (_data->_viewInWindowChangeWasDeferred) {
- [self _dispatchSetTopContentInset];
- _data->_page->viewStateDidChange(ViewState::IsInWindow);
- _data->_viewInWindowChangeWasDeferred = NO;
- }
</del><ins>+ _data->_impl->endDeferringViewInWindowChanges();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)endDeferringViewInWindowChangesSync
</span><span class="cx"> {
</span><del>- if (!_data->_shouldDeferViewInWindowChanges) {
- NSLog(@"endDeferringViewInWindowChangesSync was called without beginDeferringViewInWindowChanges!");
- return;
- }
-
- _data->_shouldDeferViewInWindowChanges = NO;
-
- if (_data->_viewInWindowChangeWasDeferred) {
- [self _dispatchSetTopContentInset];
- _data->_page->viewStateDidChange(ViewState::IsInWindow);
- _data->_viewInWindowChangeWasDeferred = NO;
- }
</del><ins>+ _data->_impl->endDeferringViewInWindowChangesSync();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_prepareForMoveToWindow:(NSWindow *)targetWindow withCompletionHandler:(void(^)(void))completionHandler
</span><span class="cx"> {
</span><del>- _data->_shouldDeferViewInWindowChanges = YES;
- [self viewWillMoveToWindow:targetWindow];
- _data->_targetWindowForMovePreparation = targetWindow;
- [self viewDidMoveToWindow];
-
- _data->_shouldDeferViewInWindowChanges = NO;
-
- _data->_page->installViewStateChangeCompletionHandler(^() {
- completionHandler();
- ASSERT(self.window == _data->_targetWindowForMovePreparation);
- _data->_targetWindowForMovePreparation = nil;
- });
-
- [self _dispatchSetTopContentInset];
- _data->_page->viewStateDidChange(ViewState::IsInWindow, false, WebPageProxy::ViewStateChangeDispatchMode::Immediate);
- _data->_viewInWindowChangeWasDeferred = NO;
</del><ins>+ _data->_impl->prepareForMoveToWindow(targetWindow, completionHandler);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)isDeferringViewInWindowChanges
</span><span class="cx"> {
</span><del>- return _data->_shouldDeferViewInWindowChanges;
</del><ins>+ return _data->_impl->isDeferringViewInWindowChanges();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)windowOcclusionDetectionEnabled
</span><span class="lines">@@ -4085,73 +3482,48 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)allowsLinkPreview
</span><span class="cx"> {
</span><del>- return _data->_allowsLinkPreview;
</del><ins>+ return _data->_impl->allowsLinkPreview();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setAllowsLinkPreview:(BOOL)allowsLinkPreview
</span><span class="cx"> {
</span><del>- if (_data->_allowsLinkPreview == allowsLinkPreview)
- return;
-
- _data->_allowsLinkPreview = allowsLinkPreview;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (!allowsLinkPreview)
- [self removeGestureRecognizer:_data->_immediateActionGestureRecognizer.get()];
- else if (NSGestureRecognizer *immediateActionRecognizer = _data->_immediateActionGestureRecognizer.get())
- [self addGestureRecognizer:immediateActionRecognizer];
-#endif
</del><ins>+ _data->_impl->setAllowsLinkPreview(allowsLinkPreview);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setIgnoresAllEvents:(BOOL)ignoresAllEvents
</span><span class="cx"> {
</span><del>- _data->_ignoresAllEvents = ignoresAllEvents;
- [self _setIgnoresNonWheelEvents:ignoresAllEvents];
</del><ins>+ _data->_impl->setIgnoresAllEvents(ignoresAllEvents);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Forward _setIgnoresNonWheelMouseEvents to _setIgnoresNonWheelEvents to avoid breaking existing clients.
</span><span class="cx"> - (void)_setIgnoresNonWheelMouseEvents:(BOOL)ignoresNonWheelMouseEvents
</span><span class="cx"> {
</span><del>- [self _setIgnoresNonWheelEvents:ignoresNonWheelMouseEvents];
</del><ins>+ _data->_impl->setIgnoresNonWheelEvents(ignoresNonWheelMouseEvents);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setIgnoresNonWheelEvents:(BOOL)ignoresNonWheelEvents
</span><span class="cx"> {
</span><del>- if (_data->_ignoresNonWheelEvents == ignoresNonWheelEvents)
- return;
-
- _data->_ignoresNonWheelEvents = ignoresNonWheelEvents;
- _data->_page->setShouldDispatchFakeMouseMoveEvents(!ignoresNonWheelEvents);
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (ignoresNonWheelEvents)
- [self removeGestureRecognizer:_data->_immediateActionGestureRecognizer.get()];
- else if (NSGestureRecognizer *immediateActionRecognizer = _data->_immediateActionGestureRecognizer.get()) {
- if (_data->_allowsLinkPreview)
- [self addGestureRecognizer:immediateActionRecognizer];
- }
-#endif
</del><ins>+ _data->_impl->setIgnoresNonWheelEvents(ignoresNonWheelEvents);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_ignoresNonWheelEvents
</span><span class="cx"> {
</span><del>- return _data->_ignoresNonWheelEvents;
</del><ins>+ return _data->_impl->ignoresNonWheelEvents();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_ignoresAllEvents
</span><span class="cx"> {
</span><del>- return _data->_ignoresAllEvents;
</del><ins>+ return _data->_impl->ignoresAllEvents();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setOverrideDeviceScaleFactor:(CGFloat)deviceScaleFactor
</span><span class="cx"> {
</span><del>- _data->_overrideDeviceScaleFactor = deviceScaleFactor;
- _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
</del><ins>+ _data->_impl->setOverrideDeviceScaleFactor(deviceScaleFactor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (CGFloat)_overrideDeviceScaleFactor
</span><span class="cx"> {
</span><del>- return _data->_overrideDeviceScaleFactor;
</del><ins>+ return _data->_impl->overrideDeviceScaleFactor();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (WKLayoutMode)_layoutMode
</span><span class="lines">@@ -4184,32 +3556,14 @@
</span><span class="cx"> _data->_impl->setViewScale(viewScale);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_dispatchSetTopContentInset
-{
- if (!_data->_didScheduleSetTopContentInset)
- return;
-
- _data->_didScheduleSetTopContentInset = NO;
- _data->_page->setTopContentInset(_data->_topContentInset);
-}
-
</del><span class="cx"> - (void)_setTopContentInset:(CGFloat)contentInset
</span><span class="cx"> {
</span><del>- _data->_topContentInset = contentInset;
-
- if (_data->_didScheduleSetTopContentInset)
- return;
-
- _data->_didScheduleSetTopContentInset = YES;
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [self _dispatchSetTopContentInset];
- });
</del><ins>+ return _data->_impl->setTopContentInset(contentInset);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (CGFloat)_topContentInset
</span><span class="cx"> {
</span><del>- return _data->_topContentInset;
</del><ins>+ return _data->_impl->topContentInset();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_setTotalHeightOfBanners:(CGFloat)totalHeightOfBanners
</span><span class="lines">@@ -4487,49 +3841,24 @@
</span><span class="cx">
</span><span class="cx"> - (void)_dismissContentRelativeChildWindows
</span><span class="cx"> {
</span><del>- // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
- if ([[self window] isKeyWindow]
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- || [_data->_immediateActionController hasActiveImmediateAction]
-#endif
- ) {
- DictionaryLookup::hidePopup();
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
- if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
- [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
-#endif
- }
-
- [self _clearTextIndicatorWithAnimation:TextIndicatorWindowDismissalAnimation::FadeOut];
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- [_data->_immediateActionController dismissContentRelativeChildWindows];
-#endif
-
- static_cast<PageClient&>(*_data->_pageClient).dismissCorrectionPanel(ReasonForDismissingAlternativeTextIgnored);
</del><ins>+ _data->_impl->dismissContentRelativeChildWindowsFromViewOnly();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)withAnimation
</span><span class="cx"> {
</span><del>- // Calling _clearTextIndicatorWithAnimation here will win out over the animated clear in _dismissContentRelativeChildWindows.
- // We can't invert these because clients can override (and have overridden) _dismissContentRelativeChildWindows, so it needs to be called.
- [self _clearTextIndicatorWithAnimation:withAnimation ? TextIndicatorWindowDismissalAnimation::FadeOut : TextIndicatorWindowDismissalAnimation::None];
- [self _dismissContentRelativeChildWindows];
</del><ins>+ _data->_impl->dismissContentRelativeChildWindowsWithAnimationFromViewOnly(withAnimation);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
</span><span class="cx">
</span><span class="cx"> - (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
</span><span class="cx"> {
</span><del>- _data->_automaticallyAdjustsContentInsets = automaticallyAdjustsContentInsets;
- [self _updateContentInsetsIfAutomatic];
</del><ins>+ _data->_impl->setAutomaticallyAdjustsContentInsets(automaticallyAdjustsContentInsets);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (BOOL)_automaticallyAdjustsContentInsets
</span><span class="cx"> {
</span><del>- return _data->_automaticallyAdjustsContentInsets;
</del><ins>+ return _data->_impl->automaticallyAdjustsContentInsets();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -80,19 +80,12 @@
</span><span class="cx"> - (void)_processDidExit;
</span><span class="cx"> - (void)_pageClosed;
</span><span class="cx"> - (void)_didRelaunchProcess;
</span><del>-- (void)_preferencesDidChange;
</del><span class="cx"> - (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
</span><span class="cx"> - (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState;
</span><span class="cx"> - (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled;
</span><span class="cx"> - (bool)_executeSavedCommandBySelector:(SEL)selector;
</span><del>-- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize;
</del><span class="cx"> - (NSRect)_convertToDeviceSpace:(NSRect)rect;
</span><span class="cx"> - (NSRect)_convertToUserSpace:(NSRect)rect;
</span><del>-- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator;
-- (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorWindowLifetime)lifetime;
-- (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorWindowDismissalAnimation)animation;
-- (void)_setTextIndicatorAnimationProgress:(float)progress;
-- (void)_selectionChanged;
</del><span class="cx">
</span><span class="cx"> - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
</span><span class="cx"> - (CALayer *)_acceleratedCompositingModeRootLayer;
</span><span class="lines">@@ -129,9 +122,6 @@
</span><span class="cx"> - (void)_reparentLayerTreeInThumbnailView;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-- (void)_windowDidOrderOnScreen:(NSNotification *)notification;
-- (void)_windowDidOrderOffScreen:(NSNotification *)notification;
-
</del><span class="cx"> - (void)_addFontPanelObserver;
</span><span class="cx"> // FullScreen
</span><span class="cx">
</span><span class="lines">@@ -139,20 +129,12 @@
</span><span class="cx"> @property (readonly) WKFullScreenWindowController *_fullScreenWindowController;
</span><span class="cx"> - (void)_closeFullScreenWindowController;
</span><span class="cx">
</span><del>-- (void)_prepareForDictionaryLookup;
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-- (void)_didPerformImmediateActionHitTest:(const WebKit::WebHitTestResultData&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
-#endif
-
</del><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
</span><span class="cx"> - (void)_startWindowDrag;
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> @property (nonatomic, retain, setter=_setPrimaryTrackingArea:) NSTrackingArea *_primaryTrackingArea;
</span><span class="cx">
</span><del>-@property (readonly) NSWindow *_targetWindowForMovePreparation;
-
</del><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> @property (nonatomic, readonly) _WKRemoteObjectRegistry *_remoteObjectRegistry;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -28,29 +28,52 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">
</span><del>-#import "WKLayoutMode.h"
-#import <wtf/RetainPtr.h>
</del><ins>+#include "WKLayoutMode.h"
+#include "WebPageProxy.h"
+#include <WebCore/TextIndicatorWindow.h>
+#include <functional>
+#include <wtf/RetainPtr.h>
+#include <wtf/WeakPtr.h>
+#include <wtf/text/WTFString.h>
</ins><span class="cx">
</span><ins>+OBJC_CLASS NSImmediateActionGestureRecognizer;
</ins><span class="cx"> OBJC_CLASS NSTextInputContext;
</span><span class="cx"> OBJC_CLASS NSView;
</span><ins>+OBJC_CLASS WKEditorUndoTargetObjC;
</ins><span class="cx"> OBJC_CLASS WKFullScreenWindowController;
</span><ins>+OBJC_CLASS WKImmediateActionController;
</ins><span class="cx"> OBJC_CLASS WKViewLayoutStrategy;
</span><ins>+OBJC_CLASS WKWindowVisibilityObserver;
</ins><span class="cx">
</span><span class="cx"> @protocol WebViewImplDelegate
</span><span class="cx">
</span><span class="cx"> - (NSTextInputContext *)_superInputContext;
</span><ins>+- (void)_superQuickLookWithEvent:(NSEvent *)event;
</ins><span class="cx">
</span><ins>+// This is a hack; these things live can live on a category (e.g. WKView (Private)) but WKView itself conforms to this protocol.
+// They're not actually optional.
+@optional
+
+- (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData;
+- (void)_prepareForImmediateActionAnimation;
+- (void)_cancelImmediateActionAnimation;
+- (void)_completeImmediateActionAnimation;
+- (void)_dismissContentRelativeChildWindows;
+- (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)animate;
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class WebEditCommandProxy;
</ins><span class="cx"> class WebPageProxy;
</span><ins>+struct ColorSpaceData;
</ins><span class="cx">
</span><span class="cx"> class WebViewImpl {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(WebViewImpl);
</span><span class="cx"> public:
</span><del>- WebViewImpl(NSView <WebViewImplDelegate> *, WebPageProxy&);
</del><ins>+ WebViewImpl(NSView <WebViewImplDelegate> *, WebPageProxy&, PageClient&);
</ins><span class="cx">
</span><span class="cx"> ~WebViewImpl();
</span><span class="cx">
</span><span class="lines">@@ -67,17 +90,25 @@
</span><span class="cx"> void viewWillStartLiveResize();
</span><span class="cx"> void viewDidEndLiveResize();
</span><span class="cx">
</span><ins>+ void renewGState();
</ins><span class="cx"> void setFrameSize(CGSize);
</span><span class="cx"> void disableFrameSizeUpdates();
</span><span class="cx"> void enableFrameSizeUpdates();
</span><span class="cx"> bool frameSizeUpdatesDisabled() const;
</span><span class="cx"> void setFrameAndScrollBy(CGRect, CGSize);
</span><ins>+ void updateWindowAndViewFrames();
</ins><span class="cx">
</span><span class="cx"> void setFixedLayoutSize(CGSize);
</span><span class="cx"> CGSize fixedLayoutSize() const;
</span><span class="cx">
</span><span class="cx"> void setDrawingAreaSize(CGSize);
</span><span class="cx">
</span><ins>+ void setAutomaticallyAdjustsContentInsets(bool);
+ bool automaticallyAdjustsContentInsets() const { return m_automaticallyAdjustsContentInsets; }
+ void updateContentInsetsIfAutomatic();
+ void setTopContentInset(CGFloat);
+ CGFloat topContentInset() const { return m_topContentInset; }
+
</ins><span class="cx"> void setContentPreparationRect(CGRect);
</span><span class="cx"> void updateViewExposedRect();
</span><span class="cx"> void setClipsToVisibleRect(bool);
</span><span class="lines">@@ -93,11 +124,45 @@
</span><span class="cx"> void setLayoutMode(WKLayoutMode);
</span><span class="cx"> void updateSupportsArbitraryLayoutModes();
</span><span class="cx">
</span><ins>+ void setOverrideDeviceScaleFactor(CGFloat);
+ CGFloat overrideDeviceScaleFactor() const { return m_overrideDeviceScaleFactor; }
+
+ void windowDidOrderOffScreen();
+ void windowDidOrderOnScreen();
+ void windowDidBecomeKey(NSWindow *);
+ void windowDidResignKey(NSWindow *);
+ void windowDidMiniaturize();
+ void windowDidDeminiaturize();
+ void windowDidMove();
+ void windowDidResize();
+ void windowDidChangeBackingProperties(CGFloat oldBackingScaleFactor);
+ void windowDidChangeScreen();
+ void windowDidChangeLayerHosting();
+ void windowDidChangeOcclusionState();
+
+ void viewWillMoveToWindow(NSWindow *);
+ void viewDidMoveToWindow();
+ void viewDidChangeBackingProperties();
+
+ ColorSpaceData colorSpace();
+
+ void beginDeferringViewInWindowChanges();
+ // FIXME: Merge these two?
+ void endDeferringViewInWindowChanges();
+ void endDeferringViewInWindowChangesSync();
+ bool isDeferringViewInWindowChanges() const { return m_shouldDeferViewInWindowChanges; }
+
+ void prepareForMoveToWindow(NSWindow *targetWindow, std::function<void()> completionHandler);
+ NSWindow *targetWindowForMovePreparation() const { return m_targetWindowForMovePreparation; }
+
</ins><span class="cx"> void updateSecureInputState();
</span><span class="cx"> void resetSecureInputState();
</span><span class="cx"> bool inSecureInputState() const { return m_inSecureInputState; }
</span><span class="cx"> void notifyInputContextAboutDiscardedComposition();
</span><span class="cx">
</span><ins>+ void pressureChangeWithEvent(NSEvent *);
+ NSEvent *lastPressureEvent() { return m_lastPressureEvent.get(); }
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> bool hasFullScreenWindowController() const;
</span><span class="cx"> WKFullScreenWindowController *fullScreenWindowController();
</span><span class="lines">@@ -106,33 +171,114 @@
</span><span class="cx"> NSView *fullScreenPlaceholderView();
</span><span class="cx"> NSWindow *createFullScreenWindow();
</span><span class="cx">
</span><ins>+ bool isEditable() const;
+ void executeEditCommand(const String& commandName, const String& argument = String());
+ void registerEditCommand(RefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
+ void clearAllEditCommands();
+ bool writeSelectionToPasteboard(NSPasteboard *, NSArray *types);
+ void centerSelectionInVisibleArea();
+ void selectionDidChange();
+ void startObservingFontPanel();
+ void updateFontPanelIfNeeded();
+
+ void preferencesDidChange();
+
+ void setTextIndicator(WebCore::TextIndicator&, WebCore::TextIndicatorWindowLifetime = WebCore::TextIndicatorWindowLifetime::Permanent);
+ void clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation);
+ void setTextIndicatorAnimationProgress(float);
+ void dismissContentRelativeChildWindows();
+ void dismissContentRelativeChildWindowsFromViewOnly();
+ void dismissContentRelativeChildWindowsWithAnimation(bool);
+ void dismissContentRelativeChildWindowsWithAnimationFromViewOnly(bool);
+
+ void quickLookWithEvent(NSEvent *);
+ 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 didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object* userData);
+ void prepareForImmediateActionAnimation();
+ void cancelImmediateActionAnimation();
+ void completeImmediateActionAnimation();
+
+ void setIgnoresNonWheelEvents(bool);
+ bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
+ void setIgnoresAllEvents(bool);
+ bool ignoresAllEvents() const { return m_ignoresAllEvents; }
+
+ void accessibilityRegisterUIProcessTokens();
+
</ins><span class="cx"> private:
</span><ins>+ WeakPtr<WebViewImpl> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
+
</ins><span class="cx"> bool supportsArbitraryLayoutModes() const;
</span><ins>+ float intrinsicDeviceScaleFactor() const;
+ void dispatchSetTopContentInset();
</ins><span class="cx">
</span><ins>+ void postFakeMouseMovedEventForFlagsChangedEvent(NSEvent *);
+
</ins><span class="cx"> NSView <WebViewImplDelegate> *m_view;
</span><span class="cx"> WebPageProxy& m_page;
</span><ins>+ PageClient& m_pageClient;
</ins><span class="cx">
</span><ins>+ WeakPtrFactory<WebViewImpl> m_weakPtrFactory;
+
</ins><span class="cx"> bool m_willBecomeFirstResponderAgain { false };
</span><span class="cx"> bool m_inBecomeFirstResponder { false };
</span><span class="cx"> bool m_inResignFirstResponder { false };
</span><span class="cx">
</span><del>- CGRect m_contentPreparationRect;
</del><ins>+ CGRect m_contentPreparationRect { CGRectZero };
</ins><span class="cx"> bool m_useContentPreparationRectForVisibleRect { false };
</span><span class="cx"> bool m_clipsToVisibleRect { false };
</span><ins>+ bool m_needsViewFrameInWindowCoordinates;
+ bool m_didScheduleWindowAndViewFrameUpdate { false };
+ bool m_isDeferringViewInWindowChanges { false };
</ins><span class="cx">
</span><del>- CGSize m_resizeScrollOffset;
</del><ins>+ bool m_automaticallyAdjustsContentInsets { false };
+ CGFloat m_topContentInset { 0 };
+ bool m_didScheduleSetTopContentInset { false };
</ins><span class="cx">
</span><del>- CGSize m_intrinsicContentSize;
</del><ins>+ CGSize m_resizeScrollOffset { CGSizeZero };
</ins><span class="cx">
</span><ins>+ CGSize m_intrinsicContentSize { CGSizeZero };
+ CGFloat m_overrideDeviceScaleFactor { 0 };
+
</ins><span class="cx"> RetainPtr<WKViewLayoutStrategy> m_layoutStrategy;
</span><span class="cx"> WKLayoutMode m_lastRequestedLayoutMode { kWKLayoutModeViewSize };
</span><span class="cx"> CGFloat m_lastRequestedViewScale { 1 };
</span><span class="cx">
</span><span class="cx"> bool m_inSecureInputState { false };
</span><ins>+ RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> RetainPtr<WKFullScreenWindowController> m_fullScreenWindowController;
</span><span class="cx"> #endif
</span><ins>+
+ RetainPtr<WKWindowVisibilityObserver> m_windowVisibilityObserver;
+
+ bool m_shouldDeferViewInWindowChanges { false };
+ bool m_viewInWindowChangeWasDeferred { false };
+ NSWindow *m_targetWindowForMovePreparation { nullptr };
+
+ id m_flagsChangedEventMonitor { nullptr };
+
+ std::unique_ptr<WebCore::TextIndicatorWindow> m_textIndicatorWindow;
+
+ RetainPtr<NSColorSpace> m_colorSpace;
+
+ RetainPtr<NSEvent> m_lastPressureEvent;
+
+ bool m_ignoresNonWheelEvents { false };
+ bool m_ignoresAllEvents { false };
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ RetainPtr<WKImmediateActionController> m_immediateActionController;
+ RetainPtr<NSImmediateActionGestureRecognizer> m_immediateActionGestureRecognizer;
+#endif
+
+ bool m_allowsLinkPreview { true };
+ bool m_didRegisterForLookupPopoverCloseNotifications { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -28,28 +28,295 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">
</span><ins>+#import "ColorSpaceData.h"
</ins><span class="cx"> #import "GenericCallback.h"
</span><span class="cx"> #import "Logging.h"
</span><span class="cx"> #import "NativeWebKeyboardEvent.h"
</span><ins>+#import "NativeWebMouseEvent.h"
+#import "PageClient.h"
</ins><span class="cx"> #import "WKFullScreenWindowController.h"
</span><ins>+#import "WKImmediateActionController.h"
</ins><span class="cx"> #import "WKViewLayoutStrategy.h"
</span><span class="cx"> #import "WKWebView.h"
</span><ins>+#import "WebEditCommandProxy.h"
</ins><span class="cx"> #import "WebPageProxy.h"
</span><span class="cx"> #import <HIToolbox/CarbonEventsCore.h>
</span><ins>+#import <WebCore/AXObjectCache.h>
+#import <WebCore/DataDetectorsSPI.h>
+#import <WebCore/DictionaryLookup.h>
</ins><span class="cx"> #import <WebCore/KeypressCommand.h>
</span><ins>+#import <WebCore/LookupSPI.h>
+#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
</ins><span class="cx"> #import <WebCore/NSWindowSPI.h>
</span><ins>+#import <WebCore/SoftLinking.h>
</ins><span class="cx"> #import <WebCore/ViewState.h>
</span><span class="cx"> #import <WebCore/WebCoreFullScreenPlaceholderView.h>
</span><span class="cx"> #import <WebCore/WebCoreFullScreenWindow.h>
</span><ins>+#import <WebKitSystemInterface.h>
</ins><span class="cx">
</span><ins>+SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
+
+@interface WKWindowVisibilityObserver : NSObject {
+ NSView *_view;
+ WebKit::WebViewImpl *_impl;
+}
+
+- (instancetype)initWithView:(NSView *)view impl:(WebKit::WebViewImpl&)impl;
+- (void)startObserving:(NSWindow *)window;
+- (void)stopObserving:(NSWindow *)window;
+- (void)startObservingFontPanel;
+- (void)startObservingLookupDismissal;
+@end
+
+@implementation WKWindowVisibilityObserver
+
+- (instancetype)initWithView:(NSView *)view impl:(WebKit::WebViewImpl&)impl
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ _view = view;
+ _impl = &impl;
+
+ return self;
+}
+
+- (void)dealloc
+{
+ if (canLoadLUNotificationPopoverWillClose())
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
+
+ [super dealloc];
+}
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+static void* keyValueObservingContext = &keyValueObservingContext;
+#endif
+
+- (void)startObserving:(NSWindow *)window
+{
+ if (!window)
+ return;
+
+ NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter];
+
+ // An NSView derived object such as WKView cannot observe these notifications, because NSView itself observes them.
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidOrderOffScreen:) name:@"NSWindowDidOrderOffScreenNotification" object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidOrderOnScreen:) name:@"_NSWindowDidBecomeVisible" object:window];
+
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidResignKey:) name:NSWindowDidResignKeyNotification object:nil];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidMove:) name:NSWindowDidMoveNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidResize:) name:NSWindowDidResizeNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeScreen:) name:NSWindowDidChangeScreenNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeLayerHosting:) name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window];
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ [window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
+ [window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
+#endif
+}
+
+- (void)stopObserving:(NSWindow *)window
+{
+ if (!window)
+ return;
+
+ NSNotificationCenter *defaultNotificationCenter = [NSNotificationCenter defaultCenter];
+
+ [defaultNotificationCenter removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window];
+ [defaultNotificationCenter removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window];
+
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidMiniaturizeNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidMoveNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidResizeNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeScreenNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
+ [defaultNotificationCenter removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (_impl->isEditable())
+ [[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext];
+ [window removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
+ [window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
+#endif
+}
+
+- (void)startObservingFontPanel
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ [[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:0 context:keyValueObservingContext];
+#endif
+}
+
+- (void)startObservingLookupDismissal
+{
+ if (canLoadLUNotificationPopoverWillClose())
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+}
+
+- (void)_windowDidOrderOnScreen:(NSNotification *)notification
+{
+ _impl->windowDidOrderOnScreen();
+}
+
+- (void)_windowDidOrderOffScreen:(NSNotification *)notification
+{
+ _impl->windowDidOrderOffScreen();
+}
+
+- (void)_windowDidBecomeKey:(NSNotification *)notification
+{
+ _impl->windowDidBecomeKey([notification object]);
+}
+
+- (void)_windowDidResignKey:(NSNotification *)notification
+{
+ _impl->windowDidResignKey([notification object]);
+}
+
+- (void)_windowDidMiniaturize:(NSNotification *)notification
+{
+ _impl->windowDidMiniaturize();
+}
+
+- (void)_windowDidDeminiaturize:(NSNotification *)notification
+{
+ _impl->windowDidDeminiaturize();
+}
+
+- (void)_windowDidMove:(NSNotification *)notification
+{
+ _impl->windowDidMove();
+}
+
+- (void)_windowDidResize:(NSNotification *)notification
+{
+ _impl->windowDidResize();
+}
+
+- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
+{
+ CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:NSBackingPropertyOldScaleFactorKey] doubleValue];
+ _impl->windowDidChangeBackingProperties(oldBackingScaleFactor);
+}
+
+- (void)_windowDidChangeScreen:(NSNotification *)notification
+{
+ _impl->windowDidChangeScreen();
+}
+
+- (void)_windowDidChangeLayerHosting:(NSNotification *)notification
+{
+ _impl->windowDidChangeLayerHosting();
+}
+
+- (void)_windowDidChangeOcclusionState:(NSNotification *)notification
+{
+ _impl->windowDidChangeOcclusionState();
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (context != keyValueObservingContext) {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ return;
+ }
+
+ if ([keyPath isEqualToString:@"visible"] && [NSFontPanel sharedFontPanelExists] && object == [NSFontPanel sharedFontPanel]) {
+ _impl->updateFontPanelIfNeeded();
+ return;
+ }
+ if ([keyPath isEqualToString:@"contentLayoutRect"] || [keyPath isEqualToString:@"titlebarAppearsTransparent"])
+ _impl->updateContentInsetsIfAutomatic();
+#endif
+}
+
+- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
+{
+ _impl->clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::None);
+}
+
+@end
+
+@interface WKEditCommandObjC : NSObject {
+ RefPtr<WebKit::WebEditCommandProxy> m_command;
+}
+- (id)initWithWebEditCommandProxy:(RefPtr<WebKit::WebEditCommandProxy>)command;
+- (WebKit::WebEditCommandProxy*)command;
+@end
+
+@interface WKEditorUndoTargetObjC : NSObject
+- (void)undoEditing:(id)sender;
+- (void)redoEditing:(id)sender;
+@end
+
+@implementation WKEditCommandObjC
+
+- (id)initWithWebEditCommandProxy:(RefPtr<WebKit::WebEditCommandProxy>)command
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ m_command = command;
+ return self;
+}
+
+- (WebKit::WebEditCommandProxy*)command
+{
+ return m_command.get();
+}
+
+@end
+
+@implementation WKEditorUndoTargetObjC
+
+- (void)undoEditing:(id)sender
+{
+ ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
+ [sender command]->unapply();
+}
+
+- (void)redoEditing:(id)sender
+{
+ ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
+ [sender command]->reapply();
+}
+
+@end
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><del>-WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WebPageProxy& page)
</del><ins>+WebViewImpl::WebViewImpl(NSView <WebViewImplDelegate> *view, WebPageProxy& page, PageClient& pageClient)
</ins><span class="cx"> : m_view(view)
</span><span class="cx"> , m_page(page)
</span><ins>+ , m_pageClient(pageClient)
+ , m_weakPtrFactory(this)
+ , m_needsViewFrameInWindowCoordinates(m_page.preferences().pluginsEnabled())
</ins><span class="cx"> , m_intrinsicContentSize(CGSizeMake(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric))
</span><span class="cx"> , m_layoutStrategy([WKViewLayoutStrategy layoutStrategyWithPage:m_page view:m_view viewImpl:*this mode:kWKLayoutModeViewSize])
</span><ins>+ , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
+ , m_windowVisibilityObserver(adoptNS([[WKWindowVisibilityObserver alloc] initWithView:view impl:*this]))
</ins><span class="cx"> {
</span><ins>+ m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
+ m_immediateActionGestureRecognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] init]);
+ m_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:m_page view:m_view viewImpl:*this recognizer:m_immediateActionGestureRecognizer.get()]);
+ [m_immediateActionGestureRecognizer setDelegate:m_immediateActionController.get()];
+ [m_immediateActionGestureRecognizer setDelaysPrimaryMouseButtonEvents:NO];
+ }
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebViewImpl::~WebViewImpl()
</span><span class="lines">@@ -57,6 +324,10 @@
</span><span class="cx"> ASSERT(!m_inSecureInputState);
</span><span class="cx">
</span><span class="cx"> [m_layoutStrategy invalidate];
</span><ins>+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ [m_immediateActionController willDestroyView:m_view];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebViewImpl::setDrawsBackground(bool drawsBackground)
</span><span class="lines">@@ -89,7 +360,7 @@
</span><span class="cx"> // If we just became first responder again, there is no need to do anything,
</span><span class="cx"> // since resignFirstResponder has correctly detected this situation.
</span><span class="cx"> if (m_willBecomeFirstResponderAgain) {
</span><del>- m_willBecomeFirstResponderAgain = NO;
</del><ins>+ m_willBecomeFirstResponderAgain = false;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -128,7 +399,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- m_willBecomeFirstResponderAgain = NO;
</del><ins>+ m_willBecomeFirstResponderAgain = false;
</ins><span class="cx"> m_inResignFirstResponder = true;
</span><span class="cx">
</span><span class="cx"> #if USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="lines">@@ -175,6 +446,18 @@
</span><span class="cx"> [m_layoutStrategy didEndLiveResize];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::renewGState()
+{
+ if (m_textIndicatorWindow)
+ dismissContentRelativeChildWindowsWithAnimation(false);
+
+ // Update the view frame.
+ if (m_view.window)
+ updateWindowAndViewFrames();
+
+ updateContentInsetsIfAutomatic();
+}
+
</ins><span class="cx"> void WebViewImpl::setFrameSize(CGSize)
</span><span class="cx"> {
</span><span class="cx"> [m_layoutStrategy didChangeFrameSize];
</span><span class="lines">@@ -203,6 +486,39 @@
</span><span class="cx"> m_view.frame = NSRectFromCGRect(frame);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::updateWindowAndViewFrames()
+{
+ if (clipsToVisibleRect())
+ updateViewExposedRect();
+
+ if (m_didScheduleWindowAndViewFrameUpdate)
+ return;
+
+ m_didScheduleWindowAndViewFrameUpdate = true;
+
+ auto weakThis = createWeakPtr();
+ dispatch_async(dispatch_get_main_queue(), [weakThis] {
+ if (!weakThis)
+ return;
+
+ weakThis->m_didScheduleWindowAndViewFrameUpdate = false;
+
+ NSRect viewFrameInWindowCoordinates = NSZeroRect;
+ NSPoint accessibilityPosition = NSZeroPoint;
+
+ if (weakThis->m_needsViewFrameInWindowCoordinates)
+ viewFrameInWindowCoordinates = [weakThis->m_view convertRect:weakThis->m_view.frame toView:nil];
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ if (WebCore::AXObjectCache::accessibilityEnabled())
+ accessibilityPosition = [[weakThis->m_view accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
+#pragma clang diagnostic pop
+
+ weakThis->m_page.windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
+ });
+}
+
</ins><span class="cx"> void WebViewImpl::setFixedLayoutSize(CGSize fixedLayoutSize)
</span><span class="cx"> {
</span><span class="cx"> m_page.setFixedLayoutSize(WebCore::expandedIntSize(WebCore::FloatSize(fixedLayoutSize)));
</span><span class="lines">@@ -222,6 +538,55 @@
</span><span class="cx"> m_resizeScrollOffset = CGSizeZero;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::setAutomaticallyAdjustsContentInsets(bool automaticallyAdjustsContentInsets)
+{
+ m_automaticallyAdjustsContentInsets = automaticallyAdjustsContentInsets;
+ updateContentInsetsIfAutomatic();
+}
+
+void WebViewImpl::updateContentInsetsIfAutomatic()
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (!m_automaticallyAdjustsContentInsets)
+ return;
+
+ NSWindow *window = m_view.window;
+ if ((window.styleMask & NSFullSizeContentViewWindowMask) && !window.titlebarAppearsTransparent && ![m_view enclosingScrollView]) {
+ NSRect contentLayoutRect = [m_view convertRect:window.contentLayoutRect fromView:nil];
+ CGFloat newTopContentInset = NSMaxY(contentLayoutRect) - NSHeight(contentLayoutRect);
+ if (m_topContentInset != newTopContentInset)
+ setTopContentInset(newTopContentInset);
+ } else
+ setTopContentInset(0);
+#endif
+}
+
+void WebViewImpl::setTopContentInset(CGFloat contentInset)
+{
+ m_topContentInset = contentInset;
+
+ if (m_didScheduleSetTopContentInset)
+ return;
+
+ m_didScheduleSetTopContentInset = true;
+
+ auto weakThis = createWeakPtr();
+ dispatch_async(dispatch_get_main_queue(), [weakThis] {
+ if (!weakThis)
+ return;
+ weakThis->dispatchSetTopContentInset();
+ });
+}
+
+void WebViewImpl::dispatchSetTopContentInset()
+{
+ if (!m_didScheduleSetTopContentInset)
+ return;
+
+ m_didScheduleSetTopContentInset = false;
+ m_page.setTopContentInset(m_topContentInset);
+}
+
</ins><span class="cx"> void WebViewImpl::setContentPreparationRect(CGRect rect)
</span><span class="cx"> {
</span><span class="cx"> m_contentPreparationRect = rect;
</span><span class="lines">@@ -337,6 +702,270 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::setOverrideDeviceScaleFactor(CGFloat deviceScaleFactor)
+{
+ m_overrideDeviceScaleFactor = deviceScaleFactor;
+ m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+}
+
+float WebViewImpl::intrinsicDeviceScaleFactor() const
+{
+ if (m_overrideDeviceScaleFactor)
+ return m_overrideDeviceScaleFactor;
+ if (m_targetWindowForMovePreparation)
+ return m_targetWindowForMovePreparation.backingScaleFactor;
+ if (NSWindow *window = m_view.window)
+ return window.backingScaleFactor;
+ return [NSScreen mainScreen].backingScaleFactor;
+}
+
+void WebViewImpl::windowDidOrderOffScreen()
+{
+ m_page.viewStateDidChange(WebCore::ViewState::IsVisible | WebCore::ViewState::WindowIsActive);
+}
+
+void WebViewImpl::windowDidOrderOnScreen()
+{
+ 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();
+ m_page.viewStateDidChange(WebCore::ViewState::WindowIsActive);
+ }
+}
+
+void WebViewImpl::windowDidResignKey(NSWindow *formerKeyWindow)
+{
+ if (formerKeyWindow == m_view.window || formerKeyWindow == m_view.window.attachedSheet) {
+ updateSecureInputState();
+ m_page.viewStateDidChange(WebCore::ViewState::WindowIsActive);
+ }
+}
+
+void WebViewImpl::windowDidMiniaturize()
+{
+ m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+}
+
+void WebViewImpl::windowDidDeminiaturize()
+{
+ m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+}
+
+void WebViewImpl::windowDidMove()
+{
+ updateWindowAndViewFrames();
+}
+
+void WebViewImpl::windowDidResize()
+{
+ updateWindowAndViewFrames();
+}
+
+void WebViewImpl::windowDidChangeBackingProperties(CGFloat oldBackingScaleFactor)
+{
+ CGFloat newBackingScaleFactor = intrinsicDeviceScaleFactor();
+ if (oldBackingScaleFactor == newBackingScaleFactor)
+ return;
+
+ m_page.setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
+}
+
+void WebViewImpl::windowDidChangeScreen()
+{
+ NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
+ m_page.windowScreenDidChange((PlatformDisplayID)[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]);
+}
+
+void WebViewImpl::windowDidChangeLayerHosting()
+{
+ m_page.layerHostingModeDidChange();
+}
+
+void WebViewImpl::windowDidChangeOcclusionState()
+{
+ m_page.viewStateDidChange(WebCore::ViewState::IsVisible);
+}
+
+void WebViewImpl::viewWillMoveToWindow(NSWindow *window)
+{
+ // If we're in the middle of preparing to move to a window, we should only be moved to that window.
+ ASSERT(!m_targetWindowForMovePreparation || (m_targetWindowForMovePreparation == window));
+
+ NSWindow *currentWindow = m_view.window;
+ if (window == currentWindow)
+ return;
+
+ clearAllEditCommands();
+
+ NSWindow *stopObservingWindow = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
+ [m_windowVisibilityObserver stopObserving:stopObservingWindow];
+ [m_windowVisibilityObserver startObserving:window];
+}
+
+void WebViewImpl::viewDidMoveToWindow()
+{
+ NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
+
+ if (window) {
+ windowDidChangeScreen();
+
+ WebCore::ViewState::Flags viewStateChanges = WebCore::ViewState::WindowIsActive | WebCore::ViewState::IsVisible;
+ if (m_isDeferringViewInWindowChanges)
+ m_viewInWindowChangeWasDeferred = true;
+ else
+ viewStateChanges |= WebCore::ViewState::IsInWindow;
+ m_page.viewStateDidChange(viewStateChanges);
+
+ updateWindowAndViewFrames();
+
+ // FIXME(135509) This call becomes unnecessary once 135509 is fixed; remove.
+ m_page.layerHostingModeDidChange();
+
+ if (!m_flagsChangedEventMonitor) {
+ auto weakThis = createWeakPtr();
+ m_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:[weakThis] (NSEvent *flagsChangedEvent) {
+ if (weakThis)
+ weakThis->postFakeMouseMovedEventForFlagsChangedEvent(flagsChangedEvent);
+ return flagsChangedEvent;
+ }];
+ }
+
+ accessibilityRegisterUIProcessTokens();
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (m_immediateActionGestureRecognizer && ![[m_view gestureRecognizers] containsObject:m_immediateActionGestureRecognizer.get()] && !m_ignoresNonWheelEvents && m_allowsLinkPreview)
+ [m_view addGestureRecognizer:m_immediateActionGestureRecognizer.get()];
+#endif
+ } else {
+ WebCore::ViewState::Flags viewStateChanges = WebCore::ViewState::WindowIsActive | WebCore::ViewState::IsVisible;
+ if (m_isDeferringViewInWindowChanges)
+ m_viewInWindowChangeWasDeferred = true;
+ else
+ viewStateChanges |= WebCore::ViewState::IsInWindow;
+ m_page.viewStateDidChange(viewStateChanges);
+
+ [NSEvent removeMonitor:m_flagsChangedEventMonitor];
+ m_flagsChangedEventMonitor = nil;
+
+ dismissContentRelativeChildWindowsWithAnimation(false);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (m_immediateActionGestureRecognizer)
+ [m_view removeGestureRecognizer:m_immediateActionGestureRecognizer.get()];
+#endif
+ }
+
+ m_page.setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
+}
+
+void WebViewImpl::viewDidChangeBackingProperties()
+{
+ NSColorSpace *colorSpace = m_view.window.colorSpace;
+ if ([colorSpace isEqualTo:m_colorSpace.get()])
+ return;
+
+ m_colorSpace = nullptr;
+ if (DrawingAreaProxy *drawingArea = m_page.drawingArea())
+ drawingArea->colorSpaceDidChange();
+}
+
+void WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent(NSEvent *flagsChangedEvent)
+{
+ NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:flagsChangedEvent.window.mouseLocationOutsideOfEventStream
+ 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);
+}
+
+ColorSpaceData WebViewImpl::colorSpace()
+{
+ if (!m_colorSpace) {
+ if (m_targetWindowForMovePreparation)
+ m_colorSpace = m_targetWindowForMovePreparation.colorSpace;
+ else if (NSWindow *window = m_view.window)
+ m_colorSpace = window.colorSpace;
+ else
+ m_colorSpace = [NSScreen mainScreen].colorSpace;
+ }
+
+ ColorSpaceData colorSpaceData;
+ colorSpaceData.cgColorSpace = [m_colorSpace CGColorSpace];
+
+ return colorSpaceData;
+}
+
+void WebViewImpl::beginDeferringViewInWindowChanges()
+{
+ if (m_shouldDeferViewInWindowChanges) {
+ NSLog(@"beginDeferringViewInWindowChanges was called while already deferring view-in-window changes!");
+ return;
+ }
+
+ m_shouldDeferViewInWindowChanges = true;
+}
+
+void WebViewImpl::endDeferringViewInWindowChanges()
+{
+ if (!m_shouldDeferViewInWindowChanges) {
+ NSLog(@"endDeferringViewInWindowChanges was called without beginDeferringViewInWindowChanges!");
+ return;
+ }
+
+ m_shouldDeferViewInWindowChanges = false;
+
+ if (m_viewInWindowChangeWasDeferred) {
+ dispatchSetTopContentInset();
+ m_page.viewStateDidChange(WebCore::ViewState::IsInWindow);
+ m_viewInWindowChangeWasDeferred = false;
+ }
+}
+
+void WebViewImpl::endDeferringViewInWindowChangesSync()
+{
+ if (!m_shouldDeferViewInWindowChanges) {
+ NSLog(@"endDeferringViewInWindowChangesSync was called without beginDeferringViewInWindowChanges!");
+ return;
+ }
+
+ m_shouldDeferViewInWindowChanges = false;
+
+ if (m_viewInWindowChangeWasDeferred) {
+ dispatchSetTopContentInset();
+ m_page.viewStateDidChange(WebCore::ViewState::IsInWindow);
+ m_viewInWindowChangeWasDeferred = false;
+ }
+}
+
+void WebViewImpl::prepareForMoveToWindow(NSWindow *targetWindow, std::function<void()> completionHandler)
+{
+ m_shouldDeferViewInWindowChanges = true;
+ viewWillMoveToWindow(targetWindow);
+ m_targetWindowForMovePreparation = targetWindow;
+ viewDidMoveToWindow();
+
+ m_shouldDeferViewInWindowChanges = false;
+
+ auto weakThis = createWeakPtr();
+ m_page.installViewStateChangeCompletionHandler([weakThis, completionHandler]() {
+ completionHandler();
+
+ if (!weakThis)
+ return;
+
+ ASSERT(weakThis->m_view.window == weakThis->m_targetWindowForMovePreparation);
+ weakThis->m_targetWindowForMovePreparation = nil;
+ });
+
+ dispatchSetTopContentInset();
+ m_page.viewStateDidChange(WebCore::ViewState::IsInWindow, false, WebPageProxy::ViewStateChangeDispatchMode::Immediate);
+ m_viewInWindowChangeWasDeferred = false;
+}
+
</ins><span class="cx"> void WebViewImpl::updateSecureInputState()
</span><span class="cx"> {
</span><span class="cx"> if (![[m_view window] isKeyWindow] || !isFocused()) {
</span><span class="lines">@@ -386,6 +1015,25 @@
</span><span class="cx"> [[m_view _superInputContext] discardMarkedText]; // Inform the input method that we won't have an inline input area despite having been asked to.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewImpl::pressureChangeWithEvent(NSEvent *event)
+{
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+ if (event == m_lastPressureEvent)
+ return;
+
+ if (m_ignoresNonWheelEvents)
+ return;
+
+ if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded)
+ return;
+
+ NativeWebMouseEvent webEvent(event, m_lastPressureEvent.get(), m_view);
+ m_page.handleMouseEvent(webEvent);
+
+ m_lastPressureEvent = event;
+#endif
+}
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> bool WebViewImpl::hasFullScreenWindowController() const
</span><span class="cx"> {
</span><span class="lines">@@ -428,7 +1076,260 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebViewImpl::isEditable() const
+{
+ return m_page.isEditable();
+}
</ins><span class="cx">
</span><ins>+void WebViewImpl::executeEditCommand(const String& commandName, const String& argument)
+{
+ m_page.executeEditCommand(commandName, argument);
+}
+
+void WebViewImpl::registerEditCommand(RefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ RefPtr<WebEditCommandProxy> command = prpCommand;
+
+ RetainPtr<WKEditCommandObjC> commandObjC = adoptNS([[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]);
+ String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
+
+ NSUndoManager *undoManager = [m_view undoManager];
+ [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
+ if (!actionName.isEmpty())
+ [undoManager setActionName:(NSString *)actionName];
+}
+
+void WebViewImpl::clearAllEditCommands()
+{
+ [[m_view undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
+}
+
+bool WebViewImpl::writeSelectionToPasteboard(NSPasteboard *pasteboard, NSArray *types)
+{
+ size_t numTypes = types.count;
+ [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];
+ else {
+ RefPtr<WebCore::SharedBuffer> buffer = m_page.dataSelectionForPasteboard([types objectAtIndex:i]);
+ [pasteboard setData:buffer ? buffer->createNSData().get() : nil forType:[types objectAtIndex:i]];
+ }
+ }
+ return true;
+}
+
+void WebViewImpl::centerSelectionInVisibleArea()
+{
+ m_page.centerSelectionInVisibleArea();
+}
+
+void WebViewImpl::selectionDidChange()
+{
+ updateFontPanelIfNeeded();
+}
+
+void WebViewImpl::startObservingFontPanel()
+{
+ [m_windowVisibilityObserver startObservingFontPanel];
+}
+
+void WebViewImpl::updateFontPanelIfNeeded()
+{
+ const EditorState& editorState = m_page.editorState();
+ 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) {
+ NSFont *font = [NSFont fontWithName:fontName size:fontSize];
+ if (font)
+ [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:selectionHasMultipleFonts];
+ });
+ }
+}
+
+void WebViewImpl::preferencesDidChange()
+{
+ BOOL needsViewFrameInWindowCoordinates = m_page.preferences().pluginsEnabled();
+
+ if (!!needsViewFrameInWindowCoordinates == !!m_needsViewFrameInWindowCoordinates)
+ return;
+
+ m_needsViewFrameInWindowCoordinates = needsViewFrameInWindowCoordinates;
+ if (m_view.window)
+ updateWindowAndViewFrames();
+}
+
+void WebViewImpl::setTextIndicator(WebCore::TextIndicator& textIndicator, WebCore::TextIndicatorWindowLifetime lifetime)
+{
+ if (!m_textIndicatorWindow)
+ m_textIndicatorWindow = std::make_unique<WebCore::TextIndicatorWindow>(m_view);
+
+ NSRect textBoundingRectInScreenCoordinates = [m_view.window convertRectToScreen:[m_view convertRect:textIndicator.textBoundingRectInRootViewCoordinates() toView:nil]];
+ m_textIndicatorWindow->setTextIndicator(textIndicator, NSRectToCGRect(textBoundingRectInScreenCoordinates), lifetime);
+}
+
+void WebViewImpl::clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation animation)
+{
+ if (m_textIndicatorWindow)
+ m_textIndicatorWindow->clearTextIndicator(animation);
+ m_textIndicatorWindow = nullptr;
+}
+
+void WebViewImpl::setTextIndicatorAnimationProgress(float progress)
+{
+ if (m_textIndicatorWindow)
+ m_textIndicatorWindow->setAnimationProgress(progress);
+}
+
+void WebViewImpl::dismissContentRelativeChildWindowsWithAnimation(bool animate)
+{
+ [m_view _dismissContentRelativeChildWindowsWithAnimation:animate];
+}
+
+void WebViewImpl::dismissContentRelativeChildWindowsWithAnimationFromViewOnly(bool animate)
+{
+ // Calling _clearTextIndicatorWithAnimation here will win out over the animated clear in dismissContentRelativeChildWindowsFromViewOnly.
+ // We can't invert these because clients can override (and have overridden) _dismissContentRelativeChildWindows, so it needs to be called.
+ // For this same reason, this can't be moved to WebViewImpl without care.
+ clearTextIndicatorWithAnimation(animate ? WebCore::TextIndicatorWindowDismissalAnimation::FadeOut : WebCore::TextIndicatorWindowDismissalAnimation::None);
+ [m_view _dismissContentRelativeChildWindows];
+}
+
+void WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly()
+{
+ bool hasActiveImmediateAction = false;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ hasActiveImmediateAction = [m_immediateActionController hasActiveImmediateAction];
+#endif
+
+ // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
+ if (m_view.window.isKeyWindow || hasActiveImmediateAction) {
+ WebCore::DictionaryLookup::hidePopup();
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
+ if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
+ [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
+#endif
+ }
+
+ clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation::FadeOut);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ [m_immediateActionController dismissContentRelativeChildWindows];
+#endif
+
+ m_pageClient.dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeTextIgnored);
+}
+
+void WebViewImpl::quickLookWithEvent(NSEvent *event)
+{
+ if (ignoresNonWheelEvents())
+ return;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (m_immediateActionGestureRecognizer) {
+ [m_view _superQuickLookWithEvent:event];
+ return;
+ }
+#endif
+
+ NSPoint locationInViewCoordinates = [m_view convertPoint:[event locationInWindow] fromView:nil];
+ m_page.performDictionaryLookupAtLocation(WebCore::FloatPoint(locationInViewCoordinates));
+}
+
+void WebViewImpl::prepareForDictionaryLookup()
+{
+ if (m_didRegisterForLookupPopoverCloseNotifications)
+ return;
+
+ m_didRegisterForLookupPopoverCloseNotifications = true;
+
+ [m_windowVisibilityObserver startObservingLookupDismissal];
+}
+
+void WebViewImpl::setAllowsLinkPreview(bool allowsLinkPreview)
+{
+ if (m_allowsLinkPreview == allowsLinkPreview)
+ return;
+
+ m_allowsLinkPreview = allowsLinkPreview;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (!allowsLinkPreview)
+ [m_view removeGestureRecognizer:m_immediateActionGestureRecognizer.get()];
+ else if (NSGestureRecognizer *immediateActionRecognizer = m_immediateActionGestureRecognizer.get())
+ [m_view addGestureRecognizer:immediateActionRecognizer];
+#endif
+}
+
+void* WebViewImpl::immediateActionAnimationControllerForHitTestResult(WKHitTestResultRef hitTestResult, uint32_t type, WKTypeRef userData)
+{
+ return [m_view _immediateActionAnimationControllerForHitTestResult:hitTestResult withType:type userData:userData];
+}
+
+void* WebViewImpl::immediateActionAnimationControllerForHitTestResultFromViewOnly(WKHitTestResultRef hitTestResult, uint32_t type, WKTypeRef userData)
+{
+ return nil;
+}
+
+void WebViewImpl::didPerformImmediateActionHitTest(const WebHitTestResultData& result, bool contentPreventsDefault, API::Object* userData)
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ [m_immediateActionController didPerformImmediateActionHitTest:result contentPreventsDefault:contentPreventsDefault userData:userData];
+#endif
+}
+
+void WebViewImpl::prepareForImmediateActionAnimation()
+{
+ [m_view _prepareForImmediateActionAnimation];
+}
+
+void WebViewImpl::cancelImmediateActionAnimation()
+{
+ [m_view _cancelImmediateActionAnimation];
+}
+
+void WebViewImpl::completeImmediateActionAnimation()
+{
+ [m_view _completeImmediateActionAnimation];
+}
+
+void WebViewImpl::setIgnoresNonWheelEvents(bool ignoresNonWheelEvents)
+{
+ if (m_ignoresNonWheelEvents == ignoresNonWheelEvents)
+ return;
+
+ m_ignoresNonWheelEvents = ignoresNonWheelEvents;
+ m_page.setShouldDispatchFakeMouseMoveEvents(!ignoresNonWheelEvents);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (ignoresNonWheelEvents)
+ [m_view removeGestureRecognizer:m_immediateActionGestureRecognizer.get()];
+ else if (NSGestureRecognizer *immediateActionRecognizer = m_immediateActionGestureRecognizer.get()) {
+ if (m_allowsLinkPreview)
+ [m_view addGestureRecognizer:immediateActionRecognizer];
+ }
+#endif
+}
+
+void WebViewImpl::setIgnoresAllEvents(bool ignoresAllEvents)
+{
+ m_ignoresAllEvents = ignoresAllEvents;
+ setIgnoresNonWheelEvents(ignoresAllEvents);
+}
+
+void WebViewImpl::accessibilityRegisterUIProcessTokens()
+{
+ // Initialize remote accessibility when the window connection has been established.
+ NSData *remoteElementToken = WKAXRemoteTokenForElement(m_view);
+ 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);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -220,7 +220,6 @@
</span><span class="cx"> WKView *m_wkView;
</span><span class="cx"> WKWebView *m_webView;
</span><span class="cx"> WebViewImpl* m_impl { nullptr };
</span><del>- RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
</del><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx"> CorrectionPanel m_correctionPanel;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -90,60 +90,11 @@
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><del>-@interface WKEditCommandObjC : NSObject
-{
- RefPtr<WebEditCommandProxy> m_command;
-}
-- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command;
-- (WebEditCommandProxy*)command;
-@end
-
-@interface WKEditorUndoTargetObjC : NSObject
-- (void)undoEditing:(id)sender;
-- (void)redoEditing:(id)sender;
-@end
-
-@implementation WKEditCommandObjC
-
-- (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command
-{
- self = [super init];
- if (!self)
- return nil;
-
- m_command = command;
- return self;
-}
-
-- (WebEditCommandProxy*)command
-{
- return m_command.get();
-}
-
-@end
-
-@implementation WKEditorUndoTargetObjC
-
-- (void)undoEditing:(id)sender
-{
- ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
- [sender command]->unapply();
-}
-
-- (void)redoEditing:(id)sender
-{
- ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
- [sender command]->reapply();
-}
-
-@end
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> PageClientImpl::PageClientImpl(WKView* wkView, WKWebView *webView)
</span><span class="cx"> : m_wkView(wkView)
</span><span class="cx"> , m_webView(webView)
</span><del>- , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
</del><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> , m_alternativeTextUIController(std::make_unique<AlternativeTextUIController>())
</span><span class="cx"> #endif
</span><span class="lines">@@ -207,8 +158,8 @@
</span><span class="cx"> if (m_wkView._thumbnailView)
</span><span class="cx"> return m_wkView._thumbnailView.window;
</span><span class="cx"> #endif
</span><del>- if (m_wkView._targetWindowForMovePreparation)
- return m_wkView._targetWindowForMovePreparation;
</del><ins>+ if (m_impl && m_impl->targetWindowForMovePreparation())
+ return m_impl->targetWindowForMovePreparation();
</ins><span class="cx"> return m_wkView.window;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -307,7 +258,7 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::preferencesDidChange()
</span><span class="cx"> {
</span><del>- [m_wkView _preferencesDidChange];
</del><ins>+ m_impl->preferencesDidChange();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
</span><span class="lines">@@ -373,15 +324,7 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
</span><span class="cx"> {
</span><del>- RefPtr<WebEditCommandProxy> command = prpCommand;
-
- RetainPtr<WKEditCommandObjC> commandObjC = adoptNS([[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]);
- String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
-
- NSUndoManager *undoManager = [m_wkView undoManager];
- [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
- if (!actionName.isEmpty())
- [undoManager setActionName:(NSString *)actionName];
</del><ins>+ m_impl->registerEditCommand(prpCommand, undoOrRedo);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(INSERTION_UNDO_GROUPING)
</span><span class="lines">@@ -393,7 +336,7 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::clearAllEditCommands()
</span><span class="cx"> {
</span><del>- [[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
</del><ins>+ m_impl->clearAllEditCommands();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
</span><span class="lines">@@ -515,17 +458,17 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::setTextIndicator(Ref<TextIndicator> textIndicator, WebCore::TextIndicatorWindowLifetime lifetime)
</span><span class="cx"> {
</span><del>- [m_wkView _setTextIndicator:textIndicator.get() withLifetime:lifetime];
</del><ins>+ m_impl->setTextIndicator(textIndicator.get(), lifetime);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::clearTextIndicator(WebCore::TextIndicatorWindowDismissalAnimation dismissalAnimation)
</span><span class="cx"> {
</span><del>- [m_wkView _clearTextIndicatorWithAnimation:dismissalAnimation];
</del><ins>+ m_impl->clearTextIndicatorWithAnimation(dismissalAnimation);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::setTextIndicatorAnimationProgress(float progress)
</span><span class="cx"> {
</span><del>- [m_wkView _setTextIndicatorAnimationProgress:progress];
</del><ins>+ m_impl->setTextIndicatorAnimationProgress(progress);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
</span><span class="lines">@@ -576,7 +519,7 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::selectionDidChange()
</span><span class="cx"> {
</span><del>- [m_wkView _selectionChanged];
</del><ins>+ m_impl->selectionDidChange();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
</span><span class="lines">@@ -603,10 +546,10 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo)
</span><span class="cx"> {
</span><del>- [m_wkView _prepareForDictionaryLookup];
</del><ins>+ m_impl->prepareForDictionaryLookup();
</ins><span class="cx">
</span><span class="cx"> DictionaryLookup::showPopup(dictionaryPopupInfo, m_wkView, [this](TextIndicator& textIndicator) {
</span><del>- [m_wkView _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
</del><ins>+ m_impl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -661,10 +604,14 @@
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize)
</span><span class="cx"> {
</span><del>- if (m_webView)
</del><ins>+#if WK_API_ENABLED
+ if (m_webView) {
</ins><span class="cx"> [m_webView _setIntrinsicContentSize:intrinsicContentSize];
</span><del>- else
- [m_wkView _setIntrinsicContentSize:intrinsicContentSize];
</del><ins>+ return;
+ }
+#endif
+
+ m_impl->setIntrinsicContentSize(intrinsicContentSize);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString)
</span><span class="lines">@@ -839,7 +786,7 @@
</span><span class="cx"> void PageClientImpl::didPerformImmediateActionHitTest(const WebHitTestResultData& result, bool contentPreventsDefault, API::Object* userData)
</span><span class="cx"> {
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
</span><del>- [m_wkView _didPerformImmediateActionHitTest:result contentPreventsDefault:contentPreventsDefault userData:userData];
</del><ins>+ m_impl->didPerformImmediateActionHitTest(result, contentPreventsDefault, userData);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -849,7 +796,7 @@
</span><span class="cx"> if (m_webView)
</span><span class="cx"> return [m_webView _immediateActionAnimationControllerForHitTestResult:wrapper(*hitTestResult) withType:(_WKImmediateActionType)type userData:(id)(userData.get())];
</span><span class="cx"> #endif
</span><del>- return [m_wkView _immediateActionAnimationControllerForHitTestResult:toAPI(hitTestResult.get()) withType:type userData:toAPI(userData.get())];
</del><ins>+ return m_impl->immediateActionAnimationControllerForHitTestResult(toAPI(hitTestResult.get()), type, toAPI(userData.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class WebPageProxy;
</span><ins>+class WebViewImpl;
</ins><span class="cx">
</span><span class="cx"> enum class ImmediateActionState {
</span><span class="cx"> None = 0,
</span><span class="lines">@@ -46,12 +47,12 @@
</span><span class="cx">
</span><span class="cx"> @class DDActionContext;
</span><span class="cx"> @class QLPreviewMenuItem;
</span><del>-@class WKView;
</del><span class="cx">
</span><span class="cx"> @interface WKImmediateActionController : NSObject <NSImmediateActionGestureRecognizerDelegate> {
</span><span class="cx"> @private
</span><del>- WebKit::WebPageProxy *_page;
- WKView *_wkView;
</del><ins>+ WebKit::WebPageProxy* _page;
+ NSView *_view;
+ WebKit::WebViewImpl* _viewImpl;
</ins><span class="cx">
</span><span class="cx"> WebKit::ImmediateActionState _state;
</span><span class="cx"> WebKit::WebHitTestResultData _hitTestResultData;
</span><span class="lines">@@ -67,8 +68,8 @@
</span><span class="cx"> BOOL _hasActiveImmediateAction;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (instancetype)initWithPage:(WebKit::WebPageProxy&)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
-- (void)willDestroyView:(WKView *)view;
</del><ins>+- (instancetype)initWithPage:(WebKit::WebPageProxy&)page view:(NSView *)view viewImpl:(WebKit::WebViewImpl&)viewImpl recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
+- (void)willDestroyView:(NSView *)view;
</ins><span class="cx"> - (void)didPerformImmediateActionHitTest:(const WebKit::WebHitTestResultData&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
</span><span class="cx"> - (void)dismissContentRelativeChildWindows;
</span><span class="cx"> - (BOOL)hasActiveImmediateAction;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (191498 => 191499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-10-23 17:55:09 UTC (rev 191498)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-10-23 17:57:33 UTC (rev 191499)
</span><span class="lines">@@ -30,11 +30,11 @@
</span><span class="cx">
</span><span class="cx"> #import "APIHitTestResult.h"
</span><span class="cx"> #import "WKNSURLExtras.h"
</span><del>-#import "WKViewInternal.h"
</del><span class="cx"> #import "WebPageMessages.h"
</span><span class="cx"> #import "WebPageProxy.h"
</span><span class="cx"> #import "WebPageProxyMessages.h"
</span><span class="cx"> #import "WebProcessProxy.h"
</span><ins>+#import "WebViewImpl.h"
</ins><span class="cx"> #import <WebCore/DataDetectorsSPI.h>
</span><span class="cx"> #import <WebCore/DictionaryLookup.h>
</span><span class="cx"> #import <WebCore/GeometryUtilities.h>
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">
</span><span class="cx"> @implementation WKImmediateActionController
</span><span class="cx">
</span><del>-- (instancetype)initWithPage:(WebPageProxy&)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</del><ins>+- (instancetype)initWithPage:(WebPageProxy&)page view:(NSView *)view viewImpl:(WebViewImpl&)viewImpl recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</ins><span class="cx"> {
</span><span class="cx"> self = [super init];
</span><span class="cx">
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="cx"> _page = &page;
</span><del>- _wkView = wkView;
</del><ins>+ _view = view;
+ _viewImpl = &viewImpl;
</ins><span class="cx"> _type = kWKImmediateActionNone;
</span><span class="cx"> _immediateActionRecognizer = immediateActionRecognizer;
</span><span class="cx"> _hasActiveImmediateAction = NO;
</span><span class="lines">@@ -80,10 +81,11 @@
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)willDestroyView:(WKView *)view
</del><ins>+- (void)willDestroyView:(NSView *)view
</ins><span class="cx"> {
</span><span class="cx"> _page = nullptr;
</span><del>- _wkView = nil;
</del><ins>+ _view = nil;
+ _viewImpl = nullptr;
</ins><span class="cx"> _hitTestResultData = WebHitTestResultData();
</span><span class="cx"> _contentPreventsDefault = NO;
</span><span class="cx">
</span><span class="lines">@@ -168,9 +170,9 @@
</span><span class="cx"> if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- [_wkView _prepareForImmediateActionAnimation];
</del><ins>+ _viewImpl->prepareForImmediateActionAnimation();
</ins><span class="cx">
</span><del>- [_wkView _dismissContentRelativeChildWindows];
</del><ins>+ _viewImpl->dismissContentRelativeChildWindowsWithAnimation(true);
</ins><span class="cx">
</span><span class="cx"> _page->setMaintainsInactiveSelection(true);
</span><span class="cx">
</span><span class="lines">@@ -231,7 +233,7 @@
</span><span class="cx">
</span><span class="cx"> _page->immediateActionDidCancel();
</span><span class="cx">
</span><del>- [_wkView _cancelImmediateActionAnimation];
</del><ins>+ _viewImpl->cancelImmediateActionAnimation();
</ins><span class="cx">
</span><span class="cx"> _page->setTextIndicatorAnimationProgress(0);
</span><span class="cx"> [self _clearImmediateActionState];
</span><span class="lines">@@ -245,7 +247,7 @@
</span><span class="cx">
</span><span class="cx"> _page->immediateActionDidComplete();
</span><span class="cx">
</span><del>- [_wkView _completeImmediateActionAnimation];
</del><ins>+ _viewImpl->completeImmediateActionAnimation();
</ins><span class="cx">
</span><span class="cx"> _page->setTextIndicatorAnimationProgress(1);
</span><span class="cx"> }
</span><span class="lines">@@ -345,12 +347,12 @@
</span><span class="cx">
</span><span class="cx"> - (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
</span><span class="cx"> {
</span><del>- return _wkView;
</del><ins>+ return _view;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point
</span><span class="cx"> {
</span><del>- if (!_wkView)
</del><ins>+ if (!_view)
</ins><span class="cx"> return nil;
</span><span class="cx">
</span><span class="cx"> RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
</span><span class="lines">@@ -369,20 +371,20 @@
</span><span class="cx">
</span><span class="cx"> - (NSRect)menuItem:(NSMenuItem *)menuItem itemFrameForPoint:(NSPoint)point
</span><span class="cx"> {
</span><del>- if (!_wkView)
</del><ins>+ if (!_view)
</ins><span class="cx"> return NSZeroRect;
</span><span class="cx">
</span><span class="cx"> RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
</span><del>- return [_wkView convertRect:hitTestResult->elementBoundingBox() toView:nil];
</del><ins>+ return [_view convertRect:hitTestResult->elementBoundingBox() toView:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSSize)menuItem:(NSMenuItem *)menuItem maxSizeForPoint:(NSPoint)point
</span><span class="cx"> {
</span><del>- if (!_wkView)
</del><ins>+ if (!_view)
</ins><span class="cx"> return NSZeroSize;
</span><span class="cx">
</span><del>- NSSize screenSize = _wkView.window.screen.frame.size;
- FloatRect largestRect = largestRectWithAspectRatioInsideRect(screenSize.width / screenSize.height, _wkView.bounds);
</del><ins>+ NSSize screenSize = _view.window.screen.frame.size;
+ FloatRect largestRect = largestRectWithAspectRatioInsideRect(screenSize.width / screenSize.height, _view.bounds);
</ins><span class="cx"> return NSMakeSize(largestRect.width() * 0.75, largestRect.height() * 0.75);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -403,7 +405,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<WebPageProxy> page = _page;
</span><span class="cx"> PageOverlay::PageOverlayID overlayID = _hitTestResultData.detectedDataOriginatingPageOverlay;
</span><del>- _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
</del><ins>+ _currentActionContext = [actionContext contextForView:_view altMode:YES interactionStartedHandler:^() {
</ins><span class="cx"> page->send(Messages::WebPage::DataDetectorsDidPresentUI(overlayID));
</span><span class="cx"> } interactionChangedHandler:^() {
</span><span class="cx"> if (_hitTestResultData.detectedDataTextIndicator)
</span><span class="lines">@@ -414,7 +416,7 @@
</span><span class="cx"> [self _clearImmediateActionState];
</span><span class="cx"> }];
</span><span class="cx">
</span><del>- [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResultData.detectedDataBoundingBox toView:nil]]];
</del><ins>+ [_currentActionContext setHighlightFrame:[_view.window convertRectToScreen:[_view convertRect:_hitTestResultData.detectedDataBoundingBox toView:nil]]];
</ins><span class="cx">
</span><span class="cx"> NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
</span><span class="cx">
</span><span class="lines">@@ -435,7 +437,7 @@
</span><span class="cx"> [actionContext setImmediate:YES];
</span><span class="cx">
</span><span class="cx"> RefPtr<WebPageProxy> page = _page;
</span><del>- _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
</del><ins>+ _currentActionContext = [actionContext contextForView:_view altMode:YES interactionStartedHandler:^() {
</ins><span class="cx"> } interactionChangedHandler:^() {
</span><span class="cx"> if (_hitTestResultData.linkTextIndicator)
</span><span class="cx"> page->setTextIndicator(_hitTestResultData.linkTextIndicator->data());
</span><span class="lines">@@ -443,7 +445,7 @@
</span><span class="cx"> [self _clearImmediateActionState];
</span><span class="cx"> }];
</span><span class="cx">
</span><del>- [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResultData.elementBoundingBox toView:nil]]];
</del><ins>+ [_currentActionContext setHighlightFrame:[_view.window convertRectToScreen:[_view convertRect:_hitTestResultData.elementBoundingBox toView:nil]]];
</ins><span class="cx">
</span><span class="cx"> RefPtr<API::HitTestResult> hitTestResult = [self _webHitTestResult];
</span><span class="cx"> NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
</span><span class="lines">@@ -465,10 +467,10 @@
</span><span class="cx"> if (!dictionaryPopupInfo.attributedString)
</span><span class="cx"> return nil;
</span><span class="cx">
</span><del>- [_wkView _prepareForDictionaryLookup];
</del><ins>+ _viewImpl->prepareForDictionaryLookup();
</ins><span class="cx">
</span><del>- return DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, _wkView, [self](TextIndicator& textIndicator) {
- [_wkView _setTextIndicator:textIndicator withLifetime:TextIndicatorWindowLifetime::Permanent];
</del><ins>+ return DictionaryLookup::animationControllerForPopup(dictionaryPopupInfo, _view, [self](TextIndicator& textIndicator) {
+ _viewImpl->setTextIndicator(textIndicator, TextIndicatorWindowLifetime::Permanent);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>