Diff
Modified: trunk/LayoutTests/ChangeLog (283753 => 283754)
--- trunk/LayoutTests/ChangeLog 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/LayoutTests/ChangeLog 2021-10-07 23:25:05 UTC (rev 283754)
@@ -1,3 +1,15 @@
+2021-10-07 Alan Bujtas <[email protected]>
+
+ Do not check for firstLineStyle while constructing RenderText
+ https://bugs.webkit.org/show_bug.cgi?id=231370
+ <rdar://83973189>
+
+ Reviewed by Antti Koivisto.
+
+ * TestExpectations: existing bug surfaced by this change.
+ * fast/inline/first-line-style-too-early-crash-expected.txt: Added.
+ * fast/inline/first-line-style-too-early-crash.html: Added.
+
2021-10-07 Ayumi Kojima <[email protected]>
[ iOS ] Marking expectations as slow for the tests that are flaky timing out.
Modified: trunk/LayoutTests/TestExpectations (283753 => 283754)
--- trunk/LayoutTests/TestExpectations 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/LayoutTests/TestExpectations 2021-10-07 23:25:05 UTC (rev 283754)
@@ -4667,6 +4667,7 @@
webkit.org/b/214461 imported/w3c/web-platform-tests/css/css-pseudo/marker-unicode-bidi-default.html [ ImageOnlyFailure ]
webkit.org/b/214461 imported/w3c/web-platform-tests/css/css-pseudo/marker-unicode-bidi-normal.html [ ImageOnlyFailure ]
webkit.org/b/214461 imported/w3c/web-platform-tests/css/css-pseudo/spelling-error-001.html [ ImageOnlyFailure ]
+webkit.org/b/230964 imported/w3c/web-platform-tests/css/css-pseudo/first-line-and-placeholder.html [ ImageOnlyFailure ]
webkit.org/b/214462 imported/w3c/web-platform-tests/css/css-scoping/host-context-specificity-001.html [ ImageOnlyFailure ]
webkit.org/b/214462 imported/w3c/web-platform-tests/css/css-scoping/host-context-specificity-002.html [ ImageOnlyFailure ]
Added: trunk/LayoutTests/fast/inline/first-line-style-too-early-crash-expected.txt (0 => 283754)
--- trunk/LayoutTests/fast/inline/first-line-style-too-early-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/inline/first-line-style-too-early-crash-expected.txt 2021-10-07 23:25:05 UTC (rev 283754)
@@ -0,0 +1 @@
+PASS if no crash or assert.
Added: trunk/LayoutTests/fast/inline/first-line-style-too-early-crash.html (0 => 283754)
--- trunk/LayoutTests/fast/inline/first-line-style-too-early-crash.html (rev 0)
+++ trunk/LayoutTests/fast/inline/first-line-style-too-early-crash.html 2021-10-07 23:25:05 UTC (rev 283754)
@@ -0,0 +1,16 @@
+<style>
+ ::first-line {
+ width: 0;
+ }
+</style>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+ _onload_ = () => {
+ document.designMode = 'on';
+ document.execCommand('SelectAll');
+ document.execCommand('Bold');
+ document.execCommand('InsertOrderedList');
+ };
+</script>
+<div></div>PASS if no crash or assert.
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (283753 => 283754)
--- trunk/Source/WebCore/ChangeLog 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/ChangeLog 2021-10-07 23:25:05 UTC (rev 283754)
@@ -1,3 +1,27 @@
+2021-10-07 Alan Bujtas <[email protected]>
+
+ Do not check for firstLineStyle while constructing RenderText
+ https://bugs.webkit.org/show_bug.cgi?id=231370
+ <rdar://83973189>
+
+ Reviewed by Antti Koivisto.
+
+ First line computation requires the renderer to be fully attached to the tree.
+ Let's check for "can use simplified text measuring for first line" at a later time, when we
+ construct the LFC tree instead.
+
+ Test: fast/inline/first-line-style-too-early-crash.html
+
+ * layout/formattingContexts/inline/InlineTextItem.cpp:
+ (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
+ * layout/formattingContexts/inline/text/TextUtil.cpp:
+ (WebCore::Layout::TextUtil::canUseSimplifiedTextMeasuringForFirstLine):
+ * layout/formattingContexts/inline/text/TextUtil.h:
+ * layout/integration/LayoutIntegrationBoxTree.cpp:
+ (WebCore::LayoutIntegration::BoxTree::buildTree):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
+
2021-10-07 Myles C. Maxfield <[email protected]>
Stop parsing font palette things that we can't implement
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp (283753 => 283754)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp 2021-10-07 23:25:05 UTC (rev 283754)
@@ -86,10 +86,9 @@
unsigned currentPosition = 0;
auto inlineItemWidth = [&](auto startPosition, auto length) -> std::optional<InlineLayoutUnit> {
- if (!inlineTextBox.canUseSimplifiedContentMeasuring())
+ if (!inlineTextBox.canUseSimplifiedContentMeasuring()
+ || !TextUtil::canUseSimplifiedTextMeasuringForFirstLine(inlineTextBox.style(), inlineTextBox.firstLineStyle()))
return { };
- if (inlineTextBox.style() != inlineTextBox.firstLineStyle())
- return { };
return TextUtil::width(inlineTextBox, fontCascade, startPosition, startPosition + length, { });
};
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp (283753 => 283754)
--- trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp 2021-10-07 23:25:05 UTC (rev 283754)
@@ -241,6 +241,11 @@
return LineBreakIteratorMode::Default;
}
+bool TextUtil::canUseSimplifiedTextMeasuringForFirstLine(const RenderStyle& style, const RenderStyle& firstLineStyle)
+{
+ return style.collapseWhiteSpace() == firstLineStyle.collapseWhiteSpace() && style.fontCascade() == firstLineStyle.fontCascade();
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h (283753 => 283754)
--- trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h 2021-10-07 23:25:05 UTC (rev 283754)
@@ -63,6 +63,7 @@
static bool shouldPreserveSpacesAndTabs(const Box&);
static bool shouldPreserveNewline(const Box&);
+ static bool canUseSimplifiedTextMeasuringForFirstLine(const RenderStyle&, const RenderStyle& firstLineStyle);
};
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (283753 => 283754)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-10-07 23:25:05 UTC (rev 283754)
@@ -37,6 +37,7 @@
#include "RenderChildIterator.h"
#include "RenderImage.h"
#include "RenderLineBreak.h"
+#include "TextUtil.h"
namespace WebCore {
namespace LayoutIntegration {
@@ -89,9 +90,14 @@
if (is<RenderText>(childRenderer)) {
auto& textRenderer = downcast<RenderText>(childRenderer);
auto style = RenderStyle::createAnonymousStyleWithDisplay(textRenderer.style(), DisplayType::Inline);
+ auto canUseSimplifiedTextMeasuring = [&] {
+ if (!textRenderer.canUseSimplifiedTextMeasuring())
+ return false;
+ return !firstLineStyle || Layout::TextUtil::canUseSimplifiedTextMeasuringForFirstLine(style, *firstLineStyle);
+ }();
return makeUnique<Layout::InlineTextBox>(
style.textSecurity() == TextSecurity::None ? textRenderer.text() : RenderBlock::updateSecurityDiscCharacters(style, textRenderer.text())
- , textRenderer.canUseSimplifiedTextMeasuring(), WTFMove(style), WTFMove(firstLineStyle));
+ , canUseSimplifiedTextMeasuring, WTFMove(style), WTFMove(firstLineStyle));
}
auto style = RenderStyle::clone(childRenderer.style());
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (283753 => 283754)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2021-10-07 23:12:14 UTC (rev 283753)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2021-10-07 23:25:05 UTC (rev 283754)
@@ -1431,12 +1431,6 @@
// FIXME: All these checks should be more fine-grained at the inline item level.
auto& style = this->style();
- if (&style != &firstLineStyle()) {
- auto& firstLineStyle = this->firstLineStyle();
- if (style.fontCascade() != firstLineStyle.fontCascade() || style.collapseWhiteSpace() != firstLineStyle.collapseWhiteSpace())
- return false;
- }
-
auto& fontCascade = style.fontCascade();
if (fontCascade.wordSpacing() || fontCascade.letterSpacing())
return false;