Backed out changeset 81cb45b03bc8 (bug 1824603) for causing reftest failures in foreignObject-zoom-01.svg CLOSED TREE

This commit is contained in:
Cristian Tuns 2023-04-03 07:25:45 -04:00
Родитель 5ba7a2fb3a
Коммит 78a197a2d1
4 изменённых файлов: 18 добавлений и 67 удалений

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

@ -26,7 +26,6 @@ skip-if = bits == 64 && (os == "mac" || os == "linux") #Bug 1646862
[browser_containerLoadingContent.js]
skip-if =
os == "win" && os_version == "6.1" # Skip on Azure - frequent failure
[browser_ImageDocument_svg_zoom.js]
[browser_submission_flush.js]
[browser_refresh_after_document_write.js]
support-files =

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

@ -1,36 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const URL = `data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="green"/></svg>`;
function test_once() {
return BrowserTestUtils.withNewTab(URL, async browser => {
return await SpecialPowers.spawn(browser, [], async function() {
const rect = content.document.documentElement.getBoundingClientRect();
info(`${rect.width}, ${rect.height}`);
is(
rect.height,
content.innerHeight,
"Should fill the viewport and not overflow"
);
});
});
}
add_task(async function test_with_no_text_zoom() {
await test_once();
});
add_task(async function test_with_text_zoom() {
let dpi = window.devicePixelRatio;
await SpecialPowers.pushPrefEnv({ set: [["ui.textScaleFactor", 200]] });
ok(
window.devicePixelRatio > dpi,
"DPI should change as a result of the pref flip"
);
return test_once();
});

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

@ -40,7 +40,12 @@ NS_IMPL_FRAMEARENA_HELPERS(SVGOuterSVGFrame)
SVGOuterSVGFrame::SVGOuterSVGFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID),
mFullZoom(PresContext()->GetFullZoom()),
mCallingReflowSVG(false),
mIsRootContent(false),
mIsInObjectOrEmbed(false),
mIsInIframe(false) {
// Outer-<svg> has CSS layout, so remove this bit:
RemoveStateBits(NS_FRAME_SVG_LAYOUT);
AddStateBits(NS_FRAME_REFLOW_ROOT | NS_FRAME_FONT_INFLATION_CONTAINER |
@ -61,16 +66,6 @@ static inline ContainSizeAxes ContainSizeAxesIfApplicable(
return aFrame->GetContainSizeAxes();
}
// This should match ImageDocument::GetZoomLevel.
float SVGOuterSVGFrame::ComputeFullZoom() const {
MOZ_ASSERT(mIsRootContent);
MOZ_ASSERT(!mIsInIframe);
if (BrowsingContext* bc = PresContext()->Document()->GetBrowsingContext()) {
return bc->FullZoom();
}
return 1.0f;
}
void SVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
@ -103,9 +98,6 @@ void SVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
mIsInIframe = nsGkAtoms::iframe->Equals(*type);
}
}
if (!mIsInIframe) {
mFullZoom = ComputeFullZoom();
}
}
MaybeSendIntrinsicSizeAndRatioToEmbedder();
@ -263,7 +255,7 @@ nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
LogicalSize cbSize = aCBSize;
IntrinsicSize intrinsicSize = GetIntrinsicSize();
if (mIsRootContent) {
if (!mContent->GetParent()) {
// We're the root of the outermost browsing context, so we need to scale
// cbSize by the full-zoom so that SVGs with percentage width/height zoom:
@ -272,8 +264,8 @@ nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
"root should not have auto-width/height containing block");
if (!mIsInIframe) {
cbSize.ISize(aWritingMode) *= mFullZoom;
cbSize.BSize(aWritingMode) *= mFullZoom;
cbSize.ISize(aWritingMode) *= PresContext()->GetFullZoom();
cbSize.BSize(aWritingMode) *= PresContext()->GetFullZoom();
}
// We also need to honour the width and height attributes' default values
@ -282,7 +274,7 @@ nsIFrame::SizeComputationResult SVGOuterSVGFrame::ComputeSize(
// intrinsic size. Also note that explicit percentage values are mapped
// into style, so the following isn't for them.)
auto* content = static_cast<SVGSVGElement*>(GetContent());
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
const SVGAnimatedLength& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
@ -391,12 +383,9 @@ void SVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
changeBits |= COORD_CONTEXT_CHANGED;
svgElem->SetViewportSize(newViewportSize);
}
if (mIsRootContent && !mIsInIframe) {
const auto oldZoom = mFullZoom;
mFullZoom = ComputeFullZoom();
if (oldZoom != mFullZoom) {
changeBits |= FULL_ZOOM_CHANGED;
}
if (mFullZoom != PresContext()->GetFullZoom() && !mIsInIframe) {
changeBits |= FULL_ZOOM_CHANGED;
mFullZoom = PresContext()->GetFullZoom();
}
if (changeBits && !HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
NotifyViewportOrTransformChanged(changeBits);

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

@ -143,18 +143,17 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
* being used as an image.
*/
bool IsRootOfImage();
float ComputeFullZoom() const;
void MaybeSendIntrinsicSizeAndRatioToEmbedder();
void MaybeSendIntrinsicSizeAndRatioToEmbedder(Maybe<IntrinsicSize>,
Maybe<AspectRatio>);
float mFullZoom = 1.0f;
float mFullZoom;
bool mCallingReflowSVG = false;
bool mIsRootContent = false;
bool mIsInObjectOrEmbed = false;
bool mIsInIframe = false;
bool mCallingReflowSVG;
bool mIsRootContent;
bool mIsInObjectOrEmbed;
bool mIsInIframe;
};
////////////////////////////////////////////////////////////////////////