<!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>[164337] 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/164337">164337</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-02-18 17:57:31 -0800 (Tue, 18 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a way to efficiently thumbnail WKViews
https://bugs.webkit.org/show_bug.cgi?id=128831
&lt;rdar://problem/15669655&gt;

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKThumbnailView.h: Added.
* UIProcess/API/Cocoa/WKThumbnailView.mm: Added.
(-[WKThumbnailView initWithFrame:fromWKView:]):
(-[WKThumbnailView _viewWasUnparented]):
(-[WKThumbnailView _viewWasParented]):
(-[WKThumbnailView viewDidMoveToWindow]):
(-[WKThumbnailView setScale:]):
(-[WKThumbnailView setThumbnailLayer:]):
(-[WKThumbnailView thumbnailLayer]):
* UIProcess/API/Cocoa/WKThumbnailViewInternal.h: Added.
Add WKThumbnailView.
Clients of this private API will call initWithFrame:fromWKView:,
giving the WKView they wish to borrow contents from.
They can also call setScale: to set the scale that will be used to render
the content in an implementation-defined set of cases (currently, we will
use the low resolution scale for WKViews which were not parented when the
WKThumbnailView was created; parented WKViews will use the existing scale).

* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::isViewWindowActive):
(WebKit::PageClientImpl::isViewVisible):
(WebKit::PageClientImpl::isViewVisibleOrOccluded):
(WebKit::PageClientImpl::isViewInWindow):
(WebKit::PageClientImpl::viewLayerHostingMode):
If the WKView has an actively-parented WKThumbnailView attached to it,
we should determine view visibility/etc. using that view instead of the WKView.

* UIProcess/API/mac/WKView.mm:
(-[WKView dealloc]):
WKThumbnailView holds on to the WKView, and clears WKView's backpointer
when it leaves the window, so we should never see WKView get deallocated
with a live thumbnail view.

(-[WKView scrollWheel:]):
(-[WKView mouseMoved:]):
(-[WKView mouseDown:]):
(-[WKView mouseUp:]):
(-[WKView mouseDragged:]):
Don't handle events while thumbnailed.

(-[WKView _setAcceleratedCompositingModeRootLayer:]):
Forward root layer changes to the installed thumbnail view.

(-[WKView _acceleratedCompositingModeRootLayer]):
_acceleratedCompositingModeRootLayer should return the same layer
that was set via _setAcceleratedCompositingModeRootLayer:, not its parent.

(-[WKView _setThumbnailView:]):
(-[WKView _thumbnailView]):
Install/uninstall a WKThumbnailView. Hand it our root layer if installing,
or recover it from the departing thumbnail view if uninstalling.

* UIProcess/API/mac/WKViewInternal.h:
Add in a missing RetainPtr.h include that I missed earlier and causes trouble.
Add WKView _thumbnailView and _setThumbnailView:.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setThumbnailScale):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::mayStartMediaWhenInWindow):

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::handleSwipeGesture):
Swipe was accidentally depending on a mistake in WKView's
_acceleratedCompositingModeRootLayer where it was returning the wrong layer.
The actual root layer doesn't have a size, so we should use the drawing
area's size instead.

* WebKit2.xcodeproj/project.pbxproj:
Add some new files.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
If we reset the page scale because a load was committed, we should
reset the stored thumbnail-scale-less page scale so that we don't restore
the wrong scale when leaving thumbnailing.

(WebKit::WebPage::WebPage):
(WebKit::WebPage::setThumbnailScale):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Apply the thumbnail scale to the page. If we're currently not in
thumbnail scaling mode, save the current page scale and scroll position
so we can restore them once we leave thumbnail mode again.
Transform the DrawingArea so that the page appears at the same
position and size, but scaled.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setTransform):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::setTransform):
Add a DrawingArea method to apply an arbitrary transform to the drawing area.

