Changeset 159071 in webkit


Ignore:
Timestamp:
Nov 11, 2013, 2:39:40 PM (11 years ago)
Author:
Antti Koivisto
Message:

End of line whitespace should collapse with white-space:pre-wrap; overflow-wrap:break-word in all cases
https://bugs.webkit.org/show_bug.cgi?id=124158

Source/WebCore:

Reviewed by Dave Hyatt.

If a word just fits the line but the following space overflows we fail to collapse whitespaces
at the end of the line. This happens because with break-word we end up taking word breaking
code path that does not have pre-wrap whitespace handling.

This patch makes the behavior consistent and also matches Firefox.

Test: fast/text/break-word-pre-wrap.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::BreakingContext::handleText):

Don't take the word break code path if we are pre-wrap and the current character is space.
Instead proceed to break the line normally as this is a valid break position.

LayoutTests:

Reviewed by Dave Hyatt.

Added a specific test and updates the test results of some complex tests that demonstrate the same issue.

  • fast/text/break-word-pre-wrap-expected.html: Added.
  • fast/text/break-word-pre-wrap.html: Added.
  • platform/mac/fast/forms/basic-textareas-expected.png:
  • platform/mac/fast/forms/basic-textareas-expected.txt:
  • platform/mac/fast/forms/basic-textareas-quirks-expected.png:
  • platform/mac/fast/forms/basic-textareas-quirks-expected.txt:
  • platform/mac-mountainlion/fast/forms/basic-textareas-expected.txt:
  • platform/mac-mountainlion/fast/forms/basic-textareas-quirks-expected.txt:
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159070 r159071  
     12013-11-11  Antti Koivisto  <antti@apple.com>
     2
     3        End of line whitespace should collapse with white-space:pre-wrap; overflow-wrap:break-word in all cases
     4        https://bugs.webkit.org/show_bug.cgi?id=124158
     5
     6        Reviewed by Dave Hyatt.
     7       
     8        Added a specific test and updates the test results of some complex tests that demonstrate the same issue.
     9
     10        * fast/text/break-word-pre-wrap-expected.html: Added.
     11        * fast/text/break-word-pre-wrap.html: Added.
     12        * platform/mac/fast/forms/basic-textareas-expected.png:
     13        * platform/mac/fast/forms/basic-textareas-expected.txt:
     14        * platform/mac/fast/forms/basic-textareas-quirks-expected.png:
     15        * platform/mac/fast/forms/basic-textareas-quirks-expected.txt:
     16        * platform/mac-mountainlion/fast/forms/basic-textareas-expected.txt:
     17        * platform/mac-mountainlion/fast/forms/basic-textareas-quirks-expected.txt:
     18
    1192013-11-11  Bear Travis  <betravis@adobe.com>
    220
  • trunk/LayoutTests/platform/mac-mountainlion/fast/forms/basic-textareas-expected.txt

    r159017 r159071  
    547547                text run at (29,26) width 5: " "
    548548                text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    549         layer at (583,422) size 56x58 clip at (584,423) size 39x56 scrollHeight 186
     549        layer at (583,422) size 56x58 clip at (584,423) size 39x56 scrollHeight 173
    550550          RenderTextControl {TEXTAREA} at (3,31) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    551             RenderBlock {DIV} at (3,3) size 35x182
    552               RenderText {#text} at (0,0) size 35x182
     551            RenderBlock {DIV} at (3,3) size 35x169
     552              RenderText {#text} at (0,0) size 35x169
    553553                text run at (0,0) width 34: "Lorem"
    554554                text run at (33,0) width 2: " "
    555555                text run at (0,13) width 33: "ipsum"
    556                 text run at (0,26) width 7: "  "
    557                 text run at (0,39) width 29: "dolor"
    558                 text run at (28,39) width 4: " "
    559                 text run at (0,52) width 30: "ABCD"
    560                 text run at (0,65) width 35: "EFGHIJ"
    561                 text run at (0,78) width 31: "KLMN"
    562                 text run at (0,91) width 31: "OPQR"
    563                 text run at (0,104) width 28: "STUV"
    564                 text run at (0,117) width 30: "WXYZ"
    565                 text run at (29,117) width 5: " "
    566                 text run at (0,130) width 32: "abcde"
    567                 text run at (0,143) width 34: "fghijkl"
    568                 text run at (0,156) width 31: "mnop"
    569                 text run at (0,169) width 34: "qrstuv"
     556                text run at (32,13) width 3: "  "
     557                text run at (0,26) width 29: "dolor"
     558                text run at (28,26) width 4: " "
     559                text run at (0,39) width 30: "ABCD"
     560                text run at (0,52) width 35: "EFGHIJ"
     561                text run at (0,65) width 31: "KLMN"
     562                text run at (0,78) width 31: "OPQR"
     563                text run at (0,91) width 28: "STUV"
     564                text run at (0,104) width 30: "WXYZ"
     565                text run at (29,104) width 5: " "
     566                text run at (0,117) width 32: "abcde"
     567                text run at (0,130) width 34: "fghijkl"
     568                text run at (0,143) width 31: "mnop"
     569                text run at (0,156) width 34: "qrstuv"
    570570        layer at (3,503) size 161x47 clip at (4,504) size 159x30 scrollWidth 427
    571571          RenderTextControl {TEXTAREA} at (3,17) size 161x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     
    12461246                text run at (29,26) width 5: " "
    12471247                text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    1248         layer at (583,401) size 56x58 clip at (584,402) size 39x56 scrollHeight 186
     1248        layer at (583,401) size 56x58 clip at (584,402) size 39x56 scrollHeight 173
    12491249          RenderTextControl {TEXTAREA} at (3,31) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    1250             RenderBlock {DIV} at (3,3) size 35x182
    1251               RenderText {#text} at (0,0) size 35x182
     1250            RenderBlock {DIV} at (3,3) size 35x169
     1251              RenderText {#text} at (0,0) size 35x169
    12521252                text run at (0,0) width 34: "Lorem"
    12531253                text run at (33,0) width 2: " "
    12541254                text run at (0,13) width 33: "ipsum"
    1255                 text run at (0,26) width 7: "  "
    1256                 text run at (0,39) width 29: "dolor"
    1257                 text run at (28,39) width 4: " "
    1258                 text run at (0,52) width 30: "ABCD"
    1259                 text run at (0,65) width 35: "EFGHIJ"
    1260                 text run at (0,78) width 31: "KLMN"
    1261                 text run at (0,91) width 31: "OPQR"
    1262                 text run at (0,104) width 28: "STUV"
    1263                 text run at (0,117) width 30: "WXYZ"
    1264                 text run at (29,117) width 5: " "
    1265                 text run at (0,130) width 32: "abcde"
    1266                 text run at (0,143) width 34: "fghijkl"
    1267                 text run at (0,156) width 31: "mnop"
    1268                 text run at (0,169) width 34: "qrstuv"
     1255                text run at (32,13) width 3: "  "
     1256                text run at (0,26) width 29: "dolor"
     1257                text run at (28,26) width 4: " "
     1258                text run at (0,39) width 30: "ABCD"
     1259                text run at (0,52) width 35: "EFGHIJ"
     1260                text run at (0,65) width 31: "KLMN"
     1261                text run at (0,78) width 31: "OPQR"
     1262                text run at (0,91) width 28: "STUV"
     1263                text run at (0,104) width 30: "WXYZ"
     1264                text run at (29,104) width 5: " "
     1265                text run at (0,117) width 32: "abcde"
     1266                text run at (0,130) width 34: "fghijkl"
     1267                text run at (0,143) width 31: "mnop"
     1268                text run at (0,156) width 34: "qrstuv"
    12691269        layer at (3,479) size 161x47 clip at (4,480) size 159x30 scrollWidth 427
    12701270          RenderTextControl {TEXTAREA} at (3,17) size 161x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
  • trunk/LayoutTests/platform/mac-mountainlion/fast/forms/basic-textareas-quirks-expected.txt

    r157961 r159071  
    366366        text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    367367        text run at (129,39) width 5: " "
    368 layer at (26,761) size 56x58 clip at (27,762) size 39x56 scrollHeight 186
     368layer at (26,761) size 56x58 clip at (27,762) size 39x56 scrollHeight 173
    369369  RenderTextControl {TEXTAREA} at (17,3) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    370     RenderBlock {DIV} at (3,3) size 35x182
    371       RenderText {#text} at (0,0) size 35x182
     370    RenderBlock {DIV} at (3,3) size 35x169
     371      RenderText {#text} at (0,0) size 35x169
    372372        text run at (0,0) width 34: "Lorem"
    373373        text run at (33,0) width 2: " "
     
    387387        text run at (0,143) width 31: "mnop"
    388388        text run at (0,156) width 34: "qrstuv"
    389         text run at (0,169) width 4: " "
     389        text run at (33,156) width 2: " "
    390390layer at (376,26) size 60x32 clip at (377,27) size 43x30 scrollHeight 160
    391391  RenderTextControl {TEXTAREA} at (15,3) size 60x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
  • trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt

    r159017 r159071  
    547547                text run at (29,26) width 5: " "
    548548                text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    549         layer at (583,422) size 56x58 clip at (584,423) size 39x56 scrollHeight 186
     549        layer at (583,422) size 56x58 clip at (584,423) size 39x56 scrollHeight 173
    550550          RenderTextControl {TEXTAREA} at (3,31) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    551             RenderBlock {DIV} at (3,3) size 35x182
    552               RenderText {#text} at (0,0) size 35x182
     551            RenderBlock {DIV} at (3,3) size 35x169
     552              RenderText {#text} at (0,0) size 35x169
    553553                text run at (0,0) width 34: "Lorem"
    554554                text run at (33,0) width 2: " "
    555555                text run at (0,13) width 33: "ipsum"
    556                 text run at (0,26) width 7: "  "
    557                 text run at (0,39) width 29: "dolor"
    558                 text run at (28,39) width 4: " "
    559                 text run at (0,52) width 30: "ABCD"
    560                 text run at (0,65) width 35: "EFGHIJ"
    561                 text run at (0,78) width 31: "KLMN"
    562                 text run at (0,91) width 31: "OPQR"
    563                 text run at (0,104) width 28: "STUV"
    564                 text run at (0,117) width 30: "WXYZ"
    565                 text run at (29,117) width 5: " "
    566                 text run at (0,130) width 32: "abcde"
    567                 text run at (0,143) width 34: "fghijkl"
    568                 text run at (0,156) width 31: "mnop"
    569                 text run at (0,169) width 34: "qrstuv"
     556                text run at (32,13) width 3: "  "
     557                text run at (0,26) width 29: "dolor"
     558                text run at (28,26) width 4: " "
     559                text run at (0,39) width 30: "ABCD"
     560                text run at (0,52) width 35: "EFGHIJ"
     561                text run at (0,65) width 31: "KLMN"
     562                text run at (0,78) width 31: "OPQR"
     563                text run at (0,91) width 28: "STUV"
     564                text run at (0,104) width 30: "WXYZ"
     565                text run at (29,104) width 5: " "
     566                text run at (0,117) width 32: "abcde"
     567                text run at (0,130) width 34: "fghijkl"
     568                text run at (0,143) width 31: "mnop"
     569                text run at (0,156) width 34: "qrstuv"
    570570        layer at (3,503) size 161x47 clip at (4,504) size 159x30 scrollWidth 425
    571571          RenderTextControl {TEXTAREA} at (3,17) size 161x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     
    12461246                text run at (29,26) width 5: " "
    12471247                text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    1248         layer at (583,401) size 56x58 clip at (584,402) size 39x56 scrollHeight 186
     1248        layer at (583,401) size 56x58 clip at (584,402) size 39x56 scrollHeight 173
    12491249          RenderTextControl {TEXTAREA} at (3,31) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    1250             RenderBlock {DIV} at (3,3) size 35x182
    1251               RenderText {#text} at (0,0) size 35x182
     1250            RenderBlock {DIV} at (3,3) size 35x169
     1251              RenderText {#text} at (0,0) size 35x169
    12521252                text run at (0,0) width 34: "Lorem"
    12531253                text run at (33,0) width 2: " "
    12541254                text run at (0,13) width 33: "ipsum"
    1255                 text run at (0,26) width 7: "  "
    1256                 text run at (0,39) width 29: "dolor"
    1257                 text run at (28,39) width 4: " "
    1258                 text run at (0,52) width 30: "ABCD"
    1259                 text run at (0,65) width 35: "EFGHIJ"
    1260                 text run at (0,78) width 31: "KLMN"
    1261                 text run at (0,91) width 31: "OPQR"
    1262                 text run at (0,104) width 28: "STUV"
    1263                 text run at (0,117) width 30: "WXYZ"
    1264                 text run at (29,117) width 5: " "
    1265                 text run at (0,130) width 32: "abcde"
    1266                 text run at (0,143) width 34: "fghijkl"
    1267                 text run at (0,156) width 31: "mnop"
    1268                 text run at (0,169) width 34: "qrstuv"
     1255                text run at (32,13) width 3: "  "
     1256                text run at (0,26) width 29: "dolor"
     1257                text run at (28,26) width 4: " "
     1258                text run at (0,39) width 30: "ABCD"
     1259                text run at (0,52) width 35: "EFGHIJ"
     1260                text run at (0,65) width 31: "KLMN"
     1261                text run at (0,78) width 31: "OPQR"
     1262                text run at (0,91) width 28: "STUV"
     1263                text run at (0,104) width 30: "WXYZ"
     1264                text run at (29,104) width 5: " "
     1265                text run at (0,117) width 32: "abcde"
     1266                text run at (0,130) width 34: "fghijkl"
     1267                text run at (0,143) width 31: "mnop"
     1268                text run at (0,156) width 34: "qrstuv"
    12691269        layer at (3,479) size 161x47 clip at (4,480) size 159x30 scrollWidth 425
    12701270          RenderTextControl {TEXTAREA} at (3,17) size 161x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
  • trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt

    r157961 r159071  
    366366        text run at (0,39) width 130: "abcdefghijklmnopqrstuv"
    367367        text run at (129,39) width 4: " "
    368 layer at (26,761) size 56x58 clip at (27,762) size 39x56 scrollHeight 186
     368layer at (26,761) size 56x58 clip at (27,762) size 39x56 scrollHeight 173
    369369  RenderTextControl {TEXTAREA} at (17,3) size 56x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
    370     RenderBlock {DIV} at (3,3) size 35x182
    371       RenderText {#text} at (0,0) size 35x182
     370    RenderBlock {DIV} at (3,3) size 35x169
     371      RenderText {#text} at (0,0) size 35x169
    372372        text run at (0,0) width 34: "Lorem"
    373373        text run at (33,0) width 2: " "
     
    387387        text run at (0,143) width 31: "mnop"
    388388        text run at (0,156) width 34: "qrstuv"
    389         text run at (0,169) width 4: " "
     389        text run at (33,156) width 2: " "
    390390layer at (376,26) size 60x32 clip at (377,27) size 43x30 scrollHeight 160
    391391  RenderTextControl {TEXTAREA} at (15,3) size 60x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
  • trunk/Source/WebCore/ChangeLog

    r159070 r159071  
     12013-11-11  Antti Koivisto  <antti@apple.com>
     2
     3        End of line whitespace should collapse with white-space:pre-wrap; overflow-wrap:break-word in all cases
     4        https://bugs.webkit.org/show_bug.cgi?id=124158
     5
     6        Reviewed by Dave Hyatt.
     7       
     8        If a word just fits the line but the following space overflows we fail to collapse whitespaces
     9        at the end of the line. This happens because with break-word we end up taking word breaking
     10        code path that does not have pre-wrap whitespace handling.
     11       
     12        This patch makes the behavior consistent and also matches Firefox.
     13
     14        Test: fast/text/break-word-pre-wrap.html
     15
     16        * rendering/RenderBlockLineLayout.cpp:
     17        (WebCore::BreakingContext::handleText):
     18       
     19            Don't take the word break code path if we are pre-wrap and the current character is space.
     20            Instead proceed to break the line normally as this is a valid break position.
     21
    1222013-11-11  Bear Travis  <betravis@adobe.com>
    223
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r159027 r159071  
    30913091        m_currentCharacterIsWS = m_currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
    30923092
    3093         if ((breakAll || breakWords) && !midWordBreak) {
     3093        if ((breakAll || breakWords) && !midWordBreak && (!m_currentCharacterIsSpace || style.whiteSpace() != PRE_WRAP)) {
    30943094            wrapW += charWidth;
    30953095            bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current.m_pos + 1 < renderText->textLength() && U16_IS_TRAIL((*renderText)[m_current.m_pos + 1]);
Note: See TracChangeset for help on using the changeset viewer.