mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1259296 - Do not scroll snap on the main thread for wheel events handled by APZ. r=kats
MozReview-Commit-ID: DudrJuO4pFM --HG-- extra : source : a9468a25f1b937c49c5f801069d2cdc2cd610bdd extra : histedit_source : 18d04bcb32288c7713a162f0ee33650f6f10926f
This commit is contained in:
parent
4058840cb9
commit
868bc3704a
@ -3176,19 +3176,6 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
if (pluginFrame) {
|
||||
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
|
||||
action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
|
||||
} else if (!wheelEvent->mMayHaveMomentum &&
|
||||
nsLayoutUtils::IsScrollFrameWithSnapping(frameToScroll)) {
|
||||
// If the target has scroll-snapping points then we want to handle
|
||||
// the wheel event on the main thread even if we have APZ enabled. Do
|
||||
// so and let the APZ know that it should ignore this event. However,
|
||||
// if the wheel event is synthesized from a Mac trackpad or other device
|
||||
// that can generate additional momentum events, then we should allow
|
||||
// APZ to handle it, because it will track the velocity and predicted
|
||||
// destination from the momentum.
|
||||
if (wheelEvent->mFlags.mHandledByAPZ) {
|
||||
wheelEvent->PreventDefault();
|
||||
}
|
||||
action = WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
|
||||
} else if (wheelEvent->mFlags.mHandledByAPZ) {
|
||||
action = WheelPrefs::ACTION_NONE;
|
||||
} else {
|
||||
|
@ -3530,12 +3530,6 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
|
||||
if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
||||
}
|
||||
} else if (gfxPlatform::GetPlatform()->SupportsApzWheelInput() &&
|
||||
nsLayoutUtils::IsScrollFrameWithSnapping(aFrame->GetParent())) {
|
||||
// If the frame is the inner content of a scrollable frame with snap-points
|
||||
// then we want to handle wheel events for it on the main thread. Add it to
|
||||
// the d-t-c region so that APZ waits for the main thread.
|
||||
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
|
||||
}
|
||||
|
||||
// Touch action region
|
||||
|
@ -8968,16 +8968,6 @@ nsLayoutUtils::GetSelectionBoundingRect(Selection* aSel)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsLayoutUtils::IsScrollFrameWithSnapping(nsIFrame* aFrame)
|
||||
{
|
||||
nsIScrollableFrame* sf = do_QueryFrame(aFrame);
|
||||
if (!sf) {
|
||||
return false;
|
||||
}
|
||||
return sf->IsScrollFrameWithSnapping();
|
||||
}
|
||||
|
||||
/* static */ nsBlockFrame*
|
||||
nsLayoutUtils::GetFloatContainingBlock(nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -2792,10 +2792,6 @@ public:
|
||||
*/
|
||||
static nsRect GetSelectionBoundingRect(mozilla::dom::Selection* aSel);
|
||||
|
||||
/**
|
||||
* Returns true if the given frame is a scrollframe and it has snap points.
|
||||
*/
|
||||
static bool IsScrollFrameWithSnapping(nsIFrame* aFrame);
|
||||
/**
|
||||
* Calculate the bounding rect of |aContent|, relative to the origin
|
||||
* of the scrolled content of |aRootScrollFrame|.
|
||||
|
@ -108,9 +108,6 @@ public:
|
||||
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;
|
||||
virtual void SetFocus(bool aOn = true, bool aRepaint = false) override;
|
||||
|
||||
virtual bool IsScrollFrameWithSnapping() const override {
|
||||
return false;
|
||||
}
|
||||
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override;
|
||||
virtual bool ShouldPropagateComputedBSizeToScrolledContent() const override;
|
||||
|
||||
|
@ -3632,26 +3632,6 @@ static void HandleScrollPref(nsIScrollable *aScrollable, int32_t aOrientation,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ScrollFrameHelper::IsScrollFrameWithSnapping() const
|
||||
{
|
||||
nsPresContext* presContext = mOuter->PresContext();
|
||||
if (!presContext->IsDynamic() &&
|
||||
!(mIsRoot && presContext->HasPaginatedScrolling())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mIsRoot) {
|
||||
const nsStyleDisplay& display = *mOuter->StyleDisplay();
|
||||
return display.mScrollSnapTypeY != NS_STYLE_SCROLL_SNAP_TYPE_NONE ||
|
||||
display.mScrollSnapTypeX != NS_STYLE_SCROLL_SNAP_TYPE_NONE;
|
||||
} else {
|
||||
const ScrollbarStyles& display = presContext->GetViewportScrollbarStylesOverride();
|
||||
return display.mScrollSnapTypeY != NS_STYLE_SCROLL_SNAP_TYPE_NONE ||
|
||||
display.mScrollSnapTypeX != NS_STYLE_SCROLL_SNAP_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollbarStyles
|
||||
ScrollFrameHelper::GetScrollbarStylesFromFrame() const
|
||||
{
|
||||
|
@ -58,7 +58,6 @@ public:
|
||||
ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot);
|
||||
~ScrollFrameHelper();
|
||||
|
||||
bool IsScrollFrameWithSnapping() const;
|
||||
mozilla::ScrollbarStyles GetScrollbarStylesFromFrame() const;
|
||||
|
||||
// If a child frame was added or removed on the scrollframe,
|
||||
@ -752,9 +751,6 @@ public:
|
||||
virtual nsIFrame* GetScrolledFrame() const override {
|
||||
return mHelper.GetScrolledFrame();
|
||||
}
|
||||
virtual bool IsScrollFrameWithSnapping() const override {
|
||||
return mHelper.IsScrollFrameWithSnapping();
|
||||
}
|
||||
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
||||
return mHelper.GetScrollbarStylesFromFrame();
|
||||
}
|
||||
@ -1168,9 +1164,6 @@ public:
|
||||
virtual nsIFrame* GetScrolledFrame() const override {
|
||||
return mHelper.GetScrolledFrame();
|
||||
}
|
||||
virtual bool IsScrollFrameWithSnapping() const override {
|
||||
return mHelper.IsScrollFrameWithSnapping();
|
||||
}
|
||||
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const override {
|
||||
return mHelper.GetScrollbarStylesFromFrame();
|
||||
}
|
||||
|
@ -65,8 +65,6 @@ public:
|
||||
*/
|
||||
virtual mozilla::ScrollbarStyles GetScrollbarStyles() const = 0;
|
||||
|
||||
virtual bool IsScrollFrameWithSnapping() const = 0;
|
||||
|
||||
enum { HORIZONTAL = 0x01, VERTICAL = 0x02 };
|
||||
/**
|
||||
* Return the scrollbars which are visible. It's OK to call this during reflow
|
||||
|
Loading…
Reference in New Issue
Block a user