Changeset 216088 in webkit


Ignore:
Timestamp:
May 2, 2017 12:35:25 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
https://bugs.webkit.org/show_bug.cgi?id=169517
<rdar://problem/30652443>

Reviewed by Dean Jackson.

Source/WebCore:

FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
advances gathered so far is the distance from the right edge of the text to the left edge of the
subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.

Test: fast/text/complex-text-selection.html

  • platform/graphics/cocoa/FontCascadeCocoa.mm:

(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):

LayoutTests:

  • fast/text/complex-text-selection-expected.html: Added.
  • fast/text/complex-text-selection.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r216087 r216088  
     12017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
     4        https://bugs.webkit.org/show_bug.cgi?id=169517
     5        <rdar://problem/30652443>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * fast/text/complex-text-selection-expected.html: Added.
     10        * fast/text/complex-text-selection.html: Added.
     11        * platform/ios/TestExpectations:
     12
    1132017-05-02  Joseph Pecoraro  <pecoraro@apple.com>
    214
  • trunk/LayoutTests/platform/ios/TestExpectations

    r215884 r216088  
    29472947# auto-sizing produces inconsistent image results
    29482948css3/viewport-percentage-lengths/vh-auto-size.html [ ImageOnlyFailure ]
     2949
     2950# This test relies on the ::selection pseudoclass which isn't honored on iOS.
     2951webkit.org/b/169517 fast/text/complex-text-selection.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r216084 r216088  
     12017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
     4        https://bugs.webkit.org/show_bug.cgi?id=169517
     5        <rdar://problem/30652443>
     6
     7        Reviewed by Dean Jackson.
     8
     9        FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
     10        subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
     11        the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
     12        of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
     13        advances gathered so far is the distance from the right edge of the text to the left edge of the
     14        subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
     15        total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
     16        forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
     17        codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
     18
     19        Test: fast/text/complex-text-selection.html
     20
     21        * platform/graphics/cocoa/FontCascadeCocoa.mm:
     22        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
     23
    1242017-05-02  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r214848 r216088  
    523523        // the sum of the layout advances.
    524524        initialAdvance = controller.totalWidth();
     525        for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i)
     526            initialAdvance -= dummyGlyphBuffer.advanceAt(i).width();
    525527        for (unsigned i = 0; i < glyphBuffer.size(); ++i)
    526528            initialAdvance -= glyphBuffer.advanceAt(i).width();
Note: See TracChangeset for help on using the changeset viewer.