script: Implement the FontFaceSet DOM API (#32576)

Add a skeleton implementation of FontFaceSet interface with support
for resolving the `document.fonts.ready` Promise when the loading of
web fonts is completed.

This change exposes new failures in the web platform tests.

These were ERROR before the change because `document.fonts.ready` caused
a `ReferenceError` causing the tests to be aborted and they now FAIL:
- /css/CSS2/linebox/vertical-align-top-bottom-001.html
- /css/css-flexbox/flex-one-sets-flex-basis-to-zero-px.html
- /css/css-fonts/generic-family-keywords-001.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-004.tentative.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-002.tentative.html
- /css/css-text/text-autospace/text-autospace-ligature-001.html
- /css/css-values/calc-size/calc-size-width.tentative.html

These were TIMEOUT before the change because `document.fonts.ready` was
a ReferenceError and the tests were asynchronous (reftest-wait). These now
FAIL because the assertions are now executed after fonts are loaded:
- /css/css-fonts/matching/fixed-stretch-style-over-weight.html
- /css/css-fonts/matching/range-descriptor-reversed.html
- /css/css-fonts/matching/stretch-distance-over-weight-distance.html
- /css/css-fonts/matching/style-ranges-over-weight-direction.html
- /css/css-fonts/variations/variable-box-font.html
- /css/css-fonts/variations/variable-gpos-m2b.html
- /css/css-fonts/variations/variable-gsub.html
- /css/css-fonts/variations/variable-opsz-size-adjust.html
- /css/css-position/sticky/position-sticky-change-top.html
- /css/css-position/sticky/position-sticky-fixed-ancestor.html
- /css/css-position/sticky/position-sticky-flexbox.html
- /css/css-position/sticky/position-sticky-grid.html
- /css/css-position/sticky/position-sticky-inline.html
- /css/css-position/sticky/position-sticky-rendering.html
- /css/css-position/sticky/position-sticky-stacking-context.html
- /css/css-position/sticky/position-sticky-table-td-left.html
- /css/css-position/sticky/position-sticky-table-td-right.html
- /css/css-position/sticky/position-sticky-table-tfoot-bottom.html
- /css/css-position/sticky/position-sticky-table-th-right.html
- /css/css-position/sticky/position-sticky-table-thead-top.html
- /css/css-position/sticky/position-sticky-table-tr-bottom.html
- /css/css-position/sticky/position-sticky-table-tr-top.html
- /css/css-position/sticky/position-sticky-writing-modes.html
- /css/css-pseudo/marker-intrinsic-contribution-001.html
- /css/css-text/hyphens/hyphens-character.html

These tests now PASS due to this patch:
* FAIL -> PASS
  - /html/canvas/element/text/2d.text.draw.fill.maxWidth.fontface.html
  - /html/canvas/element/text/2d.text.measure.width.empty.html
* TIMEOUT -> PASS
  - /css/css-fonts/variations/font-descriptor-range-reversed.html
  - /css/css-fonts/variations/variable-opsz.html
  - /css/css-position/sticky/position-sticky-table-th-left.html
* ERROR -> PASS
  - /css/css-fonts/generic-family-keywords-002.html
  - /css/css-fonts/generic-family-keywords-003.html
* These two tests only PASS in Layout 2020:
  - /css/CSS2/positioning/inline-static-position-001.html
  - /css/cssom-view/getBoundingClientRect-empty-inline.html

These two tests have subtests that PASS intermittenttly:
- /fetch/metadata/generated/css-font-face.sub.tentative.html
- /css/css-fonts/generic-family-keywords-001.html

These tests are new TIMEOUTS that used to FAIL because
`documents.fonts.ready` was undefined:
- /resource-timing/TAO-match.html
- /resource-timing/content-type.html
- /resource-timing/nextHopProtocol-is-tao-protected.https.html

The failure in `/resize-observer/change-layout-in-error.html` could be
due to an issue in the ResizeObserver implementation that is now exposed
with this change, but this needs more investigation.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-06-26 15:14:47 +05:30 committed by GitHub
parent 7ea894774f
commit a730469b70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 642 additions and 212 deletions

View file

@ -1,2 +1,6 @@
[vertical-align-top-bottom-001.html]
expected: ERROR
[text-top+bottom]
expected: FAIL
[text-bottom+bottom]
expected: FAIL

View file

@ -1,2 +0,0 @@
[inline-static-position-001.html]
expected: ERROR

View file

@ -1,2 +1,12 @@
[flex-one-sets-flex-basis-to-zero-px.html]
expected: ERROR
[.flexbox 3]
expected: FAIL
[.flexbox 4]
expected: FAIL
[.flexbox 5]
expected: FAIL
[.flexbox 6]
expected: FAIL

View file

@ -1,2 +1,39 @@
[generic-family-keywords-001.html]
expected: ERROR
[@font-face matching for quoted and unquoted serif]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted sans-serif]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted cursive]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted emoji]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted fantasy]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted monospace]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted fangsong]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted ui-serif]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted ui-sans-serif]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted ui-monospace]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted ui-rounded]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted system-ui]
expected: [FAIL, PASS]
[@font-face matching for quoted and unquoted math]
expected: [FAIL, PASS]

