| Differences between
and this patch
- a/Source/WebCore/ChangeLog +40 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2019-03-07  Javier Fernandez  <jfernandez@igalia.com>
2
3
        word is not broken, honoring word-break: break-all, if there is a single leading space and pre-wrap
4
        https://bugs.webkit.org/show_bug.cgi?id=195361
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        We must consider leading white-spaces as potential soft-breaking
9
        opportunities that may avoid breaking in the middle of the word.
10
11
        However, 'break-word: break-all' [1] implies that we should ignore
12
        previous opportunities and break at any character (among the ones
13
        valid for 'break-all') that prevents the line to overflow. Note,
14
        that these breakable characters are different from the ones
15
        provided by 'line-break: anywhere' [2].
16
17
        No new tests; this change is covered by the already existent tests
18
        of the CSS Text 3 suite of the Web Platform Tests.
19
20
        The word-break-break-all-010.html was precisely designed to cover
21
        the basic issue fixed with this change, verifying that the word is
22
        indeed broken even if a single leading space constitutes a
23
        previous soft-breaking opportunity.
24
25
        There are other Web Platform Tests. which already pass before this
26
        change, to verify that such leading white-space must be used
27
        instead of breaking the word in any other case, including
28
        overflow-wrap: break-word and even the deprecated word-break:
29
        break-word.
30
31
           - white-space/pre-wrap-016.html
32
           - overflow-wrap/overflow-wrap-break-word-004.html
33
           - overflow-wrap/overflow-wrap-break-word-005.html
34
35
        [1] https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all
36
        [2] https://drafts.csswg.org/css-text-3/#valdef-line-break-anywhere
37
38
        * rendering/line/BreakingContext.h:
39
        (WebCore::BreakingContext::handleText):
40
1
2019-03-10  Ross Kirsling  <ross.kirsling@sony.com>
41
2019-03-10  Ross Kirsling  <ross.kirsling@sony.com>
2
42
3
        Invalid flags in a RegExp literal should be an early SyntaxError
43
        Invalid flags in a RegExp literal should be an early SyntaxError
- a/Source/WebCore/rendering/line/BreakingContext.h -1 / +6 lines
Lines 817-822 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool a/Source/WebCore/rendering/line/BreakingContext.h_sec1
817
        UChar c = m_current.current();
817
        UChar c = m_current.current();
818
        m_currentCharacterIsSpace = c == ' ' || c == '\t' || (!m_preservesNewline && (c == '\n'));
818
        m_currentCharacterIsSpace = c == ' ' || c == '\t' || (!m_preservesNewline && (c == '\n'));
819
819
820
        // A single preserved leading white-space doesn't fulfill the 'betweenWords' condition, however it's indeed a
821
        // soft-breaking opportunty so we may want to avoid breaking in the middle of the word.
822
        if (m_atStart && m_currentCharacterIsSpace && !previousCharacterIsSpace)
823
            breakWords = false;
824
820
        if (canHangPunctuationAtStart && m_width.isFirstLine() && !m_width.committedWidth() && !wrapW && !inlineLogicalWidth(m_current.renderer(), true, false)) {
825
        if (canHangPunctuationAtStart && m_width.isFirstLine() && !m_width.committedWidth() && !wrapW && !inlineLogicalWidth(m_current.renderer(), true, false)) {
821
            m_width.addUncommittedWidth(-renderText.hangablePunctuationStartWidth(m_current.offset()));
826
            m_width.addUncommittedWidth(-renderText.hangablePunctuationStartWidth(m_current.offset()));
822
            canHangPunctuationAtStart = false;
827
            canHangPunctuationAtStart = false;
Lines 839-845 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool a/Source/WebCore/rendering/line/BreakingContext.h_sec2
839
844
840
        m_currentCharacterIsWS = m_currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
845
        m_currentCharacterIsWS = m_currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
841
846
842
        if ((breakAll || breakWords) && !midWordBreak && (!m_currentCharacterIsSpace || style.whiteSpace() != WhiteSpace::PreWrap)) {
847
        if ((breakAll || breakWords) && !midWordBreak && (!m_currentCharacterIsSpace || m_atStart || style.whiteSpace() != WhiteSpace::PreWrap)) {
843
            wrapW += charWidth;
848
            wrapW += charWidth;
844
            bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && U16_IS_TRAIL(renderText.characterAt(m_current.offset() + 1));
849
            bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && U16_IS_TRAIL(renderText.characterAt(m_current.offset() + 1));
845
            charWidth = textWidth(renderText, m_current.offset(), midWordBreakIsBeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, isFixedPitch, m_collapseWhiteSpace, fallbackFonts, textLayout);
850
            charWidth = textWidth(renderText, m_current.offset(), midWordBreakIsBeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, isFixedPitch, m_collapseWhiteSpace, fallbackFonts, textLayout);
- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2019-03-07  Javier Fernandez  <jfernandez@igalia.com>
2
3
        A single leading space is not considered as a word break even when word-break: break-all is set
4
        https://bugs.webkit.org/show_bug.cgi?id=195361
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Changes in the TestExpectations with new passes, thanks to this change.
9
10
        * TestExpectations:
11
          - word-break/word-break-break-all-010.html: This test pass now thanks to this change.
12
1
2019-03-10  Zalan Bujtas  <zalan@apple.com>
13
2019-03-10  Zalan Bujtas  <zalan@apple.com>
2
14
3
        [ContentChangeObserver] Fix failing test cases
15
        [ContentChangeObserver] Fix failing test cases
- a/LayoutTests/platform/gtk/TestExpectations -1 lines
Lines 3497-3503 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word a/LayoutTests/platform/gtk/TestExpectations_sec1
3497
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-bo-000.html [ ImageOnlyFailure ]
3497
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-bo-000.html [ ImageOnlyFailure ]
3498
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-lo-000.html [ ImageOnlyFailure ]
3498
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-normal-lo-000.html [ ImageOnlyFailure ]
3499
3499
3500
webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-010.html [ ImageOnlyFailure ]
3501
webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-014.html [ ImageOnlyFailure ]
3500
webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/word-break/word-break-break-all-014.html [ ImageOnlyFailure ]
3502
3501
3503
webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-004.html [ Timeout ImageOnlyFailure ]
3502
webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/boundary-shaping/boundary-shaping-004.html [ Timeout ImageOnlyFailure ]

Return to Bug 195361