<!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>[161296] 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/161296">161296</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-01-03 16:35:59 -0800 (Fri, 03 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] [WK2] TileController creates all tiles on first paint, making it slow and consuming lots of memory
https://bugs.webkit.org/show_bug.cgi?id=126457
Reviewed by Simon Fraser.
Instead of making all of the tiles all of the time, we should use the
view-exposed-rect mechanism to inform TileController about what portion
of the WKContentView is currently exposed by the WKScrollView.
* UIProcess/API/ios/WKContentView.h:
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView setViewportSize:]):
(-[WKContentView didFinishScrollTo:]):
(-[WKContentView didScrollTo:]):
Inform the WebPageProxy that our exposed rect changed.
* UIProcess/API/ios/WKView.mm:
(-[WKView scrollViewDidScroll:]):
Inform the WKContentView that we've scrolled at all.
Rename the existing WKContentView didScrollTo: to didFinishScrollTo:,
because it is expected to only fire when a scroll lands. Add didScrollTo:,
which fires continually as scrolling progresses.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::viewExposedRectChanged):
(WebKit::WebPageProxy::exposedRectChangedTimerFired):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::viewExposedRect):
* UIProcess/mac/WebPageProxyMac.mm:
Move view-exposed-rect stuff to WebPageProxy so it can be built on both
Mac and iOS, and un-!PLATFORM(IOS) some of the related members.
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::setExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::setClipsToExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::updateMainFrameClipsToExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::mainFrameTiledBacking):
Steal TiledCoreAnimationDrawingArea's exposed-rect code.
Note that on iOS, we don't need to manually offset the exposed rect by
the scroll position, because the scroll position is already baked into
the exposed rect, and WebCore's notion of the scroll position will be
inaccurate until the scroll lands.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewh">trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIiosWKViewmm">trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</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="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2014-01-03 Tim Horton <timothy_horton@apple.com>
+
+ [iOS] [WK2] TileController creates all tiles on first paint, making it slow and consuming lots of memory
+ https://bugs.webkit.org/show_bug.cgi?id=126457
+
+ Reviewed by Simon Fraser.
+
+ Instead of making all of the tiles all of the time, we should use the
+ view-exposed-rect mechanism to inform TileController about what portion
+ of the WKContentView is currently exposed by the WKScrollView.
+
+ * UIProcess/API/ios/WKContentView.h:
+ * UIProcess/API/ios/WKContentView.mm:
+ (-[WKContentView setViewportSize:]):
+ (-[WKContentView didFinishScrollTo:]):
+ (-[WKContentView didScrollTo:]):
+ Inform the WebPageProxy that our exposed rect changed.
+
+ * UIProcess/API/ios/WKView.mm:
+ (-[WKView scrollViewDidScroll:]):
+ Inform the WKContentView that we've scrolled at all.
+ Rename the existing WKContentView didScrollTo: to didFinishScrollTo:,
+ because it is expected to only fire when a scroll lands. Add didScrollTo:,
+ which fires continually as scrolling progresses.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::viewExposedRectChanged):
+ (WebKit::WebPageProxy::exposedRectChangedTimerFired):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::viewExposedRect):
+ * UIProcess/mac/WebPageProxyMac.mm:
+ Move view-exposed-rect stuff to WebPageProxy so it can be built on both
+ Mac and iOS, and un-!PLATFORM(IOS) some of the related members.
+
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+ (WebKit::RemoteLayerTreeDrawingArea::setExposedRect):
+ (WebKit::RemoteLayerTreeDrawingArea::setClipsToExposedRect):
+ (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
+ (WebKit::RemoteLayerTreeDrawingArea::updateMainFrameClipsToExposedRect):
+ (WebKit::RemoteLayerTreeDrawingArea::mainFrameTiledBacking):
+ Steal TiledCoreAnimationDrawingArea's exposed-rect code.
+ Note that on iOS, we don't need to manually offset the exposed rect by
+ the scroll position, because the scroll position is already baked into
+ the exposed rect, and WebCore's notion of the scroll position will be
+ inaccurate until the scroll lands.
+
</ins><span class="cx"> 2014-01-03 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Give all PlatformCALayers a PlatformLayerID, not just remote ones
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> - (void)setMinimumSize:(CGSize)size;
</span><span class="cx"> - (void)setViewportSize:(CGSize)size;
</span><span class="cx">
</span><ins>+- (void)didFinishScrollTo:(CGPoint)contentOffset;
</ins><span class="cx"> - (void)didScrollTo:(CGPoint)contentOffset;
</span><span class="cx"> - (void)didZoomToScale:(CGFloat)scale;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -138,13 +138,20 @@
</span><span class="cx"> - (void)setViewportSize:(CGSize)size
</span><span class="cx"> {
</span><span class="cx"> _page->setFixedLayoutSize(IntSize(size));
</span><ins>+ _page->viewExposedRectChanged(FloatRect(_page->viewExposedRect().location(), FloatSize(size)), WebPageProxy::ClipsToExposedRect::Clip);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)didScrollTo:(CGPoint)contentOffset
</del><ins>+- (void)didFinishScrollTo:(CGPoint)contentOffset
</ins><span class="cx"> {
</span><span class="cx"> _page->didFinishScrolling(contentOffset);
</span><ins>+ _page->viewExposedRectChanged(FloatRect(FloatPoint(contentOffset), _page->fixedLayoutSize()), WebPageProxy::ClipsToExposedRect::Clip);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)didScrollTo:(CGPoint)contentOffset
+{
+ _page->viewExposedRectChanged(FloatRect(FloatPoint(contentOffset), _page->fixedLayoutSize()), WebPageProxy::ClipsToExposedRect::Clip);
+}
+
</ins><span class="cx"> - (void)didZoomToScale:(CGFloat)scale
</span><span class="cx"> {
</span><span class="cx"> _page->didFinishZooming(scale);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIiosWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -187,29 +187,35 @@
</span><span class="cx"> _userHasChangedPageScale = YES;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_didScroll
</del><ins>+- (void)_didFinishScroll
</ins><span class="cx"> {
</span><span class="cx"> CGPoint position = [_scrollView convertPoint:[_scrollView contentOffset] toView:_contentView.get()];
</span><del>- [_contentView didScrollTo:position];
</del><ins>+ [_contentView didFinishScrollTo:position];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
</span><span class="cx"> {
</span><span class="cx"> // If we're decelerating, scroll offset will be updated when scrollViewDidFinishDecelerating: is called.
</span><span class="cx"> if (!decelerate)
</span><del>- [self _didScroll];
</del><ins>+ [self _didFinishScroll];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
</span><span class="cx"> {
</span><del>- [self _didScroll];
</del><ins>+ [self _didFinishScroll];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
</span><span class="cx"> {
</span><del>- [self _didScroll];
</del><ins>+ [self _didFinishScroll];
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+{
+ CGPoint position = [_scrollView convertPoint:[_scrollView contentOffset] toView:_contentView.get()];
+ [_contentView didScrollTo:position];
+}
+
</ins><span class="cx"> - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
</span><span class="cx"> {
</span><span class="cx"> ASSERT(scrollView == _scrollView);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -390,7 +390,7 @@
</span><span class="cx"> if (_data->_useContentPreparationRectForVisibleRect)
</span><span class="cx"> exposedRect = NSUnionRect(_data->_contentPreparationRect, exposedRect);
</span><span class="cx">
</span><del>- _data->_page->viewExposedRectChanged(exposedRect, _data->_clipsToVisibleRect);
</del><ins>+ _data->_page->viewExposedRectChanged(exposedRect, _data->_clipsToVisibleRect ? WebPageProxy::ClipsToExposedRect::Clip : WebPageProxy::ClipsToExposedRect::DoNotClip);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)setFrameSize:(NSSize)size
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -302,10 +302,10 @@
</span><span class="cx"> , m_mediaVolume(1)
</span><span class="cx"> , m_mayStartMediaWhenInWindow(true)
</span><span class="cx"> , m_waitingForDidUpdateViewState(false)
</span><del>-#if PLATFORM(MAC) && !PLATFORM(IOS)
</del><ins>+#if PLATFORM(MAC)
</ins><span class="cx"> , m_exposedRectChangedTimer(this, &WebPageProxy::exposedRectChangedTimerFired)
</span><del>- , m_clipsToExposedRect(false)
- , m_lastSentClipsToExposedRect(false)
</del><ins>+ , m_clipsToExposedRect(ClipsToExposedRect::DoNotClip)
+ , m_lastSentClipsToExposedRect(ClipsToExposedRect::DoNotClip)
</ins><span class="cx"> #endif
</span><span class="cx"> , m_scrollPinningBehavior(DoNotPin)
</span><span class="cx"> {
</span><span class="lines">@@ -4394,4 +4394,31 @@
</span><span class="cx"> m_process->send(Messages::WebPage::SetScrollPinningBehavior(pinning), m_pageID);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) || PLATFORM(IOS)
+void WebPageProxy::viewExposedRectChanged(const FloatRect& exposedRect, ClipsToExposedRect clipsToExposedRect)
+{
+ if (!isValid())
+ return;
+
+ m_exposedRect = exposedRect;
+ m_clipsToExposedRect = clipsToExposedRect;
+
+ if (!m_exposedRectChangedTimer.isActive())
+ m_exposedRectChangedTimer.startOneShot(0);
+}
+
+void WebPageProxy::exposedRectChangedTimerFired(Timer<WebPageProxy>*)
+{
+ if (!isValid())
+ return;
+
+ if (m_exposedRect == m_lastSentExposedRect && m_clipsToExposedRect == m_lastSentClipsToExposedRect)
+ return;
+
+ process().send(Messages::WebPage::ViewExposedRectChanged(m_exposedRect, m_clipsToExposedRect == ClipsToExposedRect::Clip), m_pageID);
+ m_lastSentExposedRect = m_exposedRect;
+ m_lastSentClipsToExposedRect = m_clipsToExposedRect;
+}
+#endif
+
</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 (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -463,7 +463,9 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
</span><del>- void viewExposedRectChanged(const WebCore::FloatRect& exposedRect, bool);
</del><ins>+ enum class ClipsToExposedRect { DoNotClip, Clip };
+ void viewExposedRectChanged(const WebCore::FloatRect& exposedRect, ClipsToExposedRect);
+ WebCore::FloatRect viewExposedRect() const { return m_exposedRect; }
</ins><span class="cx"> void exposedRectChangedTimerFired(WebCore::Timer<WebPageProxy>*);
</span><span class="cx"> void setMainFrameIsScrollable(bool);
</span><span class="cx">
</span><span class="lines">@@ -1355,13 +1357,11 @@
</span><span class="cx"> bool m_waitingForDidUpdateViewState;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-#if !PLATFORM(IOS)
</del><span class="cx"> WebCore::Timer<WebPageProxy> m_exposedRectChangedTimer;
</span><del>-#endif // PLATFORM(IOS)
</del><span class="cx"> WebCore::FloatRect m_exposedRect;
</span><span class="cx"> WebCore::FloatRect m_lastSentExposedRect;
</span><del>- bool m_clipsToExposedRect;
- bool m_lastSentClipsToExposedRect;
</del><ins>+ ClipsToExposedRect m_clipsToExposedRect;
+ ClipsToExposedRect m_lastSentClipsToExposedRect;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -155,31 +155,6 @@
</span><span class="cx"> process().send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPageProxy::viewExposedRectChanged(const FloatRect& exposedRect, bool clipsToExposedRect)
-{
- if (!isValid())
- return;
-
- m_exposedRect = exposedRect;
- m_clipsToExposedRect = clipsToExposedRect;
-
- if (!m_exposedRectChangedTimer.isActive())
- m_exposedRectChangedTimer.startOneShot(0);
-}
-
-void WebPageProxy::exposedRectChangedTimerFired(Timer<WebPageProxy>*)
-{
- if (!isValid())
- return;
-
- if (m_exposedRect == m_lastSentExposedRect && m_clipsToExposedRect == m_lastSentClipsToExposedRect)
- return;
-
- process().send(Messages::WebPage::ViewExposedRectChanged(m_exposedRect, m_clipsToExposedRect), m_pageID);
- m_lastSentExposedRect = m_exposedRect;
- m_lastSentClipsToExposedRect = m_clipsToExposedRect;
-}
-
</del><span class="cx"> void WebPageProxy::setMainFrameIsScrollable(bool isScrollable)
</span><span class="cx"> {
</span><span class="cx"> if (!isValid())
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -69,6 +69,9 @@
</span><span class="cx"> virtual void forceRepaint() OVERRIDE;
</span><span class="cx"> virtual bool forceRepaintAsync(uint64_t) OVERRIDE { return false; }
</span><span class="cx">
</span><ins>+ virtual void setExposedRect(const WebCore::FloatRect&) OVERRIDE;
+ virtual void setClipsToExposedRect(bool) OVERRIDE;
+
</ins><span class="cx"> // WebCore::GraphicsLayerClient
</span><span class="cx"> virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) OVERRIDE { }
</span><span class="cx"> virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) OVERRIDE { }
</span><span class="lines">@@ -80,12 +83,21 @@
</span><span class="cx"> virtual bool allowCompositingLayerVisualDegradation() const OVERRIDE { return false; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ void updateMainFrameClipsToExposedRect();
+ void updateScrolledExposedRect();
+
+ WebCore::TiledBacking* mainFrameTiledBacking() const;
+
</ins><span class="cx"> std::unique_ptr<RemoteLayerTreeContext> m_remoteLayerTreeContext;
</span><span class="cx"> RefPtr<WebCore::PlatformCALayer> m_rootLayer;
</span><span class="cx">
</span><span class="cx"> HashMap<PageOverlay*, std::unique_ptr<GraphicsLayerCARemote>> m_pageOverlayLayers;
</span><span class="cx">
</span><span class="cx"> WebCore::IntSize m_viewSize;
</span><ins>+
+ WebCore::FloatRect m_exposedRect;
+ WebCore::FloatRect m_scrolledExposedRect;
+ bool m_clipsToExposedRect;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (161295 => 161296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-01-04 00:24:08 UTC (rev 161295)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-01-04 00:35:59 UTC (rev 161296)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import <WebCore/FrameView.h>
</span><span class="cx"> #import <WebCore/MainFrame.h>
</span><span class="cx"> #import <WebCore/Settings.h>
</span><ins>+#import <WebCore/TiledBacking.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="lines">@@ -42,10 +43,12 @@
</span><span class="cx"> RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage* webPage, const WebPageCreationParameters&)
</span><span class="cx"> : DrawingArea(DrawingAreaTypeRemoteLayerTree, webPage)
</span><span class="cx"> , m_remoteLayerTreeContext(std::make_unique<RemoteLayerTreeContext>(webPage))
</span><ins>+ , m_clipsToExposedRect(false)
</ins><span class="cx"> {
</span><span class="cx"> webPage->corePage()->settings().setForceCompositingMode(true);
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> webPage->corePage()->settings().setDelegatesPageScaling(true);
</span><ins>+ setClipsToExposedRect(true);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -207,4 +210,63 @@
</span><span class="cx"> m_remoteLayerTreeContext->forceRepaint();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void RemoteLayerTreeDrawingArea::setExposedRect(const FloatRect& exposedRect)
+{
+ m_exposedRect = exposedRect;
+ updateScrolledExposedRect();
+}
+
+void RemoteLayerTreeDrawingArea::setClipsToExposedRect(bool clipsToExposedRect)
+{
+ m_clipsToExposedRect = clipsToExposedRect;
+ updateScrolledExposedRect();
+ updateMainFrameClipsToExposedRect();
+}
+
+void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
+{
+ if (!m_clipsToExposedRect)
+ return;
+
+ FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+ if (!frameView)
+ return;
+
+ m_scrolledExposedRect = m_exposedRect;
+
+#if !PLATFORM(IOS)
+ IntPoint scrollPositionWithOrigin = frameView->scrollPosition() + toIntSize(frameView->scrollOrigin());
+ m_scrolledExposedRect.moveBy(scrollPositionWithOrigin);
+#endif
+
+ mainFrameTiledBacking()->setExposedRect(m_scrolledExposedRect);
+
+ for (auto it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
+ if (TiledBacking* tiledBacking = it->value->tiledBacking())
+ tiledBacking->setExposedRect(m_scrolledExposedRect);
+ }
+}
+
+void RemoteLayerTreeDrawingArea::updateMainFrameClipsToExposedRect()
+{
+ if (TiledBacking* tiledBacking = mainFrameTiledBacking())
+ tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
+
+ for (auto it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it)
+ if (TiledBacking* tiledBacking = it->value->tiledBacking())
+ tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
+
+ FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+ if (!frameView)
+ return;
+
+ frameView->adjustTiledBackingCoverage();
+}
+
+TiledBacking* RemoteLayerTreeDrawingArea::mainFrameTiledBacking() const
+{
+ FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+ return frameView ? frameView->tiledBacking() : 0;
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>
</body>
</html>