Changeset 211680 in webkit


Ignore:
Timestamp:
Feb 5, 2017, 6:41:10 AM (9 years ago)
Author:
Alan Bujtas
Message:

Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
https://bugs.webkit.org/show_bug.cgi?id=167840
<rdar://problem/30364784>

Reviewed by Myles C. Maxfield.

Source/WebCore:

Surrogate pairs require special line breaking logic.

Test: fast/text/simple-line-layout-no-surrogate-pairs.html

  • rendering/SimpleLineLayout.cpp:

(WebCore::SimpleLineLayout::canUseForCharacter):
(WebCore::SimpleLineLayout::canUseForText): Checking against special characters is faster than
checking against glyphs. Reverse their order.
(WebCore::SimpleLineLayout::printReason):

LayoutTests:

  • fast/text/simple-line-layout-no-surrogate-pairs-expected.html: Added.
  • fast/text/simple-line-layout-no-surrogate-pairs.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211667 r211680  
     12017-02-05  Zalan Bujtas  <zalan@apple.com>
     2
     3        Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
     4        https://bugs.webkit.org/show_bug.cgi?id=167840
     5        <rdar://problem/30364784>
     6
     7        Reviewed by Myles C. Maxfield.
     8
     9        * fast/text/simple-line-layout-no-surrogate-pairs-expected.html: Added.
     10        * fast/text/simple-line-layout-no-surrogate-pairs.html: Added.
     11
    1122017-02-03  Myles C. Maxfield  <mmaxfield@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r211677 r211680  
     12017-02-05  Zalan Bujtas  <zalan@apple.com>
     2
     3        Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
     4        https://bugs.webkit.org/show_bug.cgi?id=167840
     5        <rdar://problem/30364784>
     6
     7        Reviewed by Myles C. Maxfield.
     8
     9        Surrogate pairs require special line breaking logic.
     10
     11        Test: fast/text/simple-line-layout-no-surrogate-pairs.html
     12
     13        * rendering/SimpleLineLayout.cpp:
     14        (WebCore::SimpleLineLayout::canUseForCharacter):
     15        (WebCore::SimpleLineLayout::canUseForText): Checking against special characters is faster than
     16        checking against glyphs. Reverse their order.
     17        (WebCore::SimpleLineLayout::printReason):
     18
    1192017-02-04  Joseph Pecoraro  <pecoraro@apple.com>
    220
  • trunk/Source/WebCore/rendering/SimpleLineLayout.cpp

    r211671 r211680  
    114114    FlowHasHangingPunctuation             = 1LLU  << 48,
    115115    FlowFontHasOverflowGlyph              = 1LLU  << 49,
    116     EndOfReasons                          = 1LLU  << 50
     116    FlowTextHasSurrogatePair              = 1LLU  << 50,
     117    EndOfReasons                          = 1LLU  << 51
    117118};
    118119const unsigned NoReason = 0;
     
    151152    }
    152153
     154    if (U16_IS_SURROGATE(character))
     155        SET_REASON_AND_RETURN_IF_NEEDED(FlowTextHasSurrogatePair, reasons, includeReasons);
     156   
    153157    UCharDirection direction = u_charDirection(character);
    154158    if (direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC
     
    180184            SET_REASON_AND_RETURN_IF_NEEDED(FlowTextHasSoftHyphen, reasons, includeReasons);
    181185
     186        auto characterReasons = canUseForCharacter(character, textIsJustified, includeReasons);
     187        if (characterReasons != NoReason)
     188            SET_REASON_AND_RETURN_IF_NEEDED(characterReasons, reasons, includeReasons);
     189
    182190        auto glyphData = fontCascade.glyphDataForCharacter(character, false);
    183191        if (!glyphData.isValid() || glyphData.font != &primaryFont)
     
    186194        if (lineHeightConstraint && primaryFont.boundsForGlyph(glyphData.glyph).height() > *lineHeightConstraint)
    187195            SET_REASON_AND_RETURN_IF_NEEDED(FlowFontHasOverflowGlyph, reasons, includeReasons);
    188 
    189         auto characterReasons = canUseForCharacter(character, textIsJustified, includeReasons);
    190         if (characterReasons != NoReason)
    191             SET_REASON_AND_RETURN_IF_NEEDED(characterReasons, reasons, includeReasons);
    192196    }
    193197    return reasons;
     
    10811085        stream << "-webkit-line-box-contain: glyphs with overflowing text.";
    10821086        break;
     1087    case FlowTextHasSurrogatePair:
     1088        stream << "surrogate pair";
     1089        break;
    10831090    case FlowTextIsEmpty:
    10841091    case FlowHasNoChild:
Note: See TracChangeset for help on using the changeset viewer.