Changeset 292043 in webkit


Ignore:
Timestamp:
Mar 29, 2022 10:55:21 AM (2 years ago)
Author:
Alan Bujtas
Message:

RenderText::width should call FontCascade directly on single space characters
https://bugs.webkit.org/show_bug.cgi?id=238484

Reviewed by Antti Koivisto.

Some "text and inline box" heavy pages (e.g. wikipedia) have the pattern of leaving one space
gap between adjacent inline boxes (<span>some content</span> <span>and some more</span>).
This patch ensures that we don't construct redundant TextRun objects (and measure their widths)
for such simple cases when applicable.

  • rendering/RenderText.cpp:

(WebCore::RenderText::width const):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r292042 r292043  
     12022-03-29  Alan Bujtas  <zalan@apple.com>
     2
     3        RenderText::width should call FontCascade directly on single space characters
     4        https://bugs.webkit.org/show_bug.cgi?id=238484
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Some "text and inline box" heavy pages (e.g. wikipedia) have the pattern of leaving one space
     9        gap between adjacent inline boxes (<span>some content</span> <span>and some more</span>).
     10        This patch ensures that we don't construct redundant TextRun objects (and measure their widths)
     11        for such simple cases when applicable.
     12
     13        * rendering/RenderText.cpp:
     14        (WebCore::RenderText::width const):
     15
    1162022-03-29  Devin Rousso  <drousso@apple.com>
    217
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r291992 r292043  
    15611561        return *width;
    15621562
     1563    if (length == 1 && (characterAt(from) == space))
     1564        return canUseSimplifiedTextMeasuring() ? fontCascade.primaryFont().spaceWidth() : fontCascade.widthOfSpaceString();
     1565
    15631566    float width = 0.f;
    15641567    if (&fontCascade == &style.fontCascade()) {
Note: See TracChangeset for help on using the changeset viewer.