Changeset 252906 in webkit


Ignore:
Timestamp:
Nov 27, 2019 9:01:11 AM (4 years ago)
Author:
Antti Koivisto
Message:

[LFC][Render tree] RenderBlockFlow::ensureLineBoxes should work with lfc layout
https://bugs.webkit.org/show_bug.cgi?id=204633

Reviewed by Zalan Bujtas.

We need to be able to switch to linebox layout when needed.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::deleteLines):
(WebCore::RenderBlockFlow::invalidateLineLayoutPath):
(WebCore::RenderBlockFlow::ensureLineBoxes):

  • rendering/RenderBlockFlow.h:

(WebCore::RenderBlockFlow::hasLineLayout const):

Also switch to using WTF::Monostate as empty state.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252905 r252906  
     12019-11-27  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Render tree] RenderBlockFlow::ensureLineBoxes should work with lfc layout
     4        https://bugs.webkit.org/show_bug.cgi?id=204633
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        We need to be able to switch to linebox layout when needed.
     9
     10        * rendering/RenderBlockFlow.cpp:
     11        (WebCore::RenderBlockFlow::deleteLines):
     12        (WebCore::RenderBlockFlow::invalidateLineLayoutPath):
     13        (WebCore::RenderBlockFlow::ensureLineBoxes):
     14        * rendering/RenderBlockFlow.h:
     15        (WebCore::RenderBlockFlow::hasLineLayout const):
     16
     17        Also switch to using WTF::Monostate as empty state.
     18
    1192019-11-27  Antti Koivisto  <antti@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r252893 r252906  
    21222122void RenderBlockFlow::deleteLines()
    21232123{
    2124     m_lineLayout = nullptr;
     2124    m_lineLayout = WTF::Monostate();
    21252125
    21262126    RenderBlock::deleteLines();
     
    36343634    case SimpleLinesPath:
    36353635        // The simple line layout may have become invalid.
    3636         m_lineLayout = nullptr;
     3636        m_lineLayout = WTF::Monostate();
    36373637        setLineLayoutPath(UndeterminedPath);
    36383638        if (needsLayout())
     
    36963696    setLineLayoutPath(ForceLineBoxesPath);
    36973697
    3698     if (!simpleLineLayout())
    3699         return;
    3700 
    3701     auto simpleLineLayout = makeRef(*this->simpleLineLayout());
     3698    if (complexLineLayout() || !hasLineLayout())
     3699        return;
     3700
     3701    auto simpleLineLayout = makeRefPtr(this->simpleLineLayout());
    37023702
    37033703    m_lineLayout = makeUnique<ComplexLineLayout>(*this);
    37043704
    3705     if (SimpleLineLayout::canUseForLineBoxTree(*this, simpleLineLayout.get())) {
    3706         SimpleLineLayout::generateLineBoxTree(*this, simpleLineLayout.get());
    3707         return;
     3705    if (simpleLineLayout) {
     3706        if (SimpleLineLayout::canUseForLineBoxTree(*this, *simpleLineLayout)) {
     3707            SimpleLineLayout::generateLineBoxTree(*this, *simpleLineLayout);
     3708            return;
     3709        }
    37083710    }
    37093711
     
    37183720    LayoutUnit repaintLogicalTop;
    37193721    LayoutUnit repaintLogicalBottom;
    3720     if (simpleLineLayout->isPaginated()) {
     3722    if (simpleLineLayout && simpleLineLayout->isPaginated()) {
    37213723        PaginatedLayoutStateMaintainer state(*this);
    37223724        complexLineLayout.layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r252893 r252906  
    541541
    542542private:
     543    bool hasLineLayout() const;
    543544    bool hasSimpleLineLayout() const;
    544545    bool hasComplexLineLayout() const;
     
    589590private:
    590591    Variant<
    591         std::nullptr_t,
     592        WTF::Monostate,
    592593        Ref<SimpleLineLayout::Layout>,
    593594#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     
    602603};
    603604
     605inline bool RenderBlockFlow::hasLineLayout() const
     606{
     607    return !WTF::holds_alternative<WTF::Monostate>(m_lineLayout);
     608}
     609
    604610inline bool RenderBlockFlow::hasComplexLineLayout() const
    605611{
Note: See TracChangeset for help on using the changeset viewer.