Changeset 159076 in webkit


Ignore:
Timestamp:
Nov 11, 2013 3:31:17 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

[Mac] Characters too close together in complex Arabic text
https://bugs.webkit.org/show_bug.cgi?id=124057

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-11-11
Reviewed by Darin Adler.

Source/WebCore:

We weren't updating our total width variable with run's initial
advance information, leading to widths that were too narrow.

In addition, while initial advances for runs that aren't the first
run are accounted for by baking in the initial advances into the
previous character's advance, the initial advance for the first run
has to be accounted for in ComplexTextController::offsetForPosition.

Test: fast/text/complex-grapheme-cluster-with-initial-advance.html
Test: fast/text/selection-in-initial-advance-region.html

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Update
total width variable
(WebCore::ComplexTextController::offsetOfPosition): Account for
the first run's initial advance.

LayoutTests:

complex-grapheme-cluster-with-initial-advance adds a span around a word in some
complex Arabic text, and expects that the word spacing is the same as without the
span.

selection-in-initial-advance-region simulates a mouse drag across a complex text run
with an initial advance. This makes sure that ComplexTextController::offsetForPosition
doesn't crash when there is an initial advance.

  • fast/text/complex-grapheme-cluster-with-initial-advance-expected.html: Added.
  • fast/text/complex-grapheme-cluster-with-initial-advance.html: Added.
  • fast/text/selection-in-initial-advance-region-expected.txt: added
  • fast/text/selection-in-initial-advance-region.html: added
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159071 r159076  
     12013-11-11  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Mac] Characters too close together in complex Arabic text
     4        https://bugs.webkit.org/show_bug.cgi?id=124057
     5
     6        Reviewed by Darin Adler.
     7
     8        complex-grapheme-cluster-with-initial-advance adds a span around a word in some
     9        complex Arabic text, and expects that the word spacing is the same as without the
     10        span.
     11
     12        selection-in-initial-advance-region simulates a mouse drag across a complex text run
     13        with an initial advance. This makes sure that ComplexTextController::offsetForPosition
     14        doesn't crash when there is an initial advance.
     15
     16        * fast/text/complex-grapheme-cluster-with-initial-advance-expected.html: Added.
     17        * fast/text/complex-grapheme-cluster-with-initial-advance.html: Added.
     18        * fast/text/selection-in-initial-advance-region-expected.txt: added
     19        * fast/text/selection-in-initial-advance-region.html: added
     20
    1212013-11-11  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r159072 r159076  
     12013-11-11  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [Mac] Characters too close together in complex Arabic text
     4        https://bugs.webkit.org/show_bug.cgi?id=124057
     5
     6        Reviewed by Darin Adler.
     7
     8        We weren't updating our total width variable with run's initial
     9        advance information, leading to widths that were too narrow.
     10
     11        In addition, while initial advances for runs that aren't the first
     12        run are accounted for by baking in the initial advances into the
     13        previous character's advance, the initial advance for the first run
     14        has to be accounted for in ComplexTextController::offsetForPosition.
     15
     16        Test: fast/text/complex-grapheme-cluster-with-initial-advance.html
     17        Test: fast/text/selection-in-initial-advance-region.html
     18
     19        * platform/graphics/mac/ComplexTextController.cpp:
     20        (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Update
     21        total width variable
     22        (WebCore::ComplexTextController::offsetOfPosition): Account for
     23        the first run's initial advance.
     24
    1252013-11-11  Brady Eidson  <beidson@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r159027 r159076  
    189189        const ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
    190190        for (unsigned j = 0; j < complexTextRun.glyphCount(); ++j) {
    191             CGFloat adjustedAdvance = m_adjustedAdvances[offsetIntoAdjustedGlyphs + j].width;
     191            size_t index = offsetIntoAdjustedGlyphs + j;
     192            CGFloat adjustedAdvance = m_adjustedAdvances[index].width;
     193            if (!index)
     194                adjustedAdvance += complexTextRun.initialAdvance().width;
    192195            if (x < adjustedAdvance) {
    193196                CFIndex hitGlyphStart = complexTextRun.indexAt(j);
     
    579582            m_adjustedAdvances[m_adjustedAdvances.size() - 1] = previousAdvance;
    580583        }
     584        widthSinceLastCommit += complexTextRun.initialAdvance().width;
    581585
    582586        if (!complexTextRun.isLTR())
Note: See TracChangeset for help on using the changeset viewer.