зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1866939 - Offset the in-process root frame scroll position layout in nsDOMWindowUtils::ZoomToFocusedInput(). r=botond
And complement it in APZCTreeManager::ConvertRectInApzcToRoot in the case of the given APZC is the root content one. Depends on D197259 Differential Revision: https://phabricator.services.mozilla.com/D197260
This commit is contained in:
Родитель
231270112d
Коммит
19eafbddec
|
@ -3106,6 +3106,8 @@ nsDOMWindowUtils::ZoomToFocusedInput() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bounds -= CSSPoint::FromAppUnits(rootScrollFrame->GetScrollPosition());
|
||||
|
||||
bool waitForRefresh = false;
|
||||
for (nsIScrollableFrame* scrollAncestor :
|
||||
CollectScrollableAncestors(element->GetPrimaryFrame())) {
|
||||
|
|
|
@ -3363,10 +3363,14 @@ CSSRect APZCTreeManager::ConvertRectInApzcToRoot(AsyncPanZoomController* aApzc,
|
|||
const CSSRect& aRect) const {
|
||||
MOZ_ASSERT(aApzc->IsRootForLayersId());
|
||||
RefPtr<AsyncPanZoomController> rootContentApzc = FindZoomableApzc(aApzc);
|
||||
if (!rootContentApzc || rootContentApzc == aApzc) {
|
||||
if (!rootContentApzc) {
|
||||
return aRect;
|
||||
}
|
||||
|
||||
if (rootContentApzc == aApzc) {
|
||||
return aRect + rootContentApzc->GetLayoutScrollOffset();
|
||||
}
|
||||
|
||||
return GetOopifToRootContentTransform(aApzc).TransformBounds(aRect);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,14 @@ async function setupIframe(aURL) {
|
|||
});
|
||||
}
|
||||
|
||||
let initial_resolution;
|
||||
async function test(aTestFile) {
|
||||
let iframeURL = SimpleTest.getTestFileURL(aTestFile);
|
||||
|
||||
// Load the test document in the same origin.
|
||||
await setupIframe(iframeURL);
|
||||
|
||||
let initial_resolution = await getResolution();
|
||||
initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -88,6 +89,12 @@ async function moveIframe() {
|
|||
}
|
||||
|
||||
waitUntilApzStable()
|
||||
.then(async () => test("helper_zoomToFocusedInput_iframe_subframe.html?margin-top=200vh"))
|
||||
.then(async () => {
|
||||
// Reset the scale to the initial value.
|
||||
SpecialPowers.DOMWindowUtils.setResolutionAndScaleTo(initial_resolution);
|
||||
await promiseApzFlushedRepaints();
|
||||
})
|
||||
// A test case where the layout scroll offset isn't zero.
|
||||
.then(async () => moveIframe())
|
||||
.then(async () => test("helper_zoomToFocusedInput_iframe_subframe.html"))
|
||||
|
|
|
@ -2032,6 +2032,11 @@ 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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче