Title: [269427] trunk/Source/WebCore
Revision
269427
Author
[email protected]
Date
2020-11-05 06:14:22 -0800 (Thu, 05 Nov 2020)

Log Message

[LFC][IFC] Transition hyphenated content to Run::renderedContent()
https://bugs.webkit.org/show_bug.cgi?id=218552

Reviewed by Antti Koivisto.

Currently hyphenated content is being constructed during paint time. This patch takes advantage of the
new Run::renderedContent() API.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
(WebCore::LayoutIntegration::LineLayout::paint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269426 => 269427)


--- trunk/Source/WebCore/ChangeLog	2020-11-05 13:11:20 UTC (rev 269426)
+++ trunk/Source/WebCore/ChangeLog	2020-11-05 14:14:22 UTC (rev 269427)
@@ -1,5 +1,19 @@
 2020-11-05  Zalan Bujtas  <[email protected]>
 
+        [LFC][IFC] Transition hyphenated content to Run::renderedContent()
+        https://bugs.webkit.org/show_bug.cgi?id=218552
+
+        Reviewed by Antti Koivisto.
+
+        Currently hyphenated content is being constructed during paint time. This patch takes advantage of the
+        new Run::renderedContent() API.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::constructContent):
+        (WebCore::LayoutIntegration::LineLayout::paint):
+
+2020-11-05  Zalan Bujtas  <[email protected]>
+
         [LFC][Integration] Let's compute display lines visual alignments first before the runs
         https://bugs.webkit.org/show_bug.cgi?id=218551
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (269426 => 269427)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-05 13:11:20 UTC (rev 269426)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-05 14:14:22 UTC (rev 269427)
@@ -198,11 +198,11 @@
         auto initialContaingBlockSize = m_layoutState.viewportSize();
         for (auto& lineRun : m_inlineFormattingState.lineRuns()) {
             auto& layoutBox = lineRun.layoutBox();
+            auto& style = layoutBox.style();
             auto computedInkOverflow = [&] (auto runRect) {
                 // FIXME: Add support for non-text ink overflow.
                 if (!lineRun.text())
                     return runRect;
-                auto& style = layoutBox.style();
                 auto inkOverflow = runRect;
                 auto strokeOverflow = std::ceil(style.computedStrokeWidth(ceiledIntSize(initialContaingBlockSize)));
                 inkOverflow.inflate(strokeOverflow);
@@ -227,6 +227,8 @@
             if (auto text = lineRun.text()) {
                 auto adjustedContentToRenderer = [&] {
                     // FIXME: This is where we create strings with trailing hyphens and truncate/replace content with ellipsis.
+                    if (text->needsHyphen())
+                        return makeString(StringView(text->content()).substring(text->start(), text->length()), style.hyphenString());
                     return String();
                 };
                 textContent = Run::TextContent { text->start(), text->length(), text->content(), adjustedContentToRenderer(), text->needsHyphen() };
@@ -523,14 +525,10 @@
         auto& line = inlineContent.lineForRun(run);
         auto baseline = paintOffset.y() + line.rect().y() + line.baseline();
         auto expansion = run.expansion();
-
-        String textWithHyphen;
-        if (textContent.hasHyphen())
-            textWithHyphen = makeString(textContent.renderedContent(), style.hyphenString());
         // TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned
         // and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px).
         auto xPos = rect.x() - (line.rect().x() + line.horizontalAlignmentOffset());
-        WebCore::TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
+        WebCore::TextRun textRun { textContent.renderedContent(), xPos, expansion.horizontalExpansion, expansion.behavior };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baseline, deviceScaleFactor) };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to