Title: [270195] trunk/Source/WebCore
Revision
270195
Author
[email protected]
Date
2020-11-27 08:52:48 -0800 (Fri, 27 Nov 2020)

Log Message

[LFC][Integration] Initial display:inline support
https://bugs.webkit.org/show_bug.cgi?id=219301

Reviewed by Zalan Bujtas.

<span> etc.

Not enabled yet.

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
(WebCore::LayoutIntegration::BoxTree::updateStyle):
(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForChild):
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
* layout/integration/LayoutIntegrationInlineContent.h:
(WebCore::LayoutIntegration::InlineContent::InlineBox::InlineBox):
(WebCore::LayoutIntegration::InlineContent::InlineBox::layoutBox const):
(WebCore::LayoutIntegration::InlineContent::InlineBox::lineIndex const):
(WebCore::LayoutIntegration::InlineContent::InlineBox::rect const):
(WebCore::LayoutIntegration::InlineContent::shrinkToFit):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::build const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayInlineBoxes const):
* layout/integration/LayoutIntegrationInlineContentBuilder.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::containing):
(WebCore::LayoutIntegration::LineLayout::enclosingBorderBoxRectFor const):
(WebCore::LayoutIntegration::LineLayout::paint):
* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::styleDidChange):
(WebCore::RenderInline::linesBoundingBox const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270194 => 270195)


--- trunk/Source/WebCore/ChangeLog	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/ChangeLog	2020-11-27 16:52:48 UTC (rev 270195)
@@ -1,3 +1,43 @@
+2020-11-27  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Initial display:inline support
+        https://bugs.webkit.org/show_bug.cgi?id=219301
+
+        Reviewed by Zalan Bujtas.
+
+        <span> etc.
+
+        Not enabled yet.
+
+        * layout/integration/LayoutIntegrationBoxTree.cpp:
+        (WebCore::LayoutIntegration::BoxTree::buildTree):
+        (WebCore::LayoutIntegration::BoxTree::updateStyle):
+        (WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
+        (WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::canUseForChild):
+        (WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
+        * layout/integration/LayoutIntegrationInlineContent.h:
+        (WebCore::LayoutIntegration::InlineContent::InlineBox::InlineBox):
+        (WebCore::LayoutIntegration::InlineContent::InlineBox::layoutBox const):
+        (WebCore::LayoutIntegration::InlineContent::InlineBox::lineIndex const):
+        (WebCore::LayoutIntegration::InlineContent::InlineBox::rect const):
+        (WebCore::LayoutIntegration::InlineContent::shrinkToFit):
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::InlineContentBuilder::build const):
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayInlineBoxes const):
+        * layout/integration/LayoutIntegrationInlineContentBuilder.h:
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::containing):
+        (WebCore::LayoutIntegration::LineLayout::enclosingBorderBoxRectFor const):
+        (WebCore::LayoutIntegration::LineLayout::paint):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutModernLines):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::styleDidChange):
+        (WebCore::RenderInline::linesBoundingBox const):
+
 2020-11-27  Víctor Manuel Jáquez Leal  <[email protected]>
 
         REGRESSION(r269642) [GStreamer][WebRTC] Unexpected results after update to M87

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -28,6 +28,8 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
+#include "InlineIterator.h"
+#include "LayoutContainerBox.h"
 #include "LayoutInlineTextBox.h"
 #include "LayoutLineBreakBox.h"
 #include "LayoutReplacedBox.h"
