Support rubber-banding in sub-frames
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Sep 2014 18:48:21 +0000 (18:48 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Sep 2014 18:48:21 +0000 (18:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136726
-and corresponding-
rdar://problem/10011924

Reviewed by Tim Horton.

Source/WebCore:

Set the appropriate scroll elasticity for all frames! As long as its enabled, sub-
frames want an elasticity of ScrollElasticityAutomatic, which will allow for
latching.
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):

Account for rubber-banding in sub-frames.
(WebCore::FrameView::isScrollableOrRubberbandable):
(WebCore::FrameView::hasScrollableOrRubberbandableAncestor):

This patch also re-names rubberBandingForOverflowScrollEnabled to
rubberBandingForSubScrollableRegionsEnabled
* page/Settings.in:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::overhangAmount):
(WebCore::RenderLayer::setHasHorizontalScrollbar):
(WebCore::RenderLayer::setHasVerticalScrollbar):

Source/WebKit/mac:

rubberBandingForOverflowScrollEnabled is re-named to
rubberBandingForSubScrollableRegionsEnabled
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

LayoutTests:

* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
* platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173523 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt
LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Settings.in
Source/WebCore/rendering/RenderLayer.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm

index 4d68dfe..2f8b404 100644 (file)
@@ -1,3 +1,15 @@
+2014-09-11  Beth Dakin  <bdakin@apple.com>
+
+        Support rubber-banding in sub-frames
+        https://bugs.webkit.org/show_bug.cgi?id=136726
+        -and corresponding-
+        rdar://problem/10011924
+
+        Reviewed by Tim Horton.
+
+        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-expected.txt:
+        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
+
 2014-09-11  Jer Noble  <jer.noble@apple.com>
 
         [EME] REGRESSION(??): test media/encrypted-media/encrypted-media-v2-syntax.html is failing
index 6271446..a15b945 100644 (file)
@@ -11,7 +11,7 @@ TEST COMPLETE
 IFrame display height = 500
 Mouse moved to (28, 566)
 Page before: 0, IFrame before: 416
