Changeset 172832 in webkit


Ignore:
Timestamp:
Aug 21, 2014 1:08:57 PM (10 years ago)
Author:
Beth Dakin
Message:

overflow:scroll elements should support rubber-banding
https://bugs.webkit.org/show_bug.cgi?id=91655

Reviewed by Sam Weinig and Darin Adler.

Source/WebCore:

This patch enables rubber-banding in overflow regions and it keeps latching
working as currently implemented.

We cannot return early here if there is no scroll delta. There won't be a scroll
delta in most cases during event.phase() == PlatformWheelEventPhaseEnded, but that
phase is required to be processed in order for rubber-banding to work properly.

  • dom/Element.cpp:

(WebCore::Element::dispatchWheelEvent):

  • page/EventHandler.cpp:

(WebCore::handleWheelEventInAppropriateEnclosingBoxForSingleAxis):

Add a setting for this, which will default to true. This allows us to disable the
feature in WebKit1 for now. There is a bug about making it work.

  • page/Settings.in:

allowsHorizontalStretching() and allowsVerticalStretching() now take the
PlatformWheelEvent as a parameter, so that ScrollElasticityAutomatic can use the
event to decide whether or not stretching should be allowed in this case.
ScrollElasticityAutomatic will not allow stretching if it is a brand new gesture
that would result in a rubber-band. We don't want to rubber-band in that case
because we want the event to propagate up to a parent view. Also added some helper
functions just to make that code easier to read.

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

(WebCore::newGestureIsStarting):
(WebCore::ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture):
(WebCore::ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching):
(WebCore::ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching):

  • platform/mac/ScrollAnimatorMac.h:
  • platform/mac/ScrollAnimatorMac.mm:

(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::newGestureIsStarting):
(WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture):
(WebCore::ScrollAnimatorMac::allowsVerticalStretching):
(WebCore::ScrollAnimatorMac::allowsHorizontalStretching):

  • platform/mac/ScrollElasticityController.h:
  • platform/mac/ScrollElasticityController.mm:

(WebCore::ScrollElasticityController::handleWheelEvent):

To opt into rubber-banding, all we have to do is implement overhangAmount and set
scroll elasticity. We'll choose ScrollElasticityAutomatic which means that we'll
only rubber-band in directions that can scroll and that we won't rubber-band for
new gestures when we're already pinned to the edge.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::overhangAmount):
(WebCore::RenderLayer::setHasHorizontalScrollbar):
(WebCore::RenderLayer::setHasVerticalScrollbar):

Source/WebKit/mac:

Disable rubber-banding in overflow areas for now.

  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

LayoutTests:

Re-baseline. Mostly these tests are different now that end end event is handled.

  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
  • platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt:

