Changeset 238349 in webkit


Ignore:
Timestamp:
Nov 17, 2018 8:11:24 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
https://bugs.webkit.org/show_bug.cgi?id=191801

Reviewed by Antti Koivisto.

Source/WebCore:

before<span style="position: relative">positioned</span>after
In the example above the <positioned> inline box has both the BreakAtStart and the BreakAtEnd rules.
While walking through the inline tree, we add BreakAtStart first and when we figure it's the last child too,
we add BreakAtEnd as well. BreakAtEnd should not clear the BreakAtStart rule.

Test: fast/inline/simple-inline-with-out-of-flow-descendant2.html

  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):

  • layout/inlineformatting/InlineFormattingState.cpp:

(WebCore::Layout::InlineFormattingState::addDetachingRule):

  • layout/inlineformatting/InlineFormattingState.h:

(WebCore::Layout::InlineFormattingState::addDetachingRule): Deleted.

Tools:

  • LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

  • fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt: Added.
  • fast/inline/simple-inline-with-out-of-flow-descendant2.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238345 r238349  
     12018-11-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
     4        https://bugs.webkit.org/show_bug.cgi?id=191801
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt: Added.
     9        * fast/inline/simple-inline-with-out-of-flow-descendant2.html: Added.
     10
    1112018-11-17  Jonathan Hammer  <jonathan@e3software.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r238345 r238349  
     12018-11-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
     4        https://bugs.webkit.org/show_bug.cgi?id=191801
     5
     6        Reviewed by Antti Koivisto.
     7
     8        before<span style="position: relative">positioned</span>after
     9        In the example above the <positioned> inline box has both the BreakAtStart and the BreakAtEnd rules.
     10        While walking through the inline tree, we add BreakAtStart first and when we figure it's the last child too,
     11        we add BreakAtEnd as well. BreakAtEnd should not clear the BreakAtStart rule.
     12
     13        Test: fast/inline/simple-inline-with-out-of-flow-descendant2.html
     14
     15        * layout/inlineformatting/InlineFormattingContext.cpp:
     16        (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
     17        * layout/inlineformatting/InlineFormattingState.cpp:
     18        (WebCore::Layout::InlineFormattingState::addDetachingRule):
     19        * layout/inlineformatting/InlineFormattingState.h:
     20        (WebCore::Layout::InlineFormattingState::addDetachingRule): Deleted.
     21
    1222018-11-17  Jonathan Hammer  <jonathan@e3software.com>
    223
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r238279 r238349  
    176176
    177177        // #1
    178         if (!detachingRules) {
     178        if (detachingRules.isEmpty()) {
    179179            uncommittedLength += currentLength();
    180180            firstUncommittedInlineItem = !firstUncommittedInlineItem ? &inlineItem : firstUncommittedInlineItem;
     
    195195
    196196        // #2
    197         if (*detachingRules == InlineFormattingState::DetachingRule::BreakAtStart) {
     197        if (detachingRules == InlineFormattingState::DetachingRule::BreakAtStart) {
    198198            commit();
    199199            firstUncommittedInlineItem = &inlineItem;
     
    203203
    204204        // #3
    205         if (*detachingRules == InlineFormattingState::DetachingRule::BreakAtEnd) {
     205        if (detachingRules == InlineFormattingState::DetachingRule::BreakAtEnd) {
    206206            ASSERT(firstUncommittedInlineItem);
    207207            uncommittedLength += currentLength();
     
    456456        // Skip formatting root subtree. They are not part of this inline formatting context.
    457457        inlineRunProvider.append(root);
    458         inlineFormattingState.addDetachingRule(root, { InlineFormattingState::DetachingRule::BreakAtStart, InlineFormattingState::DetachingRule::BreakAtEnd });
     458        inlineFormattingState.setDetachingRules(root, { InlineFormattingState::DetachingRule::BreakAtStart, InlineFormattingState::DetachingRule::BreakAtEnd });
    459459        return;
    460460    }
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp

    r238173 r238349  
    5151}
    5252
    53 std::optional<InlineFormattingState::DetachingRules> InlineFormattingState::detachingRules(const Box& layoutBox) const
     53void InlineFormattingState::addDetachingRule(const Box& layoutBox, DetachingRule detachingRule)
     54{
     55    m_detachingRules.add(&layoutBox, DetachingRule { }).iterator->value.add(detachingRule);
     56}
     57
     58OptionSet<InlineFormattingState::DetachingRule> InlineFormattingState::detachingRules(const Box& layoutBox) const
    5459{
    5560    auto detachingRules = m_detachingRules.get(&layoutBox);
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h

    r238173 r238349  
    7171        BreakAtEnd = 1 << 1
    7272    };
    73     using DetachingRules = OptionSet<DetachingRule>;
    74     std::optional<DetachingRules> detachingRules(const Box& layoutBox) const;
    75     void addDetachingRule(const Box& layoutBox, DetachingRules detachingRules) { m_detachingRules.set(&layoutBox, detachingRules); }
     73    void addDetachingRule(const Box& layoutBox, DetachingRule);
     74
     75    OptionSet<DetachingRule> detachingRules(const Box& layoutBox) const;
     76    void setDetachingRules(const Box& layoutBox, OptionSet<DetachingRule> detachingRules) { m_detachingRules.set(&layoutBox, detachingRules); }
    7677
    7778    // Temp
     
    8081
    8182private:
    82     using DetachingRulesForInlineItems = HashMap<const Box*, DetachingRules>;
     83    using DetachingRulesForInlineItems = HashMap<const Box*, OptionSet<DetachingRule>>;
    8384
    8485    InlineContent m_inlineContent;
  • trunk/Tools/ChangeLog

    r238348 r238349  
     12018-11-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
     4        https://bugs.webkit.org/show_bug.cgi?id=191801
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * LayoutReloaded/misc/LFC-passing-tests.txt:
     9
    1102018-11-17  Jer Noble  <jer.noble@apple.com>
    211
  • trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt

    r238279 r238349  
    7272fast/inline/simple-inline-inflow-positioned.html
    7373fast/inline/simple-inline-with-out-of-flow-descendant.html
     74fast/inline/simple-inline-with-out-of-flow-descendant2.html
    7475fast/block/basic/height-percentage-simple.html
    7576fast/block/basic/child-block-level-box-with-height-percent.html
Note: See TracChangeset for help on using the changeset viewer.