⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 268798 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 9:21:04 AM (6 years ago)
Author:
Antti Koivisto
Message:

[LFC][Integration] Update style of contained layout boxes
https://bugs.webkit.org/show_bug.cgi?id=218017

Reviewed by Zalan Bujtas.

Update layout box style on style change as needed. This fixes at least fast/replaced/max-width-percent.html with
image support enabled.

The patch also contains refactoring to make BoxTree non-const and moves the style update code there.

  • layout/integration/LayoutIntegrationBoxTree.cpp:

(WebCore::LayoutIntegration::BoxTree::BoxTree):
(WebCore::LayoutIntegration::BoxTree::buildTree):
(WebCore::LayoutIntegration::BoxTree::updateStyle):
(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer const):
(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox const):

  • layout/integration/LayoutIntegrationBoxTree.h:

(WebCore::LayoutIntegration::BoxTree::flow const):
(WebCore::LayoutIntegration::BoxTree::flow):

  • layout/integration/LayoutIntegrationInlineContent.cpp:

(WebCore::LayoutIntegration::InlineContent::rendererForLayoutBox const):

  • layout/integration/LayoutIntegrationInlineContent.h:
  • layout/integration/LayoutIntegrationLineIteratorModernPath.h:

(WebCore::LayoutIntegration::LineIteratorModernPath::logicalStartRunWithNode const):
(WebCore::LayoutIntegration::LineIteratorModernPath::logicalEndRunWithNode const):

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::LineLayout):
(WebCore::LayoutIntegration::LineLayout::containing):
(WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
(WebCore::LayoutIntegration::LineLayout::updateStyle):
(WebCore::LayoutIntegration::LineLayout::constructContent):
(WebCore::LayoutIntegration::LineLayout::textRunsFor const):
(WebCore::LayoutIntegration::LineLayout::runFor const):
(WebCore::LayoutIntegration::LineLayout::rendererForLayoutBox const):
(WebCore::LayoutIntegration::LineLayout::paint):
(WebCore::LayoutIntegration::LineLayout::hitTest):

  • layout/integration/LayoutIntegrationLineLayout.h:
  • layout/integration/LayoutIntegrationRunIteratorModernPath.h:

(WebCore::LayoutIntegration::RunIteratorModernPath::renderer const):

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::styleDidChange):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::styleDidChange):

