Title: [170541] trunk/Source
Revision
170541
Author
simon.fra...@apple.com
Date
2014-06-27 11:28:39 -0700 (Fri, 27 Jun 2014)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170540 => 170541)


--- 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)
@@ -1,3 +1,51 @@
+2014-06-26  Simon Fraser  <simon.fra...@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):
+
 2014-06-27  Bear Travis  <betra...@adobe.com>
 
         [Feature Queries] Fix feature queries build on Mac

Modified: trunk/Source/WebCore/WebCore.exp.in (170540 => 170541)


--- 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)
@@ -2883,6 +2883,7 @@
 __ZN7WebCore27ScrollingStateScrollingNode17setScrollPositionERKNS_10FloatPointE
 __ZN7WebCore27ScrollingStateScrollingNode20setTotalContentsSizeERKNS_9FloatSizeE
 __ZN7WebCore27ScrollingStateScrollingNode21setScrollableAreaSizeERKNS_9FloatSizeE
+__ZN7WebCore27ScrollingStateScrollingNode24setReachableContentsSizeERKNS_9FloatSizeE
 __ZN7WebCore27ScrollingStateScrollingNode26setRequestedScrollPositionERKNS_10FloatPointEb
 __ZN7WebCore27ScrollingStateScrollingNode27setScrollableAreaParametersERKNS_24ScrollableAreaParametersE
 __ZN7WebCore32ScrollingStateFrameScrollingNode14setFooterLayerERKNS_19LayerRepresentationE

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (170540 => 170541)


--- 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)
@@ -94,6 +94,7 @@
     node->setScrollOrigin(frameView->scrollOrigin());
     node->setScrollableAreaSize(frameView->visibleContentRect().size());
     node->setTotalContentsSize(frameView->totalContentsSize());
+    node->setReachableContentsSize(frameView->totalContentsSize());
 
     ScrollableAreaParameters scrollParameters;
     scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
@@ -375,6 +376,7 @@
         node->setScrollOrigin(scrollingGeometry->scrollOrigin);
         node->setScrollPosition(scrollingGeometry->scrollPosition);
         node->setTotalContentsSize(scrollingGeometry->contentSize);
+        node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
         node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
     }
 }
@@ -393,6 +395,7 @@
         node->setScrollOrigin(scrollingGeometry->scrollOrigin);
         node->setScrollPosition(scrollingGeometry->scrollPosition);
         node->setTotalContentsSize(scrollingGeometry->contentSize);
+        node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
         node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
     }
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (170540 => 170541)


--- 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)
@@ -161,6 +161,7 @@
     struct ScrollingGeometry {
         FloatSize scrollableAreaSize;
         FloatSize contentSize;
+        FloatSize reachableContentSize; // Smaller than contentSize when overflow is hidden on one axis.
         FloatPoint scrollPosition;
         IntPoint scrollOrigin;
     };

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (170540 => 170541)


--- 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)
@@ -44,6 +44,7 @@
     : ScrollingStateNode(stateNode, adoptiveTree)
     , m_scrollableAreaSize(stateNode.scrollableAreaSize())
     , m_totalContentsSize(stateNode.totalContentsSize())
+    , m_reachableContentsSize(stateNode.reachableContentsSize())
     , m_scrollPosition(stateNode.scrollPosition())
     , m_requestedScrollPosition(stateNode.requestedScrollPosition())
     , m_scrollOrigin(stateNode.scrollOrigin())
@@ -74,6 +75,15 @@
     setPropertyChanged(TotalContentsSize);
 }
 
