Changeset 252810 in webkit


Ignore:
Timestamp:
Nov 22, 2019 3:30:43 PM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Merge "insert inline runs" and "setup display runs" loops in InlineFormattingContext::setDisplayBoxesForLine
https://bugs.webkit.org/show_bug.cgi?id=204537
<rdar://problem/57440394>

Reviewed by Antti Koivisto.

Let's loop the new Line::Run list only once.

  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252808 r252810  
     12019-11-22  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Merge "insert inline runs" and "setup display runs" loops in InlineFormattingContext::setDisplayBoxesForLine
     4        https://bugs.webkit.org/show_bug.cgi?id=204537
     5        <rdar://problem/57440394>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Let's loop the new Line::Run list only once.
     10
     11        * layout/inlineformatting/InlineFormattingContext.cpp:
     12        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
     13
    1142019-11-22  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r252543 r252810  
    428428    }
    429429
    430     // Add final display runs to state.
    431430    formattingState.addLineBox(lineContent.lineBox);
    432     // FIXME: This is tempoary.
    433431    auto& currentLine = *formattingState.lineBoxes().last();
    434     for (auto& lineRun : lineContent.runList) {
    435         // Inline level containers (<span>) don't generate display runs.
    436         if (lineRun.isContainerStart() || lineRun.isContainerEnd())
    437             continue;
    438         // Completely collapsed line runs don't generate display runs either.
    439         if (lineRun.isCollapsedToVisuallyEmpty())
    440             continue;
    441         formattingState.addInlineRun(makeUnique<Display::Run>(lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);
    442     }
    443 
    444432    // Compute box final geometry.
    445433    auto& lineRuns = lineContent.runList;
     
    449437        auto& layoutBox = lineRun.layoutBox();
    450438        auto& displayBox = formattingState.displayBox(layoutBox);
     439
     440        // Add final display runs to state first.
     441        // Inline level containers (<span>) don't generate display runs and neither do completely collapsed runs.
     442        auto initiatesInlineRun = !lineRun.isContainerStart() && !lineRun.isContainerEnd() && !lineRun.isCollapsedToVisuallyEmpty();
     443        if (initiatesInlineRun)
     444            formattingState.addInlineRun(makeUnique<Display::Run>(lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);
    451445
    452446        if (lineRun.isForcedLineBreak()) {
Note: See TracChangeset for help on using the changeset viewer.