(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
(WebKit::TiledCoreAnimationDrawingArea::setPageOverlayNeedsDisplay):
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::suspendPainting):
(WebKit::TiledCoreAnimationDrawingArea::resumePainting):
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
(WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext):
(WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
(WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
(WebKit::TiledCoreAnimationDrawingArea::updateDebugInfoLayer):
(WebKit::TiledCoreAnimationDrawingArea::adjustTransientZoom):
Remove the word &quot;compositing&quot; in a bunch of places where it isn't needed.
Rename m_rootLayer to m_hostingLayer, and repurpose m_rootLayer to store
the root compositing layer actually passed in via setRootCompositingLayer.
Rename m_pendingRootCompositingLayer to m_pendingRootLayer.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPageClientImplh">trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacPageClientImplmm">trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm</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="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailViewInternal.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -1,3 +1,123 @@
</span><ins>+2014-02-18  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        Add a way to efficiently thumbnail WKViews
+        https://bugs.webkit.org/show_bug.cgi?id=128831
+        &lt;rdar://problem/15669655&gt;
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKThumbnailView.h: Added.
+        * UIProcess/API/Cocoa/WKThumbnailView.mm: Added.
+        (-[WKThumbnailView initWithFrame:fromWKView:]):
+        (-[WKThumbnailView _viewWasUnparented]):
+        (-[WKThumbnailView _viewWasParented]):
+        (-[WKThumbnailView viewDidMoveToWindow]):
+        (-[WKThumbnailView setScale:]):
+        (-[WKThumbnailView setThumbnailLayer:]):
+        (-[WKThumbnailView thumbnailLayer]):
+        * UIProcess/API/Cocoa/WKThumbnailViewInternal.h: Added.
+        Add WKThumbnailView.
+        Clients of this private API will call initWithFrame:fromWKView:,
+        giving the WKView they wish to borrow contents from.
+        They can also call setScale: to set the scale that will be used to render
+        the content in an implementation-defined set of cases (currently, we will
+        use the low resolution scale for WKViews which were not parented when the
+        WKThumbnailView was created; parented WKViews will use the existing scale).
+
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::isViewWindowActive):
+        (WebKit::PageClientImpl::isViewVisible):
+        (WebKit::PageClientImpl::isViewVisibleOrOccluded):
+        (WebKit::PageClientImpl::isViewInWindow):
+        (WebKit::PageClientImpl::viewLayerHostingMode):
+        If the WKView has an actively-parented WKThumbnailView attached to it,
+        we should determine view visibility/etc. using that view instead of the WKView.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView dealloc]):
+        WKThumbnailView holds on to the WKView, and clears WKView's backpointer
+        when it leaves the window, so we should never see WKView get deallocated
+        with a live thumbnail view.
+
+        (-[WKView scrollWheel:]):
+        (-[WKView mouseMoved:]):
+        (-[WKView mouseDown:]):
+        (-[WKView mouseUp:]):
+        (-[WKView mouseDragged:]):
+        Don't handle events while thumbnailed.
+
+        (-[WKView _setAcceleratedCompositingModeRootLayer:]):
+        Forward root layer changes to the installed thumbnail view.
+
+        (-[WKView _acceleratedCompositingModeRootLayer]):
+        _acceleratedCompositingModeRootLayer should return the same layer
+        that was set via _setAcceleratedCompositingModeRootLayer:, not its parent.
+
+        (-[WKView _setThumbnailView:]):
+        (-[WKView _thumbnailView]):
+        Install/uninstall a WKThumbnailView. Hand it our root layer if installing,
+        or recover it from the departing thumbnail view if uninstalling.
+
+        * UIProcess/API/mac/WKViewInternal.h:
+        Add in a missing RetainPtr.h include that I missed earlier and causes trouble.
+        Add WKView _thumbnailView and _setThumbnailView:.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setThumbnailScale):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::mayStartMediaWhenInWindow):
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::handleSwipeGesture):
+        Swipe was accidentally depending on a mistake in WKView's
+        _acceleratedCompositingModeRootLayer where it was returning the wrong layer.
+        The actual root layer doesn't have a size, so we should use the drawing
+        area's size instead.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add some new files.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didCommitLoad):
+        If we reset the page scale because a load was committed, we should
+        reset the stored thumbnail-scale-less page scale so that we don't restore
+        the wrong scale when leaving thumbnailing.
+
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::setThumbnailScale):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        Apply the thumbnail scale to the page. If we're currently not in
+        thumbnail scaling mode, save the current page scale and scroll position
+        so we can restore them once we leave thumbnail mode again.
+        Transform the DrawingArea so that the page appears at the same
+        position and size, but scaled.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::setTransform):
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::setTransform):
+        Add a DrawingArea method to apply an arbitrary transform to the drawing area.
+
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+        (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
+        (WebKit::TiledCoreAnimationDrawingArea::setPageOverlayNeedsDisplay):
+        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+        (WebKit::TiledCoreAnimationDrawingArea::suspendPainting):
+        (WebKit::TiledCoreAnimationDrawingArea::resumePainting):
+        (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
+        (WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext):
+        (WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
+        (WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
+        (WebKit::TiledCoreAnimationDrawingArea::updateDebugInfoLayer):
+        (WebKit::TiledCoreAnimationDrawingArea::adjustTransientZoom):
+        Remove the word &quot;compositing&quot; in a bunch of places where it isn't needed.
+        Rename m_rootLayer to m_hostingLayer, and repurpose m_rootLayer to store
+        the root compositing layer actually passed in via setRootCompositingLayer.
+        Rename m_pendingRootCompositingLayer to m_pendingRootLayer.
+
</ins><span class="cx"> 2014-02-18  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add SPI for enabling/disabling private browsing
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.h (0 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit2/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &lt;AppKit/AppKit.h&gt;
+
+@class WKView;
+
+WK_API_CLASS
+@interface WKThumbnailView : NSView
+
+- (instancetype)initWithFrame:(NSRect)frame fromWKView:(WKView *)wkView;
+
+@property (nonatomic) CGFloat scale;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.mm (0 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailView.mm        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WKThumbnailViewInternal.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;WKAPICast.h&quot;
+#import &quot;WKView.h&quot;
+#import &quot;WKViewInternal.h&quot;
+#import &quot;WebPageProxy.h&quot;
+
+// FIXME: Make it possible to leave a snapshot of the content presented in the WKView while the thumbnail is live.
+// FIXME: Don't make new speculative tiles while thumbnailed.
+// FIXME: Hide scrollbars in the thumbnail.
+// FIXME: We should re-use existing tiles for unparented views, if we have them (we need to know if they've been purged; if so, repaint at scaled-down size).
+// FIXME: We should switch to the low-resolution scale if a view we have high-resolution tiles for repaints.
+
+using namespace WebCore;
+using namespace WebKit;
+
+@implementation WKThumbnailView {
+    RetainPtr&lt;WKView&gt; _wkView;
+    WebPageProxy* _webPageProxy;
+    double _scale;
+
+    BOOL _originalMayStartMediaWhenInWindow;
+    BOOL _originalSourceViewIsInWindow;
+
+    BOOL _shouldApplyThumbnailScale;
+}
+
+- (instancetype)initWithFrame:(NSRect)frame fromWKView:(WKView *)wkView
+{
+    if (!(self = [super initWithFrame:frame]))
+        return nil;
+
+    _wkView = wkView;
+    _webPageProxy = toImpl([_wkView pageRef]);
+    _scale = 1;
+
+    _originalMayStartMediaWhenInWindow = _webPageProxy-&gt;mayStartMediaWhenInWindow();
+    _originalSourceViewIsInWindow = !![_wkView window];
+
+    _shouldApplyThumbnailScale = !_originalSourceViewIsInWindow;
+    return self;
+}
+
+- (void)_viewWasUnparented
+{
+    if (_shouldApplyThumbnailScale)
+        _webPageProxy-&gt;setThumbnailScale(1);
+
+    [_wkView _setThumbnailView:nil];
+    _webPageProxy-&gt;setMayStartMediaWhenInWindow(_originalMayStartMediaWhenInWindow);
+}
+
+- (void)_viewWasParented
+{
+    if ([_wkView _thumbnailView])
+        return;
+
+    if (_shouldApplyThumbnailScale)
+        _webPageProxy-&gt;setThumbnailScale(_scale);
+
+    if (!_originalSourceViewIsInWindow)
+        _webPageProxy-&gt;setMayStartMediaWhenInWindow(false);
+
+    [_wkView _setThumbnailView:self];
+}
+
+- (void)viewDidMoveToWindow
+{
+    if (self.window)
+        [self _viewWasParented];
+    else
+        [self _viewWasUnparented];
+}
+
+- (void)setScale:(CGFloat)scale
+{
+    _scale = scale;
+
+    if (self.window &amp;&amp; _shouldApplyThumbnailScale)
+        _webPageProxy-&gt;setThumbnailScale(_scale);
+}
+
+- (void)setThumbnailLayer:(CALayer *)layer
+{
+    self.layer.sublayers = layer ? @[ layer ] : @[ ];
+}
+
+- (CALayer *)thumbnailLayer
+{
+    if (!self.layer.sublayers.count)
+        return nil;
+
+    return [self.layer.sublayers objectAtIndex:0];
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKThumbnailViewInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailViewInternal.h (0 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailViewInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKThumbnailViewInternal.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;WKThumbnailView.h&quot;
+
+#if WK_API_ENABLED
+
+@interface WKThumbnailView ()
+
+@property (nonatomic, assign) CALayer *thumbnailLayer;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -161,7 +161,9 @@
</span><span class="cx">     virtual void beganExitFullScreen(const WebCore::IntRect&amp; initialFrame, const WebCore::IntRect&amp; finalFrame) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    WKView* m_wkView;
</del><ins>+    NSView *activeView() const;
+
+    WKView *m_wkView;
</ins><span class="cx">     RetainPtr&lt;WKEditorUndoTargetObjC&gt; m_undoTarget;
</span><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx">     CorrectionPanel m_correctionPanel;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import &quot;WKAPICast.h&quot;
</span><span class="cx"> #import &quot;WKFullScreenWindowController.h&quot;
</span><span class="cx"> #import &quot;WKStringCF.h&quot;
</span><ins>+#import &quot;WKThumbnailView.h&quot;
</ins><span class="cx"> #import &quot;WKViewInternal.h&quot;
</span><span class="cx"> #import &quot;WebColorPickerMac.h&quot;
</span><span class="cx"> #import &quot;WebContextMenuProxyMac.h&quot;
</span><span class="lines">@@ -166,9 +167,15 @@
</span><span class="cx">     return IntSize([m_wkView bounds].size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+NSView *PageClientImpl::activeView() const
+{
+    return m_wkView._thumbnailView ? m_wkView._thumbnailView : m_wkView;
+}
+
</ins><span class="cx"> bool PageClientImpl::isViewWindowActive()
</span><span class="cx"> {
</span><del>-    return [[m_wkView window] isKeyWindow] || [NSApp keyWindow] == [m_wkView window];
</del><ins>+    NSWindow *activeViewWindow = activeView().window;
+    return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PageClientImpl::isViewFocused()
</span><span class="lines">@@ -183,24 +190,27 @@
</span><span class="cx">     
</span><span class="cx"> bool PageClientImpl::isViewVisible()
</span><span class="cx"> {
</span><del>-    if (![m_wkView window])
</del><ins>+    NSView *activeView = this-&gt;activeView();
+    NSWindow *activeViewWindow = activeView.window;
+
+    if (!activeViewWindow)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (![[m_wkView window] isVisible])
</del><ins>+    if (!activeViewWindow.isVisible)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &lt;= 1080
</span><span class="cx">     // Mountain Lion and previous do not support occlusion notifications, and as such will
</span><span class="cx">     // continue to report as &quot;visible&quot; when not on the active space.
</span><del>-    if (![[m_wkView window] isOnActiveSpace])
</del><ins>+    if (!activeViewWindow.isOnActiveSpace)
</ins><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    if ([m_wkView isHiddenOrHasHiddenAncestor])
</del><ins>+    if (activeView.isHiddenOrHasHiddenAncestor)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><del>-    if ([m_wkView windowOcclusionDetectionEnabled] &amp;&amp; ([[m_wkView window] occlusionState] &amp; NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
</del><ins>+    if ([m_wkView windowOcclusionDetectionEnabled] &amp;&amp; (activeViewWindow.occlusionState &amp; NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
</ins><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -209,12 +219,12 @@
</span><span class="cx"> 
</span><span class="cx"> bool PageClientImpl::isViewVisibleOrOccluded()
</span><span class="cx"> {
</span><del>-    return [[m_wkView window] isVisible];
</del><ins>+    return activeView().window.isVisible;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PageClientImpl::isViewInWindow()
</span><span class="cx"> {
</span><del>-    return [m_wkView window];
</del><ins>+    return activeView().window;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PageClientImpl::isVisuallyIdle()
</span><span class="lines">@@ -225,7 +235,7 @@
</span><span class="cx"> LayerHostingMode PageClientImpl::viewLayerHostingMode()
</span><span class="cx"> {
</span><span class="cx"> #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
</span><del>-    if ([m_wkView window] &amp;&amp; [[m_wkView window] _hostsLayersInWindowServer])
</del><ins>+    if ([activeView().window _hostsLayersInWindowServer])
</ins><span class="cx">         return LayerHostingMode::OutOfProcess;
</span><span class="cx"> #endif
</span><span class="cx">     return LayerHostingMode::InProcess;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx"> #import &quot;WKProcessClassInternal.h&quot;
</span><span class="cx"> #import &quot;WKStringCF.h&quot;
</span><span class="cx"> #import &quot;WKTextInputWindowController.h&quot;
</span><ins>+#import &quot;WKThumbnailView.h&quot;
+#import &quot;WKThumbnailViewInternal.h&quot;
</ins><span class="cx"> #import &quot;WKViewInternal.h&quot;
</span><span class="cx"> #import &quot;WKViewPrivate.h&quot;
</span><span class="cx"> #import &quot;WebBackForwardList.h&quot;
</span><span class="lines">@@ -225,6 +227,8 @@
</span><span class="cx">     std::unique_ptr&lt;ViewGestureController&gt; _gestureController;
</span><span class="cx">     BOOL _allowsMagnification;
</span><span class="cx">     BOOL _allowsBackForwardNavigationGestures;
</span><ins>+
+    WKThumbnailView *_thumbnailView;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="lines">@@ -273,6 +277,7 @@
</span><span class="cx"> {
</span><span class="cx">     _data-&gt;_page-&gt;close();
</span><span class="cx"> 
</span><ins>+    ASSERT(!_data-&gt;_thumbnailView);
</ins><span class="cx">     ASSERT(!_data-&gt;_inSecureInputState);
</span><span class="cx"> 
</span><span class="cx">     [_data release];
</span><span class="lines">@@ -1077,6 +1082,8 @@
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER(Selector) \
</span><span class="cx">     - (void)Selector:(NSEvent *)theEvent \
</span><span class="cx">     { \
</span><ins>+        if (_data-&gt;_thumbnailView) \
+            return; \
</ins><span class="cx">         if ([[self inputContext] handleEvent:theEvent]) { \
</span><span class="cx">             LOG(TextInput, &quot;%s was handled by text input context&quot;, String(#Selector).substring(0, String(#Selector).find(&quot;Internal&quot;)).ascii().data()); \
</span><span class="cx">             return; \
</span><span class="lines">@@ -1111,6 +1118,9 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)scrollWheel:(NSEvent *)event
</span><span class="cx"> {
</span><ins>+    if (_data-&gt;_thumbnailView)
+        return;
+
</ins><span class="cx">     if (_data-&gt;_allowsBackForwardNavigationGestures) {
</span><span class="cx">         [self _ensureGestureController];
</span><span class="cx">         if (_data-&gt;_gestureController-&gt;handleScrollWheelEvent(event))
</span><span class="lines">@@ -1123,6 +1133,9 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)mouseMoved:(NSEvent *)event
</span><span class="cx"> {
</span><ins>+    if (_data-&gt;_thumbnailView)
+        return;
+
</ins><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="cx">     if (self == [[self window] firstResponder] &amp;&amp; !NSPointInRect([self convertPoint:[event locationInWindow] fromView:nil], [self visibleRect]))
</span><span class="cx">         return;
</span><span class="lines">@@ -1132,6 +1145,9 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)mouseDown:(NSEvent *)event
</span><span class="cx"> {
</span><ins>+    if (_data-&gt;_thumbnailView)
+        return;
+
</ins><span class="cx">     [self _setMouseDownEvent:event];
</span><span class="cx">     _data-&gt;_ignoringMouseDraggedEvents = NO;
</span><span class="cx">     [self mouseDownInternal:event];
</span><span class="lines">@@ -1139,12 +1155,18 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)mouseUp:(NSEvent *)event
</span><span class="cx"> {
</span><ins>+    if (_data-&gt;_thumbnailView)
+        return;
+
</ins><span class="cx">     [self _setMouseDownEvent:nil];
</span><span class="cx">     [self mouseUpInternal:event];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)mouseDragged:(NSEvent *)event
</span><span class="cx"> {
</span><ins>+    if (_data-&gt;_thumbnailView)
+        return;
+
</ins><span class="cx">     if (_data-&gt;_ignoringMouseDraggedEvents)
</span><span class="cx">         return;
</span><span class="cx">     [self mouseDraggedInternal:event];
</span><span class="lines">@@ -2483,6 +2505,13 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
</span><span class="cx"> {
</span><ins>+    [rootLayer web_disableAllActions];
+
+    if (_data-&gt;_thumbnailView) {
+        _data-&gt;_thumbnailView.thumbnailLayer = rootLayer;
+        return;
+    }
+
</ins><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><span class="lines">@@ -2527,7 +2556,10 @@
</span><span class="cx">     if (!hostView)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return hostView.layer;
</del><ins>+    if (!hostView.layer.sublayers.count)
+        return nullptr;
+
+    return hostView.layer.sublayers[0];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (RetainPtr&lt;CGImageRef&gt;)_takeViewSnapshot
</span><span class="lines">@@ -2943,6 +2975,27 @@
</span><span class="cx">     [types release];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_setThumbnailView:(WKThumbnailView *)thumbnailView
+{
+    ASSERT(!_data-&gt;_thumbnailView || !thumbnailView);
+
+    RetainPtr&lt;CALayer&gt; thumbnailLayer = _data-&gt;_thumbnailView.thumbnailLayer;
+
+    _data-&gt;_thumbnailView = thumbnailView;
+
+    if (thumbnailView)
+        thumbnailView.thumbnailLayer = [self _acceleratedCompositingModeRootLayer];
+    else
+        [self _setAcceleratedCompositingModeRootLayer:thumbnailLayer.get()];
+
+    _data-&gt;_page-&gt;viewStateDidChange(ViewState::WindowIsActive | ViewState::IsInWindow | ViewState::IsVisible);
+}
+
+- (WKThumbnailView *)_thumbnailView
+{
+    return _data-&gt;_thumbnailView;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKView (Private)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #import &quot;PluginComplexTextInputState.h&quot;
</span><span class="cx"> #import &quot;WebFindOptions.h&quot;
</span><span class="cx"> #import &lt;wtf/Forward.h&gt;
</span><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #import &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @class WKWebViewConfiguration;
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @class WKFullScreenWindowController;
</span><ins>+@class WKThumbnailView;
</ins><span class="cx"> 
</span><span class="cx"> @interface WKView ()
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="lines">@@ -103,6 +105,8 @@
</span><span class="cx"> - (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates;
</span><span class="cx"> - (BOOL)_suppressVisibilityUpdates;
</span><span class="cx"> 
</span><ins>+@property (nonatomic, setter=_setThumbnailView:) WKThumbnailView *_thumbnailView;
+
</ins><span class="cx"> // FullScreen
</span><span class="cx"> 
</span><span class="cx"> @property (readonly) BOOL _hasFullScreenWindowController;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -4497,4 +4497,12 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setThumbnailScale(double scale)
+{
+    if (!isValid())
+        return;
+
+    m_process-&gt;send(Messages::WebPage::SetThumbnailScale(scale), m_pageID);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -826,6 +826,7 @@
</span><span class="cx">     
</span><span class="cx">     void setMediaVolume(float);
</span><span class="cx">     void setMayStartMediaWhenInWindow(bool);
</span><ins>+    bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
</ins><span class="cx"> 
</span><span class="cx">     // WebPopupMenuProxy::Client
</span><span class="cx">     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
</span><span class="lines">@@ -887,6 +888,8 @@
</span><span class="cx">     void unwrapCryptoKey(const Vector&lt;uint8_t&gt;&amp;, bool&amp; succeeded, Vector&lt;uint8_t&gt;&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void setThumbnailScale(double);
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, const WebPageConfiguration&amp;);
</span><span class="cx">     void platformInitialize();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -392,7 +392,7 @@
</span><span class="cx">             m_currentSwipeLiveLayers.append(layer);
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><del>-        swipeArea = rootContentLayer.frame;
</del><ins>+        swipeArea = FloatRect(FloatPoint(), m_webPageProxy.drawingArea()-&gt;size());
</ins><span class="cx">         m_currentSwipeLiveLayers.append(rootContentLayer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -455,7 +455,7 @@
</span><span class="cx">     if (!m_customSwipeViews.isEmpty())
</span><span class="cx">         width = m_currentSwipeCustomViewBounds.width();
</span><span class="cx">     else
</span><del>-        width = m_webPageProxy.acceleratedCompositingRootLayer().frame.size.width;
</del><ins>+        width = m_webPageProxy.drawingArea()-&gt;size().width();
</ins><span class="cx"> 
</span><span class="cx">     double swipingLayerOffset = floor(width * progress);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -445,6 +445,8 @@
</span><span class="cx">                 2D429BFD1721E2C700EC681F /* PDFPluginPasswordField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */; };
</span><span class="cx">                 2D47B56C1810714E003A3AEE /* RemoteLayerBackingStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */; };
</span><span class="cx">                 2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D47B56B1810714E003A3AEE /* RemoteLayerBackingStore.h */; };
</span><ins>+                2D6B371B18A967AD0042AE80 /* WKThumbnailView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6B371918A967AD0042AE80 /* WKThumbnailView.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                2D6B371C18A967AD0042AE80 /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6B371A18A967AD0042AE80 /* WKThumbnailView.mm */; };
</ins><span class="cx">                 2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */; };
</span><span class="cx">                 2D6CD11A189058A500E5A4A0 /* ViewSnapshotStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */; };
</span><span class="cx">                 2D819B9E18627EE9001F03D1 /* ViewGestureGeometryCollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D819B99186275B3001F03D1 /* ViewGestureGeometryCollector.cpp */; };
</span><span class="lines">@@ -489,6 +491,7 @@
</span><span class="cx">                 2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */; };
</span><span class="cx">                 2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */; };
</span><span class="cx">                 2DA944BD188511E700ED86DB /* NetworkProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */; };
</span><ins>+                2DACE64E18ADBFF000E4CA76 /* WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* WKThumbnailViewInternal.h */; };
</ins><span class="cx">                 2DDE0AFA18298CC900F97EAA /* RemoteLayerTreePropertyApplier.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */; };
</span><span class="cx">                 2DDE0AFB18298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */; };
</span><span class="cx">                 2DF9593B18A42412009785A1 /* ViewGestureControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */; };
</span><span class="lines">@@ -2144,6 +2147,8 @@
</span><span class="cx">                 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginPasswordField.mm; path = PDF/PDFPluginPasswordField.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStore.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D47B56B1810714E003A3AEE /* RemoteLayerBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerBackingStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2D6B371918A967AD0042AE80 /* WKThumbnailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKThumbnailView.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                2D6B371A18A967AD0042AE80 /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKThumbnailView.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewSnapshotStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewSnapshotStore.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D70AB1318A1D51A00026D6E /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = &quot;Info-iOS.plist&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2193,6 +2198,7 @@
</span><span class="cx">                 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebBackForwardListProxyIOS.mm; path = ios/WebBackForwardListProxyIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageIOS.mm; path = ios/WebPageIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessIOS.mm; path = NetworkProcess/ios/NetworkProcessIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2DACE64D18ADBFF000E4CA76 /* WKThumbnailViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKThumbnailViewInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2DDE0AF818298CC900F97EAA /* RemoteLayerTreePropertyApplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreePropertyApplier.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DDE0AF918298CC900F97EAA /* RemoteLayerTreePropertyApplier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreePropertyApplier.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4359,6 +4365,9 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 1A43E826188F38E2009E4D30 /* Deprecated */,
</span><ins>+                                2D6B371918A967AD0042AE80 /* WKThumbnailView.h */,
+                                2DACE64D18ADBFF000E4CA76 /* WKThumbnailViewInternal.h */,
+                                2D6B371A18A967AD0042AE80 /* WKThumbnailView.mm */,
</ins><span class="cx">                                 1A4D664A18A3030E00D82E21 /* WKFrameInfo.h */,
</span><span class="cx">                                 1A4D664918A3030E00D82E21 /* WKFrameInfo.mm */,
</span><span class="cx">                                 1A4D664D18A3031B00D82E21 /* WKFrameInfoInternal.h */,
</span><span class="lines">@@ -6438,6 +6447,7 @@
</span><span class="cx">                                 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */,
</span><span class="cx">                                 1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */,
</span><span class="cx">                                 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */,
</span><ins>+                                2D6B371B18A967AD0042AE80 /* WKThumbnailView.h in Headers */,
</ins><span class="cx">                                 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */,
</span><span class="cx">                                 1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */,
</span><span class="cx">                                 2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */,
</span><span class="lines">@@ -6601,6 +6611,7 @@
</span><span class="cx">                                 1A2464F31891E45100234C5B /* APILoaderClient.h in Headers */,
</span><span class="cx">                                 BC1DD7B2114DC396005ADAF3 /* WebCoreArgumentCoders.h in Headers */,
</span><span class="cx">                                 512F589B12A8838800629530 /* WebCredential.h in Headers */,
</span><ins>+                                2DACE64E18ADBFF000E4CA76 /* WKThumbnailViewInternal.h in Headers */,
</ins><span class="cx">                                 51578B831209ECEF00A37C4A /* APIData.h in Headers */,
</span><span class="cx">                                 F6A25FDD12ADC6CC00DC40CC /* WebDatabaseManager.h in Headers */,
</span><span class="cx">                                 F62A76B712B1B25F0005F1B6 /* WebDatabaseManagerMessages.h in Headers */,
</span><span class="lines">@@ -8143,6 +8154,7 @@
</span><span class="cx">                                 510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */,
</span><span class="cx">                                 3F889D14188778C900FEADAF /* WebVideoFullscreenManagerProxy.cpp in Sources */,
</span><span class="cx">                                 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */,
</span><ins>+                                2D6B371C18A967AD0042AE80 /* WKThumbnailView.mm in Sources */,
</ins><span class="cx">                                 378E1A3D181ED6FF0031007A /* APIObject.mm in Sources */,
</span><span class="cx">                                 51FB08FF1639DE1A00EC324A /* WebResourceLoadScheduler.cpp in Sources */,
</span><span class="cx">                                 0F5947A7187B517600437857 /* RemoteScrollingCoordinatorMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -105,6 +105,8 @@
</span><span class="cx">     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
</span><span class="cx">     virtual void scheduleCompositingLayerFlush() = 0;
</span><span class="cx"> 
</span><ins>+    virtual void setTransform(const WebCore::TransformationMatrix&amp;) { }
+
</ins><span class="cx"> #if USE(COORDINATED_GRAPHICS)
</span><span class="cx">     virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection*, IPC::MessageDecoder&amp;) = 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -292,6 +292,8 @@
</span><span class="cx">     , m_viewState(parameters.viewState)
</span><span class="cx">     , m_processSuppressionDisabledByWebPreference(&quot;Process suppression is disabled.&quot;)
</span><span class="cx">     , m_pendingNavigationID(0)
</span><ins>+    , m_pageScaleWithoutThumbnailScale(1)
+    , m_thumbnailScale(1)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_pageID);
</span><span class="cx">     // FIXME: This is a non-ideal location for this Setting and
</span><span class="lines">@@ -3964,8 +3966,14 @@
</span><span class="cx">     // Only restore the scale factor for standard frame loads (of the main frame).
</span><span class="cx">     if (frame-&gt;coreFrame()-&gt;loader().loadType() == FrameLoadTypeStandard) {
</span><span class="cx">         Page* page = frame-&gt;coreFrame()-&gt;page();
</span><del>-        if (page &amp;&amp; page-&gt;pageScaleFactor() != 1)
-            scalePage(1, IntPoint());
</del><ins>+
+        if (page) {
+            if (m_thumbnailScale != 1) {
+                m_pageScaleWithoutThumbnailScale = 1;
+                setThumbnailScale(m_thumbnailScale);
+            } else if (page-&gt;pageScaleFactor() != 1)
+                scalePage(1, IntPoint());
+        }
</ins><span class="cx">     }
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     m_userHasChangedPageScaleFactor = false;
</span><span class="lines">@@ -4195,4 +4203,38 @@
</span><span class="cx">     return documentLoader.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::setThumbnailScale(double thumbnailScale)
+{
+    // FIXME (129014): If the page programmatically scales while thumbnailed, we will restore the wrong scroll position.
+
+    ASSERT_ARG(thumbnailScale, thumbnailScale &gt; 0);
+
+    double currentPageScaleFactor = pageScaleFactor();
+
+    if (thumbnailScale == m_thumbnailScale &amp;&amp; currentPageScaleFactor == m_thumbnailScale * m_pageScaleWithoutThumbnailScale)
+        return;
+
+    if (m_thumbnailScale == 1) {
+        m_pageScaleWithoutThumbnailScale = currentPageScaleFactor;
+        m_scrollPositionIgnoringThumbnailScale = m_page-&gt;mainFrame().view()-&gt;scrollPosition();
+    }
+
+    m_thumbnailScale = thumbnailScale;
+
+    // Scale the page, but leave the original page scale intact if there was any.
+    scalePage(m_thumbnailScale * m_pageScaleWithoutThumbnailScale, IntPoint());
+
+    // Scroll as far as we can towards the original scroll position in the scaled page.
+    // This may get constrained; we'll transform the drawing area to expose the right part of the page.
+    m_page-&gt;mainFrame().view()-&gt;setScrollPosition(IntPoint(m_scrollPositionIgnoringThumbnailScale.x() * m_thumbnailScale, m_scrollPositionIgnoringThumbnailScale.y() * m_thumbnailScale));
+
+    double inverseScale = 1 / m_thumbnailScale;
+    IntPoint newScrollPosition = m_page-&gt;mainFrame().view()-&gt;scrollPosition();
+    TransformationMatrix transform;
+    transform.translate((newScrollPosition.x() * inverseScale) - m_scrollPositionIgnoringThumbnailScale.x(), (newScrollPosition.y() * inverseScale) - m_scrollPositionIgnoringThumbnailScale.y());
+    transform.scale(inverseScale);
+
+    drawingArea()-&gt;setTransform(transform);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -369,6 +369,8 @@
</span><span class="cx">     void addPluginView(PluginView*);
</span><span class="cx">     void removePluginView(PluginView*);
</span><span class="cx"> 
</span><ins>+    void setThumbnailScale(double);
+
</ins><span class="cx">     bool isVisible() const { return m_viewState &amp; WebCore::ViewState::IsVisible; }
</span><span class="cx">     bool isVisibleOrOccluded() const { return m_viewState &amp; WebCore::ViewState::IsVisibleOrOccluded; }
</span><span class="cx"> 
</span><span class="lines">@@ -1091,6 +1093,10 @@
</span><span class="cx">     UserActivity m_processSuppressionDisabledByWebPreference;
</span><span class="cx"> 
</span><span class="cx">     uint64_t m_pendingNavigationID;
</span><ins>+
+    double m_pageScaleWithoutThumbnailScale;
+    WebCore::IntPoint m_scrollPositionIgnoringThumbnailScale;
+    double m_thumbnailScale;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -323,4 +323,6 @@
</span><span class="cx"> #endif
</span><span class="cx">   
</span><span class="cx">     SetScrollPinningBehavior(uint32_t pinning)
</span><ins>+
+    SetThumbnailScale(double scale)
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &lt;WebCore/LayerFlushScheduler.h&gt;
</span><span class="cx"> #include &lt;WebCore/LayerFlushSchedulerClient.h&gt;
</span><span class="cx"> #include &lt;WebCore/Timer.h&gt;
</span><ins>+#include &lt;WebCore/TransformationMatrix.h&gt;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -113,6 +114,8 @@
</span><span class="cx">     virtual void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;
</span><span class="cx">     void applyTransientZoomToPage(double scale, WebCore::FloatPoint origin);
</span><span class="cx"> 
</span><ins>+    virtual void setTransform(const WebCore::TransformationMatrix&amp;) override;
+
</ins><span class="cx">     void updateLayerHostingContext();
</span><span class="cx"> 
</span><span class="cx">     void setRootCompositingLayer(CALayer *);
</span><span class="lines">@@ -132,17 +135,17 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;LayerHostingContext&gt; m_layerHostingContext;
</span><span class="cx"> 
</span><ins>+    RetainPtr&lt;CALayer&gt; m_hostingLayer;
</ins><span class="cx">     RetainPtr&lt;CALayer&gt; m_rootLayer;
</span><del>-    RetainPtr&lt;CALayer&gt; m_pendingRootCompositingLayer;
-
</del><span class="cx">     RetainPtr&lt;CALayer&gt; m_debugInfoLayer;
</span><span class="cx"> 
</span><ins>+    RetainPtr&lt;CALayer&gt; m_pendingRootLayer;
+
</ins><span class="cx">     typedef HashMap&lt;PageOverlay*, std::unique_ptr&lt;WebCore::GraphicsLayer&gt;&gt; PageOverlayLayerMap;
</span><span class="cx">     PageOverlayLayerMap m_pageOverlayLayers;
</span><span class="cx">     mutable HashMap&lt;const WebCore::GraphicsLayer*, RetainPtr&lt;CALayer&gt;&gt; m_pageOverlayPlatformLayers;
</span><span class="cx"> 
</span><span class="cx">     bool m_isPaintingSuspended;
</span><del>-    bool m_hasRootCompositingLayer;
</del><span class="cx"> 
</span><span class="cx">     WebCore::FloatRect m_exposedRect;
</span><span class="cx">     WebCore::FloatRect m_scrolledExposedRect;
</span><span class="lines">@@ -153,6 +156,8 @@
</span><span class="cx"> 
</span><span class="cx">     double m_transientZoomScale;
</span><span class="cx">     WebCore::FloatPoint m_transientZoomOrigin;
</span><ins>+
+    WebCore::TransformationMatrix m_transform;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> DRAWING_AREA_TYPE_CASTS(TiledCoreAnimationDrawingArea, type() == DrawingAreaTypeTiledCoreAnimation);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (164336 => 164337)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2014-02-19 01:55:33 UTC (rev 164336)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2014-02-19 01:57:31 UTC (rev 164337)
</span><span class="lines">@@ -78,13 +78,11 @@
</span><span class="cx"> {
</span><span class="cx">     m_webPage-&gt;corePage()-&gt;settings().setForceCompositingMode(true);
</span><span class="cx"> 
</span><del>-    m_rootLayer = [CALayer layer];
</del><ins>+    m_hostingLayer = [CALayer layer];
+    [m_hostingLayer setFrame:m_webPage-&gt;bounds()];
+    [m_hostingLayer setOpaque:YES];
+    [m_hostingLayer setGeometryFlipped:YES];
</ins><span class="cx"> 
</span><del>-    CGRect rootLayerFrame = m_webPage-&gt;bounds();
-    m_rootLayer.get().frame = rootLayerFrame;
-    m_rootLayer.get().opaque = YES;
-    m_rootLayer.get().geometryFlipped = YES;
-
</del><span class="cx">     updateLayerHostingContext();
</span><span class="cx">     setColorSpace(parameters.colorSpace);
</span><span class="cx"> 
</span><span class="lines">@@ -124,14 +122,14 @@
</span><span class="cx"> 
</span><span class="cx"> void TiledCoreAnimationDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
</span><span class="cx"> {
</span><del>-    CALayer *rootCompositingLayer = graphicsLayer ? graphicsLayer-&gt;platformLayer() : nil;
</del><ins>+    CALayer *rootLayer = graphicsLayer ? graphicsLayer-&gt;platformLayer() : nil;
</ins><span class="cx"> 
</span><span class="cx">     if (m_layerTreeStateIsFrozen) {
</span><del>-        m_pendingRootCompositingLayer = rootCompositingLayer;
</del><ins>+        m_pendingRootLayer = rootLayer;
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    setRootCompositingLayer(rootCompositingLayer);
</del><ins>+    setRootCompositingLayer(rootLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TiledCoreAnimationDrawingArea::forceRepaint()
</span><span class="lines">@@ -221,7 +219,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!layer-&gt;drawsContent()) {
</span><span class="cx">         layer-&gt;setDrawsContent(true);
</span><del>-        layer-&gt;setSize(expandedIntSize(FloatSize(m_rootLayer.get().frame.size)));
</del><ins>+        layer-&gt;setSize(expandedIntSize(FloatSize(m_hostingLayer.get().frame.size)));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     layer-&gt;setNeedsDisplayInRect(rect);
</span><span class="lines">@@ -380,12 +378,12 @@
</span><span class="cx"> 
</span><span class="cx">     m_webPage-&gt;layoutIfNeeded();
</span><span class="cx"> 
</span><del>-    if (m_pendingRootCompositingLayer) {
-        setRootCompositingLayer(m_pendingRootCompositingLayer.get());
-        m_pendingRootCompositingLayer = nullptr;
</del><ins>+    if (m_pendingRootLayer) {
+        setRootCompositingLayer(m_pendingRootLayer.get());
+        m_pendingRootLayer = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FloatRect visibleRect = [m_rootLayer frame];
</del><ins>+    FloatRect visibleRect = [m_hostingLayer frame];
</ins><span class="cx">     visibleRect.intersect(m_scrolledExposedRect);
</span><span class="cx"> 
</span><span class="cx">     for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
</span><span class="lines">@@ -414,8 +412,8 @@
</span><span class="cx">     ASSERT(!m_isPaintingSuspended);
</span><span class="cx">     m_isPaintingSuspended = true;
</span><span class="cx"> 
</span><del>-    [m_rootLayer setValue:(id)kCFBooleanTrue forKey:@&quot;NSCAViewRenderPaused&quot;];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;NSCAViewRenderDidPauseNotification&quot; object:nil userInfo:[NSDictionary dictionaryWithObject:m_rootLayer.get() forKey:@&quot;layer&quot;]];
</del><ins>+    [m_hostingLayer setValue:@YES forKey:@&quot;NSCAViewRenderPaused&quot;];
+    [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;NSCAViewRenderDidPauseNotification&quot; object:nil userInfo:[NSDictionary dictionaryWithObject:m_hostingLayer.get() forKey:@&quot;layer&quot;]];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TiledCoreAnimationDrawingArea::resumePainting()
</span><span class="lines">@@ -427,8 +425,8 @@
</span><span class="cx">     }
</span><span class="cx">     m_isPaintingSuspended = false;
</span><span class="cx"> 
</span><del>-    [m_rootLayer setValue:(id)kCFBooleanFalse forKey:@&quot;NSCAViewRenderPaused&quot;];
-    [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;NSCAViewRenderDidResumeNotification&quot; object:nil userInfo:[NSDictionary dictionaryWithObject:m_rootLayer.get() forKey:@&quot;layer&quot;]];
</del><ins>+    [m_hostingLayer setValue:@NO forKey:@&quot;NSCAViewRenderPaused&quot;];
+    [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;NSCAViewRenderDidResumeNotification&quot; object:nil userInfo:[NSDictionary dictionaryWithObject:m_hostingLayer.get() forKey:@&quot;layer&quot;]];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect&amp; exposedRect)
</span><span class="lines">@@ -498,7 +496,7 @@
</span><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><del>-    m_rootLayer.get().frame = CGRectMake(layerPosition.width(), layerPosition.height(), viewSize.width(), viewSize.height());
</del><ins>+    [m_hostingLayer setFrame:CGRectMake(layerPosition.width(), layerPosition.height(), viewSize.width(), viewSize.height())];
</ins><span class="cx"> 
</span><span class="cx">     [CATransaction commit];
</span><span class="cx">     
</span><span class="lines">@@ -559,8 +557,8 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_hasRootCompositingLayer)
-        m_layerHostingContext-&gt;setRootLayer(m_rootLayer.get());
</del><ins>+    if (m_rootLayer)
+        m_layerHostingContext-&gt;setRootLayer(m_hostingLayer.get());
</ins><span class="cx"> 
</span><span class="cx">     if (colorSpace)
</span><span class="cx">         m_layerHostingContext-&gt;setColorSpace(colorSpace.get());
</span><span class="lines">@@ -570,19 +568,20 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_layerTreeStateIsFrozen);
</span><span class="cx"> 
</span><del>-    bool hadRootCompositingLayer = m_hasRootCompositingLayer;
-    m_hasRootCompositingLayer = !!layer;
-
</del><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><del>-    m_rootLayer.get().sublayers = m_hasRootCompositingLayer ? [NSArray arrayWithObject:layer] : [NSArray array];
</del><ins>+    [m_hostingLayer setSublayers:layer ? @[ layer ] : @[ ]];
</ins><span class="cx"> 
</span><del>-    if (hadRootCompositingLayer != m_hasRootCompositingLayer)
-        m_layerHostingContext-&gt;setRootLayer(m_hasRootCompositingLayer ? m_rootLayer.get() : 0);
</del><ins>+    bool hadRootLayer = !!m_rootLayer;
+    m_rootLayer = layer;
+    [m_rootLayer setSublayerTransform:m_transform];
</ins><span class="cx"> 
</span><ins>+    if (hadRootLayer != !!layer)
+        m_layerHostingContext-&gt;setRootLayer(layer ? m_hostingLayer.get() : 0);
+
</ins><span class="cx">     for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it)
</span><del>-        [m_rootLayer addSublayer:it-&gt;value-&gt;platformLayer()];
</del><ins>+        [m_hostingLayer addSublayer:it-&gt;value-&gt;platformLayer()];
</ins><span class="cx"> 
</span><span class="cx">     if (TiledBacking* tiledBacking = mainFrameTiledBacking())
</span><span class="cx">         tiledBacking-&gt;setAggressivelyRetainsTiles(m_webPage-&gt;corePage()-&gt;settings().aggressiveTileRetentionEnabled());
</span><span class="lines">@@ -608,7 +607,7 @@
</span><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><del>-    [m_rootLayer addSublayer:layer-&gt;platformLayer()];
</del><ins>+    [m_hostingLayer addSublayer:layer-&gt;platformLayer()];
</ins><span class="cx"> 
</span><span class="cx">     [CATransaction commit];
</span><span class="cx"> 
</span><span class="lines">@@ -643,7 +642,7 @@
</span><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><span class="cx"> 
</span><del>-    [m_rootLayer insertSublayer:layer-&gt;platformLayer() above:oldPlatformLayer.get()];
</del><ins>+    [m_hostingLayer insertSublayer:layer-&gt;platformLayer() above:oldPlatformLayer.get()];
</ins><span class="cx">     [oldPlatformLayer removeFromSuperlayer];
</span><span class="cx"> 
</span><span class="cx">     [CATransaction commit];
</span><span class="lines">@@ -669,7 +668,7 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">             [m_debugInfoLayer setName:@&quot;Debug Info&quot;];
</span><span class="cx"> #endif
</span><del>-            [m_rootLayer addSublayer:m_debugInfoLayer.get()];
</del><ins>+            [m_hostingLayer addSublayer:m_debugInfoLayer.get()];
</ins><span class="cx">         }
</span><span class="cx">     } else if (m_debugInfoLayer) {
</span><span class="cx">         [m_debugInfoLayer removeFromSuperlayer];
</span><span class="lines">@@ -688,7 +687,7 @@
</span><span class="cx">     // FIXME: Keep around pageScale=1 tiles so we can zoom out without gaps.
</span><span class="cx">     // FIXME: Bring in unparented-but-painted tiles when zooming out, to fill in any gaps.
</span><span class="cx"> 
</span><del>-    if (!m_rootLayer)
</del><ins>+    if (!m_hostingLayer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     TransformationMatrix transform;
</span><span class="lines">@@ -827,6 +826,12 @@
</span><span class="cx">     m_transientZoomScale = 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TiledCoreAnimationDrawingArea::setTransform(const TransformationMatrix&amp; transform)
+{
+    m_transform = transform;
+    [m_rootLayer setSublayerTransform:transform];
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre>
</div>
</div>

</body>
</html>