Changeset 252530 in webkit


Ignore:
Timestamp:
Nov 17, 2019 12:01:33 PM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Optimize Line::isVisuallyEmpty for the most common inline content.
https://bugs.webkit.org/show_bug.cgi?id=204259
<rdar://problem/57243610>

Reviewed by Antti Koivisto.

Move the check on text content to the front.

  • layout/inlineformatting/InlineLine.cpp:

(WebCore::Layout::Line::isVisuallyEmpty const):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252528 r252530  
     12019-11-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Optimize Line::isVisuallyEmpty for the most common inline content.
     4        https://bugs.webkit.org/show_bug.cgi?id=204259
     5        <rdar://problem/57243610>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Move the check on text content to the front.
     10
     11        * layout/inlineformatting/InlineLine.cpp:
     12        (WebCore::Layout::Line::isVisuallyEmpty const):
     13
    1142019-11-16  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp

    r252322 r252530  
    5151    bool isContainerStart() const { return m_inlineItem.isContainerStart(); }
    5252    bool isContainerEnd() const { return m_inlineItem.isContainerEnd(); }
     53    bool isForcedLineBreak() const { return m_inlineItem.isForcedLineBreak(); }
    5354    InlineItem::Type type() const { return m_inlineItem.type(); }
    5455
     
    194195    auto& formattingContext = this->formattingContext();
    195196    for (auto& run : m_inlineItemRuns) {
     197        if (run->isText()) {
     198            if (!run->isCollapsedToZeroAdvanceWidth())
     199                return false;
     200            continue;
     201        }
    196202        if (run->isContainerStart()) {
    197203            if (!isInlineContainerConsideredEmpty(formattingContext, run->layoutBox()))
     
    201207        if (run->isContainerEnd())
    202208            continue;
    203         if (run->layoutBox().establishesFormattingContext()) {
     209        if (run->isBox()) {
     210            if (!run->layoutBox().establishesFormattingContext())
     211                return false;
    204212            ASSERT(run->layoutBox().isInlineBlockBox());
    205213            auto& boxGeometry = formattingContext.geometryForBox(run->layoutBox());
     
    210218            continue;
    211219        }
    212         if (!run->isText() || !run->isCollapsedToZeroAdvanceWidth())
     220        if (run->isForcedLineBreak())
    213221            return false;
    214222    }
Note: See TracChangeset for help on using the changeset viewer.