This test requires a longer timeout to ensure that the rubber-band has ended.

  • platform/mac/fast/scrolling/scroll-latched-nested-div.html:
Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r172828 r172832  
     12014-08-21  Beth Dakin  <bdakin@apple.com>
     2
     3        overflow:scroll elements should support rubber-banding
     4        https://bugs.webkit.org/show_bug.cgi?id=91655
     5
     6        Reviewed by Sam Weinig and Darin Adler.
     7
     8        Re-baseline. Mostly these tests are different now that end end event is handled.
     9        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt:
     10        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt:
     11        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt:
     12        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt:
     13        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt:
     14        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
     15        * platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt:
     16
     17        This test requires a longer timeout to ensure that the rubber-band has ended.
     18        * platform/mac/fast/scrolling/scroll-latched-nested-div.html:
     19
    1202014-08-21  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
    221
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-expected.txt

    r169700 r172832  
    5656Mouse moved to (28, 475)
    5757Page before: 0, div before: 586
    58 Page after:  0, div after: 666
     58Page after:  0, div after: 656
    5959PASS Page did not receive wheel events.
    6060(GraphicsLayer
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-div-with-handler-expected.txt

    r169700 r172832  
    5656Mouse moved to (28, 475)
    5757Page before: 0, div before: 586
    58 Page after:  0, div after: 666
     58Page after:  0, div after: 656
    5959PASS Page did not receive wheel events.
    60 Document was initial target for 8 of the wheel events.
     60Document was initial target for 10 of the wheel events.
    6161(GraphicsLayer
    6262  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe-with-handler-expected.txt

    r169700 r172832  
    5757Page after:  70, div after: 0
    5858PASS Scrollable div did not receive wheel events.
    59 Document was initial target for 8 of the wheel events.
     59Document was initial target for 10 of the wheel events.
    6060(GraphicsLayer
    6161  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-iframe-with-handler-expected.txt

    r169700 r172832  
    1414Page after:  0, IFrame after: 496
    1515PASS Page did not receive wheel events.
    16 Document was initial target for 0 of the wheel events.
     16Document was initial target for 2 of the wheel events.
    1717(GraphicsLayer
    1818  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt

    r169700 r172832  
    1313Page after:  70, IFrame after: 0
    1414PASS IFrame did not receive wheel events.
    15 Document was initial target for 8 of the wheel events.
     15Document was initial target for 10 of the wheel events.
    1616(GraphicsLayer
    1717  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt

    r169700 r172832  
    1515Page after:  70, select after: 0
    1616PASS Select did not receive wheel events.
    17 Document was initial target for 8 of the wheel events.
     17Document was initial target for 10 of the wheel events.
    1818(GraphicsLayer
    1919  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/fast-scroll-select-latched-select-with-handler-expected.txt

    r169700 r172832  
    1616Page after:  0, select after: 140
    1717PASS Page did not receive wheel events.
    18 Document was initial target for 8 of the wheel events.
     18Document was initial target for 10 of the wheel events.
    1919(GraphicsLayer
    2020  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac/fast/scrolling/scroll-latched-nested-div.html

    r172160 r172832  
    104104    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'continue', true);
    105105    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
    106     setTimeout(checkForSecondScroll, 100);
     106    // The timeout used to be only 100, but when we added support for rubber-banding in overflow
     107    // areas, we found we had to increase the timeout to allow the rubber-band to finish.
     108    setTimeout(checkForSecondScroll, 1000);
    107109}
    108110
     
    134136    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -5, 'none', 'continue', true);
    135137    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end', true);
    136     setTimeout(checkForFirstScroll, 100);
     138    // The timeout used to be only 100, but when we added support for rubber-banding in overflow
     139    // areas, we found we had to increase the timeout to allow the rubber-band to finish.
     140    setTimeout(checkForFirstScroll, 1000);
    137141}
    138142
  • trunk/Source/WebCore/ChangeLog

    r172831 r172832  
     12014-08-21  Beth Dakin  <bdakin@apple.com>
     2
     3        overflow:scroll elements should support rubber-banding
     4        https://bugs.webkit.org/show_bug.cgi?id=91655
     5
     6        Reviewed by Sam Weinig and Darin Adler.
     7
     8        This patch enables rubber-banding in overflow regions and it keeps latching
     9        working as currently implemented.
     10
     11        We cannot return early here if there is no scroll delta. There won't be a scroll
     12        delta in most cases during event.phase() == PlatformWheelEventPhaseEnded, but that
     13        phase is required to be processed in order for rubber-banding to work properly.
     14        * dom/Element.cpp:
     15        (WebCore::Element::dispatchWheelEvent):
     16        * page/EventHandler.cpp:
     17        (WebCore::handleWheelEventInAppropriateEnclosingBoxForSingleAxis):
     18
     19        Add a setting for this, which will default to true. This allows us to disable the
     20        feature in WebKit1 for now. There is a bug about making it work.
     21        * page/Settings.in:
     22
     23        allowsHorizontalStretching() and allowsVerticalStretching() now take the
     24        PlatformWheelEvent as a parameter, so that ScrollElasticityAutomatic can use the
     25        event to decide whether or not stretching should be allowed in this case.
     26        ScrollElasticityAutomatic will not allow stretching if it is a brand new gesture
     27        that would result in a rubber-band. We don't want to rubber-band in that case
     28        because we want the event to propagate up to a parent view. Also added some helper
     29        functions just to make that code easier to read.
     30        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
     31        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     32        (WebCore::newGestureIsStarting):
     33        (WebCore::ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture):
     34        (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching):
     35        (WebCore::ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching):
     36        * platform/mac/ScrollAnimatorMac.h:
     37        * platform/mac/ScrollAnimatorMac.mm:
     38        (WebCore::ScrollAnimatorMac::handleWheelEvent):
     39        (WebCore::newGestureIsStarting):
     40        (WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture):
     41        (WebCore::ScrollAnimatorMac::allowsVerticalStretching):
     42        (WebCore::ScrollAnimatorMac::allowsHorizontalStretching):
     43        * platform/mac/ScrollElasticityController.h:
     44        * platform/mac/ScrollElasticityController.mm:
     45        (WebCore::ScrollElasticityController::handleWheelEvent):
     46
     47        To opt into rubber-banding, all we have to do is implement overhangAmount and set
     48        scroll elasticity. We'll choose ScrollElasticityAutomatic which means that we'll
     49        only rubber-band in directions that can scroll and that we won't rubber-band for
     50        new gestures when we're already pinned to the edge.
     51        * rendering/RenderLayer.cpp:
     52        (WebCore::RenderLayer::overhangAmount):
     53        (WebCore::RenderLayer::setHasHorizontalScrollbar):
     54        (WebCore::RenderLayer::setHasVerticalScrollbar):
     55
    1562014-08-21  Alex Christensen  <achristensen@webkit.org>
    257
  • trunk/Source/WebCore/dom/Element.cpp

    r172758 r172832  
    262262bool Element::dispatchWheelEvent(const PlatformWheelEvent& event)
    263263{
    264     if (!(event.deltaX() || event.deltaY()))
    265         return true;
    266 
    267264    RefPtr<WheelEvent> wheelEvent = WheelEvent::create(event, document().defaultView());
    268265    return EventDispatcher::dispatchEvent(this, wheelEvent) && !wheelEvent->defaultHandled();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r172729 r172832  
    298298static inline bool handleWheelEventInAppropriateEnclosingBoxForSingleAxis(Node* startNode, WheelEvent* wheelEvent, Element** stopElement, ScrollEventAxis axis)
    299299{
    300     if (!startNode->renderer() || (axis == ScrollEventAxis::Vertical && !wheelEvent->deltaY()) || (axis == ScrollEventAxis::Horizontal && !wheelEvent->deltaX()))
     300    bool shouldHandleEvent = (axis == ScrollEventAxis::Vertical && wheelEvent->deltaY()) || (axis == ScrollEventAxis::Horizontal && wheelEvent->deltaX());
     301#if PLATFORM(MAC)
     302    shouldHandleEvent |= wheelEvent->phase() == PlatformWheelEventPhaseEnded;
     303#endif
     304    if (!startNode->renderer() || !shouldHandleEvent)
    301305        return false;
    302306
  • trunk/Source/WebCore/page/Settings.in

    r172709 r172832  
    9595acceleratedCompositingForFixedPositionEnabled initial=defaultAcceleratedCompositingForFixedPositionEnabled
    9696acceleratedCompositingForOverflowScrollEnabled initial=false
     97rubberBandingForOverflowScrollEnabled initial=true, conditional=RUBBER_BANDING
    9798
    9899experimentalNotificationsEnabled initial=false
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h

    r170196 r172832  
    5252
    5353    // ScrollElasticityController member functions.
    54     virtual bool allowsHorizontalStretching() override;
    55     virtual bool allowsVerticalStretching() override;
     54    virtual bool allowsHorizontalStretching(const PlatformWheelEvent&) override;
     55    virtual bool allowsVerticalStretching(const PlatformWheelEvent&) override;
    5656    virtual IntSize stretchAmount() override;
    5757    virtual bool pinnedInDirection(const FloatSize&) override;
     
    7979    void updateMainFramePinState(const FloatPoint& scrollPosition);
    8080
     81    bool isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent&, ScrollEventAxis);
     82
    8183    void logExposedUnfilledArea();
    8284
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r170196 r172832  
    159159}
    160160
    161 bool ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching()
     161// FIXME: We should find a way to share some of the code from newGestureIsStarting(), isAlreadyPinnedInDirectionOfGesture(),
     162// allowsVerticalStretching(), and allowsHorizontalStretching() with the implementation in ScrollAnimatorMac.
     163static bool newGestureIsStarting(const PlatformWheelEvent& wheelEvent)
     164{
     165    return wheelEvent.phase() == PlatformWheelEventPhaseMayBegin || wheelEvent.phase() == PlatformWheelEventPhaseBegan;
     166}
     167
     168bool ScrollingTreeFrameScrollingNodeMac::isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent& wheelEvent, ScrollEventAxis axis)
     169{
     170    switch (axis) {
     171    case ScrollEventAxis::Vertical:
     172        return (wheelEvent.deltaY() > 0 && scrollPosition().y() <= minimumScrollPosition().y()) || (wheelEvent.deltaY() < 0 && scrollPosition().y() >= maximumScrollPosition().y());
     173    case ScrollEventAxis::Horizontal:
     174        return (wheelEvent.deltaX() > 0 && scrollPosition().x() <= minimumScrollPosition().x()) || (wheelEvent.deltaX() < 0 && scrollPosition().x() >= maximumScrollPosition().x());
     175    }
     176
     177    ASSERT_NOT_REACHED();
     178    return false;
     179}
     180
     181bool ScrollingTreeFrameScrollingNodeMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent)
    162182{
    163183    switch (horizontalScrollElasticity()) {
    164     case ScrollElasticityAutomatic:
    165         return hasEnabledHorizontalScrollbar() || !hasEnabledVerticalScrollbar();
     184    case ScrollElasticityAutomatic: {
     185        bool scrollbarsAllowStretching = hasEnabledHorizontalScrollbar() || !hasEnabledVerticalScrollbar();
     186        bool eventPreventsStretching = newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Horizontal);
     187        return scrollbarsAllowStretching && !eventPreventsStretching;
     188    }
    166189    case ScrollElasticityNone:
    167190        return false;
     
    174197}
    175198
    176 bool ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching()
     199bool ScrollingTreeFrameScrollingNodeMac::allowsVerticalStretching(const PlatformWheelEvent& wheelEvent)
    177200{
    178201    switch (verticalScrollElasticity()) {
    179     case ScrollElasticityAutomatic:
    180         return hasEnabledVerticalScrollbar() || !hasEnabledHorizontalScrollbar();
     202    case ScrollElasticityAutomatic: {
     203        bool scrollbarsAllowStretching = hasEnabledVerticalScrollbar() || !hasEnabledHorizontalScrollbar();
     204        bool eventPreventsStretching = newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Vertical);
     205        return scrollbarsAllowStretching && !eventPreventsStretching;
     206    }
    181207    case ScrollElasticityNone:
    182208        return false;
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h

    r162158 r172832  
    142142    /// ScrollElasticityControllerClient member functions.
    143143    virtual IntSize stretchAmount() override;
    144     virtual bool allowsHorizontalStretching() override;
    145     virtual bool allowsVerticalStretching() override;
     144    virtual bool allowsHorizontalStretching(const PlatformWheelEvent&) override;
     145    virtual bool allowsVerticalStretching(const PlatformWheelEvent&) override;
    146146    virtual bool pinnedInDirection(const FloatSize&) override;
    147147    virtual bool canScrollHorizontally() override;
     
    157157    bool pinnedInDirection(float deltaX, float deltaY);
    158158    void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>&);
     159
     160    bool isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent&, ScrollEventAxis);
    159161
    160162    ScrollElasticityController m_scrollElasticityController;
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r167693 r172832  
    10911091    // wheel event if there is nowhere to scroll.
    10921092    if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) {
    1093         if (!allowsVerticalStretching())
     1093        if (!allowsVerticalStretching(wheelEvent))
    10941094            return ScrollAnimator::handleWheelEvent(wheelEvent);
    10951095    } else {
    1096         if (!allowsHorizontalStretching())
     1096        if (!allowsHorizontalStretching(wheelEvent))
    10971097            return ScrollAnimator::handleWheelEvent(wheelEvent);
    10981098    }
     
    11321132}
    11331133
    1134 bool ScrollAnimatorMac::allowsVerticalStretching()
     1134// FIXME: We should find a way to share some of the code from newGestureIsStarting(), isAlreadyPinnedInDirectionOfGesture(),
     1135// allowsVerticalStretching(), and allowsHorizontalStretching() with the implementation in ScrollingTreeFrameScrollingNodeMac.
     1136static bool newGestureIsStarting(const PlatformWheelEvent& wheelEvent)
     1137{
     1138    return wheelEvent.phase() == PlatformWheelEventPhaseMayBegin || wheelEvent.phase() == PlatformWheelEventPhaseBegan;
     1139}
     1140
     1141bool ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent& wheelEvent, ScrollEventAxis axis)
     1142{
     1143    switch (axis) {
     1144    case ScrollEventAxis::Vertical:
     1145        return (wheelEvent.deltaY() > 0 && m_scrollableArea->scrolledToTop()) || (wheelEvent.deltaY() < 0 && m_scrollableArea->scrolledToBottom());
     1146    case ScrollEventAxis::Horizontal:
     1147        return (wheelEvent.deltaX() > 0 && m_scrollableArea->scrolledToLeft()) || (wheelEvent.deltaX() < 0 && m_scrollableArea->scrolledToRight());
     1148    }
     1149
     1150    ASSERT_NOT_REACHED();
     1151    return false;
     1152}
     1153
     1154bool ScrollAnimatorMac::allowsVerticalStretching(const PlatformWheelEvent& wheelEvent)
    11351155{
    11361156    switch (m_scrollableArea->verticalScrollElasticity()) {
     
    11381158        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
    11391159        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
    1140         return (((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled())));
     1160        bool scrollbarsAllowStretching = ((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()));
     1161        bool eventPreventsStretching = newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Vertical);
     1162        return scrollbarsAllowStretching && !eventPreventsStretching;
    11411163    }
    11421164    case ScrollElasticityNone:
     
    11501172}
    11511173
    1152 bool ScrollAnimatorMac::allowsHorizontalStretching()
     1174bool ScrollAnimatorMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent)
    11531175{
    11541176    switch (m_scrollableArea->horizontalScrollElasticity()) {
     
    11561178        Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
    11571179        Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
    1158         return (((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled())));
     1180        bool scrollbarsAllowStretching = ((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()));
     1181        bool eventPreventsStretching = newGestureIsStarting(wheelEvent) && isAlreadyPinnedInDirectionOfGesture(wheelEvent, ScrollEventAxis::Horizontal);
     1182        return scrollbarsAllowStretching && !eventPreventsStretching;
    11591183    }
    11601184    case ScrollElasticityNone:
  • trunk/Source/WebCore/platform/mac/ScrollElasticityController.h

    r160898 r172832  
    4343
    4444public:
    45     virtual bool allowsHorizontalStretching() = 0;
    46     virtual bool allowsVerticalStretching() = 0;
     45    virtual bool allowsHorizontalStretching(const PlatformWheelEvent&) = 0;
     46    virtual bool allowsVerticalStretching(const PlatformWheelEvent&) = 0;
    4747    virtual IntSize stretchAmount() = 0;
    4848    virtual bool pinnedInDirection(const FloatSize&) = 0;
  • trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm

    r160898 r172832  
    236236            }
    237237        } else {
    238             if (!m_client->allowsHorizontalStretching()) {
     238            if (!m_client->allowsHorizontalStretching(wheelEvent)) {
    239239                deltaX = 0;
    240240                eventCoalescedDeltaX = 0;
     
    246246            }
    247247
    248             if (!m_client->allowsVerticalStretching()) {
     248            if (!m_client->allowsVerticalStretching(wheelEvent)) {
    249249                deltaY = 0;
    250250                eventCoalescedDeltaY = 0;
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r172649 r172832  
    26502650IntSize RenderLayer::overhangAmount() const
    26512651{
    2652     return IntSize();
     2652    if (!renderer().frame().settings().rubberBandingForOverflowScrollEnabled())
     2653        return IntSize();
     2654
     2655    IntSize stretch;
     2656
     2657    int physicalScrollY = scrollPosition().y() + scrollOrigin().y();
     2658    if (physicalScrollY < 0)
     2659        stretch.setHeight(physicalScrollY);
     2660    else if (scrollableContentsSize().height() && physicalScrollY > scrollableContentsSize().height() - visibleHeight())
     2661        stretch.setHeight(physicalScrollY - (scrollableContentsSize().height() - visibleHeight()));
     2662
     2663    int physicalScrollX = scrollPosition().x() + scrollOrigin().x();
     2664    if (physicalScrollX < 0)
     2665        stretch.setWidth(physicalScrollX);
     2666    else if (scrollableContentsSize().width() && physicalScrollX > scrollableContentsSize().width() - visibleWidth())
     2667        stretch.setWidth(physicalScrollX - (scrollableContentsSize().width() - visibleWidth()));
     2668
     2669    return stretch;
    26532670}
    26542671
     
    29822999        return;
    29833000
    2984     if (hasScrollbar)
     3001    if (hasScrollbar) {
    29853002        m_hBar = createScrollbar(HorizontalScrollbar);
    2986     else
     3003        ScrollableArea::setHorizontalScrollElasticity(renderer().frame().settings().rubberBandingForOverflowScrollEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone);
     3004    } else {
    29873005        destroyScrollbar(HorizontalScrollbar);
     3006        ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityNone);
     3007    }
    29883008
    29893009    // Destroying or creating one bar can cause our scrollbar corner to come and go.  We need to update the opposite scrollbar's style.
     
    30053025        return;
    30063026
    3007     if (hasScrollbar)
     3027    if (hasScrollbar) {
    30083028        m_vBar = createScrollbar(VerticalScrollbar);
    3009     else
     3029        ScrollableArea::setVerticalScrollElasticity((renderer().frame().settings().rubberBandingForOverflowScrollEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone));
     3030    } else {
    30103031        destroyScrollbar(VerticalScrollbar);
     3032        ScrollableArea::setVerticalScrollElasticity(ScrollElasticityNone);
     3033    }
    30113034
    30123035     // Destroying or creating one bar can cause our scrollbar corner to come and go.  We need to update the opposite scrollbar's style.
  • trunk/Source/WebKit/mac/ChangeLog

    r172790 r172832  
     12014-08-21  Beth Dakin  <bdakin@apple.com>
     2
     3        overflow:scroll elements should support rubber-banding
     4        https://bugs.webkit.org/show_bug.cgi?id=91655
     5
     6        Reviewed by Sam Weinig and Darin Adler.
     7
     8        Disable rubber-banding in overflow areas for now.
     9        * WebView/WebView.mm:
     10        (-[WebView _preferencesChanged:]):
     11
    1122014-08-19  Pratik Solanki  <psolanki@apple.com>
    213
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r172749 r172832  
    23042304#endif
    23052305
     2306    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=136131
     2307    settings.setRubberBandingForOverflowScrollEnabled(false);
     2308
    23062309#if PLATFORM(IOS)
    23072310    settings.setStandalone([preferences _standalone]);
Note: See TracChangeset for help on using the changeset viewer.