+void ScrollingStateScrollingNode::setReachableContentsSize(const FloatSize& reachableContentsSize)
+{
+    if (m_reachableContentsSize == reachableContentsSize)
+        return;
+
+    m_reachableContentsSize = reachableContentsSize;
+    setPropertyChanged(ReachableContentsSize);
+}
+
 void ScrollingStateScrollingNode::setScrollPosition(const FloatPoint& scrollPosition)
 {
     if (m_scrollPosition == scrollPosition)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (170540 => 170541)


--- 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)
@@ -42,6 +42,7 @@
     enum ChangedProperty {
         ScrollableAreaSize = NumStateNodeBits,
         TotalContentsSize,
+        ReachableContentsSize,
         ScrollPosition,
         ScrollOrigin,
         ScrollableAreaParams,
@@ -55,6 +56,9 @@
     const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
     void setTotalContentsSize(const FloatSize&);
 
+    const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
+    void setReachableContentsSize(const FloatSize&);
+
     const FloatPoint& scrollPosition() const { return m_scrollPosition; }
     void setScrollPosition(const FloatPoint&);
 
@@ -77,6 +81,7 @@
 private:
     FloatSize m_scrollableAreaSize;
     FloatSize m_totalContentsSize;
+    FloatSize m_reachableContentsSize;
     FloatPoint m_scrollPosition;
     FloatPoint m_requestedScrollPosition;
     IntPoint m_scrollOrigin;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (170540 => 170541)


--- 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)
@@ -58,6 +58,9 @@
         m_totalContentsSize = state.totalContentsSize();
     }
 
+    if (state.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize))
+        m_reachableContentsSize = state.reachableContentsSize();
+
     if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
         m_lastCommittedScrollPosition = state.scrollPosition();
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (170540 => 170541)


--- 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)
@@ -69,6 +69,7 @@
     FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
     const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; }
     const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
+    const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
     const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
 
     // If the totalContentsSize changes in the middle of a rubber-band, we still want to use the old totalContentsSize for the sake of
@@ -89,6 +90,7 @@
     FloatSize m_scrollableAreaSize;
     FloatSize m_totalContentsSize;
     FloatSize m_totalContentsSizeForRubberBand;
+    FloatSize m_reachableContentsSize;
     FloatPoint m_lastCommittedScrollPosition;
     IntPoint m_scrollOrigin;
     

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (170540 => 170541)


--- 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)
@@ -2734,11 +2734,32 @@
     return point;
 }
 
+IntSize RenderLayer::visibleSize() const
+{
+    if (!renderer().isBox())
+        return IntSize();
+
+    return IntSize(renderBox()->pixelSnappedClientWidth(), renderBox()->pixelSnappedClientHeight());
+}
+
 IntSize RenderLayer::contentsSize() const
 {
     return IntSize(scrollWidth(), scrollHeight());
 }
 
+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;
+}
+
 bool RenderLayer::shouldSuspendScrollAnimations() const
 {
     return renderer().view().frameView().shouldSuspendScrollAnimations();

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (170540 => 170541)


--- 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)
@@ -344,7 +344,7 @@
     String name() const;
 
     RenderLayerModelObject& renderer() const { return m_renderer; }
-    RenderBox* renderBox() const { return renderer().isBox() ? &toRenderBox(renderer()) : 0; }
+    RenderBox* renderBox() const { return renderer().isBox() ? &toRenderBox(renderer()) : nullptr; }
     RenderLayer* parent() const { return m_parent; }
     RenderLayer* previousSibling() const { return m_previous; }
     RenderLayer* nextSibling() const { return m_next; }
@@ -420,6 +420,7 @@
     int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x(); }
     int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().y(); }
     IntSize scrollOffset() const { return IntSize(scrollXOffset(), scrollYOffset()); }
+    IntSize scrollableContentsSize() const;
 
     void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
 
@@ -1077,7 +1078,7 @@
     virtual IntPoint minimumScrollPosition() const override;
     virtual IntPoint maximumScrollPosition() const override;
     virtual IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
-    virtual IntSize visibleSize() const override { return m_layerSize; }
+    virtual IntSize visibleSize() const override;
     virtual IntSize contentsSize() const override;
     virtual IntSize overhangAmount() const override;
     virtual IntPoint lastKnownMousePosition() const override;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (170540 => 170541)


