Title: [186185] trunk/Source/WebCore
- Revision
- 186185
- Author
- bfulg...@apple.com
- Date
- 2015-07-01 12:29:33 -0700 (Wed, 01 Jul 2015)
Log Message
REGRESSION (r184296): View keeps scrolling upward
https://bugs.webkit.org/show_bug.cgi?id=146497
<rdar://problem/21524942>
Reviewed by Darin Adler.
Avoid improperly triggering the ScrollController wheel event handling
logic when the wheel event deltaX/deltaY are zero. On certain sites,
this caused a programmatic _javascript_ scroll to be triggered unexpectedly,
scrolling the page back to some initial state.
This bug was introduced while trying to make sure scrollbars were notified
when the wheel event had come to an end. Revise that change so that we still
follow the right code path for non-stretchable regions. However, make sure
that for zero-delta wheel events we make sure to properly handle the wheel
event phase.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent): New helper function
to reduce the complexity of the logic in handleWheelEvent.
(WebCore::ScrollAnimatorMac::handleWheelEvent): When wheel events should be forwarded
to the parent scroll view, if the event was handled or has no change in position
trigger the 'handleWheelEventPhase' logic so that scrollbars are hidden, etc.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (186184 => 186185)
--- trunk/Source/WebCore/ChangeLog 2015-07-01 19:11:47 UTC (rev 186184)
+++ trunk/Source/WebCore/ChangeLog 2015-07-01 19:29:33 UTC (rev 186185)
@@ -1,3 +1,30 @@
+2015-06-30 Brent Fulgham <bfulg...@apple.com>
+
+ REGRESSION (r184296): View keeps scrolling upward
+ https://bugs.webkit.org/show_bug.cgi?id=146497
+ <rdar://problem/21524942>
+
+ Reviewed by Darin Adler.
+
+ Avoid improperly triggering the ScrollController wheel event handling
+ logic when the wheel event deltaX/deltaY are zero. On certain sites,
+ this caused a programmatic _javascript_ scroll to be triggered unexpectedly,
+ scrolling the page back to some initial state.
+
+ This bug was introduced while trying to make sure scrollbars were notified
+ when the wheel event had come to an end. Revise that change so that we still
+ follow the right code path for non-stretchable regions. However, make sure
+ that for zero-delta wheel events we make sure to properly handle the wheel
+ event phase.
+
+ * platform/mac/ScrollAnimatorMac.h:
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent): New helper function
+ to reduce the complexity of the logic in handleWheelEvent.
+ (WebCore::ScrollAnimatorMac::handleWheelEvent): When wheel events should be forwarded
+ to the parent scroll view, if the event was handled or has no change in position
+ trigger the 'handleWheelEventPhase' logic so that scrollbars are hidden, etc.
+
2015-06-30 Dean Jackson <d...@apple.com>
Hide the inline controls when going into PiP
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (186184 => 186185)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2015-07-01 19:11:47 UTC (rev 186184)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h 2015-07-01 19:29:33 UTC (rev 186185)
@@ -85,6 +85,7 @@
virtual void scrollToOffsetWithoutAnimation(const FloatPoint&) override;
#if ENABLE(RUBBER_BANDING)
+ bool shouldForwardWheelEventsToParent(const PlatformWheelEvent&);
virtual bool handleWheelEvent(const PlatformWheelEvent&) override;
#endif
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (186184 => 186185)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2015-07-01 19:11:47 UTC (rev 186184)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2015-07-01 19:29:33 UTC (rev 186185)
@@ -1106,6 +1106,15 @@
}
#if ENABLE(RUBBER_BANDING)
+
+bool ScrollAnimatorMac::shouldForwardWheelEventsToParent(const PlatformWheelEvent& wheelEvent)
+{
+ if (std::abs(wheelEvent.deltaY()) >= std::abs(wheelEvent.deltaX()))
+ return !allowsVerticalStretching(wheelEvent);
+
+ return !allowsHorizontalStretching(wheelEvent);
+}
+
bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
m_haveScrolledSincePageLoad = true;
@@ -1113,18 +1122,15 @@
if (!wheelEvent.hasPreciseScrollingDeltas() || !rubberBandingEnabledForSystem())
return ScrollAnimator::handleWheelEvent(wheelEvent);
- if (wheelEvent.deltaX() || wheelEvent.deltaY()) {
- // FIXME: This is somewhat roundabout hack to allow forwarding wheel events
- // up to the parent scrollable area. It takes advantage of the fact that
- // the base class implementation of handleWheelEvent will not accept the
- // wheel event if there is nowhere to scroll.
- if (fabsf(wheelEvent.deltaY()) >= fabsf(wheelEvent.deltaX())) {
- if (!allowsVerticalStretching(wheelEvent))
- return ScrollAnimator::handleWheelEvent(wheelEvent);
- } else {
- if (!allowsHorizontalStretching(wheelEvent))
- return ScrollAnimator::handleWheelEvent(wheelEvent);
- }
+ // FIXME: This is somewhat roundabout hack to allow forwarding wheel events
+ // up to the parent scrollable area. It takes advantage of the fact that
+ // the base class implementation of handleWheelEvent will not accept the
+ // wheel event if there is nowhere to scroll.
+ if (shouldForwardWheelEventsToParent(wheelEvent)) {
+ bool didHandleEvent = ScrollAnimator::handleWheelEvent(wheelEvent);
+ if (didHandleEvent || (!wheelEvent.deltaX() && !wheelEvent.deltaY()))
+ handleWheelEventPhase(wheelEvent.phase());
+ return didHandleEvent;
}
bool didHandleEvent = m_scrollController.handleWheelEvent(wheelEvent);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes