Changeset 254378 in webkit


Ignore:
Timestamp:
Jan 10, 2020 4:13:12 PM (4 years ago)
Author:
Antti Koivisto
Message:

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

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/css/simple-color-change.html

For simple style changes we may keep the existing layout boxes. In this case we need to update the style.

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::updateStyle):

Update style in layout boxes.

(WebCore::LayoutIntegration::LineLayout::rootLayoutBox):

  • layout/integration/LayoutIntegrationLineLayout.h:

Make root non-const.

  • layout/layouttree/LayoutBox.h:

(WebCore::Layout::Box::nextSibling):

  • layout/layouttree/LayoutContainer.h:

Expose non-const accessors.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::styleDidChange):

Invoke LineLayout::updateStyle

LayoutTests:

  • fast/css/simple-color-change-expected.html: Added.
  • fast/css/simple-color-change.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254376 r254378  
     12020-01-10  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Integration] Update style for layout boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=206074
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * fast/css/simple-color-change-expected.html: Added.
     9        * fast/css/simple-color-change.html: Added.
     10
    1112020-01-10  Brent Fulgham  <bfulgham@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r254374 r254378  
     12020-01-10  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Integration] Update style for layout boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=206074
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Test: fast/css/simple-color-change.html
     9
     10        For simple style changes we may keep the existing layout boxes. In this case we need to update the style.
     11
     12        * layout/integration/LayoutIntegrationLineLayout.cpp:
     13        (WebCore::LayoutIntegration::LineLayout::updateStyle):
     14
     15        Update style in layout boxes.
     16
     17        (WebCore::LayoutIntegration::LineLayout::rootLayoutBox):
     18        * layout/integration/LayoutIntegrationLineLayout.h:
     19
     20        Make root non-const.
     21
     22        * layout/layouttree/LayoutBox.h:
     23        (WebCore::Layout::Box::nextSibling):
     24        * layout/layouttree/LayoutContainer.h:
     25
     26        Expose non-const accessors.
     27
     28        * rendering/RenderBlockFlow.cpp:
     29        (WebCore::RenderBlockFlow::styleDidChange):
     30
     31        Invoke LineLayout::updateStyle
     32
    1332020-01-10  John Wilander  <wilander@apple.com>
    234
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r254371 r254378  
    7777}
    7878
     79void LineLayout::updateStyle()
     80{
     81    auto& root = rootLayoutBox();
     82
     83    // FIXME: Encapsulate style updates better.
     84    root.updateStyle(m_flow.style());
     85
     86    for (auto* child = root.firstChild(); child; child = child->nextSibling()) {
     87        if (child->isAnonymous())
     88            child->updateStyle(RenderStyle::createAnonymousStyleWithDisplay(root.style(), DisplayType::Inline));
     89    }
     90}
     91
    7992void LineLayout::layout()
    8093{
     
    200213}
    201214
     215Layout::Container& LineLayout::rootLayoutBox()
     216{
     217    return m_treeContent->rootLayoutBox();
     218}
     219
    202220void LineLayout::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    203221{
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r253287 r254378  
    6161    static bool canUseFor(const RenderBlockFlow&);
    6262
     63    void updateStyle();
    6364    void layout();
    6465
     
    8182private:
    8283    const Layout::Container& rootLayoutBox() const;
     84    Layout::Container& rootLayoutBox();
    8385    void prepareRootGeometryForLayout();
    8486    ShadowData* debugTextShadow();
    8587
    8688    const RenderBlockFlow& m_flow;
    87     std::unique_ptr<const Layout::LayoutTreeContent> m_treeContent;
     89    std::unique_ptr<Layout::LayoutTreeContent> m_treeContent;
    8890    std::unique_ptr<Layout::LayoutState> m_layoutState;
    8991    LayoutUnit m_contentLogicalHeight;
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.h

    r253985 r254378  
    131131    const Box* previousInFlowOrFloatingSibling() const;
    132132
     133    // FIXME: This is currently needed for style updates.
     134    Box* nextSibling() { return m_nextSibling; }
     135
    133136    bool isContainer() const { return m_baseTypeFlags & ContainerFlag; }
    134137    bool isBlockContainer() const { return isBlockLevelBox() && isContainer(); }
  • trunk/Source/WebCore/layout/layouttree/LayoutContainer.h

    r248290 r254378  
    4949    const Box* lastInFlowOrFloatingChild() const;
    5050
     51    // FIXME: This is currently needed for style updates.
     52    Box* firstChild() { return m_firstChild; }
     53
    5154    bool hasChild() const { return firstChild(); }
    5255    bool hasInFlowChild() const { return firstInFlowChild(); }
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r254087 r254378  
    21052105    if (multiColumnFlow())
    21062106        updateStylesForColumnChildren();
     2107
     2108#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     2109    if (layoutFormattingContextLineLayout())
     2110        layoutFormattingContextLineLayout()->updateStyle();
     2111#endif
    21072112}
    21082113
Note: See TracChangeset for help on using the changeset viewer.