[CSS] Expand -webkit-line-break value space
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2012 20:31:10 +0000 (20:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2012 20:31:10 +0000 (20:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100739

Patch by Glenn Adams <glenn@skynav.com> on 2012-10-30
Reviewed by Eric Seidel.

Source/WebCore:

(1) expand -webkit-line-break to include new values defined by CSS3 Text [1], i.e., 'auto', 'strict', 'loose';
(2) change default (initial) value for -webkit-line-break to 'auto' to match CSS3 Text;
(3) rename enum EKHTMLLineBreak to LineBreak, renaming enum values appropriately;

New tests to be added when functionality of new values is added. No rendering behavior change at this time.
Only externally visible change is default (initial) value returning 'auto' rather than 'normal', for which 3 existing
tests that were sensitive to this value have been updated. Note that until the functionality for the new values is
added, any actual use of the new values will be treated as the same as the pre-existing 'normal' value, i.e., the
default semantics.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
Update from kthmlLineBreak() to lineBreak().

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
Update values supported for CSSPropertyWebkitLineBreak.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator LineBreak):
Update LineBreak enumeration values (previously EKHTMLLineBreak).

* css/CSSValueKeywords.in:
Update keywords used for -webkit-line-break.

* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder):
Update names for line break style getter/setter.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
Remove khtml prefix on line break related state.

* rendering/style/RenderStyle.h:
Remove khtml prefix on line break related methods. Update to redefined LineBreak
enumeration type.

* rendering/style/RenderStyleConstants.h:
Rename EKHTMLLineBreak enumeration to LineBreak.
Redefine LineBreak enumeration to include new CSS3 Text modes (auto, loose, strict) and
use better names.

* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
Remove khtml prefix on line break related state references.

* rendering/style/StyleRareInheritedData.h:
(StyleRareInheritedData):
Remove khtml prefix on line break related state. Widen field to 3 bits to support 8 values,
of which 5 are now used.

LayoutTests:

Change default (initial) value for -webkit-line-break to 'auto' to match CSS3 Text.

* fast/css/getComputedStyle/computed-style-expected.txt:
Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.

* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.

* svg/css/getComputedStyle-basic-expected.txt:
Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h

index 41635dc..b076e22 100644 (file)
@@ -1,3 +1,21 @@
+2012-10-30  Glenn Adams  <glenn@skynav.com>
+
+        [CSS] Expand -webkit-line-break value space
+        https://bugs.webkit.org/show_bug.cgi?id=100739
+
+        Reviewed by Eric Seidel.
+
+        Change default (initial) value for -webkit-line-break to 'auto' to match CSS3 Text.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.
+
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.
+
+        * svg/css/getComputedStyle-basic-expected.txt:
+        Fix for change of initial (default) value on -webkit-line-break from 'normal' to 'auto'.
+
 2012-10-30  Robert Hogan  <robert@webkit.org>
 
         white-space: nowrap inline element beside a floated element wraps incorrectly without trailing textnode/newline
index 5e7d1eb..ce07063 100644 (file)
@@ -162,7 +162,7 @@ zoom: 1;
 -webkit-hyphens: manual;
 -webkit-line-align: none;
 -webkit-line-box-contain: block inline replaced;
--webkit-line-break: normal;
+-webkit-line-break: auto;
 -webkit-line-clamp: none;
 -webkit-line-grid: none;
 -webkit-line-snap: none;
index 6194620..55d28fe 100644 (file)
@@ -161,7 +161,7 @@ zoom: 1
 -webkit-hyphens: manual
 -webkit-line-align: none
 -webkit-line-box-contain: block inline replaced
--webkit-line-break: normal
+-webkit-line-break: auto
 -webkit-line-clamp: none
 -webkit-line-grid: none
 -webkit-line-snap: none
index cd24dde..e4efb9f 100644 (file)
@@ -322,7 +322,7 @@ rect: style.getPropertyValue(-webkit-line-align) : none
 rect: style.getPropertyCSSValue(-webkit-line-align) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-line-box-contain) : block inline replaced
 rect: style.getPropertyCSSValue(-webkit-line-box-contain) : [object CSSValue]