--- 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)
@@ -508,7 +508,7 @@
     bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
     bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
     client->addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollingLayer()->platformLayer(), backing->scrollingContentsLayer()->platformLayer(),
-        IntSize(layer.scrollWidth(), layer.scrollHeight()), allowHorizontalScrollbar, allowVerticalScrollbar);
+        layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
 }
 
 void RenderLayerCompositor::updateCustomLayersAfterFlush()
@@ -3739,7 +3739,7 @@
         if (isRootLayer)
             updateScrollCoordinationForThisFrame(parentNodeID);
         else {
-            ScrollingNodeType nodeType = isRootLayer ? FrameScrollingNode : OverflowScrollingNode;
+            ScrollingNodeType nodeType = OverflowScrollingNode;
             ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID);
             if (!nodeID)
                 return;
@@ -3749,6 +3749,7 @@
             scrollingGeometry.scrollPosition = layer.scrollPosition();
             scrollingGeometry.scrollableAreaSize = layer.visibleSize();
             scrollingGeometry.contentSize = layer.contentsSize();
+            scrollingGeometry.reachableContentSize = layer.scrollableContentsSize();
             scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
         }
     }

Modified: trunk/Source/WebKit2/ChangeLog (170540 => 170541)


--- 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)
@@ -1,3 +1,33 @@
+2014-06-26  Simon Fraser  <simon.fra...@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): 
+
 2014-06-27  Joseph Pecoraro  <pecor...@apple.com>
 
         Fix various leaks, RetainPtrs should adopt allocs

Modified: trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (170540 => 170541)


--- 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)
@@ -125,6 +125,7 @@
     
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaSize, scrollableAreaSize)
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::TotalContentsSize, totalContentsSize)
+    SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ReachableContentsSize, reachableContentsSize)
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollPosition, scrollPosition)
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollOrigin, scrollOrigin)
     SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaParams, scrollableAreaParameters)
@@ -189,6 +190,7 @@
 
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaSize, FloatSize, setScrollableAreaSize);
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::TotalContentsSize, FloatSize, setTotalContentsSize);
+    SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ReachableContentsSize, FloatSize, setReachableContentsSize);
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollPosition, FloatPoint, setScrollPosition);
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollOrigin, IntPoint, setScrollOrigin);
     SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
@@ -565,11 +567,14 @@
     RemoteScrollingTreeTextStream& ts = *this;
     
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaSize))
-        dumpProperty(ts, "scrollable-area-size", node.totalContentsSize());
+        dumpProperty(ts, "scrollable-area-size", node.scrollableAreaSize());
 
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
         dumpProperty(ts, "total-contents-size", node.totalContentsSize());
 
+    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize))
+        dumpProperty(ts, "reachable-contents-size", node.reachableContentsSize());
+
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
         dumpProperty(ts, "scroll-position", node.scrollPosition());
 

Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (170540 => 170541)


--- 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)
@@ -140,7 +140,9 @@
 
     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer)
         || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)
-        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)) {
+        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize)
+        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)
+        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin)) {
         BEGIN_BLOCK_OBJC_EXCEPTIONS
         UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
         ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
@@ -152,12 +154,31 @@
             scrollView.delegate = m_scrollViewDelegate.get();
         }
 
-        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
-            scrollView.contentSize = scrollingStateNode.totalContentsSize();
+        bool recomputeInsets = scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize);
+        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize)) {
+            scrollView.contentSize = scrollingStateNode.reachableContentsSize();
+            recomputeInsets = true;
+        }
 
-        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) && ![m_scrollViewDelegate _isInUserInteraction])
-            scrollView.contentOffset = scrollingStateNode.scrollPosition();
+        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();
 
+            if (scrollOrigin().y())
+                insets.top = reachableContentsSize().height() - totalContentsSize().height();
+
+            scrollView.contentInset = insets;
+        }
+            
         END_BLOCK_OBJC_EXCEPTIONS
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to