@@ -60,31 +62,57 @@
 
 void BoxTree::buildTree()
 {
-    for (auto& childRenderer : childrenOfType<RenderObject>(m_flow)) {
-        std::unique_ptr<Layout::Box> childBox;
+    auto createChildBox = [&](RenderObject& childRenderer) -> std::unique_ptr<Layout::Box> {
         if (is<RenderText>(childRenderer)) {
             auto& textRenderer = downcast<RenderText>(childRenderer);
-            childBox = makeUnique<Layout::InlineTextBox>(textRenderer.text(), textRenderer.canUseSimplifiedTextMeasuring(), RenderStyle::createAnonymousStyleWithDisplay(m_root.style(), DisplayType::Inline));
-        } else if (childRenderer.isLineBreak()) {
-            auto clonedStyle = RenderStyle::clone(childRenderer.style());
-            clonedStyle.setDisplay(DisplayType::Inline);
-            clonedStyle.setFloating(Float::No);
-            clonedStyle.setPosition(PositionType::Static);
-            childBox = makeUnique<Layout::LineBreakBox>(downcast<RenderLineBreak>(childRenderer).isWBR(), WTFMove(clonedStyle));
-        } else if (is<RenderReplaced>(childRenderer)) {
-            auto clonedStyle = RenderStyle::clone(childRenderer.style());
-            childBox = makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { is<RenderImage>(childRenderer) ? Layout::Box::ElementType::Image : Layout::Box::ElementType::GenericElement }, WTFMove(clonedStyle));
-        } else if (is<RenderBlock>(childRenderer)) {
-            auto clonedStyle = RenderStyle::clone(childRenderer.style());
-            childBox = makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(clonedStyle));
+            auto style = RenderStyle::createAnonymousStyleWithDisplay(textRenderer.style(), DisplayType::Inline);
+            return makeUnique<Layout::InlineTextBox>(textRenderer.text(), textRenderer.canUseSimplifiedTextMeasuring(), WTFMove(style));
         }
-        ASSERT(childBox);
 
-        m_root.appendChild(*childBox);
-        m_boxes.append({ WTFMove(childBox), &childRenderer });
+        auto style = RenderStyle::clone(childRenderer.style());
+        if (childRenderer.isLineBreak()) {
+            style.setDisplay(DisplayType::Inline);
+            style.setFloating(Float::No);
+            style.setPosition(PositionType::Static);
+            return makeUnique<Layout::LineBreakBox>(downcast<RenderLineBreak>(childRenderer).isWBR(), WTFMove(style));
+        }
+
+        if (is<RenderReplaced>(childRenderer))
+            return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { is<RenderImage>(childRenderer) ? Layout::Box::ElementType::Image : Layout::Box::ElementType::GenericElement }, WTFMove(style));
+
+        if (is<RenderBlock>(childRenderer))
+            return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style));
+
+        if (is<RenderInline>(childRenderer))
+            return makeUnique<Layout::ContainerBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style));
+
+        ASSERT_NOT_REACHED();
+        return nullptr;
+    };
+
+    for (auto walker = InlineWalker(m_flow); !walker.atEnd(); walker.advance()) {
+        auto& childRenderer = *walker.current();
+        auto childBox = createChildBox(childRenderer);
+        appendChild(WTFMove(childBox), childRenderer);
     }
 }
 
+void BoxTree::appendChild(std::unique_ptr<Layout::Box> childBox, RenderObject& childRenderer)
+{
+    auto& parentBox = downcast<Layout::ContainerBox>(layoutBoxForRenderer(*childRenderer.parent()));
+    parentBox.appendChild(*childBox);
+
+    m_boxes.append({ WTFMove(childBox), &childRenderer });
+
+    if (m_boxes.size() > smallTreeThreshold) {
+        if (m_rendererToBoxMap.isEmpty()) {
+            for (auto& entry : m_boxes)
+                m_rendererToBoxMap.add(entry.renderer, entry.box.get());
+        } else
+            m_rendererToBoxMap.add(&childRenderer, m_boxes.last().box.get());
+    }
+}
+
 void BoxTree::updateStyle(const RenderBoxModelObject& renderer)
 {
     auto& layoutBox = layoutBoxForRenderer(renderer);
@@ -92,9 +120,9 @@
 
     layoutBox.updateStyle(style);
 
-    if (&layoutBox == &m_root) {
-        for (auto* child = m_root.firstChild(); child; child = child->nextSibling()) {
-            if (child->isAnonymous())
+    if (is<Layout::ContainerBox>(layoutBox)) {
+        for (auto* child = downcast<Layout::ContainerBox>(layoutBox).firstChild(); child; child = child->nextSibling()) {
+            if (child->isInlineTextBox())
                 child->updateStyle(RenderStyle::createAnonymousStyleWithDisplay(style, DisplayType::Inline));
         }
     }
@@ -109,14 +137,10 @@
         auto index = m_boxes.findMatching([&](auto& entry) {
             return entry.renderer == &renderer;
         });
-        ASSERT(index != notFound);
+        RELEASE_ASSERT(index != notFound);
         return *m_boxes[index].box;
     }
 
-    if (m_rendererToBoxMap.isEmpty()) {
-        for (auto& entry : m_boxes)
-            m_rendererToBoxMap.add(entry.renderer, entry.box.get());
-    }
     return *m_rendererToBoxMap.get(&renderer);
 }
 
@@ -134,7 +158,7 @@
         auto index = m_boxes.findMatching([&](auto& entry) {
             return entry.box.get() == &box;
         });
-        ASSERT(index != notFound);
+        RELEASE_ASSERT(index != notFound);
         return *m_boxes[index].renderer;
     }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h	2020-11-27 16:52:48 UTC (rev 270195)
