Bug 1718012 - Call UpdateSizesBeforeReflow only for resize reflow cases and set MobileViewportManager::mMobileViewportSize even if mDisplaySize hasn't been changed in UpdateSizesBeforeReflow. r=tnikkel

In the case of reflowing caused by full zoom changes, the mDisplaySize isn't
changed, whereas mMobileViewportSize should be changed.

Differential Revision: https://phabricator.services.mozilla.com/D120190
This commit is contained in:
Hiroyuki Ikezoe 2021-08-02 21:27:19 +00:00
Родитель acb7240df4
Коммит a7abbb66f2
32 изменённых файлов: 56 добавлений и 208 удалений

Просмотреть файл

@ -3177,6 +3177,8 @@ void Document::SetCompatibilityMode(nsCompatibility aMode) {
}
mCompatMode = aMode;
CompatibilityModeChanged();
// Trigger recomputation of the nsViewportInfo the next time it's queried.
mViewportType = Unknown;
}
static void WarnIfSandboxIneffective(nsIDocShell* aDocShell,

Просмотреть файл

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test for Bug 1223561</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="text/javascript" src="file_fullscreen-utils.js"></script>
</head>
<body>
<div id="target" style="width: 100px; height: 100px; background-color: green;"></div>
<script>
"use strict";
function begin() {
info("Setting full zoom to 30%");
SpecialPowers.setFullZoom(window, 0.3);
addFullscreenChangeContinuation("enter", enteredFullscreen);
target.requestFullscreen();
}
function enteredFullscreen() {
info("The element with green background should be in fullscreen");
assertWindowPureColor(window, "green");
addFullscreenChangeContinuation("exit", exitedFullscreen);
document.exitFullscreen();
}
function exitedFullscreen() {
opener.nextTest();
}
</script>
</body>
</html>

Просмотреть файл

@ -471,6 +471,7 @@ support-files =
file_fullscreen-table.html
file_fullscreen-top-layer.html
file_fullscreen-utils.js
file_fullscreen-with-full-zoom.html
[test_fullscreen_meta_viewport.html]
support-files = file_fullscreen_meta_viewport.html

Просмотреть файл

@ -54,6 +54,7 @@ var gTestWindows = [
["dom.security.featurePolicy.webidl.enabled", true]] },
{ test: "file_fullscreen-async.html" },
{ test: "file_fullscreen-sub-iframe.html" },
{ test: "file_fullscreen-with-full-zoom.html" },
];
var testWindow = null;

Просмотреть файл

@ -48,6 +48,10 @@ MobileViewportManager::MobileViewportManager(MVMContext* aContext,
mContext->AddEventListener(LOAD, this, true);
mContext->AddObserver(this, BEFORE_FIRST_PAINT.Data(), false);
// We need to initialize the display size and the CSS viewport size before
// the initial reflow happens.
UpdateSizesBeforeReflow();
}
MobileViewportManager::~MobileViewportManager() = default;
@ -566,10 +570,6 @@ void MobileViewportManager::RefreshVisualViewportSize() {
void MobileViewportManager::UpdateSizesBeforeReflow() {
if (Maybe<LayoutDeviceIntSize> newDisplaySize =
mContext->GetContentViewerSize()) {
if (mDisplaySize == *newDisplaySize) {
return;
}
mDisplaySize = *newDisplaySize;
MVM_LOG("%p: Reflow starting, display size updated to %s\n", this,
ToString(mDisplaySize).c_str());

Просмотреть файл

@ -2009,6 +2009,10 @@ void PresShell::SimpleResizeReflow(nscoord aWidth, nscoord aHeight,
FrameNeedsReflow(rootFrame, IntrinsicDirty::Resize,
NS_FRAME_HAS_DIRTY_CHILDREN);
if (mMobileViewportManager) {
mMobileViewportManager->UpdateSizesBeforeReflow();
}
// For compat with the old code path which always reflowed as long as there
// was a root frame.
bool suppressReflow = (aOptions & ResizeReflowOptions::SuppressReflow) ||
@ -9493,10 +9497,6 @@ bool PresShell::DoReflow(nsIFrame* target, bool aInterruptible,
timeStart = TimeStamp::Now();
}
if (mMobileViewportManager) {
mMobileViewportManager->UpdateSizesBeforeReflow();
}
// Schedule a paint, but don't actually mark this frame as changed for
// retained DL building purposes. If any child frames get moved, then
// they will schedule paint again. We could probaby skip this, and just

Просмотреть файл

@ -1,8 +0,0 @@
[multicol-overflow-positioned-transform-001.html]
[Check scrollWidth before and after transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,8 +0,0 @@
[multicol-overflow-transform-001.html]
[Check scrollWidth before and after transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-001.html]
[Check scrollWidth before and after transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-002.html]
[Check scrollWidth before and after transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-003.html]
[Check scrollWidth before and after transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-004.html]
[Check scrollWidth before and after position and transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight after position and transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-005.html]
[Check scrollWidth before and after appendChild() and transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after appendChild() and transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scrollable-overflow-transform-dynamic-006.html]
[Check scrollWidth before and after removeChild() and transform chage]
expected:
if os == "android": FAIL
[Check scrollWidth and scrollHeight before and after removeChild() and transform chage]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[position-sticky-get-bounding-client-rect.html]
[sticky positioned element should be observable by getBoundingClientRect.]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[position-sticky-transforms-translate.html]
[Translation transform can move sticky element past sticking point]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[collapsed-scroll-overflow.html]
[visual overflow is included in scroll area]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,15 +1,18 @@
[viewport-units-css2-001.html]
[vh length applied to border-top-width]
expected:
if (os == "mac"): ["FAIL", "PASS"]
if os == "win": ["FAIL", "PASS"]
if os == "android": PASS
if os == "mac": [FAIL, PASS]
if os == "win": [FAIL, PASS]
if os == "android": [FAIL, PASS]
FAIL
[vmin length applied to border-top-width]
expected:
if (os == "mac"): ["FAIL", "PASS"]
if os == "win": ["FAIL", "PASS"]
if os == "mac": [FAIL, PASS]
if os == "win": [FAIL, PASS]
if os == "android": PASS
FAIL
[vmax length applied to border-top-width]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[elementScroll-002.html]
[simple scroll with style: 'margin' and 'overflow: hidden']
expected:
if (os == "android") and e10s: FAIL

Просмотреть файл

@ -1,9 +0,0 @@
[scroll-behavior-smooth.html]
[BODY element scroll-behavior should not propagate to viewport]
expected:
if (os == "android") and e10s: "FAIL"
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1556685
[HTML element scroll-behavior should propagate to viewport]
expected:
if (os == "android") and e10s: "FAIL"

Просмотреть файл

@ -1,25 +1,13 @@
[scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
@ -28,4 +16,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,21 +0,0 @@
[scrollIntoView-horizontal-tb-writing-mode.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[scrollIntoView-scrollMargin.html]
[scrollIntoView({block: "end", inline: "end"})]
expected:
if (os == "android") and e10s: FAIL

Просмотреть файл

@ -1,5 +0,0 @@
[scrollIntoView-scrollPadding.html]
[scrollIntoView({block: "end", inline: "end"})]
expected:
if (os == "android") and e10s: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-sideways-lr-writing-mode-and-rtl-direction.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -20,4 +16,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-sideways-lr-writing-mode.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -26,4 +22,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-sideways-rl-writing-mode-and-rtl-direction.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
@ -20,4 +16,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-sideways-rl-writing-mode.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -26,4 +22,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-vertical-lr-writing-mode-and-rtl-direction.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -26,4 +22,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-vertical-lr-writing-mode.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -20,4 +16,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,8 +1,4 @@
[scrollIntoView-vertical-rl-writing-mode.html]
[scrollIntoView({"block":"center","inline":"center"})]
expected:
if os == "android": FAIL
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
@ -26,4 +22,3 @@
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

Просмотреть файл

@ -1,17 +0,0 @@
[scrollLeftTop.html]
[writing-mode:vertical-rl; direction:rtl]
expected:
if os == "android": FAIL
[writing-mode:horizontal-tb; direction:ltr]
expected:
if os == "android": FAIL
[writing-mode:horizontal-tb; direction:rtl]
expected:
if os == "android": FAIL
[writing-mode:vertical-lr; direction:ltr]
expected:
if os == "android": FAIL