WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-135195-20140729181201.patch (text/plain), 11.14 KB, created by
Wenson Hsieh
on 2014-07-29 18:12:14 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2014-07-29 18:12:14 PDT
Size:
11.14 KB
patch
obsolete
>Subversion Revision: 171775 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1e39811b0918ea54642bf36401232e997c256e17..d583d6e49de78da8c271a59d798720de64edcc8e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2014-07-28 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Refactor EventHandler to call ScrollAnimator::handleWheelEvent for overflow scrolling >+ https://bugs.webkit.org/show_bug.cgi?id=135195 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ ScrollableArea::handleWheelEvent is not currently being used to handle wheel events for overflow scrolling; it instead directly invokes ScrollableArea::scroll. >+ In order to expose wheel phases on Mac, the PlatformWheelEvent itself should propagate down to ScrollableArea, not just the scroll granularity, direction and >+ multiplier required by ScrollableArea::scroll. With this patch, PlatformWheelEvent will be "shipped" along with the WheelEvent. >+ >+ No new tests, since behavior should not have changed. >+ >+ * page/EventHandler.cpp: >+ (WebCore::didScrollInScrollableAreaForSingleAxis): Calls ScrollableArea::scroll directly using WheelEvent's data. Used to handle programmatic WheelEvents, e.g. from JavaScript. >+ (WebCore::handleWheelEventInAppropriateEnclosingBoxForSingleAxis): Finds the correct ScrollableArea and attempts to scroll it using the information contained in the WheelEvent via ScrollableArea::handleWheelEvent >+ (WebCore::EventHandler::defaultWheelEventHandler): Updated to use handleWheelEventInAppropriateEnclosingBoxForSingleAxis instead of scrollNode. >+ (WebCore::scrollNode): Deleted. >+ * rendering/RenderListBox.h: Made RenderListBox::scroll public so it can be invoked from EventHandler::handleWheelEventInAppropriateEnclosingBoxForSingleAxis. >+ * rendering/RenderNamedFlowThread.cpp: Refactored to let EventHandler update nextScrollBlock in the case of isRenderNamedFlowThread(). >+ (WebCore::RenderNamedFlowThread::fragmentFromRenderBoxAsRenderBlock): >+ * rendering/RenderNamedFlowThread.h: >+ > 2014-07-29 Pratik Solanki <psolanki@apple.com> > > [iOS] REGRESSION(r171526): PDF documents fail to load in WebKit1 with disk image caching enabled >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index bdf0328a6c3b4ff1a57f46d3fbde724f37f9a219..87bb213fd1d2976db86b9da09904eb3880f99fef 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -73,6 +73,7 @@ > #include "RenderFrameSet.h" > #include "RenderLayer.h" > #include "RenderListBox.h" >+#include "RenderNamedFlowThread.h" > #include "RenderTextControlSingleLine.h" > #include "RenderView.h" > #include "RenderWidget.h" >@@ -283,16 +284,50 @@ static inline ScrollGranularity wheelGranularityToScrollGranularity(unsigned del > } > } > >-static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Element** stopElement, const IntPoint& wheelEventAbsolutePoint) >+static inline bool didScrollInScrollableAreaForSingleAxis(ScrollableArea* scrollableArea, WheelEvent* wheelEvent, ScrollEventAxis axis) > { >- if (!delta) >- return false; >- if (!node->renderer()) >+ float delta = axis == ScrollEventAxis::Vertical ? wheelEvent->deltaY() : wheelEvent->deltaX(); >+ ScrollDirection negativeDirection = axis == ScrollEventAxis::Vertical ? ScrollUp : ScrollLeft; >+ ScrollDirection positiveDirection = axis == ScrollEventAxis::Vertical ? ScrollDown : ScrollRight; >+ return scrollableArea->scroll(delta < 0 ? negativeDirection : positiveDirection, wheelGranularityToScrollGranularity(wheelEvent->deltaMode()), delta > 0 ? delta : -delta); >+} >+ >+static inline bool handleWheelEventInAppropriateEnclosingBoxForSingleAxis(Node* startNode, WheelEvent* wheelEvent, Element** stopElement, ScrollEventAxis axis) >+{ >+ if (!startNode->renderer() || (axis == ScrollEventAxis::Vertical && !wheelEvent->deltaY()) || (axis == ScrollEventAxis::Horizontal && !wheelEvent->deltaX())) > return false; >- RenderBox& enclosingBox = node->renderer()->enclosingBox(); >- float absDelta = delta > 0 ? delta : -delta; > >- return enclosingBox.scroll(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopElement, &enclosingBox, wheelEventAbsolutePoint); >+ RenderBox& initialEnclosingBox = startNode->renderer()->enclosingBox(); >+ if (initialEnclosingBox.isListBox()) >+ return didScrollInScrollableAreaForSingleAxis(static_cast<RenderListBox*>(&initialEnclosingBox), wheelEvent, axis); >+ >+ RenderBox* currentEnclosingBox = &initialEnclosingBox; >+ while (currentEnclosingBox) { >+ if (RenderLayer* boxLayer = currentEnclosingBox->layer()) { >+ const PlatformWheelEvent* platformEvent = wheelEvent->wheelEvent(); >+ bool scrollingWasHandled; >+ if (platformEvent != nullptr) >+ scrollingWasHandled = boxLayer->handleWheelEvent(axis == ScrollEventAxis::Vertical ? platformEvent->copyIgnoringHorizontalDelta() : platformEvent->copyIgnoringVerticalDelta()); >+ else >+ scrollingWasHandled = didScrollInScrollableAreaForSingleAxis(boxLayer, wheelEvent, axis); >+ >+ if (scrollingWasHandled) { >+ if (stopElement) >+ *stopElement = currentEnclosingBox->element(); >+ return true; >+ } >+ } >+ >+ if (stopElement && *stopElement && *stopElement == currentEnclosingBox->element()) >+ return true; >+ >+ currentEnclosingBox = currentEnclosingBox->containingBlock(); >+ if (currentEnclosingBox && currentEnclosingBox->isRenderNamedFlowThread()) >+ currentEnclosingBox = RenderNamedFlowThread::fragmentFromRenderBoxAsRenderBlock(currentEnclosingBox, roundedIntPoint(wheelEvent->absoluteLocation()), initialEnclosingBox); >+ if (!currentEnclosingBox || currentEnclosingBox->isRenderView()) >+ return false; >+ } >+ return false; > } > > #if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)) >@@ -2631,7 +2666,6 @@ void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv > return; > > Element* stopElement = m_previousWheelScrolledElement.get(); >- ScrollGranularity granularity = wheelGranularityToScrollGranularity(wheelEvent->deltaMode()); > DominantScrollGestureDirection dominantDirection = DominantScrollGestureDirection::None; > > // Workaround for scrolling issues <rdar://problem/14758615>. >@@ -2642,10 +2676,10 @@ void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv > > // Break up into two scrolls if we need to. Diagonal movement on > // a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set). >- if (dominantDirection != DominantScrollGestureDirection::Vertical && scrollNode(wheelEvent->deltaX(), granularity, ScrollRight, ScrollLeft, startNode, &stopElement, roundedIntPoint(wheelEvent->absoluteLocation()))) >+ if (dominantDirection != DominantScrollGestureDirection::Vertical && handleWheelEventInAppropriateEnclosingBoxForSingleAxis(startNode, wheelEvent, &stopElement, ScrollEventAxis::Horizontal)) > wheelEvent->setDefaultHandled(); > >- if (dominantDirection != DominantScrollGestureDirection::Horizontal && scrollNode(wheelEvent->deltaY(), granularity, ScrollDown, ScrollUp, startNode, &stopElement, roundedIntPoint(wheelEvent->absoluteLocation()))) >+ if (dominantDirection != DominantScrollGestureDirection::Horizontal && handleWheelEventInAppropriateEnclosingBoxForSingleAxis(startNode, wheelEvent, &stopElement, ScrollEventAxis::Vertical)) > wheelEvent->setDefaultHandled(); > > if (!m_latchedWheelEventElement) >diff --git a/Source/WebCore/platform/ScrollTypes.h b/Source/WebCore/platform/ScrollTypes.h >index 5fd35c922165cda7bdbfd73999a1c31b9f7416bd..d616fe6ee51986e8a382bca63bf9b2a3f4f00fc7 100644 >--- a/Source/WebCore/platform/ScrollTypes.h >+++ b/Source/WebCore/platform/ScrollTypes.h >@@ -123,6 +123,8 @@ namespace WebCore { > > enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar }; > >+ enum class ScrollEventAxis { Horizontal, Vertical }; >+ > typedef unsigned ScrollbarControlState; > > enum ScrollbarControlStateMask { >diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h >index bc8b8f18e8d1828d369637ef7fb198c6d1686d76..600b7d4f18921fe646a658cd531b415f85973cb4 100644 >--- a/Source/WebCore/rendering/RenderListBox.h >+++ b/Source/WebCore/rendering/RenderListBox.h >@@ -59,6 +59,8 @@ public: > > int size() const; > >+ virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override; >+ > virtual bool scrolledToTop() const override; > virtual bool scrolledToBottom() const override; > virtual bool scrolledToLeft() const override; >@@ -78,7 +80,6 @@ private: > > virtual bool isPointInOverflowControl(HitTestResult&, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset) override; > >- virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override; > virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override; > > virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; >diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.cpp b/Source/WebCore/rendering/RenderNamedFlowThread.cpp >index a2334681504b8d28e2b5e980288e5ae923b58de1..9d94e0a1560b4c9181a88a2f44b7d08c45db836a 100644 >--- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp >+++ b/Source/WebCore/rendering/RenderNamedFlowThread.cpp >@@ -375,6 +375,11 @@ LayoutRect RenderNamedFlowThread::decorationsClipRectForBoxInNamedFlowFragment(c > return visualOverflowRect; > } > >+RenderBlock* RenderNamedFlowThread::fragmentFromRenderBoxAsRenderBlock(RenderBox* renderBox, const IntPoint& absolutePoint, const RenderBox& flowedBox) >+{ >+ return toRenderNamedFlowThread(renderBox)->fragmentFromAbsolutePointAndBox(absolutePoint, flowedBox); >+} >+ > RenderNamedFlowFragment* RenderNamedFlowThread::fragmentFromAbsolutePointAndBox(const IntPoint& absolutePoint, const RenderBox& flowedBox) > { > RenderRegion* startRegion = nullptr; >diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.h b/Source/WebCore/rendering/RenderNamedFlowThread.h >index 01d7cef6deabff2039736e460d653b10df3dfebb..ede9c07c013b8f731eddf54ef70a071b78c2c209 100644 >--- a/Source/WebCore/rendering/RenderNamedFlowThread.h >+++ b/Source/WebCore/rendering/RenderNamedFlowThread.h >@@ -62,6 +62,8 @@ public: > bool hasChild(RenderElement& child) const { return m_flowThreadChildList.contains(&child); } > #endif > >+ static RenderBlock* fragmentFromRenderBoxAsRenderBlock(RenderBox*, const IntPoint& absolutePoint, const RenderBox& flowedBox); >+ > void pushDependencies(RenderNamedFlowThreadList&); > > virtual void addRegionToThread(RenderRegion*) override;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 135195
:
235375
|
235438
|
235455
|
235457
|
235470
|
235480
|
235490
|
235523
|
235526
|
235530
|
235533
|
235613
|
235621
|
235694
| 235721