Changeset 167560 in webkit
- Timestamp:
- Apr 19, 2014 7:32:48 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167559 r167560 1 2014-04-19 Brent Fulgham <bfulgham@apple.com> 2 3 Latched scrolling may interact badly with custom programmatic scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=131869 5 <rdar://problem/16249557> 6 7 Reviewed by Darin Adler. 8 9 * dom/Element.cpp: 10 (WebCore::Element::setScrollLeft): Mark scrollable area as having 11 been scrolled programmatically. 12 (WebCore::Element::setScrollTop): Ditto. 13 * page/EventHandler.cpp: 14 (WebCore::EventHandler::handleWheelEvent): Check for programmatic scroll, and 15 clear latched state if the handler manually scrolled. Clear programmatic 16 scroll state at the end of event handling. 17 (WebCore::EventHandler::clearLatchedState): Refactored code. 18 * page/EventHandler.h: 19 * page/mac/EventHandlerMac.mm: 20 (WebCore::EventHandler::platformPrepareForWheelEvents): Check 21 if scrollable area was scrolled programmatically. If it was, do 22 not honor latching behavior. 23 * platform/ScrollableArea.cpp: 24 (WebCore::ScrollableArea::ScrollableArea): Initialize new member. 25 * platform/ScrollableArea.h: 26 (WebCore::ScrollableArea::isScrolledProgrammatically): Added. 27 (WebCore::ScrollableArea::setScrolledProgrammatically): Added. 28 1 29 2014-04-19 Chris Fleizach <cfleizach@apple.com> 2 30 -
trunk/Source/WebCore/dom/Element.cpp
r167545 r167560 62 62 #include "PlatformWheelEvent.h" 63 63 #include "PointerLockController.h" 64 #include "RenderLayer.h" 64 65 #include "RenderNamedFlowFragment.h" 65 66 #include "RenderRegion.h" … … 799 800 document().updateLayoutIgnorePendingStylesheets(); 800 801 801 if (RenderBox* rend = renderBox()) 802 rend->setScrollLeft(static_cast<int>(newLeft * rend->style().effectiveZoom())); 802 if (RenderBox* renderer = renderBox()) { 803 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom())); 804 if (auto* scrollableArea = renderer->layer()) 805 scrollableArea->setScrolledProgrammatically(true); 806 } 803 807 } 804 808 … … 807 811 document().updateLayoutIgnorePendingStylesheets(); 808 812 809 if (RenderBox* rend = renderBox()) 810 rend->setScrollTop(static_cast<int>(newTop * rend->style().effectiveZoom())); 813 if (RenderBox* renderer = renderBox()) { 814 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom())); 815 if (auto* scrollableArea = renderer->layer()) 816 scrollableArea->setScrolledProgrammatically(true); 817 } 811 818 } 812 819 -
trunk/Source/WebCore/page/EventHandler.cpp
r167267 r167560 2594 2594 if (widget && passWheelEventToWidget(e, widget)) { 2595 2595 m_isHandlingWheelEvent = false; 2596 if (scrollableArea) 2597 scrollableArea->setScrolledProgrammatically(false); 2596 2598 return true; 2597 2599 } … … 2600 2602 if (!element->dispatchWheelEvent(event)) { 2601 2603 m_isHandlingWheelEvent = false; 2604 2605 if (scrollableArea && scrollableArea->isScrolledProgrammatically()) { 2606 // Web developer is controlling scrolling. Don't attempt to latch ourselves: 2607 clearLatchedState(); 2608 scrollableArea->setScrolledProgrammatically(false); 2609 } 2610 2602 2611 return true; 2603 2612 } 2604 2613 } 2605 2614 2615 if (scrollableArea) 2616 scrollableArea->setScrolledProgrammatically(false); 2617 2606 2618 return platformCompleteWheelEvent(e, scrollableContainer, scrollableArea); 2619 } 2620 2621 void EventHandler::clearLatchedState() 2622 { 2623 m_latchedWheelEventElement = nullptr; 2624 #if PLATFORM(COCOA) 2625 m_latchedScrollableContainer = nullptr; 2626 #endif 2627 m_widgetIsLatched = false; 2628 m_previousWheelScrolledElement = nullptr; 2607 2629 } 2608 2630 -
trunk/Source/WebCore/page/EventHandler.h
r167267 r167560 437 437 #endif 438 438 439 void clearLatchedState(); 440 439 441 Frame& m_frame; 440 442 -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r166965 r167560 800 800 m_recentWheelEventDeltaTracker->beginTrackingDeltas(); 801 801 } else if (wheelEvent.shouldResetLatching()) { 802 m_latchedWheelEventElement = nullptr; 803 m_latchedScrollableContainer = nullptr; 804 m_widgetIsLatched = false; 805 m_previousWheelScrolledElement = nullptr; 802 clearLatchedState(); 806 803 m_recentWheelEventDeltaTracker->endTrackingDeltas(); 807 804 } -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r165484 r167560 60 60 , m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault) 61 61 , m_scrollOriginChanged(false) 62 , m_scrolledProgrammatically(false) 62 63 { 63 64 } -
trunk/Source/WebCore/platform/ScrollableArea.h
r166630 r167560 157 157 virtual bool scrolledToRight() const; 158 158 159 bool isScrolledProgrammatically() const { return m_scrolledProgrammatically; } 160 void setScrolledProgrammatically(bool state) { m_scrolledProgrammatically = state; } 161 159 162 enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScrollbars }; 160 163 enum VisibleContentRectBehavior { … … 293 296 294 297 unsigned m_scrollOriginChanged : 1; 298 unsigned m_scrolledProgrammatically : 1; 295 299 }; 296 300 -
trunk/WebKit.xcworkspace/xcshareddata/xcschemes/All Source (target WebProcess).xcscheme
r166950 r167560 146 146 launchStyle = "0" 147 147 useCustomWorkingDirectory = "NO" 148 buildConfiguration = " Debug"148 buildConfiguration = "Release" 149 149 ignoresPersistentStateOnLaunch = "NO" 150 150 debugDocumentVersioning = "YES"
Note: See TracChangeset
for help on using the changeset viewer.