- Revision
- 281465
- Author
- za...@apple.com
- Date
- 2021-08-23 13:29:28 -0700 (Mon, 23 Aug 2021)
Log Message
Simplified text measuring only works with the primary font
https://bugs.webkit.org/show_bug.cgi?id=228617
<rdar://problem/81588175>
Reviewed by Myles C. Maxfield.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-fonts/font-display/font-display-failure-fallback-expected.txt:
Source/WebCore:
This is in preparation for adding fallback font support (IFC).
The reason why this works on trunk is because computeCanUseSimplifiedTextMeasuring() is only used by
the modern line layout codepath which does not support fallback font support yet.
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuring):
* rendering/RenderText.cpp:
(WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
LayoutTests:
While running DumpRenderTree:
- DOMContentLoaded event is dispatched (parsing is done, DOM is built)
- window load event is dispatched (JS, CSS are finished loading)
- dispatchDidFinishLoad is called (this is when all the loads are complete, including web fonts)
dispatchDidFinishLoad is when DumpRenderTree declares the test complete and takes the snapshot.
Without the early font access (i.e. requesting the font during paint), the window load event and
dispatchDidFinishLoad happen the same time.
As dispatchDidFinishLoad triggers the snapshot, we initiate the font load,
but at this point the test is already declared complete so we are not going to wait for these pending loads.
We simply paint the content with whatever is available.
Now the early font access (at render tree building) triggers the font load which in turn delays the dispatchDidFinishLoad callback.
It also means the snapshot is taken at a later time when the font load is complete.
Let's adjust these test cases to make sure the test framework is not going to wait for the font loads.
* TestExpectations: Fails both with FF and Chrome (tested locally).
* fast/text/font-promises-gc-expected.txt:
* http/tests/webfont/font-loading-system-fallback-visibility-FontRanges.html:
* http/tests/webfont/font-loading-system-fallback-visibility.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (281464 => 281465)
--- trunk/LayoutTests/ChangeLog 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/ChangeLog 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1,3 +1,34 @@
+2021-08-23 Alan Bujtas <za...@apple.com>
+
+ Simplified text measuring only works with the primary font
+ https://bugs.webkit.org/show_bug.cgi?id=228617
+ <rdar://problem/81588175>
+
+ Reviewed by Myles C. Maxfield.
+
+ While running DumpRenderTree:
+ - DOMContentLoaded event is dispatched (parsing is done, DOM is built)
+ - window load event is dispatched (JS, CSS are finished loading)
+ - dispatchDidFinishLoad is called (this is when all the loads are complete, including web fonts)
+
+ dispatchDidFinishLoad is when DumpRenderTree declares the test complete and takes the snapshot.
+
+ Without the early font access (i.e. requesting the font during paint), the window load event and
+ dispatchDidFinishLoad happen the same time.
+ As dispatchDidFinishLoad triggers the snapshot, we initiate the font load,
+ but at this point the test is already declared complete so we are not going to wait for these pending loads.
+ We simply paint the content with whatever is available.
+
+ Now the early font access (at render tree building) triggers the font load which in turn delays the dispatchDidFinishLoad callback.
+ It also means the snapshot is taken at a later time when the font load is complete.
+
+ Let's adjust these test cases to make sure the test framework is not going to wait for the font loads.
+
+ * TestExpectations: Fails both with FF and Chrome (tested locally).
+ * fast/text/font-promises-gc-expected.txt:
+ * http/tests/webfont/font-loading-system-fallback-visibility-FontRanges.html:
+ * http/tests/webfont/font-loading-system-fallback-visibility.html:
+
2021-08-23 Arcady Goldmints-Orlov <agoldmi...@igalia.com>
[GLIB] imported/w3c/web-platform-tests/css/css-text/white-space/control-chars-* fail
Modified: trunk/LayoutTests/TestExpectations (281464 => 281465)
--- trunk/LayoutTests/TestExpectations 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/TestExpectations 2021-08-23 20:29:28 UTC (rev 281465)
@@ -2264,6 +2264,7 @@
# A support file for a test
imported/w3c/web-platform-tests/css/css-masking/clip-path/svg-clipPath.svg [ Skip ]
+imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-descendant-text-mutated-001.html [ Skip ]
imported/w3c/web-platform-tests/css/css-multicol/columnfill-auto-max-height-001.html
imported/w3c/web-platform-tests/css/css-multicol/columnfill-auto-max-height-002.html
Modified: trunk/LayoutTests/fast/text/font-promises-gc-expected.txt (281464 => 281465)
--- trunk/LayoutTests/fast/text/font-promises-gc-expected.txt 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/fast/text/font-promises-gc-expected.txt 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Font status: unloaded
+CONSOLE MESSAGE: Font status: loaded
CONSOLE MESSAGE: Font loaded
This test should not time out, and should say "SUCCESS".
Hello
Modified: trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility-FontRanges.html (281464 => 281465)
--- trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility-FontRanges.html 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility-FontRanges.html 2021-08-23 20:29:28 UTC (rev 281465)
@@ -21,6 +21,14 @@
</head>
<body>
This test makes sure that system fallback fonts during loading are invisible when the loading font is invisible. The test passes if this text is the only text on the page.
-<div style="font: 48px 'WebFont', 'Helvetica';">の</div>
</body>
</html>
+<script>
+window._onload_ = function() {
+ let webFontDiv = document.createElement("div");
+ webFontDiv.style.fontSize = "48px";
+ webFontDiv.style.fontFamily = "WebFont, Helvetica";
+ webFontDiv.innerHTML = "の";
+ document.body.appendChild(webFontDiv);
+};
+</script>
Modified: trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility.html (281464 => 281465)
--- trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility.html 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/http/tests/webfont/font-loading-system-fallback-visibility.html 2021-08-23 20:29:28 UTC (rev 281465)
@@ -21,6 +21,14 @@
</head>
<body>
This test makes sure that system fallback fonts (occuring when falling off the end of the fallback list) during loading are invisible when the loading font is invisible. The test passes if this text is the only text on the page.
-<div style="font: 48px 'WebFont', 'WebFont2', 'Helvetica';">の</div>
</body>
</html>
+<script>
+window._onload_ = function() {
+ let webFontDiv = document.createElement("div");
+ webFontDiv.style.fontSize = "48px";
+ webFontDiv.style.fontFamily = "WebFont, WebFont2, Helvetica";
+ webFontDiv.innerHTML = "の";
+ document.body.appendChild(webFontDiv);
+};
+</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281464 => 281465)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1,3 +1,13 @@
+2021-08-23 Alan Bujtas <za...@apple.com>
+
+ Simplified text measuring only works with the primary font
+ https://bugs.webkit.org/show_bug.cgi?id=228617
+ <rdar://problem/81588175>
+
+ Reviewed by Myles C. Maxfield.
+
+ * web-platform-tests/css/css-fonts/font-display/font-display-failure-fallback-expected.txt:
+
2021-08-23 Sihui Liu <sihui_...@apple.com>
Import permissions tests from WPT
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-display/font-display-failure-fallback-expected.txt (281464 => 281465)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-display/font-display-failure-fallback-expected.txt 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/font-display/font-display-failure-fallback-expected.txt 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1,4 +1,4 @@
hello
-FAIL Fallback for font failure period assert_equals: first source should be loaded expected 1 but got 0
+PASS Fallback for font failure period
Modified: trunk/Source/WebCore/ChangeLog (281464 => 281465)
--- trunk/Source/WebCore/ChangeLog 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/Source/WebCore/ChangeLog 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1,5 +1,23 @@
2021-08-23 Alan Bujtas <za...@apple.com>
+ Simplified text measuring only works with the primary font
+ https://bugs.webkit.org/show_bug.cgi?id=228617
+ <rdar://problem/81588175>
+
+ Reviewed by Myles C. Maxfield.
+
+ This is in preparation for adding fallback font support (IFC).
+
+ The reason why this works on trunk is because computeCanUseSimplifiedTextMeasuring() is only used by
+ the modern line layout codepath which does not support fallback font support yet.
+
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::canUseSimplifiedTextMeasuring):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
+
+2021-08-23 Alan Bujtas <za...@apple.com>
+
Pre-formatted content gets distorted when attempting to select content
https://bugs.webkit.org/show_bug.cgi?id=228655
<rdar://81288187>
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (281464 => 281465)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2021-08-23 20:29:28 UTC (rev 281465)
@@ -98,17 +98,21 @@
return block.relativePositionOffset();
}
-static bool canUseSimplifiedTextMeasuring(const StringView& content, const FontCascade& font, bool whitespaceIsCollapsed)
+static bool canUseSimplifiedTextMeasuring(const StringView& content, const FontCascade& fontCascade, bool whitespaceIsCollapsed)
{
- if (font.codePath(TextRun(content)) == FontCascade::CodePath::Complex)
+ if (fontCascade.codePath(TextRun(content)) == FontCascade::CodePath::Complex)
return false;
- if (font.wordSpacing() || font.letterSpacing())
+ if (fontCascade.wordSpacing() || fontCascade.letterSpacing())
return false;
+ auto& primaryFont = fontCascade.primaryFont();
for (unsigned i = 0; i < content.length(); ++i) {
if (!WidthIterator::characterCanUseSimplifiedTextMeasuring(content[i], whitespaceIsCollapsed))
return false;
+ auto glyphData = fontCascade.glyphDataForCharacter(content[i], false);
+ if (!glyphData.isValid() || glyphData.font != &primaryFont)
+ return false;
}
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (281464 => 281465)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2021-08-23 20:00:06 UTC (rev 281464)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2021-08-23 20:29:28 UTC (rev 281465)
@@ -1432,10 +1432,16 @@
if (font.codePath(run) != FontCascade::CodePath::Simple)
return false;
+ auto& fontCascade = style().fontCascade();
+ auto& primaryFont = fontCascade.primaryFont();
auto whitespaceIsCollapsed = style().collapseWhiteSpace();
for (unsigned i = 0; i < text().length(); ++i) {
- if (!WidthIterator::characterCanUseSimplifiedTextMeasuring(text()[i], whitespaceIsCollapsed))
+ auto character = text()[i];
+ if (!WidthIterator::characterCanUseSimplifiedTextMeasuring(character, whitespaceIsCollapsed))
return false;
+ auto glyphData = fontCascade.glyphDataForCharacter(character, false);
+ if (!glyphData.isValid() || glyphData.font != &primaryFont)
+ return false;
}
return true;
}