Skip to content

Commit

Permalink
Minor fixing to WPT css/css-fonts/fallback-remote-to-data-url.html
Browse files Browse the repository at this point in the history
1. The font style is also applied to element non-target so that we can
   verify the effect of unicode-range on data-font

2. Added 'font-display: swap' to remote-font so that we can observe the
   fallback when loading remote-font

Bug: 897539
Change-Id: I9bbe0705bc7d3a9ebbaf92f2c8c26c557adec24a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3069529
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#908594}
  • Loading branch information
xiaochengh authored and chromium-wpt-export-bot committed Aug 4, 2021
1 parent cdd20e3 commit ddaa08b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions css/css-fonts/fallback-remote-to-data-url.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
font-family: remote-font;
/* Set a long delay to make sure it doesn't finish loading */
src: url('/fonts/Revalia.woff?pipe=trickle(d1)') format('woff');
font-display: swap;
}

#target {
#target, #not-covered {
font: 25px/1 remote-font, data-font, monospace;
}
</style>
<span id="target">0123456789</span>
<span id="non-target">ABCDEFGHIJ</span>
<span id="not-covered">ABCDEFGHIJ</span>
<script>
promise_test(async () => {
// The loading of data-font may still be asynchronous. Wait to allow it to load.
Expand All @@ -40,7 +41,7 @@
target.offsetWidth, 250,
'Digits are in the unicode range of data-font and hence shaped with it');
assert_not_equals(
document.getElementById('non-target').offsetWidth, 250,
document.getElementById('not-covered').offsetWidth, 250,
'Letters are out of the unicode range of data-font and hence shaped with fallback');
}, 'We should use the inline custom font to render the page when the primary remote font is loading');
</script>

0 comments on commit ddaa08b

Please sign in to comment.