@@ -58,6 +58,7 @@
 
 private:
     void buildTree();
+    void appendChild(std::unique_ptr<Layout::Box>, RenderObject&);
 
     RenderBlockFlow& m_flow;
     Layout::InitialContainingBlock m_root;

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -28,10 +28,12 @@
 
 #include "DocumentMarkerController.h"
 #include "HTMLTextFormControlElement.h"
+#include "InlineIterator.h"
 #include "Logging.h"
 #include "RenderBlockFlow.h"
 #include "RenderChildIterator.h"
 #include "RenderImage.h"
+#include "RenderInline.h"
 #include "RenderLineBreak.h"
 #include "RenderMultiColumnFlow.h"
 #include "RenderTextControl.h"
@@ -46,6 +48,7 @@
 #define ALLOW_IMAGES 1
 #define ALLOW_ALL_REPLACED 1
 #define ALLOW_INLINE_BLOCK 1
+#define ALLOW_INLINES 0
 
 #ifndef NDEBUG
 #define SET_REASON_AND_RETURN_IF_NEEDED(reason, reasons, includeReasons) { \
@@ -637,6 +640,28 @@
     }
 #endif
 
+#if ALLOW_INLINES
+    if (is<RenderInline>(child)) {
+        auto& renderInline = downcast<RenderInline>(child);
+        if (renderInline.isRubyInline() || renderInline.isQuote() || renderInline.isSVGInline())
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+
+        auto& style = renderInline.style();
+        if (!isSupportedStyle(style))
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons)
+        if (style.hasBorder())
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+        if (style.hasBackground())
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+        if (renderInline.marginLeft() < 0 || renderInline.marginRight() < 0 || renderInline.marginTop() < 0 || renderInline.marginBottom() < 0)
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+        if (renderInline.paddingLeft() < 0 || renderInline.paddingRight() < 0 || renderInline.paddingTop() < 0 || renderInline.paddingBottom() < 0)
+            SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
+
+        return reasons;
+    }
+#endif
+
     SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonSupportedChild, reasons, includeReasons);
     return reasons;
 }
@@ -711,12 +736,13 @@
         SET_REASON_AND_RETURN_IF_NEEDED(FlowParentIsTextAreaWithWrapping, reasons, includeReasons);
     // This currently covers <blockflow>#text</blockflow>, <blockflow>#text<br></blockflow> and mutiple (sibling) RenderText cases.
     // The <blockflow><inline>#text</inline></blockflow> case is also popular and should be relatively easy to cover.
