Title: [268806] trunk/Source/WebCore
Revision
268806
Author
an...@apple.com
Date
2020-10-21 11:07:09 -0700 (Wed, 21 Oct 2020)

Log Message

[LFC][Integration] Use LineLayout::containing() in more places
https://bugs.webkit.org/show_bug.cgi?id=218029

Reviewed by Zalan Bujtas.

* layout/integration/LayoutIntegrationRunIterator.cpp:
(WebCore::LayoutIntegration::firstTextRunFor):
(WebCore::LayoutIntegration::runFor):
(WebCore::LayoutIntegration::lineLayoutSystemFlowForRenderer): Deleted.
* rendering/RenderText.cpp:
(WebCore::RenderText::usesComplexLineLayoutPath const):
(WebCore::RenderText::layoutFormattingContextLineLayout const): Deleted.
* rendering/RenderText.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268805 => 268806)


--- trunk/Source/WebCore/ChangeLog	2020-10-21 17:14:25 UTC (rev 268805)
+++ trunk/Source/WebCore/ChangeLog	2020-10-21 18:07:09 UTC (rev 268806)
@@ -1,3 +1,19 @@
+2020-10-21  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Use LineLayout::containing() in more places
+        https://bugs.webkit.org/show_bug.cgi?id=218029
+
+        Reviewed by Zalan Bujtas.
+
+        * layout/integration/LayoutIntegrationRunIterator.cpp:
+        (WebCore::LayoutIntegration::firstTextRunFor):
+        (WebCore::LayoutIntegration::runFor):
+        (WebCore::LayoutIntegration::lineLayoutSystemFlowForRenderer): Deleted.
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::usesComplexLineLayoutPath const):
+        (WebCore::RenderText::layoutFormattingContextLineLayout const): Deleted.
+        * rendering/RenderText.h:
+
 2020-10-21  Youenn Fablet  <you...@apple.com>
 
         WebRTC VP9 Decoder should be able to use VTB

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp (268805 => 268806)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp	2020-10-21 17:14:25 UTC (rev 268805)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp	2020-10-21 18:07:09 UTC (rev 268806)
@@ -160,23 +160,11 @@
     return *this;
 }
 
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-static const RenderBlockFlow* lineLayoutSystemFlowForRenderer(const RenderObject& renderer)
-{
-    // In currently supported cases the renderer is always direct child of the flow.
-    if (!is<RenderBlockFlow>(renderer.parent()))
-        return nullptr;
-    return downcast<RenderBlockFlow>(renderer.parent());
-}
-#endif
-
 TextRunIterator firstTextRunFor(const RenderText& text)
 {
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* flow = lineLayoutSystemFlowForRenderer(text)) {
-        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
-            return layoutFormattingContextLineLayout->textRunsFor(text);
-    }
+    if (auto* lineLayout = LineLayout::containing(text))
+        return lineLayout->textRunsFor(text);
 #endif
 
     return { RunIteratorLegacyPath { text.firstTextBox() } };
@@ -201,26 +189,22 @@
     return { firstTextRunFor(text) };
 }
 
-RunIterator runFor(const RenderLineBreak& renderElement)
+RunIterator runFor(const RenderLineBreak& renderer)
 {
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
-        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
-            return layoutFormattingContextLineLayout->runFor(renderElement);
-    }
+    if (auto* lineLayout = LineLayout::containing(renderer))
+        return lineLayout->runFor(renderer);
 #endif
-    return { RunIteratorLegacyPath(renderElement.inlineBoxWrapper()) };
+    return { RunIteratorLegacyPath(renderer.inlineBoxWrapper()) };
 }
 
-RunIterator runFor(const RenderBox& renderElement)
+RunIterator runFor(const RenderBox& renderer)
 {
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
-        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
-            return layoutFormattingContextLineLayout->runFor(renderElement);
-    }
+    if (auto* lineLayout = LineLayout::containing(renderer))
+        return lineLayout->runFor(renderer);
 #endif
-    return { RunIteratorLegacyPath(renderElement.inlineBoxWrapper()) };
+    return { RunIteratorLegacyPath(renderer.inlineBoxWrapper()) };
 }
 
 LineRunIterator lineRun(const RunIterator& runIterator)

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (268805 => 268806)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2020-10-21 17:14:25 UTC (rev 268805)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2020-10-21 18:07:09 UTC (rev 268806)
@@ -38,6 +38,7 @@
 #include "Hyphenation.h"
 #include "InlineTextBox.h"
 #include "LayoutIntegrationLineIterator.h"
+#include "LayoutIntegrationLineLayout.h"
 #include "LayoutIntegrationRunIterator.h"
 #include "Range.h"
 #include "RenderBlock.h"
@@ -1464,22 +1465,13 @@
     downcast<RenderBlockFlow>(*parent()).ensureLineBoxes();
 }
 
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-const LayoutIntegration::LineLayout* RenderText::layoutFormattingContextLineLayout() const
-{
-    if (!is<RenderBlockFlow>(*parent()))
-        return nullptr;
-    return downcast<RenderBlockFlow>(*parent()).layoutFormattingContextLineLayout();
-}
-#endif
-
 bool RenderText::usesComplexLineLayoutPath() const
 {
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    if (layoutFormattingContextLineLayout())
-        return false;
+    return !LayoutIntegration::LineLayout::containing(*this);
+#else
+    return true;
 #endif
-    return true;
 }
 
 float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const

Modified: trunk/Source/WebCore/rendering/RenderText.h (268805 => 268806)


--- trunk/Source/WebCore/rendering/RenderText.h	2020-10-21 17:14:25 UTC (rev 268805)
+++ trunk/Source/WebCore/rendering/RenderText.h	2020-10-21 18:07:09 UTC (rev 268806)
@@ -168,9 +168,6 @@
 #endif
 
     void ensureLineBoxes();
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-    const LayoutIntegration::LineLayout* layoutFormattingContextLineLayout() const;
-#endif
     bool usesComplexLineLayoutPath() const;
 
     StringView stringView(unsigned start = 0, Optional<unsigned> stop = WTF::nullopt) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to