-rect: style.getPropertyValue(-webkit-line-break) : normal
+rect: style.getPropertyValue(-webkit-line-break) : auto
 rect: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-line-clamp) : none
 rect: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue]
@@ -824,7 +824,7 @@ g: style.getPropertyValue(-webkit-line-align) : none
 g: style.getPropertyCSSValue(-webkit-line-align) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-line-box-contain) : block inline replaced
 g: style.getPropertyCSSValue(-webkit-line-box-contain) : [object CSSValue]
-g: style.getPropertyValue(-webkit-line-break) : normal
+g: style.getPropertyValue(-webkit-line-break) : auto
 g: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-line-clamp) : none
 g: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue]
index 892ffe5..125c724 100644 (file)
@@ -1,3 +1,63 @@
+2012-10-30  Glenn Adams  <glenn@skynav.com>
+
+        [CSS] Expand -webkit-line-break value space
+        https://bugs.webkit.org/show_bug.cgi?id=100739
+
+        Reviewed by Eric Seidel.
+
+        (1) expand -webkit-line-break to include new values defined by CSS3 Text [1], i.e., 'auto', 'strict', 'loose';
+        (2) change default (initial) value for -webkit-line-break to 'auto' to match CSS3 Text;
+        (3) rename enum EKHTMLLineBreak to LineBreak, renaming enum values appropriately;
+
+        New tests to be added when functionality of new values is added. No rendering behavior change at this time.
+        Only externally visible change is default (initial) value returning 'auto' rather than 'normal', for which 3 existing
+        tests that were sensitive to this value have been updated. Note that until the functionality for the new values is
+        added, any actual use of the new values will be treated as the same as the pre-existing 'normal' value, i.e., the
+        default semantics.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        Update from kthmlLineBreak() to lineBreak().
+
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        Update values supported for CSSPropertyWebkitLineBreak.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator LineBreak):
+        Update LineBreak enumeration values (previously EKHTMLLineBreak).
+
+        * css/CSSValueKeywords.in:
+        Update keywords used for -webkit-line-break.
+
+        * css/StyleBuilder.cpp:
+        (WebCore::StyleBuilder::StyleBuilder):
+        Update names for line break style getter/setter.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        Remove khtml prefix on line break related state.
+
+        * rendering/style/RenderStyle.h:
+        Remove khtml prefix on line break related methods. Update to redefined LineBreak
+        enumeration type.
+
+        * rendering/style/RenderStyleConstants.h:
+        Rename EKHTMLLineBreak enumeration to LineBreak.
+        Redefine LineBreak enumeration to include new CSS3 Text modes (auto, loose, strict) and
+        use better names.
+
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        Remove khtml prefix on line break related state references.
+
+        * rendering/style/StyleRareInheritedData.h:
+        (StyleRareInheritedData):
+        Remove khtml prefix on line break related state. Widen field to 3 bits to support 8 values,
+        of which 5 are now used.
+
 2012-10-30  Antti Koivisto  <antti@apple.com>
 
         Avoid unnecessary style recalcs on class attribute mutation
index 4cb9e70..d09d04a 100644 (file)
@@ -2138,7 +2138,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
         case CSSPropertyWordWrap:
             return cssValuePool().createValue(style->overflowWrap());
         case CSSPropertyWebkitLineBreak:
-            return cssValuePool().createValue(style->khtmlLineBreak());
+            return cssValuePool().createValue(style->lineBreak());
         case CSSPropertyWebkitNbspMode:
             return cssValuePool().createValue(style->nbspMode());
         case CSSPropertyResize:
index 3094f40..8620093 100644 (file)
@@ -827,8 +827,8 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueNone || valueID == CSSValueEdges)
             return true;
         break;
-    case CSSPropertyWebkitLineBreak: // normal | after-white-space
-        if (valueID == CSSValueNormal || valueID == CSSValueAfterWhiteSpace)
+    case CSSPropertyWebkitLineBreak: // auto | loose | normal | strict | after-white-space
+        if (valueID == CSSValueAuto || valueID == CSSValueLoose || valueID == CSSValueNormal || valueID == CSSValueStrict || valueID == CSSValueAfterWhiteSpace)
             return true;
         break;
     case CSSPropertyWebkitLineSnap:
