<!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>[191510] 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/191510">191510</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-10-23 14:03:08 -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 hitTest:]):
(-[WKView _processDidExit]):
(-[WKView _setThumbnailView:]):
(-[WKView _thumbnailView]):
(-[WKFlippedView isFlipped]): Deleted.
(-[WKView dealloc]): Deleted.
(-[WKView _setAcceleratedCompositingModeRootLayer:]): Deleted.
(-[WKView _acceleratedCompositingModeRootLayer]): Deleted.
(-[WKView _updateThumbnailViewLayer]): Deleted.
(-[WKView _reparentLayerTreeInThumbnailView]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::acceleratedCompositingRootLayer):
(WebKit::WebViewImpl::layerHostingView):
(WebKit::WebViewImpl::thumbnailView):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKFlippedView isFlipped]):
(WebKit::WebViewImpl::~WebViewImpl):
(WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
(WebKit::WebViewImpl::setThumbnailView):
(WebKit::WebViewImpl::reparentLayerTreeInThumbnailView):
(WebKit::WebViewImpl::updateThumbnailViewLayer):
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::enterAcceleratedCompositingMode):
(WebKit::PageClientImpl::exitAcceleratedCompositingMode):
(WebKit::PageClientImpl::updateAcceleratedCompositingMode):
(WebKit::PageClientImpl::setAcceleratedCompositingRootLayer):
(WebKit::PageClientImpl::acceleratedCompositingRootLayer):
Move accelerated compositing and thumbnail view code.</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="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/ChangeLog        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -6,6 +6,44 @@
</span><span class="cx">         Reviewed by Anders Carlsson.
</span><span class="cx"> 
</span><span class="cx">         * UIProcess/API/mac/WKView.mm:
</span><ins>+        (-[WKView hitTest:]):
+        (-[WKView _processDidExit]):
+        (-[WKView _setThumbnailView:]):
+        (-[WKView _thumbnailView]):
+        (-[WKFlippedView isFlipped]): Deleted.
+        (-[WKView dealloc]): Deleted.
+        (-[WKView _setAcceleratedCompositingModeRootLayer:]): Deleted.
+        (-[WKView _acceleratedCompositingModeRootLayer]): Deleted.
+        (-[WKView _updateThumbnailViewLayer]): Deleted.
+        (-[WKView _reparentLayerTreeInThumbnailView]): Deleted.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/Cocoa/WebViewImpl.h:
+        (WebKit::WebViewImpl::acceleratedCompositingRootLayer):
+        (WebKit::WebViewImpl::layerHostingView):
+        (WebKit::WebViewImpl::thumbnailView):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (-[WKFlippedView isFlipped]):
+        (WebKit::WebViewImpl::~WebViewImpl):
+        (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
+        (WebKit::WebViewImpl::setThumbnailView):
+        (WebKit::WebViewImpl::reparentLayerTreeInThumbnailView):
+        (WebKit::WebViewImpl::updateThumbnailViewLayer):
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
+        (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer):
+        (WebKit::PageClientImpl::acceleratedCompositingRootLayer):
+        Move accelerated compositing and thumbnail view code.
+
+2015-10-23  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        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:
</ins><span class="cx">         (-[WKView _superRemoveTrackingRect:]):
</span><span class="cx">         (-[WKView addTrackingRect:owner:userData:assumeInside:]):
</span><span class="cx">         (-[WKView _addTrackingRect:owner:userData:assumeInside:useTrackingNum:]):
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -80,7 +80,6 @@
</span><span class="cx"> #import &quot;WebSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebViewImpl.h&quot;
</span><span class="cx"> #import &quot;_WKRemoteObjectRegistryInternal.h&quot;
</span><del>-#import &quot;_WKThumbnailViewInternal.h&quot;
</del><span class="cx"> #import &lt;QuartzCore/QuartzCore.h&gt;
</span><span class="cx"> #import &lt;WebCore/AXObjectCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/ColorMac.h&gt;
</span><span class="lines">@@ -104,7 +103,6 @@
</span><span class="cx"> #import &lt;WebCore/TextIndicator.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextIndicatorWindow.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextUndoInsertionMarkupMac.h&gt;
</span><del>-#import &lt;WebCore/WebActionDisablingCALayerDelegate.h&gt;
</del><span class="cx"> #import &lt;WebCore/WebCoreCALayerExtras.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreFullScreenPlaceholderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreFullScreenWindow.h&gt;
</span><span class="lines">@@ -179,8 +177,6 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSTrackingArea&gt; _primaryTrackingArea;
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;NSView&gt; _layerHostingView;
-
</del><span class="cx">     RetainPtr&lt;id&gt; _remoteAccessibilityChild;
</span><span class="cx"> 
</span><span class="cx">     // For asynchronous validation.
</span><span class="lines">@@ -213,13 +209,7 @@
</span><span class="cx">     BOOL _allowsMagnification;
</span><span class="cx">     BOOL _allowsBackForwardNavigationGestures;
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;CALayer&gt; _rootLayer;
-
</del><span class="cx">     CGFloat _totalHeightOfBanners;
</span><del>-
-#if WK_API_ENABLED
-    _WKThumbnailView *_thumbnailView;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="lines">@@ -236,18 +226,6 @@
</span><span class="cx"> - (bool)didReceiveUnhandledCommand;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-@interface WKFlippedView : NSView
-@end
-
-@implementation WKFlippedView
-
-- (BOOL)isFlipped
-{
-    return YES;
-}
-
-@end
-
</del><span class="cx"> @interface WKView () &lt;WebViewImplDelegate&gt;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="lines">@@ -280,10 +258,6 @@
</span><span class="cx"> 
</span><span class="cx">     _data-&gt;_impl = nullptr;
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-    ASSERT(!_data-&gt;_thumbnailView);
-#endif
-
</del><span class="cx">     [_data release];
</span><span class="cx">     _data = nil;
</span><span class="cx"> 
</span><span class="lines">@@ -2410,7 +2384,7 @@
</span><span class="cx"> - (NSView *)hitTest:(NSPoint)point
</span><span class="cx"> {
</span><span class="cx">     NSView *hitView = [super hitTest:point];
</span><del>-    if (hitView &amp;&amp; _data &amp;&amp; hitView == _data-&gt;_layerHostingView)
</del><ins>+    if (hitView &amp;&amp; _data &amp;&amp; hitView == _data-&gt;_impl-&gt;layerHostingView())
</ins><span class="cx">         hitView = self;
</span><span class="cx"> 
</span><span class="cx">     return hitView;
</span><span class="lines">@@ -2443,8 +2417,8 @@
</span><span class="cx"> {
</span><span class="cx">     _data-&gt;_impl-&gt;notifyInputContextAboutDiscardedComposition();
</span><span class="cx"> 
</span><del>-    if (_data-&gt;_layerHostingView)
-        [self _setAcceleratedCompositingModeRootLayer:nil];
</del><ins>+    if (_data-&gt;_impl-&gt;layerHostingView())
+        _data-&gt;_impl-&gt;setAcceleratedCompositingRootLayer(nil);
</ins><span class="cx"> 
</span><span class="cx">     [self _updateRemoteAccessibilityRegistration:NO];
</span><span class="cx"> 
</span><span class="lines">@@ -2551,61 +2525,6 @@
</span><span class="cx">     _data-&gt;_impl-&gt;toolTipChanged(oldToolTip, newToolTip);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
-{
-    [rootLayer web_disableAllActions];
-
-    _data-&gt;_rootLayer = rootLayer;
-
-#if WK_API_ENABLED
-    if (_data-&gt;_thumbnailView) {
-        [self _updateThumbnailViewLayer];
-        return;
-    }
-#endif
-
-    [CATransaction begin];
-    [CATransaction setDisableActions:YES];
-
-    if (rootLayer) {
-        if (!_data-&gt;_layerHostingView) {
-            // Create an NSView that will host our layer tree.
-            _data-&gt;_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:[self bounds]]);
-            [_data-&gt;_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-
-
-            [self addSubview:_data-&gt;_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
-
-            // Create a root layer that will back the NSView.
-            RetainPtr&lt;CALayer&gt; layer = adoptNS([[CALayer alloc] init]);
-            [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
-#ifndef NDEBUG
-            [layer setName:@&quot;Hosting root layer&quot;];
-#endif
-
-            [_data-&gt;_layerHostingView setLayer:layer.get()];
-            [_data-&gt;_layerHostingView setWantsLayer:YES];
-        }
-
-        [_data-&gt;_layerHostingView layer].sublayers = [NSArray arrayWithObject:rootLayer];
-    } else {
-        if (_data-&gt;_layerHostingView) {
-            [_data-&gt;_layerHostingView removeFromSuperview];
-            [_data-&gt;_layerHostingView setLayer:nil];
-            [_data-&gt;_layerHostingView setWantsLayer:NO];
-
-            _data-&gt;_layerHostingView = nullptr;
-        }
-    }
-
-    [CATransaction commit];
-}
-
-- (CALayer *)_acceleratedCompositingModeRootLayer
-{
-    return _data-&gt;_rootLayer.get();
-}
-
</del><span class="cx"> static RetainPtr&lt;CGImageRef&gt; takeWindowSnapshot(CGSWindowID windowID, bool captureAtNominalResolution)
</span><span class="cx"> {
</span><span class="cx">     CGSWindowCaptureOptions options = kCGSCaptureIgnoreGlobalClipShape;
</span><span class="lines">@@ -2969,34 +2888,15 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> - (void)_setThumbnailView:(_WKThumbnailView *)thumbnailView
</span><span class="cx"> {
</span><del>-    ASSERT(!_data-&gt;_thumbnailView || !thumbnailView);
-
-    _data-&gt;_thumbnailView = thumbnailView;
-
-    if (thumbnailView)
-        [self _updateThumbnailViewLayer];
-    else
-        [self _setAcceleratedCompositingModeRootLayer:_data-&gt;_rootLayer.get()];
</del><ins>+    _data-&gt;_impl-&gt;setThumbnailView(thumbnailView);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (_WKThumbnailView *)_thumbnailView
</span><span class="cx"> {
</span><del>-    return _data-&gt;_thumbnailView;
</del><ins>+    if (!_data-&gt;_impl)
+        return nil;
+    return _data-&gt;_impl-&gt;thumbnailView();
</ins><span class="cx"> }
</span><del>-
-- (void)_updateThumbnailViewLayer
-{
-    _WKThumbnailView *thumbnailView = _data-&gt;_thumbnailView;
-    ASSERT(thumbnailView);
-
-    if (thumbnailView._waitingForSnapshot &amp;&amp; self.window)
-        [self _reparentLayerTreeInThumbnailView];
-}
-
-- (void)_reparentLayerTreeInThumbnailView
-{
-    _data-&gt;_thumbnailView._thumbnailLayer = _data-&gt;_rootLayer.get();
-}
</del><span class="cx"> #endif // WK_API_ENABLED
</span><span class="cx"> 
</span><span class="cx"> - (void)_didFirstVisuallyNonEmptyLayoutForMainFrame
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -87,9 +87,6 @@
</span><span class="cx"> - (NSRect)_convertToDeviceSpace:(NSRect)rect;
</span><span class="cx"> - (NSRect)_convertToUserSpace:(NSRect)rect;
</span><span class="cx"> 
</span><del>-- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
-- (CALayer *)_acceleratedCompositingModeRootLayer;
-
</del><span class="cx"> - (PassRefPtr&lt;WebKit::ViewSnapshot&gt;)_takeViewSnapshot;
</span><span class="cx"> - (void)_wheelEventWasNotHandledByWebCore:(NSEvent *)event;
</span><span class="cx"> 
</span><span class="lines">@@ -117,7 +114,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> @property (nonatomic, setter=_setThumbnailView:) _WKThumbnailView *_thumbnailView;
</span><del>-- (void)_reparentLayerTreeInThumbnailView;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> - (void)_addFontPanelObserver;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> OBJC_CLASS WKImmediateActionController;
</span><span class="cx"> OBJC_CLASS WKViewLayoutStrategy;
</span><span class="cx"> OBJC_CLASS WKWindowVisibilityObserver;
</span><ins>+OBJC_CLASS _WKThumbnailView;
</ins><span class="cx"> 
</span><span class="cx"> @protocol WebViewImplDelegate
</span><span class="cx"> 
</span><span class="lines">@@ -227,6 +228,15 @@
</span><span class="cx">     NSString *stringForToolTip(NSToolTipTag tag);
</span><span class="cx">     void toolTipChanged(NSString *oldToolTip, NSString *newToolTip);
</span><span class="cx"> 
</span><ins>+    void setAcceleratedCompositingRootLayer(CALayer *);
+    CALayer *acceleratedCompositingRootLayer() const { return m_rootLayer.get(); }
+    NSView *layerHostingView() const { return m_layerHostingView.get(); }
+
+#if WK_API_ENABLED
+    void setThumbnailView(_WKThumbnailView *);
+    _WKThumbnailView *thumbnailView() const { return m_thumbnailView; }
+#endif // WK_API_ENABLED
+
</ins><span class="cx"> private:
</span><span class="cx">     WeakPtr&lt;WebViewImpl&gt; createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
</span><span class="cx"> 
</span><span class="lines">@@ -241,6 +251,9 @@
</span><span class="cx">     void sendToolTipMouseExited();
</span><span class="cx">     void sendToolTipMouseEntered();
</span><span class="cx"> 
</span><ins>+    void reparentLayerTreeInThumbnailView();
+    void updateThumbnailViewLayer();
+
</ins><span class="cx">     NSView &lt;WebViewImplDelegate&gt; *m_view;
</span><span class="cx">     WebPageProxy&amp; m_page;
</span><span class="cx">     PageClient&amp; m_pageClient;
</span><span class="lines">@@ -312,6 +325,13 @@
</span><span class="cx">     NSToolTipTag m_lastToolTipTag { 0 };
</span><span class="cx">     id m_trackingRectOwner { nil };
</span><span class="cx">     void* m_trackingRectUserData { nullptr };
</span><ins>+
+    RetainPtr&lt;CALayer&gt; m_rootLayer;
+    RetainPtr&lt;NSView&gt; m_layerHostingView;
+
+#if WK_API_ENABLED
+    _WKThumbnailView *m_thumbnailView;
+#endif
</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 (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #import &quot;WKWebView.h&quot;
</span><span class="cx"> #import &quot;WebEditCommandProxy.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><ins>+#import &quot;_WKThumbnailViewInternal.h&quot;
</ins><span class="cx"> #import &lt;HIToolbox/CarbonEventsCore.h&gt;
</span><span class="cx"> #import &lt;WebCore/AXObjectCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><span class="lines">@@ -52,6 +53,8 @@
</span><span class="cx"> #import &lt;WebCore/NSWindowSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="cx"> #import &lt;WebCore/ViewState.h&gt;
</span><ins>+#import &lt;WebCore/WebActionDisablingCALayerDelegate.h&gt;
+#import &lt;WebCore/WebCoreCALayerExtras.h&gt;
</ins><span class="cx"> #import &lt;WebCore/WebCoreFullScreenPlaceholderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreFullScreenWindow.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="lines">@@ -296,6 +299,18 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@interface WKFlippedView : NSView
+@end
+
+@implementation WKFlippedView
+
+- (BOOL)isFlipped
+{
+    return YES;
+}
+
+@end
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> WebViewImpl::WebViewImpl(NSView &lt;WebViewImplDelegate&gt; *view, WebPageProxy&amp; page, PageClient&amp; pageClient)
</span><span class="lines">@@ -325,6 +340,10 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_inSecureInputState);
</span><span class="cx"> 
</span><ins>+#if WK_API_ENABLED
+    ASSERT(!m_thumbnailView);
+#endif
+
</ins><span class="cx">     [m_layoutStrategy invalidate];
</span><span class="cx"> 
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="lines">@@ -1553,6 +1572,81 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebViewImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
+{
+    [rootLayer web_disableAllActions];
+
+    m_rootLayer = rootLayer;
+
+#if WK_API_ENABLED
+    if (m_thumbnailView) {
+        updateThumbnailViewLayer();
+        return;
+    }
+#endif
+
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
+    if (rootLayer) {
+        if (!m_layerHostingView) {
+            // Create an NSView that will host our layer tree.
+            m_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:m_view.bounds]);
+            [m_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+            [m_view addSubview:m_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
+
+            // Create a root layer that will back the NSView.
+            RetainPtr&lt;CALayer&gt; layer = adoptNS([[CALayer alloc] init]);
+            [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+#ifndef NDEBUG
+            [layer setName:@&quot;Hosting root layer&quot;];
+#endif
+
+            [m_layerHostingView setLayer:layer.get()];
+            [m_layerHostingView setWantsLayer:YES];
+        }
+
+        [m_layerHostingView layer].sublayers = [NSArray arrayWithObject:rootLayer];
+    } else if (m_layerHostingView) {
+        [m_layerHostingView removeFromSuperview];
+        [m_layerHostingView setLayer:nil];
+        [m_layerHostingView setWantsLayer:NO];
+
+        m_layerHostingView = nullptr;
+    }
+
+    [CATransaction commit];
+}
+
+#if WK_API_ENABLED
+void WebViewImpl::setThumbnailView(_WKThumbnailView *thumbnailView)
+{
+    ASSERT(!m_thumbnailView || !thumbnailView);
+
+    m_thumbnailView = thumbnailView;
+
+    if (thumbnailView)
+        updateThumbnailViewLayer();
+    else
+        setAcceleratedCompositingRootLayer(m_rootLayer.get());
+}
+
+void WebViewImpl::reparentLayerTreeInThumbnailView()
+{
+    m_thumbnailView._thumbnailLayer = m_rootLayer.get();
+}
+
+void WebViewImpl::updateThumbnailViewLayer()
+{
+    _WKThumbnailView *thumbnailView = m_thumbnailView;
+    ASSERT(thumbnailView);
+
+    if (thumbnailView._waitingForSnapshot &amp;&amp; m_view.window)
+        reparentLayerTreeInThumbnailView();
+}
+#endif // WK_API_ENABLED
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (191509 => 191510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 20:50:34 UTC (rev 191509)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-23 21:03:08 UTC (rev 191510)
</span><span class="lines">@@ -482,12 +482,12 @@
</span><span class="cx">     ASSERT(!layerTreeContext.isEmpty());
</span><span class="cx"> 
</span><span class="cx">     CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
</span><del>-    [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
</del><ins>+    m_impl-&gt;setAcceleratedCompositingRootLayer(renderLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::exitAcceleratedCompositingMode()
</span><span class="cx"> {
</span><del>-    [m_wkView _setAcceleratedCompositingModeRootLayer:nil];
</del><ins>+    m_impl-&gt;setAcceleratedCompositingRootLayer(nil);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext&amp; layerTreeContext)
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx">     ASSERT(!layerTreeContext.isEmpty());
</span><span class="cx"> 
</span><span class="cx">     CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
</span><del>-    [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
</del><ins>+    m_impl-&gt;setAcceleratedCompositingRootLayer(renderLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::willEnterAcceleratedCompositingMode()
</span><span class="lines">@@ -504,12 +504,12 @@
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
</span><span class="cx"> {
</span><del>-    [m_wkView _setAcceleratedCompositingModeRootLayer:rootLayer];
</del><ins>+    m_impl-&gt;setAcceleratedCompositingRootLayer(rootLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CALayer *PageClientImpl::acceleratedCompositingRootLayer() const
</span><span class="cx"> {
</span><del>-    return m_wkView._acceleratedCompositingModeRootLayer;
</del><ins>+    return m_impl-&gt;acceleratedCompositingRootLayer();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;ViewSnapshot&gt; PageClientImpl::takeViewSnapshot()
</span></span></pre>
</div>
</div>

</body>
</html>