Diff
Modified: trunk/Source/WebCore/ChangeLog (281759 => 281760)
--- trunk/Source/WebCore/ChangeLog 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/ChangeLog 2021-08-30 15:56:19 UTC (rev 281760)
@@ -1,3 +1,29 @@
+2021-08-30 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Move hyphen handling from the integration run to IFC's display run
+ https://bugs.webkit.org/show_bug.cgi?id=229662
+
+ Reviewed by Antti Koivisto.
+
+ Move the rendered content handling (hyphen only atm) over to the IFC display runs.
+ This is in preparation for merging integration and IFC's display runs.
+
+ * display/css/DisplayBoxPainter.cpp:
+ (WebCore::Display::BoxPainter::paintBoxContent):
+ * display/css/DisplayTextBox.cpp:
+ (WebCore::Display::TextBox::debugDescription const):
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::createRunsAndUpdateGeometryForLineContent):
+ * layout/formattingContexts/inline/InlineLineRun.h:
+ (WebCore::Layout::LineRun::Text::originalContent const):
+ (WebCore::Layout::LineRun::Text::renderedContent const):
+ (WebCore::Layout::LineRun::Text::hasHyphen const):
+ (WebCore::Layout::LineRun::Text::Text):
+ (WebCore::Layout::LineRun::Text::content const): Deleted.
+ (WebCore::Layout::LineRun::Text::needsHyphen const): Deleted.
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
+
2021-08-30 Chris Dumez <[email protected]>
Implement self.reportError()
Modified: trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp (281759 => 281760)
--- trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/display/css/DisplayBoxPainter.cpp 2021-08-30 15:56:19 UTC (rev 281760)
@@ -80,7 +80,7 @@
auto baseline = textRect.y() + style.fontMetrics().ascent();
auto expansion = textBox.expansion();
- auto textRun = TextRun { textBox.text().content().substring(textBox.text().start(), textBox.text().length()), textRect.x(), expansion.horizontalExpansion, expansion.behavior };
+ auto textRun = TextRun { textBox.text().originalContent().substring(textBox.text().start(), textBox.text().length()), textRect.x(), expansion.horizontalExpansion, expansion.behavior };
textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
paintingContext.context.drawText(style.fontCascade(), textRun, { textRect.x(), baseline });
return;
Modified: trunk/Source/WebCore/display/css/DisplayTextBox.cpp (281759 => 281760)
--- trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/display/css/DisplayTextBox.cpp 2021-08-30 15:56:19 UTC (rev 281760)
@@ -53,7 +53,7 @@
TextStream stream;
stream << boxName() << " " << absoluteBoxRect() << " (" << this << ")";
- auto textContent = text().content().substring(text().start(), text().length());
+ auto textContent = text().originalContent().substring(text().start(), text().length());
textContent.replaceWithLiteral('\\', "\\\\");
textContent.replaceWithLiteral('\n', "\\n");
const size_t maxPrintedLength = 80;
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (281759 => 281760)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-30 15:56:19 UTC (rev 281760)
@@ -73,8 +73,8 @@
auto textRunRect = lineBox.logicalRectForTextRun(lineRun);
textRunRect.moveBy(lineBoxLogicalTopLeft);
+ auto& style = layoutBox.style();
auto inkOverflow = [&] {
- auto& style = layoutBox.style();
auto initialContaingBlockSize = RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled()
? formattingState.layoutState().viewportSize()
: formattingState.layoutState().geometryForBox(layoutBox.initialContainingBlock()).contentBox().size();
@@ -89,8 +89,18 @@
return inkOverflow;
};
ASSERT(lineRun.textContent() && is<InlineTextBox>(layoutBox));
- auto& textContent = lineRun.textContent();
- formattingState.addLineRun({ lineIndex, LineRun::Type::Text, layoutBox, textRunRect, inkOverflow(), lineRun.expansion(), LineRun::Text { textContent->start, textContent->length, downcast<InlineTextBox>(layoutBox).content(), textContent->needsHyphen } });
+ auto content = downcast<InlineTextBox>(layoutBox).content();
+ auto text = lineRun.textContent();
+ auto adjustedContentToRender = [&] {
+ return text->needsHyphen ? makeString(content.substring(text->start, text->length), style.hyphenString()) : String();
+ };
+ formattingState.addLineRun({ lineIndex
+ , LineRun::Type::Text
+ , layoutBox
+ , textRunRect
+ , inkOverflow()
+ , lineRun.expansion()
+ , LineRun::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen } });
break;
}
case InlineItem::Type::SoftLineBreak: {
@@ -98,8 +108,14 @@
softLineBreakRunRect.moveBy(lineBoxLogicalTopLeft);
ASSERT(lineRun.textContent() && is<InlineTextBox>(layoutBox));
- auto& textContent = lineRun.textContent();
- formattingState.addLineRun({ lineIndex, LineRun::Type::SoftLineBreak, layoutBox, softLineBreakRunRect, softLineBreakRunRect, lineRun.expansion(), LineRun::Text { textContent->start, textContent->length, downcast<InlineTextBox>(layoutBox).content(), textContent->needsHyphen } });
+ auto& text = lineRun.textContent();
+ formattingState.addLineRun({ lineIndex
+ , LineRun::Type::SoftLineBreak
+ , layoutBox
+ , softLineBreakRunRect
+ , softLineBreakRunRect
+ , lineRun.expansion()
+ , LineRun::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
break;
}
case InlineItem::Type::HardLineBreak: {
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h (281759 => 281760)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineRun.h 2021-08-30 15:56:19 UTC (rev 281760)
@@ -39,20 +39,22 @@
struct Text {
WTF_MAKE_STRUCT_FAST_ALLOCATED;
public:
- Text(size_t position, size_t length, const String&, bool needsHyphen = false);
+ Text(size_t position, size_t length, const String& originalContent, String adjustedContentToRender = String(), bool hasHyphen = false);
size_t start() const { return m_start; }
size_t end() const { return start() + length(); }
size_t length() const { return m_length; }
- String content() const { return m_contentString; }
+ String originalContent() const { return m_originalContent; }
+ String renderedContent() const { return m_adjustedContentToRender; }
- bool needsHyphen() const { return m_needsHyphen; }
+ bool hasHyphen() const { return m_hasHyphen; }
private:
size_t m_start { 0 };
size_t m_length { 0 };
- bool m_needsHyphen { false };
- String m_contentString;
+ bool m_hasHyphen { false };
+ String m_originalContent;
+ String m_adjustedContentToRender;
};
enum class Type {
@@ -133,11 +135,12 @@
{
}
-inline LineRun::Text::Text(size_t start, size_t length, const String& contentString, bool needsHyphen)
+inline LineRun::Text::Text(size_t start, size_t length, const String& originalContent, String adjustedContentToRender, bool hasHyphen)
: m_start(start)
, m_length(length)
- , m_needsHyphen(needsHyphen)
- , m_contentString(contentString)
+ , m_hasHyphen(hasHyphen)
+ , m_originalContent(originalContent)
+ , m_adjustedContentToRender(adjustedContentToRender)
{
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (281759 => 281760)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-30 15:56:10 UTC (rev 281759)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-30 15:56:19 UTC (rev 281760)
@@ -176,8 +176,6 @@
bidiResolver.createBidiRunsForLine(Iterator(&lineRuns, lineRuns.size()));
#endif
- Vector<bool> hasAdjustedTrailingLineList(lines.size(), false);
-
auto createDisplayBoxRun = [&](auto& lineRun) {
if (lineRun.isRootInlineBox()) {
// FIXME: Teach the run iterators to ignore the root inline box runs.
@@ -212,8 +210,7 @@
inlineContent.runs.append({ lineIndex, layoutBox, runRect, inkOverflow, { }, { } });
};
- auto createDisplayTextRunForRange = [&](auto& lineRun, auto startOffset, auto endOffset) {
- RELEASE_ASSERT(startOffset < endOffset);
+ auto createDisplayTextRun = [&](auto& lineRun) {
auto& layoutBox = lineRun.layoutBox();
auto lineIndex = lineRun.lineIndex();
auto runRect = FloatRect { lineRun.logicalRect() };
@@ -223,26 +220,19 @@
inkOverflow.setY(roundToInt(inkOverflow.y()));
}
- auto& style = layoutBox.style();
auto text = lineRun.text();
- auto adjustedContentToRender = [&] {
- auto originalContent = text->content().substring(text->start(), text->length());
- if (text->needsHyphen())
- return makeString(originalContent, style.hyphenString());
- return String();
- };
-
- RELEASE_ASSERT(startOffset >= text->start() && startOffset < text->end());
- RELEASE_ASSERT(endOffset > text->start() && endOffset <= text->end());
- auto textContent = Run::TextContent { startOffset, endOffset - startOffset, text->content(), adjustedContentToRender(), text->needsHyphen() };
- auto expansion = Run::Expansion { lineRun.expansion().behavior, lineRun.expansion().horizontalExpansion };
- inlineContent.runs.append({ lineIndex, layoutBox, runRect, inkOverflow, expansion, textContent });
+ inlineContent.runs.append({ lineIndex
+ , layoutBox
+ , runRect
+ , inkOverflow
+ , Run::Expansion { lineRun.expansion().behavior, lineRun.expansion().horizontalExpansion }
+ , Run::TextContent { text->start(), text->length(), text->originalContent(), text->renderedContent(), text->hasHyphen() } });
};
inlineContent.runs.reserveInitialCapacity(lineRuns.size());
for (auto& lineRun : lineRuns) {
if (auto& text = lineRun.text())
- createDisplayTextRunForRange(lineRun, text->start(), text->end());
+ createDisplayTextRun(lineRun);
else
createDisplayBoxRun(lineRun);
}