Changeset 233916 in webkit


Ignore:
Timestamp:
Jul 18, 2018 11:10:08 AM (6 years ago)
Author:
mmaxfield@apple.com
Message:

Rename WordBreak::Break to WordBreak::BreakWord
https://bugs.webkit.org/show_bug.cgi?id=187767

Reviewed by Simon Fraser.

These breaking properties are very confusing. There are:

  1. word-break: break-all, a standard value that allows breaking after every

character.

  1. word-break: break-word, a non-standard value which allows for breaking after

every character, but only if the word is too long for the available width (otherwise
it works the same as word-break: normal). This affects the min-content-size of the
text (and makes it equal to what it would be if word-break: break-all was
specified).

  1. word-wrap: break-word, which is the same as word-break: break-word, but doesn't

affect the min-content-size of the text.

  1. overflow-wrap: break-word, which is the same as word-wrap: break-word.

Because this is so confusing it's valuable for our internal enums to match the names
of the official CSS properties/values.

No new tests because there is no behavior change.

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator WordBreak const):

  • rendering/RenderText.cpp:

(WebCore::RenderText::computePreferredLogicalWidths):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::breakWords const):

  • rendering/style/RenderStyleConstants.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r233915 r233916  
     12018-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Rename WordBreak::Break to WordBreak::BreakWord
     4        https://bugs.webkit.org/show_bug.cgi?id=187767
     5
     6        Reviewed by Simon Fraser.
     7
     8        These breaking properties are very confusing. There are:
     9
     10        1. word-break: break-all, a standard value that allows breaking after every
     11        character.
     12        2. word-break: break-word, a non-standard value which allows for breaking after
     13        every character, but only if the word is too long for the available width (otherwise
     14        it works the same as word-break: normal). This affects the min-content-size of the
     15        text (and makes it equal to what it would be if word-break: break-all was
     16        specified).
     17        3. word-wrap: break-word, which is the same as word-break: break-word, but doesn't
     18        affect the min-content-size of the text.
     19        4. overflow-wrap: break-word, which is the same as word-wrap: break-word.
     20
     21        Because this is so confusing it's valuable for our internal enums to match the names
     22        of the official CSS properties/values.
     23
     24        No new tests because there is no behavior change.
     25
     26        * css/CSSPrimitiveValueMappings.h:
     27        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     28        (WebCore::CSSPrimitiveValue::operator WordBreak const):
     29        * rendering/RenderText.cpp:
     30        (WebCore::RenderText::computePreferredLogicalWidths):
     31        * rendering/style/RenderStyle.h:
     32        (WebCore::RenderStyle::breakWords const):
     33        * rendering/style/RenderStyleConstants.h:
     34
    1352018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
    236
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r233851 r233916  
    30883088        m_value.valueID = CSSValueKeepAll;
    30893089        break;
    3090     case WordBreak::Break:
     3090    case WordBreak::BreakWord:
    30913091        m_value.valueID = CSSValueBreakWord;
    30923092        break;
     
    31043104        return WordBreak::KeepAll;
    31053105    case CSSValueBreakWord:
    3106         return WordBreak::Break;
     3106        return WordBreak::BreakWord;
    31073107    case CSSValueNormal:
    31083108        return WordBreak::Normal;
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r232178 r233916  
    827827    // do not affect minimum preferred sizes. Note that break-word is a non-standard value for
    828828    // word-break, but we support it as though it means break-all.
    829     bool breakAll = (style.wordBreak() == WordBreak::BreakAll || style.wordBreak() == WordBreak::Break) && style.autoWrap();
     829    bool breakAll = (style.wordBreak() == WordBreak::BreakAll || style.wordBreak() == WordBreak::BreakWord) && style.autoWrap();
    830830    bool keepAllWords = style.wordBreak() == WordBreak::KeepAll;
    831831    bool canUseLineBreakShortcut = iteratorMode == LineBreakIteratorMode::Default;
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r232559 r233916  
    20452045inline bool RenderStyle::breakWords() const
    20462046{
    2047     return wordBreak() == WordBreak::Break || overflowWrap() == OverflowWrap::Break;
     2047    return wordBreak() == WordBreak::BreakWord || overflowWrap() == OverflowWrap::Break;
    20482048}
    20492049
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r233838 r233916  
    517517    BreakAll,
    518518    KeepAll,
    519     Break
     519    BreakWord
    520520};
    521521
Note: See TracChangeset for help on using the changeset viewer.