index 984c082..6be8e3a 100644 (file)
@@ -1440,31 +1440,46 @@ template<> inline CSSPrimitiveValue::operator EFloat() const
     return NoFloat;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_IDENT;
     switch (e) {
-        case LBNORMAL:
-            m_value.ident = CSSValueNormal;
-            break;
-        case AFTER_WHITE_SPACE:
-            m_value.ident = CSSValueAfterWhiteSpace;
-            break;
+    case LineBreakAuto:
+        m_value.ident = CSSValueAuto;
+        break;
+    case LineBreakLoose:
+        m_value.ident = CSSValueLoose;
+        break;
+    case LineBreakNormal:
+        m_value.ident = CSSValueNormal;
+        break;
+    case LineBreakStrict:
+        m_value.ident = CSSValueStrict;
+        break;
+    case LineBreakAfterWhiteSpace:
+        m_value.ident = CSSValueAfterWhiteSpace;
+        break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
+template<> inline CSSPrimitiveValue::operator LineBreak() const
 {
     switch (m_value.ident) {
-        case CSSValueAfterWhiteSpace:
-            return AFTER_WHITE_SPACE;
-        case CSSValueNormal:
-            return LBNORMAL;
+    case CSSValueAuto:
+        return LineBreakAuto;
+    case CSSValueLoose:
+        return LineBreakLoose;
+    case CSSValueNormal:
+        return LineBreakNormal;
+    case CSSValueStrict:
+        return LineBreakStrict;
+    case CSSValueAfterWhiteSpace:
+        return LineBreakAfterWhiteSpace;
     }
 
     ASSERT_NOT_REACHED();
-    return LBNORMAL;
+    return LineBreakAuto;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
index c60aa58..2c1702a 100644 (file)
@@ -621,6 +621,10 @@ space
 //
 // CSS_PROP__KHTML_LINE_BREAK
 //
+// auto
+loose
+// normal
+strict
 after-white-space
 
 // -webkit-appearance
index 5795def..0501dc9 100644 (file)
@@ -2002,7 +2002,7 @@ StyleBuilder::StyleBuilder()
     setPropertyHandler(CSSPropertyWebkitHyphenateLimitLines, ApplyPropertyNumber<short, &RenderStyle::hyphenationLimitLines, &RenderStyle::setHyphenationLimitLines, &RenderStyle::initialHyphenationLimitLines, CSSValueNoLimit>::createHandler());
     setPropertyHandler(CSSPropertyWebkitHyphens, ApplyPropertyDefault<Hyphens, &RenderStyle::hyphens, Hyphens, &RenderStyle::setHyphens, Hyphens, &RenderStyle::initialHyphens>::createHandler());
     setPropertyHandler(CSSPropertyWebkitLineAlign, ApplyPropertyDefault<LineAlign, &RenderStyle::lineAlign, LineAlign, &RenderStyle::setLineAlign, LineAlign, &RenderStyle::initialLineAlign>::createHandler());
-    setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<EKHTMLLineBreak, &RenderStyle::khtmlLineBreak, EKHTMLLineBreak, &RenderStyle::setKHTMLLineBreak, EKHTMLLineBreak, &RenderStyle::initialKHTMLLineBreak>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitLineBreak, ApplyPropertyDefault<LineBreak, &RenderStyle::lineBreak, LineBreak, &RenderStyle::setLineBreak, LineBreak, &RenderStyle::initialLineBreak>::createHandler());
     setPropertyHandler(CSSPropertyWebkitLineClamp, ApplyPropertyDefault<const LineClampValue&, &RenderStyle::lineClamp, LineClampValue, &RenderStyle::setLineClamp, LineClampValue, &RenderStyle::initialLineClamp>::createHandler());
     setPropertyHandler(CSSPropertyWebkitLineGrid, ApplyPropertyString<MapNoneToNull, &RenderStyle::lineGrid, &RenderStyle::setLineGrid, &RenderStyle::initialLineGrid>::createHandler());
     setPropertyHandler(CSSPropertyWebkitLineSnap, ApplyPropertyDefault<LineSnap, &RenderStyle::lineSnap, LineSnap, &RenderStyle::setLineSnap, LineSnap, &RenderStyle::initialLineSnap>::createHandler());
index 6db4bb9..179d325 100644 (file)
@@ -471,7 +471,7 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
             || rareInheritedData->wordBreak != other->rareInheritedData->wordBreak
             || rareInheritedData->overflowWrap != other->rareInheritedData->overflowWrap
             || rareInheritedData->nbspMode != other->rareInheritedData->nbspMode
-            || rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak
+            || rareInheritedData->lineBreak != other->rareInheritedData->lineBreak
             || rareInheritedData->textSecurity != other->rareInheritedData->textSecurity
             || rareInheritedData->hyphens != other->rareInheritedData->hyphens
             || rareInheritedData->hyphenationLimitBefore != other->rareInheritedData->hyphenationLimitBefore
index d1fd13e..ebe91b4 100644 (file)
@@ -683,7 +683,7 @@ public:
 
     bool breakOnlyAfterWhiteSpace() const
     {
-        return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
+        return whiteSpace() == PRE_WRAP || lineBreak() == LineBreakAfterWhiteSpace;
     }
 
     bool breakWords() const
@@ -846,7 +846,7 @@ public:
     EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
     EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); }
     ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
