Bug 1421384 - Inherit touch-action flags down in the compositor hit-test infos. r=miko

Per the touch-action spec, the effective touch-action on an element includes
touch-action restrictions from ancestor elements up to and including the
element that has the "default action". This patch implements that behaviour
so that WebRender gets correct touch-action values on its display items.

MozReview-Commit-ID: Cw5uqAsE9qm

--HG--
extra : rebase_source : ef6e24a66385e097d50b3a03c06091464b1bb5b9
This commit is contained in:
Kartikaya Gupta 2018-06-11 08:29:24 -04:00
parent 6adee62041
commit 4294162115
3 changed files with 26 additions and 1 deletions

View File

@ -69,7 +69,7 @@
[test_group_pointerevents.html]
skip-if = os == 'win' && os_version == '10.0' # Bug 1404836
[test_group_touchevents.html]
skip-if = webrender || (verify && debug && (os == 'win')) # bug 1424752
skip-if = (verify && debug && (os == 'win'))
[test_group_wheelevents.html]
skip-if = (toolkit == 'android') # wheel events not supported on mobile
[test_group_zoom.html]

View File

@ -11263,10 +11263,31 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
}
}
// Inherit the touch-action flags from the parent, if there is one. We do this
// because of how the touch-action on a frame combines the touch-action from
// ancestor DOM elements. Refer to the documentation in TouchActionHelper.cpp
// for details; this code is meant to be equivalent to that code, but woven
// into the top-down recursive display list building process.
CompositorHitTestInfo inheritedTouchAction = CompositorHitTestInfo::eInvisibleToHitTest;
if (nsDisplayCompositorHitTestInfo* parentInfo = aBuilder->GetCompositorHitTestInfo()) {
inheritedTouchAction = (parentInfo->HitTestInfo() & CompositorHitTestInfo::eTouchActionMask);
}
nsIFrame* touchActionFrame = this;
if (nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this)) {
touchActionFrame = do_QueryFrame(scrollFrame);
// On scrollframes, stop inheriting the pan-x and pan-y flags; instead,
// reset them back to zero to allow panning on the scrollframe unless we
// encounter an element that disables it that's inside the scrollframe.
// This is equivalent to the |considerPanning| variable in
// TouchActionHelper.cpp, but for a top-down traversal.
CompositorHitTestInfo panMask = CompositorHitTestInfo::eTouchActionPanXDisabled
| CompositorHitTestInfo::eTouchActionPanYDisabled;
inheritedTouchAction &= ~panMask;
}
result |= inheritedTouchAction;
const uint32_t touchAction = nsLayoutUtils::GetTouchActionFromFrame(touchActionFrame);
// The CSS allows the syntax auto | none | [pan-x || pan-y] | manipulation
// so we can eliminate some combinations of things.

View File

@ -734,6 +734,10 @@ public:
{
mCompositorHitTestInfo = aHitTestInfo;
}
nsDisplayCompositorHitTestInfo* GetCompositorHitTestInfo() const
{
return mCompositorHitTestInfo;
}
/**
* Builds a new nsDisplayCompositorHitTestInfo for the frame |aFrame| if