mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1375944 - Increment font set generation when font-face is synchronously loaded in post-traversal. r=heycam
MozReview-Commit-ID: IJO6Uggpca4 --HG-- rename : layout/reftests/fonts/Ahem.ttf => layout/style/test/Ahem.ttf extra : rebase_source : 0fc61d16412ff48eb50129bc614607a647293542
This commit is contained in:
parent
ecd9640d99
commit
747d424555
@ -460,7 +460,24 @@ gfxUserFontEntry::ContinueLoad()
|
||||
MOZ_ASSERT(mUserFontLoadState == STATUS_LOAD_PENDING);
|
||||
MOZ_ASSERT(mSrcList[mSrcIndex].mSourceType == gfxFontFaceSrc::eSourceType_URL);
|
||||
|
||||
SetLoadState(STATUS_LOADING);
|
||||
DoLoadNextSrc(true);
|
||||
if (LoadState() != STATUS_LOADING) {
|
||||
MOZ_ASSERT(mUserFontLoadState != STATUS_LOAD_PENDING,
|
||||
"Not in parallel traversal, shouldn't get LOAD_PENDING again");
|
||||
// Loading is synchronously finished (loaded from cache or failed). We
|
||||
// need to increment the generation so that we flush the style data to
|
||||
// use the new loaded font face.
|
||||
// Without parallel traversal, we would simply get the right font data
|
||||
// after the first call to DoLoadNextSrc() in this case, so we don't need
|
||||
// to touch the generation to trigger another restyle.
|
||||
// XXX We may want to return synchronously in parallel traversal in those
|
||||
// cases as well if possible, so that we don't have an additional restyle.
|
||||
// That doesn't work currently because nsIDocument::GetDocShell (called
|
||||
// from FontFaceSet::CheckFontLoad) dereferences a weak pointer, which is
|
||||
// not allowed in parallel traversal.
|
||||
IncrementGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,7 +1,7 @@
|
||||
== ellipsis-font-fallback.html ellipsis-font-fallback-ref.html
|
||||
== line-clipping.html line-clipping-ref.html
|
||||
fuzzy-if(Android,16,244) HTTP(..) == marker-basic.html marker-basic-ref.html # Bug 1128229
|
||||
fails-if(stylo) HTTP(..) == marker-string.html marker-string-ref.html
|
||||
HTTP(..) == marker-string.html marker-string-ref.html
|
||||
skip-if(Android) HTTP(..) == bidi-simple.html bidi-simple-ref.html # Fails on Android due to anti-aliasing
|
||||
skip-if(!gtkWidget) fuzzy-if(gtkWidget,2,289) HTTP(..) == bidi-simple-scrolled.html bidi-simple-scrolled-ref.html # Fails on Windows and OSX due to anti-aliasing
|
||||
fuzzy-if(Android,24,4000) fuzzy-if(cocoaWidget,1,40) fuzzy-if(asyncPan&&!layersGPUAccelerated,140,1836) HTTP(..) == scroll-rounding.html scroll-rounding-ref.html # bug 760264
|
||||
|
BIN
layout/style/test/Ahem.ttf
Normal file
BIN
layout/style/test/Ahem.ttf
Normal file
Binary file not shown.
13
layout/style/test/file_bug1375944.html
Normal file
13
layout/style/test/file_bug1375944.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: Ahem;
|
||||
src: url(Ahem.ttf);
|
||||
}
|
||||
#test {
|
||||
display: inline-block;
|
||||
font: 64px/1 Ahem;
|
||||
margin-right: 1ex;
|
||||
}
|
||||
</style>
|
||||
<div id="test">X</div>
|
@ -155,6 +155,8 @@ support-files = file_bug1089417_iframe.html
|
||||
[test_bug1232829.html]
|
||||
[test_bug1292447.html]
|
||||
[test_bug1371488.html]
|
||||
[test_bug1375944.html]
|
||||
support-files = file_bug1375944.html Ahem.ttf
|
||||
[test_cascade.html]
|
||||
[test_ch_ex_no_infloops.html]
|
||||
[test_change_hint_optimizations.html]
|
||||
|
34
layout/style/test/test_bug1375944.html
Normal file
34
layout/style/test/test_bug1375944.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for bug 1375944</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="subframe"></iframe>
|
||||
<pre id="log">
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
async function runTest() {
|
||||
let f = new FontFace("Ahem", "url(Ahem.ttf)", {});
|
||||
await f.load();
|
||||
is(f.status, "loaded", "Loaded Ahem font");
|
||||
|
||||
let subframe = document.getElementById("subframe");
|
||||
subframe.src = "file_bug1375944.html";
|
||||
await new Promise(resolve => subframe.onload = resolve);
|
||||
let elem = subframe.contentDocument.getElementById("test");
|
||||
is(elem.getBoundingClientRect().width, 64,
|
||||
"The font should be loaded properly");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user