Skip to content

Commit 4294162

Browse files
committed
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
1 parent 6adee62 commit 4294162

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

gfx/layers/apz/test/mochitest/mochitest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
[test_group_pointerevents.html]
7070
skip-if = os == 'win' && os_version == '10.0' # Bug 1404836
7171
[test_group_touchevents.html]
72-
skip-if = webrender || (verify && debug && (os == 'win')) # bug 1424752
72+
skip-if = (verify && debug && (os == 'win'))
7373
[test_group_wheelevents.html]
7474
skip-if = (toolkit == 'android') # wheel events not supported on mobile
7575
[test_group_zoom.html]

layout/generic/nsFrame.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11263,10 +11263,31 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
1126311263
}
1126411264
}
1126511265

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

layout/painting/nsDisplayList.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,10 @@ class nsDisplayListBuilder {
734734
{
735735
mCompositorHitTestInfo = aHitTestInfo;
736736
}
737+
nsDisplayCompositorHitTestInfo* GetCompositorHitTestInfo() const
738+
{
739+
return mCompositorHitTestInfo;
740+
}
737741

738742
/**
739743
* Builds a new nsDisplayCompositorHitTestInfo for the frame |aFrame| if

0 commit comments

Comments
 (0)