-    for (const auto* child = flow.firstChild(); child; child = child->nextSibling()) {
-        if (!is<RenderText>(*child) && flow.containsFloats()) {
+    for (auto walker = InlineWalker(const_cast<RenderBlockFlow&>(flow)); !walker.atEnd(); walker.advance()) {
+        auto& child = *walker.current();
+        if (!is<RenderText>(child) && flow.containsFloats()) {
             // Non-text content may stretch the line and we don't yet have support for dynamic float avoiding (as the line grows).
             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasUnsupportedFloat, reasons, includeReasons);
         }
-        auto childReasons = canUseForChild(*child, includeReasons);
+        auto childReasons = canUseForChild(child, includeReasons);
         if (childReasons)
             ADD_REASONS_AND_RETURN_IF_NEEDED(childReasons, reasons, includeReasons);
     }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h	2020-11-27 16:52:48 UTC (rev 270195)
@@ -50,11 +50,32 @@
     static Ref<InlineContent> create(const LineLayout& lineLayout) { return adoptRef(*new InlineContent(lineLayout)); }
     ~InlineContent();
 
+    class InlineBox {
+    public:
+        InlineBox(const Layout::Box& layoutBox, size_t lineIndex, const FloatRect& rect)
+            : m_layoutBox(makeWeakPtr(layoutBox))
+            , m_lineIndex(lineIndex)
+            , m_rect(rect)
+        {
+        }
+        const Layout::Box& layoutBox() const { return *m_layoutBox; }
+
+        size_t lineIndex() const { return m_lineIndex; }
+        const FloatRect& rect() const { return m_rect; }
+
+    private:
+        WeakPtr<const Layout::Box> m_layoutBox;
+        size_t m_lineIndex;
+        FloatRect m_rect;
+    };
+
     using Runs = Vector<Run, 4>;
     using Lines = Vector<Line, 4>;
 
     Runs runs;
     Lines lines;
+    Vector<InlineBox> inlineBoxes;
+
     float clearGapAfterLastLine { 0 };
 
     const Line& lineForRun(const Run& run) const { return lines[run.lineIndex()]; }
@@ -75,6 +96,7 @@
 {
     runs.shrinkToFit();
     lines.shrinkToFit();
+    inlineBoxes.shrinkToFit();
 }
 
 }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -157,6 +157,7 @@
     auto lineLevelVisualAdjustmentsForRuns = computeLineLevelVisualAdjustmentsForRuns(inlineFormattingState);
     createDisplayLineRuns(inlineFormattingState, inlineContent, lineLevelVisualAdjustmentsForRuns);
     createDisplayLines(inlineFormattingState, inlineContent, lineLevelVisualAdjustmentsForRuns);
+    createDisplayInlineBoxes(inlineFormattingState, inlineContent);
 }
 
 InlineContentBuilder::LineLevelVisualAdjustmentsForRunsList InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns(const Layout::InlineFormattingState& inlineFormattingState) const
@@ -348,7 +349,33 @@
     }
 }
 
+void InlineContentBuilder::createDisplayInlineBoxes(const Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
+{
+    auto& lines = inlineFormattingState.lines();
+    auto& lineBoxes = inlineFormattingState.lineBoxes();
+    for (size_t lineIndex = 0; lineIndex < lineBoxes.size(); ++lineIndex) {
+        auto& lineBox = lineBoxes[lineIndex];
+        auto& line = lines[lineIndex];
+
+        auto& lineBoxLogicalRect = line.lineBoxLogicalRect();
+
+        for (auto& inlineLevelBox : lineBox.inlineLevelBoxList()) {
+            if (!inlineLevelBox->isInlineBox() || inlineLevelBox->isRootInlineBox())
+                continue;
+            auto& layoutBox = inlineLevelBox->layoutBox();
+            auto inlineLevelBoxLogicalRect = lineBox.logicalMarginRectForInlineLevelBox(layoutBox);
+            // inlineLevelBoxLogicalRect encloses the margin box, but we need border box for the display line.
+            auto& geometry = m_layoutState.geometryForBox(layoutBox);
+            inlineLevelBoxLogicalRect.expandVertically(-std::max(0_lu, geometry.marginBefore() + geometry.marginAfter()));
+            inlineLevelBoxLogicalRect.moveVertically(std::max(0_lu, geometry.marginBefore()));
+            inlineLevelBoxLogicalRect.moveBy(lineBoxLogicalRect.topLeft());
+
+            inlineContent.inlineBoxes.append({ layoutBox, lineIndex, inlineLevelBoxLogicalRect });
+        }
+    }
 }
+
 }
+}
 
 #endif

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h	2020-11-27 16:52:48 UTC (rev 270195)
@@ -55,6 +55,7 @@
     LineLevelVisualAdjustmentsForRunsList computeLineLevelVisualAdjustmentsForRuns(const Layout::InlineFormattingState&) const;
     void createDisplayLineRuns(const Layout::InlineFormattingState&, InlineContent&, const LineLevelVisualAdjustmentsForRunsList&) const;
     void createDisplayLines(const Layout::InlineFormattingState&, InlineContent&, const LineLevelVisualAdjustmentsForRunsList&) const;
+    void createDisplayInlineBoxes(const Layout::InlineFormattingState&, InlineContent&) const;
 
     const Layout::LayoutState& m_layoutState;
     const RenderBlockFlow& m_blockFlow;

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -76,9 +76,11 @@
     if (renderer.isReplica() || renderer.isRenderScrollbarPart())
         return nullptr;
     
