<!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>[170541] trunk/Source</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/170541">170541</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-06-27 11:28:39 -0700 (Fri, 27 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS WK2] Fix touch-scrollable elements with overflow:scroll on just one axis, and RTL scrolling
https://bugs.webkit.org/show_bug.cgi?id=134377
<rdar://problem/16762224>
Reviewed by Tim Horton.
Source/WebCore:
Make -webkit-overflow-scrolling:touch scrolling work correctly when one axis
has overflow:scroll and the other overflow:hidden. Also fix scrolling in RTL
contexts.
An RTL scroller with overflow-x:hidden will have a non-zero scroll origin,
and needs to truncate the scrolled content on the left side. To pass the
correct geometry to the UI process, we need to introduce the concept of
"reachable" size as well as total content size; normally these are the same,
but will differ when scrolling is only allowed on one axis but there is overflow
on both axes.
To get the reachable size, add RenderLayer::scrollableContentsSize().
RenderLayer::visibleSize() was wrong; the function should return the size of the
scrollable portion, but used layer size which includes borders. Fix to use pixelSnappedClientWidth()/Height(),
which is what we use for scrollbar computations.
* WebCore.exp.in:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
* page/scrolling/ScrollingCoordinator.h:
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setReachableContentsSize):
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::reachableContentsSize):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::reachableContentsSize):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::visibleSize):
(WebCore::RenderLayer::scrollableContentsSize):
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::updateScrollingLayerWithClient):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
Source/WebKit2:
Make -webkit-overflow-scrolling:touch scrolling work correctly when one axis
has overflow:scroll and the other overflow:hidden. Also fix scrolling in RTL
contexts.
An RTL scroller with overflow-x:hidden will have a non-zero scroll origin,
and needs to truncate the scrolled content on the left side. To pass the
correct geometry to the UI process, we need to introduce the concept of
"reachable" size as well as total content size; normally these are the same,
but will differ when scrolling is only allowed on one axis but there is overflow
on both axes.
ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() uses the total and
reachable content sizes to set a negative edge inset on the left (for RTL) or top
(for bottom-to-top) so prevent scrolling into these areas.
* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::encode):
(ArgumentCoder<ScrollingStateScrollingNode>::decode):
(WebKit::RemoteScrollingTreeTextStream::dump):
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateScrollingNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedScrollingRemoteScrollingCoordinatorTransactioncpp">trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/ChangeLog        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2014-06-26 Simon Fraser <simon.fraser@apple.com>
+
+ [iOS WK2] Fix touch-scrollable elements with overflow:scroll on just one axis, and RTL scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=134377
+ <rdar://problem/16762224>
+
+ Reviewed by Tim Horton.
+
+ Make -webkit-overflow-scrolling:touch scrolling work correctly when one axis
+ has overflow:scroll and the other overflow:hidden. Also fix scrolling in RTL
+ contexts.
+
+ An RTL scroller with overflow-x:hidden will have a non-zero scroll origin,
+ and needs to truncate the scrolled content on the left side. To pass the
+ correct geometry to the UI process, we need to introduce the concept of
+ "reachable" size as well as total content size; normally these are the same,
+ but will differ when scrolling is only allowed on one axis but there is overflow
+ on both axes.
+
+ To get the reachable size, add RenderLayer::scrollableContentsSize().
+
+ RenderLayer::visibleSize() was wrong; the function should return the size of the
+ scrollable portion, but used layer size which includes borders. Fix to use pixelSnappedClientWidth()/Height(),
+ which is what we use for scrollbar computations.
+
+ * WebCore.exp.in:
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
+ (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
+ (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
+ * page/scrolling/ScrollingCoordinator.h:
+ * page/scrolling/ScrollingStateScrollingNode.cpp:
+ (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+ (WebCore::ScrollingStateScrollingNode::setReachableContentsSize):
+ * page/scrolling/ScrollingStateScrollingNode.h:
+ (WebCore::ScrollingStateScrollingNode::reachableContentsSize):
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+ (WebCore::ScrollingTreeScrollingNode::reachableContentsSize):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::visibleSize):
+ (WebCore::RenderLayer::scrollableContentsSize):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::updateScrollingLayerWithClient):
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
+
</ins><span class="cx"> 2014-06-27 Bear Travis <betravis@adobe.com>
</span><span class="cx">
</span><span class="cx"> [Feature Queries] Fix feature queries build on Mac
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -2883,6 +2883,7 @@
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode17setScrollPositionERKNS_10FloatPointE
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode20setTotalContentsSizeERKNS_9FloatSizeE
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode21setScrollableAreaSizeERKNS_9FloatSizeE
</span><ins>+__ZN7WebCore27ScrollingStateScrollingNode24setReachableContentsSizeERKNS_9FloatSizeE
</ins><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode26setRequestedScrollPositionERKNS_10FloatPointEb
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode27setScrollableAreaParametersERKNS_24ScrollableAreaParametersE
</span><span class="cx"> __ZN7WebCore32ScrollingStateFrameScrollingNode14setFooterLayerERKNS_19LayerRepresentationE
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx"> node->setScrollOrigin(frameView->scrollOrigin());
</span><span class="cx"> node->setScrollableAreaSize(frameView->visibleContentRect().size());
</span><span class="cx"> node->setTotalContentsSize(frameView->totalContentsSize());
</span><ins>+ node->setReachableContentsSize(frameView->totalContentsSize());
</ins><span class="cx">
</span><span class="cx"> ScrollableAreaParameters scrollParameters;
</span><span class="cx"> scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
</span><span class="lines">@@ -375,6 +376,7 @@
</span><span class="cx"> node->setScrollOrigin(scrollingGeometry->scrollOrigin);
</span><span class="cx"> node->setScrollPosition(scrollingGeometry->scrollPosition);
</span><span class="cx"> node->setTotalContentsSize(scrollingGeometry->contentSize);
</span><ins>+ node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
</ins><span class="cx"> node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -393,6 +395,7 @@
</span><span class="cx"> node->setScrollOrigin(scrollingGeometry->scrollOrigin);
</span><span class="cx"> node->setScrollPosition(scrollingGeometry->scrollPosition);
</span><span class="cx"> node->setTotalContentsSize(scrollingGeometry->contentSize);
</span><ins>+ node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
</ins><span class="cx"> node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -161,6 +161,7 @@
</span><span class="cx"> struct ScrollingGeometry {
</span><span class="cx"> FloatSize scrollableAreaSize;
</span><span class="cx"> FloatSize contentSize;
</span><ins>+ FloatSize reachableContentSize; // Smaller than contentSize when overflow is hidden on one axis.
</ins><span class="cx"> FloatPoint scrollPosition;
</span><span class="cx"> IntPoint scrollOrigin;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateScrollingNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> : ScrollingStateNode(stateNode, adoptiveTree)
</span><span class="cx"> , m_scrollableAreaSize(stateNode.scrollableAreaSize())
</span><span class="cx"> , m_totalContentsSize(stateNode.totalContentsSize())
</span><ins>+ , m_reachableContentsSize(stateNode.reachableContentsSize())
</ins><span class="cx"> , m_scrollPosition(stateNode.scrollPosition())
</span><span class="cx"> , m_requestedScrollPosition(stateNode.requestedScrollPosition())
</span><span class="cx"> , m_scrollOrigin(stateNode.scrollOrigin())
</span><span class="lines">@@ -74,6 +75,15 @@
</span><span class="cx"> setPropertyChanged(TotalContentsSize);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ScrollingStateScrollingNode::setReachableContentsSize(const FloatSize& reachableContentsSize)
+{
+ if (m_reachableContentsSize == reachableContentsSize)
+ return;
+
+ m_reachableContentsSize = reachableContentsSize;
+ setPropertyChanged(ReachableContentsSize);
+}
+
</ins><span class="cx"> void ScrollingStateScrollingNode::setScrollPosition(const FloatPoint& scrollPosition)
</span><span class="cx"> {
</span><span class="cx"> if (m_scrollPosition == scrollPosition)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> enum ChangedProperty {
</span><span class="cx"> ScrollableAreaSize = NumStateNodeBits,
</span><span class="cx"> TotalContentsSize,
</span><ins>+ ReachableContentsSize,
</ins><span class="cx"> ScrollPosition,
</span><span class="cx"> ScrollOrigin,
</span><span class="cx"> ScrollableAreaParams,
</span><span class="lines">@@ -55,6 +56,9 @@
</span><span class="cx"> const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
</span><span class="cx"> void setTotalContentsSize(const FloatSize&);
</span><span class="cx">
</span><ins>+ const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
+ void setReachableContentsSize(const FloatSize&);
+
</ins><span class="cx"> const FloatPoint& scrollPosition() const { return m_scrollPosition; }
</span><span class="cx"> void setScrollPosition(const FloatPoint&);
</span><span class="cx">
</span><span class="lines">@@ -77,6 +81,7 @@
</span><span class="cx"> private:
</span><span class="cx"> FloatSize m_scrollableAreaSize;
</span><span class="cx"> FloatSize m_totalContentsSize;
</span><ins>+ FloatSize m_reachableContentsSize;
</ins><span class="cx"> FloatPoint m_scrollPosition;
</span><span class="cx"> FloatPoint m_requestedScrollPosition;
</span><span class="cx"> IntPoint m_scrollOrigin;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -58,6 +58,9 @@
</span><span class="cx"> m_totalContentsSize = state.totalContentsSize();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (state.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize))
+ m_reachableContentsSize = state.reachableContentsSize();
+
</ins><span class="cx"> if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
</span><span class="cx"> m_lastCommittedScrollPosition = state.scrollPosition();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
</span><span class="cx"> const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; }
</span><span class="cx"> const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
</span><ins>+ const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
</ins><span class="cx"> const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
</span><span class="cx">
</span><span class="cx"> // If the totalContentsSize changes in the middle of a rubber-band, we still want to use the old totalContentsSize for the sake of
</span><span class="lines">@@ -89,6 +90,7 @@
</span><span class="cx"> FloatSize m_scrollableAreaSize;
</span><span class="cx"> FloatSize m_totalContentsSize;
</span><span class="cx"> FloatSize m_totalContentsSizeForRubberBand;
</span><ins>+ FloatSize m_reachableContentsSize;
</ins><span class="cx"> FloatPoint m_lastCommittedScrollPosition;
</span><span class="cx"> IntPoint m_scrollOrigin;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -2734,11 +2734,32 @@
</span><span class="cx"> return point;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IntSize RenderLayer::visibleSize() const
+{
+ if (!renderer().isBox())
+ return IntSize();
+
+ return IntSize(renderBox()->pixelSnappedClientWidth(), renderBox()->pixelSnappedClientHeight());
+}
+
</ins><span class="cx"> IntSize RenderLayer::contentsSize() const
</span><span class="cx"> {
</span><span class="cx"> return IntSize(scrollWidth(), scrollHeight());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IntSize RenderLayer::scrollableContentsSize() const
+{
+ IntSize contentsSize = this->contentsSize();
+
+ if (!hasScrollableHorizontalOverflow())
+ contentsSize.setWidth(std::min(contentsSize.width(), visibleSize().width()));
+
+ if (!hasScrollableVerticalOverflow())
+ contentsSize.setHeight(std::min(contentsSize.height(), visibleSize().height()));
+
+ return contentsSize;
+}
+
</ins><span class="cx"> bool RenderLayer::shouldSuspendScrollAnimations() const
</span><span class="cx"> {
</span><span class="cx"> return renderer().view().frameView().shouldSuspendScrollAnimations();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -344,7 +344,7 @@
</span><span class="cx"> String name() const;
</span><span class="cx">
</span><span class="cx"> RenderLayerModelObject& renderer() const { return m_renderer; }
</span><del>- RenderBox* renderBox() const { return renderer().isBox() ? &toRenderBox(renderer()) : 0; }
</del><ins>+ RenderBox* renderBox() const { return renderer().isBox() ? &toRenderBox(renderer()) : nullptr; }
</ins><span class="cx"> RenderLayer* parent() const { return m_parent; }
</span><span class="cx"> RenderLayer* previousSibling() const { return m_previous; }
</span><span class="cx"> RenderLayer* nextSibling() const { return m_next; }
</span><span class="lines">@@ -420,6 +420,7 @@
</span><span class="cx"> int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x(); }
</span><span class="cx"> int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().y(); }
</span><span class="cx"> IntSize scrollOffset() const { return IntSize(scrollXOffset(), scrollYOffset()); }
</span><ins>+ IntSize scrollableContentsSize() const;
</ins><span class="cx">
</span><span class="cx"> void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
</span><span class="cx">
</span><span class="lines">@@ -1077,7 +1078,7 @@
</span><span class="cx"> virtual IntPoint minimumScrollPosition() const override;
</span><span class="cx"> virtual IntPoint maximumScrollPosition() const override;
</span><span class="cx"> virtual IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
</span><del>- virtual IntSize visibleSize() const override { return m_layerSize; }
</del><ins>+ virtual IntSize visibleSize() const override;
</ins><span class="cx"> virtual IntSize contentsSize() const override;
</span><span class="cx"> virtual IntSize overhangAmount() const override;
</span><span class="cx"> virtual IntPoint lastKnownMousePosition() const override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -508,7 +508,7 @@
</span><span class="cx"> bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
</span><span class="cx"> bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
</span><span class="cx"> client->addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
</span><del>- IntSize(layer.scrollWidth(), layer.scrollHeight()), allowHorizontalScrollbar, allowVerticalScrollbar);
</del><ins>+ layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderLayerCompositor::updateCustomLayersAfterFlush()
</span><span class="lines">@@ -3739,7 +3739,7 @@
</span><span class="cx"> if (isRootLayer)
</span><span class="cx"> updateScrollCoordinationForThisFrame(parentNodeID);
</span><span class="cx"> else {
</span><del>- ScrollingNodeType nodeType = isRootLayer ? FrameScrollingNode : OverflowScrollingNode;
</del><ins>+ ScrollingNodeType nodeType = OverflowScrollingNode;
</ins><span class="cx"> ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID);
</span><span class="cx"> if (!nodeID)
</span><span class="cx"> return;
</span><span class="lines">@@ -3749,6 +3749,7 @@
</span><span class="cx"> scrollingGeometry.scrollPosition = layer.scrollPosition();
</span><span class="cx"> scrollingGeometry.scrollableAreaSize = layer.visibleSize();
</span><span class="cx"> scrollingGeometry.contentSize = layer.contentsSize();
</span><ins>+ scrollingGeometry.reachableContentSize = layer.scrollableContentsSize();
</ins><span class="cx"> scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-06-26 Simon Fraser <simon.fraser@apple.com>
+
+ [iOS WK2] Fix touch-scrollable elements with overflow:scroll on just one axis, and RTL scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=134377
+ <rdar://problem/16762224>
+
+ Reviewed by Tim Horton.
+
+ Make -webkit-overflow-scrolling:touch scrolling work correctly when one axis
+ has overflow:scroll and the other overflow:hidden. Also fix scrolling in RTL
+ contexts.
+
+ An RTL scroller with overflow-x:hidden will have a non-zero scroll origin,
+ and needs to truncate the scrolled content on the left side. To pass the
+ correct geometry to the UI process, we need to introduce the concept of
+ "reachable" size as well as total content size; normally these are the same,
+ but will differ when scrolling is only allowed on one axis but there is overflow
+ on both axes.
+
+ ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() uses the total and
+ reachable content sizes to set a negative edge inset on the left (for RTL) or top
+ (for bottom-to-top) so prevent scrolling into these areas.
+
+ * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
+ (ArgumentCoder<ScrollingStateScrollingNode>::encode):
+ (ArgumentCoder<ScrollingStateScrollingNode>::decode):
+ (WebKit::RemoteScrollingTreeTextStream::dump):
+ * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
+
</ins><span class="cx"> 2014-06-27 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix various leaks, RetainPtrs should adopt allocs
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedScrollingRemoteScrollingCoordinatorTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx">
</span><span class="cx"> SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaSize, scrollableAreaSize)
</span><span class="cx"> SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::TotalContentsSize, totalContentsSize)
</span><ins>+ SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ReachableContentsSize, reachableContentsSize)
</ins><span class="cx"> SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollPosition, scrollPosition)
</span><span class="cx"> SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollOrigin, scrollOrigin)
</span><span class="cx"> SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaParams, scrollableAreaParameters)
</span><span class="lines">@@ -189,6 +190,7 @@
</span><span class="cx">
</span><span class="cx"> SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaSize, FloatSize, setScrollableAreaSize);
</span><span class="cx"> SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::TotalContentsSize, FloatSize, setTotalContentsSize);
</span><ins>+ SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ReachableContentsSize, FloatSize, setReachableContentsSize);
</ins><span class="cx"> SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollPosition, FloatPoint, setScrollPosition);
</span><span class="cx"> SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollOrigin, IntPoint, setScrollOrigin);
</span><span class="cx"> SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
</span><span class="lines">@@ -565,11 +567,14 @@
</span><span class="cx"> RemoteScrollingTreeTextStream& ts = *this;
</span><span class="cx">
</span><span class="cx"> if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaSize))
</span><del>- dumpProperty(ts, "scrollable-area-size", node.totalContentsSize());
</del><ins>+ dumpProperty(ts, "scrollable-area-size", node.scrollableAreaSize());
</ins><span class="cx">
</span><span class="cx"> if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
</span><span class="cx"> dumpProperty(ts, "total-contents-size", node.totalContentsSize());
</span><span class="cx">
</span><ins>+ if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize))
+ dumpProperty(ts, "reachable-contents-size", node.reachableContentsSize());
+
</ins><span class="cx"> if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
</span><span class="cx"> dumpProperty(ts, "scroll-position", node.scrollPosition());
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (170540 => 170541)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2014-06-27 18:13:58 UTC (rev 170540)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2014-06-27 18:28:39 UTC (rev 170541)
</span><span class="lines">@@ -140,7 +140,9 @@
</span><span class="cx">
</span><span class="cx"> if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer)
</span><span class="cx"> || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)
</span><del>- || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)) {
</del><ins>+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize)
+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)
+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) {
</ins><span class="cx"> BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
</span><span class="cx"> ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
</span><span class="lines">@@ -152,12 +154,31 @@
</span><span class="cx"> scrollView.delegate = m_scrollViewDelegate.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
- scrollView.contentSize = scrollingStateNode.totalContentsSize();
</del><ins>+ bool recomputeInsets = scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize);
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize)) {
+ scrollView.contentSize = scrollingStateNode.reachableContentsSize();
+ recomputeInsets = true;
+ }
</ins><span class="cx">
</span><del>- if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) && ![m_scrollViewDelegate _isInUserInteraction])
- scrollView.contentOffset = scrollingStateNode.scrollPosition();
</del><ins>+ if ((scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)
+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
+ && ![m_scrollViewDelegate _isInUserInteraction]) {
+ scrollView.contentOffset = scrollingStateNode.scrollPosition() + scrollOrigin();
+ recomputeInsets = true;
+ }
+
+ if (recomputeInsets) {
+ UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0);
+ // With RTL or bottom-to-top scrolling (non-zero origin), we need extra space on the left or top.
+ if (scrollOrigin().x())
+ insets.left = reachableContentsSize().width() - totalContentsSize().width();
</ins><span class="cx">
</span><ins>+ if (scrollOrigin().y())
+ insets.top = reachableContentsSize().height() - totalContentsSize().height();
+
+ scrollView.contentInset = insets;
+ }
+
</ins><span class="cx"> END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>