View file

@ -1,2 +0,0 @@
[generic-family-keywords-002.html]
expected: ERROR

View file

@ -1,2 +0,0 @@
[generic-family-keywords-003.html]
expected: ERROR

View file

@ -1,2 +1,2 @@
[fixed-stretch-style-over-weight.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[range-descriptor-reversed.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[stretch-distance-over-weight-distance.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[style-ranges-over-weight-direction.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,18 @@
[math-script-level-002.tentative.html]
expected: ERROR
[auto]
expected: FAIL
[auto ; starting from level 7]
expected: FAIL
[add(<integer>)]
expected: FAIL
[add(<integer>) ; starting from level 3]
expected: FAIL
[<integer>]
expected: FAIL
[<integer> ; starting from level 50]
expected: FAIL

View file

@ -1,2 +1,12 @@
[math-script-level-004.tentative.html]
expected: ERROR
[scriptPercentScaleDown=80, scriptScriptPercentScaleDown=40]
expected: FAIL
[scriptPercentScaleDown=0, scriptScriptPercentScaleDown=40]
expected: FAIL
[scriptPercentScaleDown=80, scriptScriptPercentScaleDown=0]
expected: FAIL
[No MATH table]
expected: FAIL

View file

@ -1,3 +1,4 @@
[test_datafont_same_origin.html]
expected: TIMEOUT
[Test if data:font would be treated same origin.]
expected: FAIL
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[font-descriptor-range-reversed.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[variable-box-font.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[variable-gpos-m2b.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[variable-gsub.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[variable-opsz-size-adjust.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[variable-opsz.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[position-sticky-change-top.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-fixed-ancestor.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-flexbox.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-grid.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-inline.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-rendering.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-stacking-context.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-td-left.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-td-right.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-tfoot-bottom.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[position-sticky-table-th-left.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[position-sticky-table-th-right.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-thead-top.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-tr-bottom.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-table-tr-top.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[position-sticky-writing-modes.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,12 @@
[marker-intrinsic-contribution-001.html]
expected: ERROR
[Intrinsic contribution of inside symbol marker]
expected: FAIL
[Intrinsic contribution of inside decimal marker]
expected: FAIL
[Intrinsic contribution of inside string marker]
expected: FAIL
[Intrinsic contribution of inside content marker]
expected: FAIL

View file

@ -1,2 +1,2 @@
[hyphens-character.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,3 @@
[text-autospace-ligature-001.html]
expected: ERROR
[text-autospace not implemented]
expected: FAIL

View file

@ -1,2 +1,57 @@
[calc-size-width.tentative.html]
expected: ERROR
[resolved width for width: calc-size(any, 357px)]
expected: FAIL
[resolved width for width: calc-size(any, 31%)]
expected: FAIL
[resolved width for width: calc-size(max-content, 31%)]
expected: FAIL
[resolved width for width: calc-size(fit-content, 72px)]
expected: FAIL
[resolved width for width: calc-size(37px, 93px)]
expected: FAIL
[resolved width for width: calc-size(83px, size * 3)]
expected: FAIL
[resolved width for width: calc-size(min-content, size / 2)]
expected: FAIL
[resolved width for width: calc-size(max-content, size * 1.2)]
expected: FAIL
[resolved width for width: calc-size(fit-content, size / 4 + 30px)]
expected: FAIL
[resolved width for width: calc-size(stretch, size / 2 - 10%)]
expected: FAIL
[resolved width for width: calc-size(30px, 15em)]
expected: FAIL
[resolved width for width: calc-size(calc-size(any, 30px), 15em)]
expected: FAIL
[resolved width for width: calc-size(calc-size(2in, 30px), 15em)]
expected: FAIL
[resolved width for width: calc-size(calc-size(min-content, 30px), 15em)]
expected: FAIL
[resolved width for width: calc-size(calc-size(min-content, size), size)]
expected: FAIL
[resolved width for width: calc-size(auto, size * 0.6 + 23px)]
expected: FAIL
[resolved width for width: with container width 300px]
expected: FAIL
[resolved width for width: with container width 500px]
expected: FAIL
[resolved width for width: with container width 700px]
expected: FAIL

View file

@ -1,2 +0,0 @@
[getBoundingClientRect-empty-inline.html]
expected: ERROR