Bug 1934164. Remove unused scroll grab code. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D230635
This commit is contained in:
@@ -6948,13 +6948,6 @@ void* nsContentUtils::AllocClassMatchingInfo(nsINode* aRootNode,
|
||||
return info;
|
||||
}
|
||||
|
||||
bool nsContentUtils::HasScrollgrab(nsIContent* aContent) {
|
||||
// If we ever standardize this feature we'll want to hook this up properly
|
||||
// again. For now we're removing all the DOM-side code related to it but
|
||||
// leaving the layout and APZ handling for it in place.
|
||||
return false;
|
||||
}
|
||||
|
||||
void nsContentUtils::FlushLayoutForTree(nsPIDOMWindowOuter* aWindow) {
|
||||
if (!aWindow) {
|
||||
return;
|
||||
|
||||
@@ -2532,12 +2532,6 @@ class nsContentUtils {
|
||||
static void GetAltText(nsAString& text);
|
||||
static void GetModifierSeparatorText(nsAString& text);
|
||||
|
||||
/**
|
||||
* Returns if aContent has the 'scrollgrab' property.
|
||||
* aContent may be null (in this case false is returned).
|
||||
*/
|
||||
static bool HasScrollgrab(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Flushes the layout tree (recursively)
|
||||
*
|
||||
|
||||
@@ -267,9 +267,6 @@ std::ostream& operator<<(std::ostream& aStream,
|
||||
if (aMetadata.GetScrollParentId() != ScrollableLayerGuid::NULL_SCROLL_ID) {
|
||||
aStream << "] [scrollParent=" << aMetadata.GetScrollParentId();
|
||||
}
|
||||
if (aMetadata.GetHasScrollgrab()) {
|
||||
aStream << "] [scrollgrab";
|
||||
}
|
||||
aStream << "] [overscroll=" << aMetadata.GetOverscrollBehavior() << "] ["
|
||||
<< aMetadata.GetScrollUpdates().Length() << " scrollupdates"
|
||||
<< "] }";
|
||||
|
||||
@@ -752,7 +752,6 @@ struct ScrollMetadata {
|
||||
mPageScrollAmount(0, 0),
|
||||
mInteractiveWidget(
|
||||
dom::InteractiveWidgetUtils::DefaultInteractiveWidgetMode()),
|
||||
mHasScrollgrab(false),
|
||||
mIsLayersIdRoot(false),
|
||||
mIsAutoDirRootContentRTL(false),
|
||||
mForceDisableApz(false),
|
||||
@@ -771,7 +770,6 @@ struct ScrollMetadata {
|
||||
mLineScrollAmount == aOther.mLineScrollAmount &&
|
||||
mPageScrollAmount == aOther.mPageScrollAmount &&
|
||||
mInteractiveWidget == aOther.mInteractiveWidget &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
|
||||
mIsAutoDirRootContentRTL == aOther.mIsAutoDirRootContentRTL &&
|
||||
mForceDisableApz == aOther.mForceDisableApz &&
|
||||
@@ -827,10 +825,6 @@ struct ScrollMetadata {
|
||||
void SetPageScrollAmount(const LayoutDeviceIntSize& size) {
|
||||
mPageScrollAmount = size;
|
||||
}
|
||||
void SetHasScrollgrab(bool aHasScrollgrab) {
|
||||
mHasScrollgrab = aHasScrollgrab;
|
||||
}
|
||||
bool GetHasScrollgrab() const { return mHasScrollgrab; }
|
||||
void SetIsLayersIdRoot(bool aValue) { mIsLayersIdRoot = aValue; }
|
||||
bool IsLayersIdRoot() const { return mIsLayersIdRoot; }
|
||||
void SetIsAutoDirRootContentRTL(bool aValue) {
|
||||
@@ -957,9 +951,6 @@ struct ScrollMetadata {
|
||||
// be checked on AsyncPanZoomController::mScrollMetadata.
|
||||
dom::InteractiveWidget mInteractiveWidget;
|
||||
|
||||
// Whether or not this frame is for an element marked 'scrollgrab'.
|
||||
bool mHasScrollgrab : 1;
|
||||
|
||||
// Whether these framemetrics are for the root scroll frame (root element if
|
||||
// we don't have a root scroll frame) for its layers id.
|
||||
bool mIsLayersIdRoot : 1;
|
||||
|
||||
@@ -3076,11 +3076,6 @@ APZCTreeManager::BuildOverscrollHandoffChain(
|
||||
apzc = scrollParent.get();
|
||||
}
|
||||
|
||||
// Now adjust the chain to account for scroll grabbing. Sorting is a bit
|
||||
// of an overkill here, but scroll grabbing will likely be generalized
|
||||
// to scroll priorities, so we might as well do it this way.
|
||||
result->SortByScrollPriority();
|
||||
|
||||
// Print the overscroll chain for debugging.
|
||||
for (uint32_t i = 0; i < result->Length(); ++i) {
|
||||
APZCTM_LOG("OverscrollHandoffChain[%d] = %p\n", i,
|
||||
|
||||
@@ -5671,7 +5671,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
||||
Metrics().SetCumulativeResolution(aLayerMetrics.GetCumulativeResolution());
|
||||
Metrics().SetTransformToAncestorScale(
|
||||
aLayerMetrics.GetTransformToAncestorScale());
|
||||
mScrollMetadata.SetHasScrollgrab(aScrollMetadata.GetHasScrollgrab());
|
||||
mScrollMetadata.SetLineScrollAmount(aScrollMetadata.GetLineScrollAmount());
|
||||
mScrollMetadata.SetPageScrollAmount(aScrollMetadata.GetPageScrollAmount());
|
||||
mScrollMetadata.SetSnapInfo(ScrollSnapInfo(aScrollMetadata.GetSnapInfo()));
|
||||
|
||||
@@ -447,12 +447,6 @@ class AsyncPanZoomController {
|
||||
void ClearOverscroll();
|
||||
void ClearPhysicalOverscroll();
|
||||
|
||||
/**
|
||||
* Returns whether this APZC is for an element marked with the 'scrollgrab'
|
||||
* attribute.
|
||||
*/
|
||||
bool HasScrollgrab() const { return mScrollMetadata.GetHasScrollgrab(); }
|
||||
|
||||
/**
|
||||
* Returns whether this APZC has scroll snap points.
|
||||
*/
|
||||
|
||||
@@ -20,22 +20,6 @@ void OverscrollHandoffChain::Add(AsyncPanZoomController* aApzc) {
|
||||
mChain.push_back(aApzc);
|
||||
}
|
||||
|
||||
struct CompareByScrollPriority {
|
||||
bool operator()(const RefPtr<AsyncPanZoomController>& a,
|
||||
const RefPtr<AsyncPanZoomController>& b) const {
|
||||
return a->HasScrollgrab() && !b->HasScrollgrab();
|
||||
}
|
||||
};
|
||||
|
||||
void OverscrollHandoffChain::SortByScrollPriority() {
|
||||
// The sorting being stable ensures that the relative order between
|
||||
// non-scrollgrabbing APZCs remains child -> parent.
|
||||
// (The relative order between scrollgrabbing APZCs will also remain
|
||||
// child -> parent, though that's just an artefact of the implementation
|
||||
// and users of 'scrollgrab' should not rely on this.)
|
||||
std::stable_sort(mChain.begin(), mChain.end(), CompareByScrollPriority());
|
||||
}
|
||||
|
||||
const RefPtr<AsyncPanZoomController>& OverscrollHandoffChain::GetApzcAtIndex(
|
||||
uint32_t aIndex) const {
|
||||
MOZ_ASSERT(aIndex < Length());
|
||||
|
||||
@@ -26,8 +26,7 @@ class AsyncPanZoomController;
|
||||
* This class represents the chain of APZCs along which overscroll is handed
|
||||
* off. It is created by APZCTreeManager by starting from an initial APZC which
|
||||
* is the target for input events, and following the scroll parent ID links
|
||||
* (often but not always corresponding to parent pointers in the APZC tree),
|
||||
* then adjusting for scrollgrab.
|
||||
* (often but not always corresponding to parent pointers in the APZC tree).
|
||||
*/
|
||||
class OverscrollHandoffChain {
|
||||
protected:
|
||||
|
||||
@@ -142,67 +142,6 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
|
||||
rootApzc = ApzcOf(root);
|
||||
}
|
||||
|
||||
void CreateScrollgrabLayerTree(bool makeParentScrollable = true) {
|
||||
const char* treeShape = "x(x)";
|
||||
LayerIntRect layerVisibleRect[] = {
|
||||
LayerIntRect(0, 0, 100, 100), // scroll-grabbing parent
|
||||
LayerIntRect(0, 20, 100, 80) // child
|
||||
};
|
||||
CreateScrollData(treeShape, layerVisibleRect);
|
||||
float parentHeight = makeParentScrollable ? 120 : 100;
|
||||
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
|
||||
CSSRect(0, 0, 100, parentHeight));
|
||||
SetScrollableFrameMetrics(layers[1],
|
||||
ScrollableLayerGuid::START_SCROLL_ID + 1,
|
||||
CSSRect(0, 0, 100, 800));
|
||||
SetScrollHandoff(layers[1], root);
|
||||
registration = MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
|
||||
UpdateHitTestingTree();
|
||||
rootApzc = ApzcOf(root);
|
||||
rootApzc->GetScrollMetadata().SetHasScrollgrab(true);
|
||||
}
|
||||
|
||||
void TestFlingAcceleration() {
|
||||
// Jack up the fling acceleration multiplier so we can easily determine
|
||||
// whether acceleration occured.
|
||||
const float kAcceleration = 100.0f;
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_accel_base_mult", kAcceleration);
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_accel_min_fling_velocity", 0.0);
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_accel_min_pan_velocity", 0.0);
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf(layers[1]);
|
||||
|
||||
// Pan once, enough to fully scroll the scrollgrab parent and then scroll
|
||||
// and fling the child.
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID + 1);
|
||||
Pan(manager, 70, 40);
|
||||
|
||||
// Give the fling animation a chance to start.
|
||||
SampleAnimationsOnce();
|
||||
|
||||
float childVelocityAfterFling1 = childApzc->GetVelocityVector().y;
|
||||
|
||||
// Pan again.
|
||||
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID + 1);
|
||||
Pan(manager, 70, 40);
|
||||
|
||||
// Give the fling animation a chance to start.
|
||||
// This time it should be accelerated.
|
||||
SampleAnimationsOnce();
|
||||
|
||||
float childVelocityAfterFling2 = childApzc->GetVelocityVector().y;
|
||||
|
||||
// We should have accelerated once.
|
||||
// The division by 2 is to account for friction.
|
||||
EXPECT_GT(childVelocityAfterFling2,
|
||||
childVelocityAfterFling1 * kAcceleration / 2);
|
||||
|
||||
// We should not have accelerated twice.
|
||||
// The division by 4 is to account for friction.
|
||||
EXPECT_LE(childVelocityAfterFling2,
|
||||
childVelocityAfterFling1 * kAcceleration * kAcceleration / 4);
|
||||
}
|
||||
|
||||
void TestCrossApzcAxisLock() {
|
||||
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 1);
|
||||
|
||||
@@ -567,62 +506,6 @@ TEST_F(APZScrollHandoffTester, SimultaneousFlings) {
|
||||
parent2->AssertStateIsFling();
|
||||
}
|
||||
|
||||
#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
|
||||
TEST_F(APZScrollHandoffTester, Scrollgrab) {
|
||||
SCOPED_GFX_PREF_BOOL("apz.allow_immediate_handoff", true);
|
||||
|
||||
// Set up the layer tree
|
||||
CreateScrollgrabLayerTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf(layers[1]);
|
||||
|
||||
// Pan on the child, enough to fully scroll the scrollgrab parent (20 px)
|
||||
// and leave some more (another 15 px) for the child.
|
||||
Pan(childApzc, 80, 45);
|
||||
|
||||
// Check that the parent and child have scrolled as much as we expect.
|
||||
EXPECT_EQ(20, rootApzc->GetFrameMetrics().GetVisualScrollOffset().y);
|
||||
EXPECT_EQ(15, childApzc->GetFrameMetrics().GetVisualScrollOffset().y);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(APZScrollHandoffTester, ScrollgrabFling) {
|
||||
SCOPED_GFX_PREF_BOOL("apz.allow_immediate_handoff", true);
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
|
||||
|
||||
// Set up the layer tree
|
||||
CreateScrollgrabLayerTree();
|
||||
|
||||
RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf(layers[1]);
|
||||
|
||||
// Pan on the child, not enough to fully scroll the scrollgrab parent.
|
||||
Pan(childApzc, 80, 70);
|
||||
|
||||
// Check that it is the scrollgrab parent that's in a fling, not the child.
|
||||
rootApzc->AssertStateIsFling();
|
||||
childApzc->AssertStateIsReset();
|
||||
}
|
||||
|
||||
TEST_F(APZScrollHandoffTesterMock, ScrollgrabFlingAcceleration1) {
|
||||
SCOPED_GFX_PREF_BOOL("apz.allow_immediate_handoff", true);
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
|
||||
CreateScrollgrabLayerTree(true /* make parent scrollable */);
|
||||
|
||||
// Note: Usually, fling acceleration does not work across handoff, because our
|
||||
// fling acceleration code does not propagate the "fling cancel velocity"
|
||||
// across handoff. However, this test sets apz.fling_min_velocity_threshold to
|
||||
// zero, so the "fling cancel velocity" is allowed to be zero, and fling
|
||||
// acceleration succeeds, almost by accident.
|
||||
TestFlingAcceleration();
|
||||
}
|
||||
|
||||
TEST_F(APZScrollHandoffTesterMock, ScrollgrabFlingAcceleration2) {
|
||||
SCOPED_GFX_PREF_BOOL("apz.allow_immediate_handoff", true);
|
||||
SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
|
||||
CreateScrollgrabLayerTree(false /* do not make parent scrollable */);
|
||||
TestFlingAcceleration();
|
||||
}
|
||||
|
||||
TEST_F(APZScrollHandoffTester, ImmediateHandoffDisallowed_Pan) {
|
||||
SCOPED_GFX_PREF_BOOL("apz.allow_immediate_handoff", false);
|
||||
|
||||
|
||||
@@ -599,7 +599,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
|
||||
WriteParam(aWriter, aParam.mLineScrollAmount);
|
||||
WriteParam(aWriter, aParam.mPageScrollAmount);
|
||||
WriteParam(aWriter, aParam.mInteractiveWidget);
|
||||
WriteParam(aWriter, aParam.mHasScrollgrab);
|
||||
WriteParam(aWriter, aParam.mIsLayersIdRoot);
|
||||
WriteParam(aWriter, aParam.mIsAutoDirRootContentRTL);
|
||||
WriteParam(aWriter, aParam.mForceDisableApz);
|
||||
@@ -634,8 +633,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
|
||||
ReadParam(aReader, &aResult->mLineScrollAmount) &&
|
||||
ReadParam(aReader, &aResult->mPageScrollAmount) &&
|
||||
ReadParam(aReader, &aResult->mInteractiveWidget) &&
|
||||
ReadBoolForBitfield(aReader, aResult,
|
||||
¶mType::SetHasScrollgrab) &&
|
||||
ReadBoolForBitfield(aReader, aResult,
|
||||
¶mType::SetIsLayersIdRoot) &&
|
||||
ReadBoolForBitfield(aReader, aResult,
|
||||
|
||||
@@ -8931,14 +8931,6 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
|
||||
|
||||
metrics.SetPresShellId(presShell->GetPresShellId());
|
||||
|
||||
// If the scroll frame's content is marked 'scrollgrab', record this
|
||||
// in the FrameMetrics so APZ knows to provide the scroll grabbing
|
||||
// behaviour.
|
||||
if (aScrollFrame &&
|
||||
nsContentUtils::HasScrollgrab(aScrollFrame->GetContent())) {
|
||||
metadata.SetHasScrollgrab(true);
|
||||
}
|
||||
|
||||
if (ShouldDisableApzForElement(aContent)) {
|
||||
metadata.SetForceDisableApz(true);
|
||||
}
|
||||
|
||||
@@ -4205,7 +4205,7 @@ void ScrollContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// minimal display port.
|
||||
if (aBuilder->IsPaintingToWindow()) {
|
||||
if (DisplayPortUtils::HasNonMinimalDisplayPort(GetContent()) ||
|
||||
mZoomableByAPZ || nsContentUtils::HasScrollgrab(GetContent())) {
|
||||
mZoomableByAPZ) {
|
||||
aBuilder->SetContainsNonMinimalDisplayPort();
|
||||
}
|
||||
}
|
||||
@@ -4537,9 +4537,7 @@ bool ScrollContainerFrame::DecideScrollableLayer(
|
||||
// the compositor can find the scrollable layer for async scrolling.
|
||||
// If the element is marked 'scrollgrab', also force building of a layer
|
||||
// so that APZ can implement scroll grabbing.
|
||||
mWillBuildScrollableLayer = hasDisplayPort ||
|
||||
nsContentUtils::HasScrollgrab(content) ||
|
||||
mZoomableByAPZ;
|
||||
mWillBuildScrollableLayer = hasDisplayPort || mZoomableByAPZ;
|
||||
return mWillBuildScrollableLayer;
|
||||
}
|
||||
|
||||
@@ -5994,8 +5992,7 @@ bool ScrollContainerFrame::IsScrollingActive() const {
|
||||
|
||||
nsIContent* content = GetContent();
|
||||
return mHasBeenScrolledRecently || IsAlwaysActive() ||
|
||||
DisplayPortUtils::HasDisplayPort(content) ||
|
||||
nsContentUtils::HasScrollgrab(content);
|
||||
DisplayPortUtils::HasDisplayPort(content);
|
||||
}
|
||||
|
||||
void ScrollContainerFrame::FinishReflowForScrollbar(
|
||||
|
||||
Reference in New Issue
Block a user