Update the line layout style.

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268797 r268798  
     12020-10-21  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Integration] Update style of contained layout boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=218017
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Update layout box style on style change as needed. This fixes at least fast/replaced/max-width-percent.html with
     9        image support enabled.
     10
     11        The patch also contains refactoring to make BoxTree non-const and moves the style update code there.
     12
     13        * layout/integration/LayoutIntegrationBoxTree.cpp:
     14        (WebCore::LayoutIntegration::BoxTree::BoxTree):
     15        (WebCore::LayoutIntegration::BoxTree::buildTree):
     16        (WebCore::LayoutIntegration::BoxTree::updateStyle):
     17        (WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
     18        (WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer const):
     19        (WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
     20        (WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox const):
     21        * layout/integration/LayoutIntegrationBoxTree.h:
     22        (WebCore::LayoutIntegration::BoxTree::flow const):
     23        (WebCore::LayoutIntegration::BoxTree::flow):
     24        * layout/integration/LayoutIntegrationInlineContent.cpp:
     25        (WebCore::LayoutIntegration::InlineContent::rendererForLayoutBox const):
     26        * layout/integration/LayoutIntegrationInlineContent.h:
     27        * layout/integration/LayoutIntegrationLineIteratorModernPath.h:
     28        (WebCore::LayoutIntegration::LineIteratorModernPath::logicalStartRunWithNode const):
     29        (WebCore::LayoutIntegration::LineIteratorModernPath::logicalEndRunWithNode const):
     30        * layout/integration/LayoutIntegrationLineLayout.cpp:
     31        (WebCore::LayoutIntegration::LineLayout::LineLayout):
     32        (WebCore::LayoutIntegration::LineLayout::containing):
     33        (WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
     34        (WebCore::LayoutIntegration::LineLayout::updateStyle):
     35        (WebCore::LayoutIntegration::LineLayout::constructContent):
     36        (WebCore::LayoutIntegration::LineLayout::textRunsFor const):
     37        (WebCore::LayoutIntegration::LineLayout::runFor const):
     38        (WebCore::LayoutIntegration::LineLayout::rendererForLayoutBox const):
     39        (WebCore::LayoutIntegration::LineLayout::paint):
     40        (WebCore::LayoutIntegration::LineLayout::hitTest):
     41        * layout/integration/LayoutIntegrationLineLayout.h:
     42        * layout/integration/LayoutIntegrationRunIteratorModernPath.h:
     43        (WebCore::LayoutIntegration::RunIteratorModernPath::renderer const):
     44        * rendering/RenderBlockFlow.cpp:
     45        (WebCore::RenderBlockFlow::styleDidChange):
     46        * rendering/RenderBox.cpp:
     47        (WebCore::RenderBox::styleDidChange):
     48
     49        Update the line layout style.
     50
    1512020-10-21  Philippe Normand  <pnormand@igalia.com>
    252
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp

    r268660 r268798  
    4949}
    5050
    51 BoxTree::BoxTree(const RenderBlockFlow& flow)
    52     : m_root(rootBoxStyle(flow.style()))
     51BoxTree::BoxTree(RenderBlockFlow& flow)
     52    : m_flow(flow)
     53    , m_root(rootBoxStyle(flow.style()))
    5354{
    5455    if (flow.isAnonymous())
    5556        m_root.setIsAnonymous();
    5657
    57     buildTree(flow);
     58    buildTree();
    5859}
    5960
    60 void BoxTree::buildTree(const RenderBlockFlow& flow)
     61void BoxTree::buildTree()
    6162{
    62     for (auto& childRenderer : childrenOfType<RenderObject>(flow)) {
     63    for (auto& childRenderer : childrenOfType<RenderObject>(m_flow)) {
    6364        std::unique_ptr<Layout::Box> childBox;
    6465        if (is<RenderText>(childRenderer)) {
     
    8384}
    8485
    85 const Layout::Box* BoxTree::layoutBoxForRenderer(const RenderObject& renderer) const
     86void BoxTree::updateStyle(const RenderBoxModelObject& renderer)
    8687{
     88    auto& layoutBox = layoutBoxForRenderer(renderer);
     89    auto& style = renderer.style();
     90
     91    layoutBox.updateStyle(style);
     92
     93    if (&layoutBox == &m_root) {
     94        for (auto* child = m_root.firstChild(); child; child = child->nextSibling()) {
     95            if (child->isAnonymous())
     96                child->updateStyle(RenderStyle::createAnonymousStyleWithDisplay(style, DisplayType::Inline));
     97        }
     98    }
     99}
     100
     101Layout::Box& BoxTree::layoutBoxForRenderer(const RenderObject& renderer)
     102{
     103    if (&renderer == &m_flow)
     104        return m_root;
     105
    87106    if (m_boxes.size() <= smallTreeThreshold) {
    88107        auto index = m_boxes.findMatching([&](auto& entry) {
    89108            return entry.renderer == &renderer;
    90109        });
    91         if (index == notFound)
    92             return nullptr;
    93         return m_boxes[index].box.get();
     110        ASSERT(index != notFound);
     111        return *m_boxes[index].box;
    94112    }
    95113
     
    98116            m_rendererToBoxMap.add(entry.renderer, entry.box.get());
    99117    }
    100     return m_rendererToBoxMap.get(&renderer);
     118    return *m_rendererToBoxMap.get(&renderer);
    101119}
    102120
    103 const RenderObject* BoxTree::rendererForLayoutBox(const Layout::Box& box) const
     121const Layout::Box& BoxTree::layoutBoxForRenderer(const RenderObject& renderer) const
    104122{
     123    return const_cast<BoxTree&>(*this).layoutBoxForRenderer(renderer);
     124}
     125
     126RenderObject& BoxTree::rendererForLayoutBox(const Layout::Box& box)
     127{
     128    if (&box == &m_root)
     129        return m_flow;
     130
    105131    if (m_boxes.size() <= smallTreeThreshold) {
    106132        auto index = m_boxes.findMatching([&](auto& entry) {
    107133            return entry.box.get() == &box;
    108134        });
    109         if (index == notFound)
    110             return nullptr;
    111         return m_boxes[index].renderer;
     135        ASSERT(index != notFound);
     136        return *m_boxes[index].renderer;
    112137    }
    113138
     
    116141            m_boxToRendererMap.add(entry.box.get(), entry.renderer);
    117142    }
    118     return m_boxToRendererMap.get(&box);
     143    return *m_boxToRendererMap.get(&box);
     144}
     145
     146const RenderObject& BoxTree::rendererForLayoutBox(const Layout::Box& box) const
     147{
     148    return const_cast<BoxTree&>(*this).rendererForLayoutBox(box);
    119149}
    120150
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h

    r258820 r268798  
    3535
    3636class RenderBlockFlow;
     37class RenderBoxModelObject;
    3738
    3839namespace LayoutIntegration {
     
    4041class BoxTree {
    4142public:
    42     BoxTree(const RenderBlockFlow&);
     43    BoxTree(RenderBlockFlow&);
     44
     45    void updateStyle(const RenderBoxModelObject&);
     46
     47    const RenderBlockFlow& flow() const { return m_flow; }
     48    RenderBlockFlow& flow() { return m_flow; }
    4349
    4450    const Layout::InitialContainingBlock& rootLayoutBox() const { return m_root; }
    4551    Layout::InitialContainingBlock& rootLayoutBox() { return m_root; }
    4652
    47     const Layout::Box* layoutBoxForRenderer(const RenderObject&) const;
    48     const RenderObject* rendererForLayoutBox(const Layout::Box&) const;
     53    const Layout::Box& layoutBoxForRenderer(const RenderObject&) const;
     54    Layout::Box& layoutBoxForRenderer(const RenderObject&);
     55
     56    const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
     57    RenderObject& rendererForLayoutBox(const Layout::Box&);
    4958
    5059private:
    51     void buildTree(const RenderBlockFlow&);
     60    void buildTree();
    5261
     62    RenderBlockFlow& m_flow;
    5363    Layout::InitialContainingBlock m_root;
    5464    struct BoxAndRenderer {
    55         std::unique_ptr<const Layout::Box> box;
    56         const RenderObject* renderer { nullptr };
     65        std::unique_ptr<Layout::Box> box;
     66        RenderObject* renderer { nullptr };
    5767    };
    5868    Vector<BoxAndRenderer, 1> m_boxes;
    5969
    60     mutable HashMap<const RenderObject*, const Layout::Box*> m_rendererToBoxMap;
    61     mutable HashMap<const Layout::Box*, const RenderObject*> m_boxToRendererMap;
     70    HashMap<const RenderObject*, Layout::Box*> m_rendererToBoxMap;
     71    HashMap<const Layout::Box*, RenderObject*> m_boxToRendererMap;
    6272};
    6373
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.cpp

    r268055 r268798  
    6262}
    6363
    64 const RenderObject* InlineContent::rendererForLayoutBox(const Layout::Box& layoutBox) const
     64const RenderObject& InlineContent::rendererForLayoutBox(const Layout::Box& layoutBox) const
    6565{
    6666    return m_lineLayout->rendererForLayoutBox(layoutBox);
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h

    r268202 r268798  
    6262
    6363    const LineLayout& lineLayout() const;
    64     const RenderObject* rendererForLayoutBox(const Layout::Box&) const;
     64    const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
    6565
    6666private:
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h

    r268260 r268798  
    100100        auto endIndex = startIndex + line().runCount();
    101101        for (auto runIndex = startIndex; runIndex < endIndex; ++runIndex) {
    102             auto& renderer = *m_inlineContent->rendererForLayoutBox(m_inlineContent->runs[runIndex].layoutBox());
     102            auto& renderer = m_inlineContent->rendererForLayoutBox(m_inlineContent->runs[runIndex].layoutBox());
    103103            if (renderer.node())
    104104                return { *m_inlineContent, runIndex };
     
    112112        auto endIndex = startIndex + line().runCount();
    113113        for (auto runIndex = endIndex; runIndex-- > startIndex;) {
    114             auto& renderer = *m_inlineContent->rendererForLayoutBox(m_inlineContent->runs[runIndex].layoutBox());
     114            auto& renderer = m_inlineContent->rendererForLayoutBox(m_inlineContent->runs[runIndex].layoutBox());
    115115            if (renderer.node())
    116116                return { *m_inlineContent, runIndex };
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r268764 r268798  
    5656namespace LayoutIntegration {
    5757
    58 LineLayout::LineLayout(const RenderBlockFlow& flow)
    59     : m_flow(flow)
    60     , m_boxTree(flow)
    61     , m_layoutState(m_flow.document(), rootLayoutBox())
     58LineLayout::LineLayout(RenderBlockFlow& flow)
     59    : m_boxTree(flow)
     60    , m_layoutState(flow.document(), rootLayoutBox())
    6261    , m_inlineFormattingState(m_layoutState.ensureInlineFormattingState(rootLayoutBox()))
    6362{
    64     m_layoutState.setIsIntegratedRootBoxFirstChild(m_flow.parent()->firstChild() == &m_flow);
     63    m_layoutState.setIsIntegratedRootBoxFirstChild(flow.parent()->firstChild() == &flow);
    6564}
    6665
    6766LineLayout::~LineLayout() = default;
     67
     68LineLayout* LineLayout::containing(RenderObject& renderer)
     69{
     70    if (auto* parent = renderer.parent()) {
     71        if (is<RenderBlockFlow>(*parent))
     72            return downcast<RenderBlockFlow>(*parent).layoutFormattingContextLineLayout();
     73    }
     74
     75    return nullptr;
     76}
     77
     78const LineLayout* LineLayout::containing(const RenderObject& renderer)
     79{
     80    return containing(const_cast<RenderObject&>(renderer));
     81}
    6882
    6983bool LineLayout::isEnabled()
     
    88102void LineLayout::updateReplacedDimensions(const RenderBox& replaced)
    89103{
    90     auto& layoutBox = *m_boxTree.layoutBoxForRenderer(replaced);
    91     auto& replacedBox = const_cast<Layout::ReplacedBox&>(downcast<Layout::ReplacedBox>(layoutBox));
     104    auto& layoutBox = m_boxTree.layoutBoxForRenderer(replaced);
     105    auto& replacedBox = downcast<Layout::ReplacedBox>(layoutBox);
    92106
    93107    replacedBox.setContentSizeForIntegration({ replaced.contentLogicalWidth(), replaced.contentLogicalHeight() });
    94108}
    95109
    96 void LineLayout::updateStyle()
    97 {
    98     auto& root = rootLayoutBox();
    99 
    100     // FIXME: Encapsulate style updates better.
    101     root.updateStyle(m_flow.style());
    102 
    103     for (auto* child = root.firstChild(); child; child = child->nextSibling()) {
    104         if (child->isAnonymous())
    105             child->updateStyle(RenderStyle::createAnonymousStyleWithDisplay(root.style(), DisplayType::Inline));
    106     }
     110void LineLayout::updateStyle(const RenderBoxModelObject& renderer)
     111{
     112    m_boxTree.updateStyle(renderer);
    107113}
    108114
     
    119125
    120126    auto invalidationState = Layout::InvalidationState { };
    121     auto horizontalConstraints = Layout::HorizontalConstraints { m_flow.borderAndPaddingStart(), m_flow.contentSize().width() };
    122     auto verticalConstraints = Layout::VerticalConstraints { m_flow.borderAndPaddingBefore(), { } };
     127    auto horizontalConstraints = Layout::HorizontalConstraints { flow().borderAndPaddingStart(), flow().contentSize().width() };
     128    auto verticalConstraints = Layout::VerticalConstraints { flow().borderAndPaddingBefore(), { } };
    123129
    124130    inlineFormattingContext.layoutInFlowContent(invalidationState, { horizontalConstraints, verticalConstraints });
     
    169175
    170176            if (layoutBox.isReplacedBox()) {
    171                 auto& renderer = downcast<RenderBox>(*rendererForLayoutBox(layoutBox));
     177                auto& renderer = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
    172178                auto borderBoxLocation = FloatPoint { runRect.x(), runRect.y() + m_layoutState.geometryForBox(layoutBox).marginBefore() };
    173                 const_cast<RenderBox&>(renderer).setLocation(flooredLayoutPoint(borderBoxLocation));
     179                renderer.setLocation(flooredLayoutPoint(borderBoxLocation));
    174180            }
    175181        }
     
    187193            auto overflowWidth = [&] {
    188194                // FIXME: It's the copy of the lets-adjust-overflow-for-the-caret behavior from ComplexLineLayout::addOverflowFromInlineChildren.
    189                 auto endPadding = m_flow.hasOverflowClip() ? m_flow.paddingEnd() : 0_lu;
     195                auto endPadding = flow().hasOverflowClip() ? flow().paddingEnd() : 0_lu;
    190196                if (!endPadding)
    191                     endPadding = m_flow.endPaddingWidthForCaret();
    192                 if (m_flow.hasOverflowClip() && !endPadding && m_flow.element() && m_flow.element()->isRootEditableElement())
     197                    endPadding = flow().endPaddingWidthForCaret();
     198                if (flow().hasOverflowClip() && !endPadding && flow().element() && flow().element()->isRootEditableElement())
    193199                    endPadding = 1;
    194200                auto lineBoxLogicalWidth = lineBoxLogicalRect.width() + endPadding;
     
    220226void LineLayout::prepareLayoutState()
    221227{
    222     m_layoutState.setViewportSize(m_flow.frame().view()->size());
     228    m_layoutState.setViewportSize(flow().frame().view()->size());
    223229
    224230    auto& rootGeometry = m_layoutState.ensureGeometryForBox(rootLayoutBox());
    225     rootGeometry.setContentBoxWidth(m_flow.contentSize().width());
     231    rootGeometry.setContentBoxWidth(flow().contentSize().width());
    226232    rootGeometry.setPadding({ { } });
    227233    rootGeometry.setBorder({ });
     
    235241    floatingState.clear();
    236242
    237     if (!m_flow.containsFloats())
     243    if (!flow().containsFloats())
    238244        return;
    239245
    240     for (auto& floatingObject : *m_flow.floatingObjectSet()) {
     246    for (auto& floatingObject : *flow().floatingObjectSet()) {
    241247        auto& rect = floatingObject->frameRect();
    242248        auto position = floatingObject->type() == FloatingObject::FloatRight
     
    302308}
    303309
    304 void LineLayout::adjustForPagination(RenderBlockFlow& flow)
    305 {
    306     ASSERT(&flow == &m_flow);
    307     auto paginedInlineContent = adjustLinePositionsForPagination(*m_inlineContent, flow);
     310void LineLayout::adjustForPagination()
     311{
     312    auto paginedInlineContent = adjustLinePositionsForPagination(*m_inlineContent, flow());
    308313    if (paginedInlineContent.ptr() == m_inlineContent) {
    309314        m_paginatedHeight = { };
     
    317322}
    318323
    319 void LineLayout::collectOverflow(RenderBlockFlow& flow)
    320 {
    321     ASSERT(&flow == &m_flow);
    322 
     324void LineLayout::collectOverflow()
     325{
    323326    for (auto& line : inlineContent()->lines) {
    324         flow.addLayoutOverflow(Layout::toLayoutRect(line.scrollableOverflow()));
    325         if (!flow.hasOverflowClip())
    326             flow.addVisualOverflow(Layout::toLayoutRect(line.inkOverflow()));
     327        flow().addLayoutOverflow(Layout::toLayoutRect(line.scrollableOverflow()));
     328        if (!flow().hasOverflowClip())
     329            flow().addVisualOverflow(Layout::toLayoutRect(line.inkOverflow()));
    327330    }
    328331}
     
    339342    if (!m_inlineContent)
    340343        return { };
    341     auto* layoutBox = m_boxTree.layoutBoxForRenderer(renderText);
    342     ASSERT(layoutBox);
     344    auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderText);
    343345
    344346    auto firstIndex = [&]() -> Optional<size_t> {
    345347        for (size_t i = 0; i < m_inlineContent->runs.size(); ++i) {
    346             if (&m_inlineContent->runs[i].layoutBox() == layoutBox)
     348            if (&m_inlineContent->runs[i].layoutBox() == &layoutBox)
    347349                return i;
    348350        }
     
    360362    if (!m_inlineContent)
    361363        return { };
    362     auto* layoutBox = m_boxTree.layoutBoxForRenderer(renderElement);
    363     ASSERT(layoutBox);
     364    auto& layoutBox = m_boxTree.layoutBoxForRenderer(renderElement);
    364365
    365366    for (size_t i = 0; i < m_inlineContent->runs.size(); ++i) {
    366367        auto& run =  m_inlineContent->runs[i];
    367         if (&run.layoutBox() == layoutBox)
     368        if (&run.layoutBox() == &layoutBox)
    368369            return { RunIteratorModernPath(*m_inlineContent, i) };
    369370    }
     
    372373}
    373374
    374 const RenderObject* LineLayout::rendererForLayoutBox(const Layout::Box& layoutBox) const
     375const RenderObject& LineLayout::rendererForLayoutBox(const Layout::Box& layoutBox) const
    375376{
    376377    return m_boxTree.rendererForLayoutBox(layoutBox);
     
    396397
    397398    auto& inlineContent = *m_inlineContent;
    398     float deviceScaleFactor = m_flow.document().deviceScaleFactor();
     399    float deviceScaleFactor = flow().document().deviceScaleFactor();
    399400
    400401    auto paintRect = paintInfo.rect;
     
    403404    for (auto& run : inlineContent.runsForRect(paintRect)) {
    404405        if (!run.textContent()) {
    405             auto* renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
    406             if (renderer && renderer->isReplaced() && is<RenderBox>(*renderer)) {
    407                 auto& renderBox = const_cast<RenderBox&>(downcast<RenderBox>(*renderer));
     406            auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
     407            if (renderer.isReplaced() && is<RenderBox>(renderer)) {
     408                auto& renderBox = downcast<RenderBox>(renderer);
    408409                if (renderBox.hasSelfPaintingLayer())
    409410                    continue;
     
    450451        TextPainter textPainter(paintInfo.context());
    451452        textPainter.setFont(style.fontCascade());
    452         textPainter.setStyle(computeTextPaintStyle(m_flow.frame(), style, paintInfo));
     453        textPainter.setStyle(computeTextPaintStyle(flow().frame(), style, paintInfo));
    453454        if (auto* debugShadow = debugTextShadow())
    454455            textPainter.setShadow(debugShadow);
     
    459460        if (!style.textDecorationsInEffect().isEmpty()) {
    460461            // FIXME: Use correct RenderText.
    461             if (auto* textRenderer = childrenOfType<RenderText>(m_flow).first()) {
     462            if (auto* textRenderer = childrenOfType<RenderText>(flow()).first()) {
    462463                auto painter = TextDecorationPainter { paintInfo.context(), style.textDecorationsInEffect(), *textRenderer, false, style.fontCascade() };
    463464                painter.setWidth(rect.width());
     
    490491            continue;
    491492
    492         auto& renderer = const_cast<RenderObject&>(*m_boxTree.rendererForLayoutBox(run.layoutBox()));
     493        auto& renderer = m_boxTree.rendererForLayoutBox(run.layoutBox());
    493494
    494495        renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
     
    502503ShadowData* LineLayout::debugTextShadow()
    503504{
    504     if (!m_flow.settings().simpleLineLayoutDebugBordersEnabled())
     505    if (!flow().settings().simpleLineLayoutDebugBordersEnabled())
    505506        return nullptr;
    506507
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r268598 r268798  
    4343class RenderBlockFlow;
    4444class RenderBox;
     45class RenderBoxModelObject;
    4546struct PaintInfo;
    4647
     
    5253    WTF_MAKE_FAST_ALLOCATED;
    5354public:
    54     LineLayout(const RenderBlockFlow&);
     55    LineLayout(RenderBlockFlow&);
    5556    ~LineLayout();
     57
     58    static LineLayout* containing(RenderObject&);
     59    static const LineLayout* containing(const RenderObject&);
    5660
    5761    static bool isEnabled();
     
    6064
    6165    void updateReplacedDimensions(const RenderBox&);
    62     void updateStyle();
     66    void updateStyle(const RenderBoxModelObject&);
    6367    void layout();
    6468
     
    6973    LayoutUnit lastLineBaseline() const;
    7074
    71     void adjustForPagination(RenderBlockFlow&);
    72     void collectOverflow(RenderBlockFlow&);
     75    void adjustForPagination();
     76    void collectOverflow();
    7377
    7478    const InlineContent* inlineContent() const { return m_inlineContent.get(); }
     
    8185    RunIterator runFor(const RenderElement&) const;
    8286
    83     const RenderObject* rendererForLayoutBox(const Layout::Box&) const;
     87    const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
    8488
    8589    static void releaseCaches(RenderView&);
     
    9195    InlineContent& ensureInlineContent();
    9296
     97    RenderBlockFlow& flow() { return m_boxTree.flow(); }
     98    const RenderBlockFlow& flow() const { return m_boxTree.flow(); }
     99
    93100    const Layout::ContainerBox& rootLayoutBox() const;
    94101    Layout::ContainerBox& rootLayoutBox();
     
    96103    void releaseInlineItemCache();
    97104
    98     const RenderBlockFlow& m_flow;
    99105    BoxTree m_boxTree;
    100106    Layout::LayoutState m_layoutState;
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h

    r268520 r268798  
    118118    const RenderObject& renderer() const
    119119    {
    120         return *m_inlineContent->rendererForLayoutBox(run().layoutBox());
     120        return m_inlineContent->rendererForLayoutBox(run().layoutBox());
    121121    }
    122122
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r268667 r268798  
    21042104        if (shouldInvalidateLineLayoutPath())
    21052105            invalidateLineLayoutPath();
     2106
     2107#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     2108        if (auto* lineLayout = layoutFormattingContextLineLayout())
     2109            lineLayout->updateStyle(*this);
     2110#endif
    21062111    }
    21072112
    21082113    if (multiColumnFlow())
    21092114        updateStylesForColumnChildren();
    2110 
    2111 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    2112     if (layoutFormattingContextLineLayout())
    2113         layoutFormattingContextLineLayout()->updateStyle();
    2114 #endif
    21152115}
    21162116
     
    29892989#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    29902990    if (layoutFormattingContextLineLayout()) {
    2991         layoutFormattingContextLineLayout()->collectOverflow(*this);
     2991        layoutFormattingContextLineLayout()->collectOverflow();
    29922992        return;
    29932993    }
     
    36773677
    36783678    if (view().frameView().layoutContext().layoutState()->isPaginated())
    3679         layoutFormattingContextLineLayout.adjustForPagination(*this);
     3679        layoutFormattingContextLineLayout.adjustForPagination();
    36803680
    36813681    auto contentHeight = layoutFormattingContextLineLayout.contentLogicalHeight();
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r268666 r268798  
    4848#include "HitTestResult.h"
    4949#include "InlineElementBox.h"
     50#include "LayoutIntegrationLineLayout.h"
    5051#include "Page.h"
    5152#include "PaintInfo.h"
     
    408409    if (isOutOfFlowPositioned() && parent() && parent()->style().isDisplayFlexibleOrGridBox())
    409410        clearOverrideContentSize();
     411
     412    if (diff == StyleDifference::Layout) {
     413        if (auto* lineLayout = LayoutIntegration::LineLayout::containing(*this))
     414            lineLayout->updateStyle(*this);
     415    }
    410416}
    411417
Note: See TracChangeset for help on using the changeset viewer.