Repository navigation
fonts: Add WebFontDocumentContext for CSS Fonts 4 font fetching - #40301
Conversation
|
🔨 Triggering try run (#18964463483) for Linux (WPT) |
TimvdLippe
left a comment
There was a problem hiding this comment.
Nice! I would expect some CSP tests to start passing as well.
|
|
mrobinson
left a comment
There was a problem hiding this comment.
Looks good from the perspective of someone who worked on the font loader. I'm not sure about the origin request parameter.
|
🔨 Triggering try run (#18981318512) for Linux (WPT) |
|
Test results for linux-wpt from try job (#18981318512): Flaky unexpected result (26)
Stable unexpected results that are known to be intermittent (16)
|
|
✨ Try run (#18981318512) succeeded. |
|
Aha, the culprit is: servo/components/fonts/font_context.rs Line 931 in 2a18c6b |
|
|
|
If my try push in https://github.com/servo/servo/actions/runs/19019558687 goes well, I would like to split this work up into three PRs in sequence:
That will hopefully put us in a position where reporting CSP violations for web fonts doesn't break tests that expect a particular CSP failure but see a violation from our injected Ahem.ttf instead. |
|
Sounds like a good plan to me |
|
Another alternative here would be to ensure that every platform has Ahem loaded into its system font cache before running the tests. It seems like this could be done by injecting it manually on Servo startup. |
About this, I wonder why it is necessary? We are currently waiting for all web fonts to load before taking screenshots. Is there another case that I'm missing here? |
There's a window of time between finishing fetching an external style sheet and starting fetching any web fonts that it defines. Without our injected user style sheet present, we end up sometimes taking a screenshot during that window so the expected font is not applied. |
Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
Signed-off-by: Josh Matthews <[email protected]>
| })); | ||
| } | ||
|
|
||
| fn clone(&self) -> Box<dyn CspViolationHandler> { |
There was a problem hiding this comment.
Can't we derive Clone for this struct? It looks like the default implementation to me
There was a problem hiding this comment.
We can derive Clone, I don't think it really helps us at all since we still need to write this method.
| pub csp_handler: Box<dyn CspViolationHandler>, | ||
| } | ||
|
|
||
| impl Clone for WebFontDocumentContext { |
There was a problem hiding this comment.
Same here, can't we derive Clone?
There was a problem hiding this comment.
Nope—the presence of the trait object makes that impossible, and trying to use trait CspViolationHandler: Clone means it can't be used as a trait object.
Rebase of #37021 with review comments applied. These changes bundle up the required information from the relevant global when a stylesheet is added so that any requests for web fonts match the specification.
Testing: Newly passing tests.
Fixes: #36590