-    EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
+    LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); }
     const AtomicString& highlight() const { return rareInheritedData->highlight; }
     Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
     short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; }
@@ -1311,7 +1311,7 @@ public:
     void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
     void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); }
     void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
-    void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
+    void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); }
     void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
     void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
     void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); }
@@ -1650,7 +1650,7 @@ public:
     static EWordBreak initialWordBreak() { return NormalWordBreak; }
     static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
     static ENBSPMode initialNBSPMode() { return NBNORMAL; }
-    static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
+    static LineBreak initialLineBreak() { return LineBreakAuto; }
     static const AtomicString& initialHighlight() { return nullAtom; }
     static ESpeak initialSpeak() { return SpeakNormal; }
     static Hyphens initialHyphens() { return HyphensManual; }
index d3d34e5..f9f3209 100644 (file)
@@ -210,8 +210,8 @@ enum ENBSPMode {
     NBNORMAL, SPACE
 };
 
-enum EKHTMLLineBreak {
-    LBNORMAL, AFTER_WHITE_SPACE
+enum LineBreak {
+    LineBreakAuto, LineBreakLoose, LineBreakNormal, LineBreakStrict, LineBreakAfterWhiteSpace
 };
 
 enum EResize {
index 3962e7f..1680221 100644 (file)
@@ -71,7 +71,7 @@ StyleRareInheritedData::StyleRareInheritedData()
     , wordBreak(RenderStyle::initialWordBreak())
     , overflowWrap(RenderStyle::initialOverflowWrap())
     , nbspMode(NBNORMAL)
-    , khtmlLineBreak(LBNORMAL)
+    , lineBreak(LineBreakAuto)
     , textSizeAdjust(RenderStyle::initialTextSizeAdjust())
     , resize(RenderStyle::initialResize())
     , userSelect(RenderStyle::initialUserSelect())
@@ -133,7 +133,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
     , wordBreak(o.wordBreak)
     , overflowWrap(o.overflowWrap)
     , nbspMode(o.nbspMode)
-    , khtmlLineBreak(o.khtmlLineBreak)
+    , lineBreak(o.lineBreak)
     , textSizeAdjust(o.textSizeAdjust)
     , resize(o.resize)
     , userSelect(o.userSelect)
@@ -214,7 +214,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && wordBreak == o.wordBreak
         && overflowWrap == o.overflowWrap
         && nbspMode == o.nbspMode
-        && khtmlLineBreak == o.khtmlLineBreak
+        && lineBreak == o.lineBreak
 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
         && useTouchOverflowScrolling == o.useTouchOverflowScrolling
 #endif
index 27d5c9a..a34dfb2 100644 (file)
@@ -85,7 +85,7 @@ public:
     unsigned wordBreak : 2; // EWordBreak
     unsigned overflowWrap : 1; // EOverflowWrap
     unsigned nbspMode : 1; // ENBSPMode
-    unsigned khtmlLineBreak : 1; // EKHTMLLineBreak
+    unsigned lineBreak : 3; // LineBreak
     unsigned textSizeAdjust : 1; // An Apple extension.
     unsigned resize : 2; // EResize
     unsigned userSelect : 2; // EUserSelect