-    if (auto* parent = renderer.parent()) {
+    for (auto* parent = renderer.parent(); parent; parent = parent->parent()) {
         if (is<RenderBlockFlow>(*parent))
             return downcast<RenderBlockFlow>(*parent).modernLineLayout();
+        if (!is<RenderInline>(*parent))
+            return nullptr;
     }
 
     return nullptr;
@@ -348,6 +350,22 @@
     return { LineIteratorModernPath(*m_inlineContent, m_inlineContent->lines.isEmpty() ? 0 : m_inlineContent->lines.size() - 1) };
 }
 
+LayoutRect LineLayout::enclosingBorderBoxRectFor(const RenderInline& renderInline) const
+{
+    if (!m_inlineContent)
+        return { };
+
+    auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderInline);
+
+    LayoutRect rect;
+    for (auto& inlineBox : m_inlineContent->inlineBoxes) {
+        if (&inlineBox.layoutBox() == &layoutBox)
+            rect.uniteIfNonZero(LayoutRect(inlineBox.rect()));
+    }
+
+    return rect;
+}
+
 const RenderObject& LineLayout::rendererForLayoutBox(const Layout::Box& layoutBox) const
 {
     return m_boxTree.rendererForLayoutBox(layoutBox);
@@ -428,12 +446,10 @@
         textPainter.paint(textRun, rect, textOrigin);
 
         if (!style.textDecorationsInEffect().isEmpty()) {
-            // FIXME: Use correct RenderText.
-            if (auto* textRenderer = childrenOfType<RenderText>(flow()).first()) {
-                auto painter = TextDecorationPainter { paintInfo.context(), style.textDecorationsInEffect(), *textRenderer, false, style.fontCascade() };
-                painter.setWidth(rect.width());
-                painter.paintTextDecoration(textRun, textOrigin, rect.location() + paintOffset);
-            }
+            auto& textRenderer = downcast<RenderText>(m_boxTree.rendererForLayoutBox(run.layoutBox()));
+            auto painter = TextDecorationPainter { paintInfo.context(), style.textDecorationsInEffect(), textRenderer, false, style.fontCascade() };
+            painter.setWidth(rect.width());
+            painter.paintTextDecoration(textRun, textOrigin, rect.location() + paintOffset);
         }
     }
 }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (270194 => 270195)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-11-27 16:52:48 UTC (rev 270195)
@@ -88,6 +88,8 @@
     LineIterator firstLine() const;
     LineIterator lastLine() const;
 
+    LayoutRect enclosingBorderBoxRectFor(const RenderInline&) const;
+
     const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
     const RenderBlockFlow& flow() const { return m_boxTree.flow(); }
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (270194 => 270195)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -3606,7 +3606,8 @@
 
     auto& layoutFormattingContextLineLayout = *this->modernLineLayout();
 
-    for (auto& renderer : childrenOfType<RenderObject>(*this)) {
+    for (auto walker = InlineWalker(*this); !walker.atEnd(); walker.advance()) {
+        auto& renderer = *walker.current();
         if (relayoutChildren)
             renderer.setNeedsLayout(MarkOnlyThis);
         if (!renderer.needsLayout() && !needsUpdateReplacedDimensions)

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (270194 => 270195)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2020-11-27 16:31:56 UTC (rev 270194)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2020-11-27 16:52:48 UTC (rev 270195)
@@ -30,6 +30,7 @@
 #include "HitTestResult.h"
 #include "InlineElementBox.h"
 #include "InlineTextBox.h"
+#include "LayoutIntegrationLineLayout.h"
 #include "RenderBlock.h"
 #include "RenderChildIterator.h"
 #include "RenderFragmentedFlow.h"
@@ -193,6 +194,13 @@
         }
         setRenderInlineAlwaysCreatesLineBoxes(alwaysCreateLineBoxes);
     }
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (diff >= StyleDifference::Repaint) {
+        if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this))
+            lineLayout->updateStyle(*this);
+    }
+#endif
 }
 
 void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout)
@@ -602,6 +610,9 @@
 
 IntRect RenderInline::linesBoundingBox() const
 {
+    if (auto* layout = LayoutIntegration::LineLayout::containing(*this))
+        return enclosingIntRect(layout->enclosingBorderBoxRectFor(*this));
+
     if (!alwaysCreateLineBoxes()) {
         ASSERT(!firstLineBox());
         FloatRect floatResult;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to