Changeset 148367 in webkit


Ignore:
Timestamp:
Apr 13, 2013 3:01:47 PM (11 years ago)
Author:
robert@webkit.org
Message:

Whitespace between nowrap elements ignored after collapsed trailing space in a text run
https://bugs.webkit.org/show_bug.cgi?id=17705

Reviewed by Ryosuke Niwa.

Source/WebCore:

Bug 93448 and r138654 fixed the treatment of line-breaks between nowrap elements. This augments
that fix by recognizing that we have a potential break not only in situations where the next character is a
space and the current character is not, but also where the next character is a space and the current character
*is* a space *and* we are ignoring spaces. This is so because any spaces we have ignored up to this point
after the actual word end will get collapsed away even if we don't end up taking the line break.

In a nutshell, if we allow whitespace collapsing 'word ' and 'word' are equivalent when before a whitespace
character, so treat the first as well as the second as a potential linebreak.

Test: fast/text/whitespace/inline-whitespace-wrapping-5.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):

LayoutTests:

  • fast/text/whitespace/inline-whitespace-wrapping-5-expected.html: Added.
  • fast/text/whitespace/inline-whitespace-wrapping-5.html: Added.
  • fast/text/whitespace/inline-whitespace-wrapping-6-expected.html: Added.
  • fast/text/whitespace/inline-whitespace-wrapping-6.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148361 r148367  
     12013-03-04  Robert Hogan  <robert@webkit.org>
     2
     3        Whitespace between nowrap elements ignored after collapsed trailing space in a text run
     4        https://bugs.webkit.org/show_bug.cgi?id=17705
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/text/whitespace/inline-whitespace-wrapping-5-expected.html: Added.
     9        * fast/text/whitespace/inline-whitespace-wrapping-5.html: Added.
     10        * fast/text/whitespace/inline-whitespace-wrapping-6-expected.html: Added.
     11        * fast/text/whitespace/inline-whitespace-wrapping-6.html: Added.
     12
    1132013-04-13  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r148365 r148367  
     12013-03-04  Robert Hogan  <robert@webkit.org>
     2
     3        Whitespace between nowrap elements ignored after collapsed trailing space in a text run
     4        https://bugs.webkit.org/show_bug.cgi?id=17705
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Bug 93448 and r138654 fixed the treatment of line-breaks between nowrap elements. This augments
     9        that fix by recognizing that we have a potential break not only in situations where the next character is a
     10        space and the current character is not, but also where the next character is a space and the current character
     11        *is* a space *and* we are ignoring spaces. This is so because any spaces we have ignored up to this point
     12        after the actual word end will get collapsed away even if we don't end up taking the line break.
     13
     14        In a nutshell, if we allow whitespace collapsing 'word  ' and 'word' are equivalent when before a whitespace
     15        character, so treat the first as well as the second as a potential linebreak.
     16
     17        Test: fast/text/whitespace/inline-whitespace-wrapping-5.html
     18
     19        * rendering/RenderBlockLineLayout.cpp:
     20        (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
     21
    1222013-04-13  Andreas Kling  <akling@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r148358 r148367  
    32163216                if (nextText->textLength()) {
    32173217                    UChar c = nextText->characterAt(0);
    3218                     // If the next item on the line is text, and if we did not end with
    3219                     // a space, then the next text run continues our word (and so it needs to
    3220                     // keep adding to the uncommitted width. Just update and continue.
    3221                     checkForBreak = !currentCharacterIsSpace && (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline()));
     3218                    // If we allow whitespace collapsing, 'word  ' and 'word' are equivalent before a whitespace
     3219                    // character, so treat both as a potential linebreak.
     3220                    checkForBreak = (ignoringSpaces || !currentCharacterIsSpace) && (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline()));
    32223221                } else if (nextText->isWordBreak())
    32233222                    checkForBreak = true;
Note: See TracChangeset for help on using the changeset viewer.