Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1866939) for causing very frequent Andro…
Browse files Browse the repository at this point in the history
…id mochitest failure in test_group_zoomToFocusedInput.html on a CLOSED TREE

Backed out changeset b0542bbe1fe7 (bug 1866939)
Backed out changeset 6fb1b891307b (bug 1866939)
  • Loading branch information
chorotan committed Jan 17, 2024
1 parent 3933e3d commit 6f390e9
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 170 deletions.
2 changes: 0 additions & 2 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3106,8 +3106,6 @@ nsDOMWindowUtils::ZoomToFocusedInput() {
return NS_OK;
}

bounds -= CSSPoint::FromAppUnits(rootScrollFrame->GetScrollPosition());

bool waitForRefresh = false;
for (nsIScrollableFrame* scrollAncestor :
CollectScrollableAncestors(element->GetPrimaryFrame())) {
Expand Down
10 changes: 2 additions & 8 deletions gfx/layers/apz/src/APZCTreeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3353,24 +3353,18 @@ CSSToCSSMatrix4x4 APZCTreeManager::GetOopifToRootContentTransform(
result.PostScale(1.0 / rootZoom.scale, 1.0 / rootZoom.scale, 1.0);
}

CSSPoint rootScrollPosition = rootContentApzc->GetLayoutScrollOffset();
return ViewAs<CSSToCSSMatrix4x4>(result,
PixelCastJustification::UntypedPrePostScale)
.PostTranslate(rootScrollPosition.x, rootScrollPosition.y, 0);
PixelCastJustification::UntypedPrePostScale);
}

CSSRect APZCTreeManager::ConvertRectInApzcToRoot(AsyncPanZoomController* aApzc,
const CSSRect& aRect) const {
MOZ_ASSERT(aApzc->IsRootForLayersId());
RefPtr<AsyncPanZoomController> rootContentApzc = FindZoomableApzc(aApzc);
if (!rootContentApzc) {
if (!rootContentApzc || rootContentApzc == aApzc) {
return aRect;
}

if (rootContentApzc == aApzc) {
return aRect + rootContentApzc->GetLayoutScrollOffset();
}

return GetOopifToRootContentTransform(aApzc).TransformBounds(aRect);
}

Expand Down
5 changes: 2 additions & 3 deletions gfx/layers/apz/src/APZCTreeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
const AsyncTransformComponents& aComponents) const;

/*
* Returns the matrix which transforms coordinates relative to the layout
* viewport of |aApzc|, to be relative to the document origin of the root
* content APZC of |aApzc|.
* Returns the transform matrix from |aApzc| to the root content APZC of
* |aApzc|.
* |aApzc| must be the root APZC of an out-of-process iframe.
*/
CSSToCSSMatrix4x4 GetOopifToRootContentTransform(
Expand Down
4 changes: 4 additions & 0 deletions gfx/layers/apz/src/AsyncPanZoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,10 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(
MOZ_ASSERT(this == treeManagerLocal->FindRootApzcFor(GetLayersId()));
transformToRootContentApzc =
treeManagerLocal->GetOopifToRootContentTransform(this);

CSSPoint rootScrollPosition = rootContentApzc->GetLayoutScrollOffset();
transformToRootContentApzc.PostTranslate(rootScrollPosition.x,
rootScrollPosition.y, 0);
}
}
}
Expand Down
35 changes: 0 additions & 35 deletions gfx/layers/apz/test/mochitest/apz_test_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1285,38 +1285,3 @@ function collectSampledScrollOffsets(aElement) {
SpecialPowers.wrap(result).scrollId == scrollId
);
}

function cloneVisualViewport() {
return {
offsetLeft: visualViewport.offsetLeft,
offsetTop: visualViewport.offsetTop,
pageLeft: visualViewport.pageLeft,
pageTop: visualViewport.pageTop,
width: visualViewport.width,
height: visualViewport.height,
scale: visualViewport.scale,
};
}

function compareVisualViewport(
aVisualViewportValue1,
aVisualViewportValue2,
aMessage
) {
for (let p in aVisualViewportValue1) {
// Due to the method difference of the calculation for double-tap-zoom in
// OOP iframes, we allow 1.0 difference in each visualViewport value.
// NOTE: Because of our layer pixel snapping (bug 1774315 and bug 1852884)
// the visual viewport metrics can have one more pixel difference so we
// allow it here.
const tolerance = 1.0 + 1.0;
isfuzzy(
aVisualViewportValue1[p],
aVisualViewportValue2[p],
aVisualViewportValue1.scale > 1.0
? tolerance
: tolerance / aVisualViewportValue1.scale,
`${p} should be same on ${aMessage}`
);
}
}
26 changes: 26 additions & 0 deletions gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@
});
}

function cloneVisualViewport() {
return {
offsetLeft: visualViewport.offsetLeft,
offsetTop: visualViewport.offsetTop,
pageLeft: visualViewport.pageLeft,
pageTop: visualViewport.pageTop,
width: visualViewport.width,
height: visualViewport.height,
scale: visualViewport.scale,
};
}

function compareVisualViewport(aVisualViewportValue1, aVisualViewportValue2, aMessage) {
for (let p in aVisualViewportValue1) {
// Due to the method difference of the calculation for double-tap-zoom in
// OOP iframes, we allow 1.0 difference in each visualViewport value.
// NOTE: Because of our layer pixel snapping (bug 1774315 and bug 1852884)
// the visual viewport metrics can have one more pixel difference so we
// allow it here.
const tolerance = 1.0 + 1.0;
isfuzzy(aVisualViewportValue1[p], aVisualViewportValue2[p],
aVisualViewportValue1.scale > 1.0 ? tolerance : tolerance / aVisualViewportValue1.scale,
`${p} should be same on ${aMessage}`);
}
}

const useTouchpad = (location.search == "?touchpad");

async function test(aTestFile) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
{"file": "helper_zoomToFocusedInput_multiline.html"},
{"file": "helper_zoomToFocusedInput_iframe.html"},
{"file": "helper_zoomToFocusedInput_iframe.html?cross-origin"},
{"file": "helper_zoomToFocusedInput_iframe-2.html",
"prefs": [["dom.meta-viewport.enabled", true]] },
{"file": "helper_zoomToFocusedInput_fixed_bug1673511.html"},
{"file": "helper_zoomToFocusedInput_nozoom_bug1738696.html"},
{"file": "helper_zoomToFocusedInput_nested_position_fixed.html"},
Expand Down
5 changes: 0 additions & 5 deletions widget/nsIWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -2032,11 +2032,6 @@ class nsIWidget : public nsISupports {
virtual TextEventDispatcherListener*
GetNativeTextEventDispatcherListener() = 0;

/**
* Trigger an animation to zoom to the given |aRect|.
* |aRect| should be relative to the layout viewport of the widget's root
* document
*/
virtual void ZoomToRect(const uint32_t& aPresShellId,
const ScrollableLayerGuid::ViewID& aViewId,
const CSSRect& aRect, const uint32_t& aFlags) = 0;
Expand Down

0 comments on commit 6f390e9

Please sign in to comment.