Changeset 250776 in webkit


Ignore:
Timestamp:
Oct 7, 2019 10:28:28 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC] Add const version of LayoutState::displayBoxForLayoutBox
https://bugs.webkit.org/show_bug.cgi?id=202623
<rdar://problem/56025259>

Reviewed by Antti Koivisto.

  • layout/LayoutState.cpp:

(WebCore::Layout::LayoutState::displayBoxForLayoutBox):
(WebCore::Layout::LayoutState::displayBoxForLayoutBox const):

  • layout/LayoutState.h:
  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::outputLayoutTree):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r250774 r250776  
     12019-10-07  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Add const version of LayoutState::displayBoxForLayoutBox
     4        https://bugs.webkit.org/show_bug.cgi?id=202623
     5        <rdar://problem/56025259>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * layout/LayoutState.cpp:
     10        (WebCore::Layout::LayoutState::displayBoxForLayoutBox):
     11        (WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
     12        * layout/LayoutState.h:
     13        * layout/layouttree/LayoutTreeBuilder.cpp:
     14        (WebCore::Layout::outputLayoutTree):
     15
    1162019-10-07  youenn fablet  <youenn@apple.com>
    217
  • trunk/Source/WebCore/layout/LayoutState.cpp

    r250769 r250776  
    4646}
    4747
    48 Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
     48Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox)
    4949{
    5050    return *m_layoutToDisplayBox.ensure(&layoutBox, [&layoutBox] {
    5151        return makeUnique<Display::Box>(layoutBox.style());
    5252    }).iterator->value;
     53}
     54
     55const Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
     56{
     57    ASSERT(hasDisplayBox(layoutBox));
     58    return *m_layoutToDisplayBox.get(&layoutBox);
    5359}
    5460
  • trunk/Source/WebCore/layout/LayoutState.h

    r250769 r250776  
    6161#endif
    6262
    63     Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const;
     63    Display::Box& displayBoxForLayoutBox(const Box& layoutBox);
     64    const Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const;
    6465    bool hasDisplayBox(const Box& layoutBox) const { return m_layoutToDisplayBox.contains(&layoutBox); }
    6566
     
    7879    HashSet<const FormattingContext*> m_formattingContextList;
    7980#endif
    80     mutable HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
     81    HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
    8182    QuirksMode m_quirksMode { QuirksMode::No };
    8283};
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r250769 r250776  
    327327{
    328328    for (auto& child : childrenOfType<Box>(rootContainer)) {
    329         Display::Box* displayBox = nullptr;
    330         // Not all boxes generate display boxes.
    331         if (layoutState && layoutState->hasDisplayBox(child))
    332             displayBox = &layoutState->displayBoxForLayoutBox(child);
    333 
    334         outputLayoutBox(stream, child, displayBox, depth);
    335         if (layoutState && child.establishesInlineFormattingContext())
    336             outputInlineRuns(stream, *layoutState, downcast<Container>(child), depth + 1);
     329        if (layoutState) {
     330            // Not all boxes generate display boxes.
     331            if (layoutState->hasDisplayBox(child))
     332                outputLayoutBox(stream, child, &layoutState->displayBoxForLayoutBox(child), depth);
     333            if (child.establishesInlineFormattingContext())
     334                outputInlineRuns(stream, *layoutState, downcast<Container>(child), depth + 1);
     335        } else
     336            outputLayoutBox(stream, child, nullptr, depth);
    337337
    338338        if (is<Container>(child))
Note: See TracChangeset for help on using the changeset viewer.