Title: [160917] branches/safari-537.74-branch/Source/WebCore

Diff

Modified: branches/safari-537.74-branch/Source/WebCore/ChangeLog (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/ChangeLog	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/ChangeLog	2013-12-20 19:34:55 UTC (rev 160917)
@@ -1,5 +1,35 @@
- 2013-12-19  Matthew Hanson  <matthew_han...@apple.com>
+2013-12-19  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r160898: <rdar://problems/15709940>
+
+    2013-12-19  Beth Dakin  <bda...@apple.com>
+
+            REGRESSION: cnn.com will continue to reveal 1 px of overhang after rubber-banding 
+            at the top
+            https://bugs.webkit.org/show_bug.cgi?id=126054
+
+            Reviewed by Simon Fraser.
+
+            This regression was caused by http://trac.webkit.org/changeset/160791 It turns out 
+            that the line of code I removed was not always a no-op. In some instances, like on 
+            cnn.com, it would ensure that our final scroll position after a rubber-band was 
+            not something within the overhang area. It was still wrong in its assumption that 
+            rubber-band is always bouncing back the spot it originated from. So this patch 
+            continues to ignore the rubber-bands origin, and instead finds the nearest point 
+            that is not in the overhang area, and scrolls to that point instead of the origin.
+
+            * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+            * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+            (WebCore::ScrollingTreeScrollingNodeMac::adjustScrollPositionToBoundsIfNecessary):
+            * platform/mac/ScrollAnimatorMac.h:
+            * platform/mac/ScrollAnimatorMac.mm:
+            (WebCore::ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary):
+            * platform/mac/ScrollElasticityController.h:
+            * platform/mac/ScrollElasticityController.mm:
+            (WebCore::ScrollElasticityController::snapRubberBandTimerFired):
+
+2013-12-19  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r159463: <rdar://problems/15701094>
 
     2013-11-18  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-12-20 19:34:55 UTC (rev 160917)
@@ -60,6 +60,7 @@
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
     virtual void startSnapRubberbandTimer() OVERRIDE;
     virtual void stopSnapRubberbandTimer() OVERRIDE;
+    virtual void adjustScrollPositionToBoundsIfNecessary() OVERRIDE;
 
     IntPoint scrollPosition() const;
     void setScrollPosition(const IntPoint&);

Modified: branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-12-20 19:34:55 UTC (rev 160917)
@@ -271,6 +271,19 @@
     m_snapRubberbandTimer = nullptr;
 }
 
+void ScrollingTreeScrollingNodeMac::adjustScrollPositionToBoundsIfNecessary()
+{
+    IntPoint currentScrollPosition = absoluteScrollPosition();
+    IntPoint minPosition = minimumScrollPosition();
+    IntPoint maxPosition = maximumScrollPosition();
+
+    int nearestXWithinBounds = std::max<int>(std::min<int>(currentScrollPosition.x(), maxPosition.x()), minPosition.x());
+    int nearestYWithinBounds = std::max<int>(std::min<int>(currentScrollPosition.y(), maxPosition.y()), minPosition.y());
+
+    IntPoint nearestPointWithinBounds(nearestXWithinBounds, nearestYWithinBounds);
+    immediateScrollBy(nearestPointWithinBounds - currentScrollPosition);
+}
+
 IntPoint ScrollingTreeScrollingNodeMac::scrollPosition() const
 {
     if (shouldUpdateScrollLayerPositionOnMainThread())

Modified: branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.h (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2013-12-20 19:34:55 UTC (rev 160917)
@@ -148,6 +148,7 @@
     virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
     virtual void startSnapRubberbandTimer() OVERRIDE;
     virtual void stopSnapRubberbandTimer() OVERRIDE;
+    virtual void adjustScrollPositionToBoundsIfNecessary() OVERRIDE;
 
     bool pinnedInDirection(float deltaX, float deltaY);
     void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*);

Modified: branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2013-12-20 19:34:55 UTC (rev 160917)
@@ -715,6 +715,18 @@
     return FloatPoint(newX, newY);
 }
 
+void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary()
+{
+    bool currentlyConstrainsToContentEdge = m_scrollableArea->constrainsScrollingToContentEdge();
+    m_scrollableArea->setConstrainsScrollingToContentEdge(true);
+
+    IntPoint currentScrollPosition = absoluteScrollPosition();
+    FloatPoint nearestPointWithinBounds = adjustScrollPositionIfNecessary(absoluteScrollPosition());
+    immediateScrollBy(nearestPointWithinBounds - currentScrollPosition);
+
+    m_scrollableArea->setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge);
+}
+
 void ScrollAnimatorMac::immediateScrollTo(const FloatPoint& newPosition)
 {
     FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition);

Modified: branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.h (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.h	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.h	2013-12-20 19:34:55 UTC (rev 160917)
@@ -57,6 +57,10 @@
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
     virtual void startSnapRubberbandTimer() = 0;
     virtual void stopSnapRubberbandTimer() = 0;
+
+    // If the current scroll position is within the overhang area, this function will cause
+    // the page to scroll to the nearest boundary point.
+    virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
 };
 
 class ScrollElasticityController {

Modified: branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.mm (160916 => 160917)


--- branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.mm	2013-12-20 19:05:34 UTC (rev 160916)
+++ branches/safari-537.74-branch/Source/WebCore/platform/mac/ScrollElasticityController.mm	2013-12-20 19:34:55 UTC (rev 160917)
@@ -368,6 +368,8 @@
             m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
             m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
         } else {
+            m_client->adjustScrollPositionToBoundsIfNecessary();
+
             stopSnapRubberbandTimer();
             m_stretchScrollForce = FloatSize();
             m_startTime = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to