Bug 1901414 - Flush layout before firing SVG image doc load. r=dshin, a=RyanVM

This commit is contained in:
Emilio Cobos Álvarez 2024-06-14 07:33:45 +00:00
parent 50ae660151
commit c01ef4310d
5 changed files with 43 additions and 2 deletions

View file

@ -319,7 +319,14 @@ nsXMLContentSink::DidBuildModel(bool aTerminated) {
mDocument->RemoveObserver(this);
mIsDocumentObserver = false;
mDocument->EndLoad();
RefPtr<Document> doc = mDocument;
if (!mDeferredLayoutStart && doc->IsBeingUsedAsImage()) {
// Eagerly layout image documents, so that layout-triggered loads have a
// chance of blocking the load event, see bug 1901414.
doc->FlushPendingNotifications(FlushType::Layout);
}
doc->EndLoad();
DropParserAndPerfHint();
}

View file

@ -63,6 +63,6 @@ load 1534346-1.html
load 1604307-1.html
load 1606499-1.html
load 1547895-1.html
skip-if(Android) skip-if(isDebugBuild) load 1747514.html # Bug 1780219
skip-if(Android||isDebugBuild||AddressSanitizer||ThreadSanitizer) load 1747514.html # Too slow for some configurations, see bug 1780219 for android for example.
HTTP load 1810896-1.html
load 1854907-1.html

View file

@ -0,0 +1,12 @@
<!doctype html>
<style>
@font-face {
font-family: CustomFont;
src: url("/fonts/Ahem.ttf");
}
svg { font: 25px/1 CustomFont }
body { margin: 0 }
</style>
<svg width="800" height="80">
<text x="0" y="0">Hello, world!</text>
</svg>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -0,0 +1,11 @@
<!doctype html>
<meta charset=utf-8>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1901414">
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<link rel="match" href="text-font-face-load-image-ref.html">
<style>
img { image-rendering: crisp-edges }
body { margin: 0 }
</style>
<img id="image" src="text-font-face-load-image-svg.svg">