Changeset 292685 in webkit


Ignore:
Timestamp:
Apr 9, 2022 7:59:35 PM (2 years ago)
Author:
Alan Bujtas
Message:

[Text autosizing] Remove redundant lineCountForTextAutosizing member function
https://bugs.webkit.org/show_bug.cgi?id=239034

Reviewed by Antti Koivisto.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
(WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.

  • rendering/RenderBlockFlow.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r292684 r292685  
     12022-04-09  Alan Bujtas  <zalan@apple.com>
     2
     3        [Text autosizing] Remove redundant lineCountForTextAutosizing member function
     4        https://bugs.webkit.org/show_bug.cgi?id=239034
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * rendering/RenderBlockFlow.cpp:
     9        (WebCore::RenderBlockFlow::adjustComputedFontSizes): stop walking the list item children when we see multiple lines.
     10        (WebCore::RenderBlockFlow::lineCountForTextAutosizing): Deleted.
     11        * rendering/RenderBlockFlow.h:
     12
    1132022-04-09  Khem Raj  <raj.khem@gmail.com>
    214
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r292679 r292685  
    37723772}
    37733773
    3774 int RenderBlockFlow::lineCountForTextAutosizing()
    3775 {
    3776     if (style().visibility() != Visibility::Visible)
    3777         return 0;
    3778     if (childrenInline())
    3779         return lineCount();
    3780     // Only descend into list items.
    3781     int count = 0;
    3782     for (auto& listItem : childrenOfType<RenderListItem>(*this))
    3783         count += listItem.lineCount();
    3784     return count;
    3785 }
    3786 
    37873774static bool isNonBlocksOrNonFixedHeightListItems(const RenderObject& renderer)
    37883775{
     
    38163803        return;
    38173804   
    3818     unsigned lineCount;
    3819     if (m_lineCountForTextAutosizing == NOT_SET) {
    3820         int count = lineCountForTextAutosizing();
    3821         if (!count)
     3805    unsigned lineCount = m_lineCountForTextAutosizing;
     3806    if (lineCount == NOT_SET) {
     3807        if (style().visibility() != Visibility::Visible)
    38223808            lineCount = NO_LINE;
    3823         else if (count == 1)
    3824             lineCount = ONE_LINE;
    3825         else
    3826             lineCount = MULTI_LINE;
    3827     } else
    3828         lineCount = m_lineCountForTextAutosizing;
    3829    
     3809        else {
     3810            size_t lineCountInBlock = 0;
     3811            if (childrenInline())
     3812                lineCountInBlock = this->lineCount();
     3813            else {
     3814                for (auto& listItem : childrenOfType<RenderListItem>(*this)) {
     3815                    lineCountInBlock += listItem.lineCount();
     3816                    if (lineCountInBlock > 1)
     3817                        break;
     3818                }
     3819            }
     3820            lineCount = !lineCountInBlock ? NO_LINE : lineCountInBlock == 1 ? ONE_LINE : MULTI_LINE;
     3821        }
     3822    }
     3823
    38303824    ASSERT(lineCount != NOT_SET);
    38313825    if (lineCount == NO_LINE)
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r291312 r292685  
    547547
    548548#if ENABLE(TEXT_AUTOSIZING)
    549     int lineCountForTextAutosizing();
    550549    void adjustComputedFontSizes(float size, float visibleWidth);
    551550    void resetComputedFontSize()
Note: See TracChangeset for help on using the changeset viewer.