Changeset 208722 in webkit


Ignore:
Timestamp:
Nov 14, 2016 6:19:27 PM (7 years ago)
Author:
Simon Fraser
Message:

Scrolling when zoomed doesn't always use the correct layout viewport
https://bugs.webkit.org/show_bug.cgi?id=164756

Reviewed by Dean Jackson.

The scrolling thread was always using the layout viewport rect pushed onto it and
never computing a new one, so when scrolling around after zooming position:fixed
elements would not get the expected visual viewport behavior.

Fix by having ScrollingTreeFrameScrollingNode updating its notion of the layout viewport
on scrolls.

Not testable because we can't dump the scrolling tree on Mac (yet).

  • page/scrolling/ScrollingTreeFrameScrollingNode.h:

(WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

(WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r208716 r208722  
     12016-11-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Scrolling when zoomed doesn't always use the correct layout viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=164756
     5
     6        Reviewed by Dean Jackson.
     7
     8        The scrolling thread was always using the layout viewport rect pushed onto it and
     9        never computing a new one, so when scrolling around after zooming position:fixed
     10        elements would not get the expected visual viewport behavior.
     11
     12        Fix by having ScrollingTreeFrameScrollingNode updating its notion of the layout viewport
     13        on scrolls.
     14
     15        Not testable because we can't dump the scrolling tree on Mac (yet).
     16
     17        * page/scrolling/ScrollingTreeFrameScrollingNode.h:
     18        (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
     19        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     20        (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
     21
    1222016-11-14  Ryosuke Niwa  <rniwa@webkit.org>
    223
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h

    r208666 r208722  
    7171
    7272    FloatRect layoutViewport() const { return m_layoutViewport; };
     73    void setLayoutViewport(const FloatRect& r) { m_layoutViewport = r; };
     74
    7375    FloatPoint minLayoutViewportOrigin() const { return m_minLayoutViewportOrigin; }
    7476    FloatPoint maxLayoutViewportOrigin() const { return m_maxLayoutViewportOrigin; }
    7577
    7678    ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const { return m_behaviorForFixed; }
    77    
     79
    7880private:
    7981    void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r208503 r208722  
    389389    updateMainFramePinState(scrollPosition);
    390390
    391     FloatRect layoutViewport;
    392391    Optional<FloatPoint> layoutViewportOrigin;
    393392    if (scrollingTree().visualViewportEnabled()) {
     
    395394        float counterScale = 1 / frameScaleFactor();
    396395        visibleContentOrigin.scale(counterScale, counterScale);
    397         layoutViewport = layoutViewportForScrollPosition(visibleContentOrigin, frameScaleFactor());
    398         layoutViewportOrigin = layoutViewport.location();
     396        FloatRect newLayoutViewport = layoutViewportForScrollPosition(visibleContentOrigin, frameScaleFactor());
     397        setLayoutViewport(newLayoutViewport);
     398        layoutViewportOrigin = newLayoutViewport.location();
    399399    }
    400400
     
    405405    }
    406406
    407     setScrollLayerPosition(scrollPosition, layoutViewport);
     407    setScrollLayerPosition(scrollPosition, layoutViewport());
    408408    scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, layoutViewportOrigin);
    409409}
Note: See TracChangeset for help on using the changeset viewer.