-Page after:  0, IFrame after: 496
+Page after:  0, IFrame after: 486
 PASS Page did not receive wheel events.
 (GraphicsLayer
   (anchor 0.00 0.00)
index 35e0551..abd96f5 100644 (file)
@@ -11,9 +11,9 @@ TEST COMPLETE
 IFrame display height = 500
 Mouse moved to (28, 566)
 Page before: 0, IFrame before: 416
-Page after:  0, IFrame after: 496
+Page after:  0, IFrame after: 486
 PASS Page did not receive wheel events.
-Document was initial target for 2 of the wheel events.
+Document was initial target for 0 of the wheel events.
 (GraphicsLayer
   (anchor 0.00 0.00)
   (bounds 785.00 2341.00)
index f2a3914..07f4811 100644 (file)
@@ -1,3 +1,30 @@
+2014-09-11  Beth Dakin  <bdakin@apple.com>
+
+        Support rubber-banding in sub-frames
+        https://bugs.webkit.org/show_bug.cgi?id=136726
+        -and corresponding-
+        rdar://problem/10011924
+
+        Reviewed by Tim Horton.
+
+        Set the appropriate scroll elasticity for all frames! As long as its enabled, sub-
+        frames want an elasticity of ScrollElasticityAutomatic, which will allow for 
+        latching. 
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+
+        Account for rubber-banding in sub-frames.
+        (WebCore::FrameView::isScrollableOrRubberbandable):
+        (WebCore::FrameView::hasScrollableOrRubberbandableAncestor):
+
+        This patch also re-names rubberBandingForOverflowScrollEnabled to 
+        rubberBandingForSubScrollableRegionsEnabled
+        * page/Settings.in:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::overhangAmount):
+        (WebCore::RenderLayer::setHasHorizontalScrollbar):
+        (WebCore::RenderLayer::setHasVerticalScrollbar):
+
 2014-09-11  Myles C. Maxfield <mmaxfield@apple.com>  <litherum@gmail.com>
 
         Initial implementation of SVG to OTF font converter
index 8cf16b8..5998c54 100644 (file)
@@ -200,10 +200,20 @@ FrameView::FrameView(Frame& frame)
 {
     init();
 
-    if (frame.isMainFrame()) {
-        ScrollableArea::setVerticalScrollElasticity(m_frame->page() ? m_frame->page()->verticalScrollElasticity() : ScrollElasticityAllowed);
-        ScrollableArea::setHorizontalScrollElasticity(m_frame->page() ? m_frame->page()->horizontalScrollElasticity() : ScrollElasticityAllowed);
-    }
+#if ENABLE(RUBBER_BANDING)
+    ScrollElasticity verticalElasticity = ScrollElasticityNone;
+    ScrollElasticity horizontalElasticity = ScrollElasticityNone;
+    if (m_frame->isMainFrame()) {
+        verticalElasticity = m_frame->page() ? m_frame->page()->verticalScrollElasticity() : ScrollElasticityAllowed;
+        horizontalElasticity = m_frame->page() ? m_frame->page()->horizontalScrollElasticity() : ScrollElasticityAllowed;
+    } else if (m_frame->settings().rubberBandingForSubScrollableRegionsEnabled()) {
+        verticalElasticity = ScrollElasticityAutomatic;
+        horizontalElasticity = ScrollElasticityAutomatic;
+    }
+
+    ScrollableArea::setVerticalScrollElasticity(verticalElasticity);
+    ScrollableArea::setHorizontalScrollElasticity(horizontalElasticity);
+#endif
 }
 
 PassRefPtr<FrameView> FrameView::create(Frame& frame)
@@ -3348,24 +3358,21 @@ bool FrameView::isScrollable(Scrollability definitionOfScrollable)
 
 bool FrameView::isScrollableOrRubberbandable()
 {
-    return frame().isMainFrame() ? isScrollable(Scrollability::ScrollableOrRubberbandable) : isScrollable(Scrollability::Scrollable);
+    return isScrollable(Scrollability::ScrollableOrRubberbandable);
 }
 
 bool FrameView::hasScrollableOrRubberbandableAncestor()
 {
     if (frame().isMainFrame())
-        return isScrollable(Scrollability::ScrollableOrRubberbandable);
+        return isScrollableOrRubberbandable();
 
-    FrameView* parentFrameView = this->parentFrameView();
-    if (!parentFrameView)
-        return false;
-
-    RenderView* parentRenderView = parentFrameView->renderView();
-    if (!parentRenderView)
-        return false;
+    for (FrameView* parent = this->parentFrameView(); parent; parent = parent->parentFrameView()) {
+        Scrollability frameScrollability = parent->frame().isMainFrame() ? Scrollability::ScrollableOrRubberbandable : Scrollability::Scrollable;
+        if (parent->isScrollable(frameScrollability))
+            return true;
+    }
 
-    RenderLayer* enclosingLayer = parentRenderView->enclosingLayer();
-    return enclosingLayer && enclosingLayer->hasScrollableOrRubberbandableAncestor();
+    return false;
 }
 
 void FrameView::updateScrollableAreaSet()
index f77074a..e797fd0 100644 (file)
@@ -94,7 +94,7 @@ xssAuditorEnabled initial=false
 unsafePluginPastingEnabled initial=true
 acceleratedCompositingForFixedPositionEnabled initial=defaultAcceleratedCompositingForFixedPositionEnabled
 acceleratedCompositingForOverflowScrollEnabled initial=false
-rubberBandingForOverflowScrollEnabled initial=true, conditional=RUBBER_BANDING
+rubberBandingForSubScrollableRegionsEnabled initial=true, conditional=RUBBER_BANDING
 
 experimentalNotificationsEnabled initial=false
 webGLEnabled initial=false
index 3e7c8d1..afb736e 100644 (file)
@@ -2650,7 +2650,7 @@ IntRect RenderLayer::visibleContentRectInternal(VisibleContentRectIncludesScroll
 IntSize RenderLayer::overhangAmount() const
 {
 #if ENABLE(RUBBER_BANDING)
-    if (!renderer().frame().settings().rubberBandingForOverflowScrollEnabled())
+    if (!renderer().frame().settings().rubberBandingForSubScrollableRegionsEnabled())
         return IntSize();
 
     IntSize stretch;
@@ -3005,7 +3005,7 @@ void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar)
     if (hasScrollbar) {
         m_hBar = createScrollbar(HorizontalScrollbar);
 #if ENABLE(RUBBER_BANDING)
-        ScrollElasticity elasticity = scrollsOverflow() && renderer().frame().settings().rubberBandingForOverflowScrollEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
+        ScrollElasticity elasticity = scrollsOverflow() && renderer().frame().settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
         ScrollableArea::setHorizontalScrollElasticity(elasticity);
 #endif
     } else {
@@ -3036,7 +3036,7 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar)
     if (hasScrollbar) {
         m_vBar = createScrollbar(VerticalScrollbar);
 #if ENABLE(RUBBER_BANDING)
-        ScrollElasticity elasticity = scrollsOverflow() && renderer().frame().settings().rubberBandingForOverflowScrollEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
+        ScrollElasticity elasticity = scrollsOverflow() && renderer().frame().settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
         ScrollableArea::setVerticalScrollElasticity(elasticity);
 #endif
     } else {
index 6239920..d22aba5 100644 (file)
@@ -1,3 +1,17 @@
+2014-09-11  Beth Dakin  <bdakin@apple.com>
+
+        Support rubber-banding in sub-frames
+        https://bugs.webkit.org/show_bug.cgi?id=136726
+        -and corresponding-
+        rdar://problem/10011924
+
+        Reviewed by Tim Horton.
+
+        rubberBandingForOverflowScrollEnabled is re-named to
+        rubberBandingForSubScrollableRegionsEnabled
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2014-09-09  Benjamin Poulain  <bpoulain@apple.com>
 
         Disable the "unreachable-code" warning
index c1f781c..a6f3b54 100644 (file)
@@ -2284,7 +2284,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
 #if ENABLE(RUBBER_BANDING)
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=136131
-    settings.setRubberBandingForOverflowScrollEnabled(false);
+    settings.setRubberBandingForSubScrollableRegionsEnabled(false);
 #endif
 
 #if PLATFORM(IOS)