Title: [98638] trunk
Revision
98638
Author
hy...@apple.com
Date
2011-10-27 14:21:32 -0700 (Thu, 27 Oct 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=71061
        
[CSS Line Grid] Add support for parsing the line-grid property.

Source/WebCore: 

New tests in fast/line-grid.

Reviewed by Dan Bernstein.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::lineGrid):
(WebCore::InheritedFlags::setLineGrid):
(WebCore::InheritedFlags::initialLineGrid):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:

LayoutTests: 

Reviewed by Dan Bernstein.

* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/line-grid: Added.
* fast/line-grid/line-grid-parsing-expected.txt: Added.
* fast/line-grid/line-grid-parsing.html: Added.
* fast/line-grid/script-tests: Added.
* fast/line-grid/script-tests/line-grid-parsing.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98637 => 98638)


--- trunk/LayoutTests/ChangeLog	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/LayoutTests/ChangeLog	2011-10-27 21:21:32 UTC (rev 98638)
@@ -1,3 +1,19 @@
+2011-10-27  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=71061
+        
+        [CSS Line Grid] Add support for parsing the line-grid property.
+
+        Reviewed by Dan Bernstein.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * fast/line-grid: Added.
+        * fast/line-grid/line-grid-parsing-expected.txt: Added.
+        * fast/line-grid/line-grid-parsing.html: Added.
+        * fast/line-grid/script-tests: Added.
+        * fast/line-grid/script-tests/line-grid-parsing.js: Added.
+
 2011-10-27  Fady Samuel  <fsam...@chromium.org>
 
         iframes seem to occasionally doubly scale or scale incorrectly when pageScaleFactor != 1.0

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (98637 => 98638)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-10-27 21:21:32 UTC (rev 98638)
@@ -152,6 +152,7 @@
 -webkit-line-box-contain: block inline replaced;
 -webkit-line-break: normal;
 -webkit-line-clamp: none;
+-webkit-line-grid: none;
 -webkit-locale: auto;
 -webkit-margin-before-collapse: collapse;
 -webkit-margin-after-collapse: collapse;

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (98637 => 98638)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-10-27 21:21:32 UTC (rev 98638)
@@ -151,6 +151,7 @@
     -webkit-line-box-contain: block inline replaced
     -webkit-line-break: normal
     -webkit-line-clamp: none
+    -webkit-line-grid: none
     -webkit-locale: auto
     -webkit-margin-before-collapse: collapse
     -webkit-margin-after-collapse: collapse

Added: trunk/LayoutTests/fast/line-grid/line-grid-parsing-expected.txt (0 => 98638)


--- trunk/LayoutTests/fast/line-grid/line-grid-parsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/line-grid/line-grid-parsing-expected.txt	2011-10-27 21:21:32 UTC (rev 98638)
@@ -0,0 +1,24 @@
+Test parsing of the CSS line-grid property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test("-webkit-line-grid: none") is "none"
+PASS test("-webkit-line-grid: first-grid") is "first-grid"
+PASS test("-webkit-line-grid: 'first grid'") is ""
+PASS test("-webkit-line-grid: ;") is ""
+PASS test("-webkit-line-grid: 1") is ""
+PASS test("-webkit-line-grid: 1.2") is ""
+PASS test("-webkit-line-grid: -1") is ""
+PASS test("-webkit-line-grid: 12px") is ""
+PASS testComputedStyle("none") is "none"
+PASS testComputedStyle("") is "none"
+PASS testComputedStyle("'first-flow'") is "none"
+PASS testComputedStyle("first-grid") is "first-grid"
+PASS testComputedStyle("12px") is "none"
+PASS testInherited("none") is "none"
+PASS testInherited("grid") is "grid"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/line-grid/line-grid-parsing.html (0 => 98638)


--- trunk/LayoutTests/fast/line-grid/line-grid-parsing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/line-grid/line-grid-parsing.html	2011-10-27 21:21:32 UTC (rev 98638)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/line-grid/script-tests/line-grid-parsing.js (0 => 98638)


--- trunk/LayoutTests/fast/line-grid/script-tests/line-grid-parsing.js	                        (rev 0)
+++ trunk/LayoutTests/fast/line-grid/script-tests/line-grid-parsing.js	2011-10-27 21:21:32 UTC (rev 98638)
@@ -0,0 +1,50 @@
+description('Test parsing of the CSS line-grid property.');
+
+function test(declaration) {
+    var div = document.createElement("div");
+    div.setAttribute("style", declaration);
+    return div.style.webkitLineGrid;
+}
+
+function testComputedStyle(value) {
+    var div = document.createElement("div");
+    document.body.appendChild(div);
+    div.style.setProperty("-webkit-line-grid", value);
+    var webkitFlowComputedValue = getComputedStyle(div).getPropertyValue("-webkit-line-grid");
+    document.body.removeChild(div);
+    return webkitFlowComputedValue;
+}
+
+function testInherited(parentValue) {
+    var parentDiv = document.createElement("div");
+    document.body.appendChild(parentDiv);
+    parentDiv.style.setProperty("-webkit-line-grid", parentValue);
+
+    var childDiv = document.createElement("div");
+    parentDiv.appendChild(childDiv);
+
+    var childWebKitFlowComputedValue = getComputedStyle(childDiv).getPropertyValue("-webkit-line-grid");
+
+    parentDiv.removeChild(childDiv);
+    document.body.removeChild(parentDiv);
+
+    return childWebKitFlowComputedValue;
+}
+
+shouldBeEqualToString('test("-webkit-line-grid: none")', "none");
+shouldBeEqualToString('test("-webkit-line-grid: first-grid")', "first-grid");
+shouldBeEqualToString('test("-webkit-line-grid: \'first grid\'")', "");
+shouldBeEqualToString('test("-webkit-line-grid: ;")', "");
+shouldBeEqualToString('test("-webkit-line-grid: 1")', "");
+shouldBeEqualToString('test("-webkit-line-grid: 1.2")', "");
+shouldBeEqualToString('test("-webkit-line-grid: -1")', "");
+shouldBeEqualToString('test("-webkit-line-grid: 12px")', "");
+
+shouldBeEqualToString('testComputedStyle("none")', "none");
+shouldBeEqualToString('testComputedStyle("")', "none");
+shouldBeEqualToString('testComputedStyle("\'first-flow\'")', "none");
+shouldBeEqualToString('testComputedStyle("first-grid")', "first-grid");
+shouldBeEqualToString('testComputedStyle("12px")', "none");
+
+shouldBeEqualToString('testInherited("none")', "none");
+shouldBeEqualToString('testInherited("grid")', "grid");

Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (98637 => 98638)


--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-10-27 21:21:32 UTC (rev 98638)
@@ -302,6 +302,8 @@
 rect: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-line-clamp) : none
 rect: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(-webkit-line-grid) : none
+rect: style.getPropertyCSSValue(-webkit-line-grid) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-locale) : auto
 rect: style.getPropertyCSSValue(-webkit-locale) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-margin-before-collapse) : collapse
@@ -784,6 +786,8 @@
 g: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-line-clamp) : none
 g: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(-webkit-line-grid) : none
+g: style.getPropertyCSSValue(-webkit-line-grid) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-locale) : auto
 g: style.getPropertyCSSValue(-webkit-locale) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-margin-before-collapse) : collapse

Modified: trunk/Source/WebCore/ChangeLog (98637 => 98638)


--- trunk/Source/WebCore/ChangeLog	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/ChangeLog	2011-10-27 21:21:32 UTC (rev 98638)
@@ -1,3 +1,31 @@
+2011-10-27  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=71061
+        
+        [CSS Line Grid] Add support for parsing the line-grid property.
+
+        New tests in fast/line-grid.
+
+        Reviewed by Dan Bernstein.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::lineGrid):
+        (WebCore::InheritedFlags::setLineGrid):
+        (WebCore::InheritedFlags::initialLineGrid):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator==):
+        * rendering/style/StyleRareInheritedData.h:
+
 2011-10-27  Fady Samuel  <fsam...@chromium.org>
 
         iframes seem to occasionally doubly scale or scale incorrectly when pageScaleFactor != 1.0

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (98637 => 98638)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-10-27 21:21:32 UTC (rev 98638)
@@ -226,6 +226,7 @@
     CSSPropertyWebkitLineBoxContain,
     CSSPropertyWebkitLineBreak,
     CSSPropertyWebkitLineClamp,
+    CSSPropertyWebkitLineGrid,
     CSSPropertyWebkitLocale,
     CSSPropertyWebkitMarginBeforeCollapse,
     CSSPropertyWebkitMarginAfterCollapse,
@@ -1973,6 +1974,10 @@
             return primitiveValueCache->createValue(style->pointerEvents());
         case CSSPropertyWebkitColorCorrection:
             return primitiveValueCache->createValue(style->colorSpace());
+        case CSSPropertyWebkitLineGrid:
+            if (style->lineGrid().isNull())
+                return primitiveValueCache->createIdentifierValue(CSSValueNone);
+            return primitiveValueCache->createValue(style->lineGrid(), CSSPrimitiveValue::CSS_STRING);
         case CSSPropertyWebkitWritingMode:
             return primitiveValueCache->createValue(style->writingMode());
         case CSSPropertyWebkitTextCombine:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (98637 => 98638)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-10-27 21:21:32 UTC (rev 98638)
@@ -1903,6 +1903,17 @@
             validPrimitive = true;
         break;
 
+    case CSSPropertyWebkitLineGrid:
+        if (id == CSSValueNone)
+            validPrimitive = true;
+        else if (value->unit == CSSPrimitiveValue::CSS_IDENT) {
+            String lineGridValue = String(value->string);
+            if (!lineGridValue.isEmpty()) {
+                addProperty(propId, primitiveValueCache()->createValue(lineGridValue, CSSPrimitiveValue::CSS_STRING), important);
+                return true;
+            }
+        }
+        break;
     case CSSPropertyWebkitLocale:
         if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING)
             validPrimitive = true;

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (98637 => 98638)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2011-10-27 21:21:32 UTC (rev 98638)
@@ -330,6 +330,7 @@
     case CSSPropertyWebkitHyphens:
     case CSSPropertyWebkitLineBoxContain:
     case CSSPropertyWebkitLineBreak:
+    case CSSPropertyWebkitLineGrid:
     case CSSPropertyWebkitNbspMode:
     case CSSPropertyWebkitRtlOrdering:
     case CSSPropertyWebkitTextCombine:

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (98637 => 98638)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2011-10-27 21:21:32 UTC (rev 98638)
@@ -269,6 +269,7 @@
 -webkit-line-box-contain
 -webkit-line-break
 -webkit-line-clamp
+-webkit-line-grid
 -webkit-logical-width
 -webkit-logical-height
 -webkit-margin-after-collapse

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (98637 => 98638)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-10-27 21:21:32 UTC (rev 98638)
@@ -3372,7 +3372,7 @@
     case CSSPropertyWebkitColumnBreakInside:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(columnBreakInside, ColumnBreakInside, PageBreak)
         return;
-     case CSSPropertyWebkitColumnRule:
+    case CSSPropertyWebkitColumnRule:
         if (isInherit) {
             m_style->setColumnRuleColor(m_parentStyle->columnRuleColor().isValid() ? m_parentStyle->columnRuleColor() : m_parentStyle->color());
             m_style->setColumnRuleStyle(m_parentStyle->columnRuleStyle());
@@ -3381,6 +3381,13 @@
         else if (isInitial)
             m_style->resetColumnRule();
         return;
+    case CSSPropertyWebkitLineGrid:
+        HANDLE_INHERIT_AND_INITIAL(lineGrid, LineGrid);
+        if (primitiveValue->getIdent() == CSSValueNone)
+            m_style->setLineGrid(nullAtom);
+        else
+            m_style->setLineGrid(primitiveValue->getStringValue());
+        return;
     case CSSPropertyWebkitRegionBreakBefore:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE_WITH_VALUE(regionBreakBefore, RegionBreakBefore, PageBreak)
         return;

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (98637 => 98638)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-10-27 21:21:32 UTC (rev 98638)
@@ -810,6 +810,8 @@
     const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
     RegionOverflow regionOverflow() const { return static_cast<RegionOverflow>(rareNonInheritedData->m_regionOverflow); }
 
+    const AtomicString& lineGrid() const { return rareInheritedData->m_lineGrid; }
+    
     // Apple-specific property getter methods
     EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
     const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
@@ -1189,6 +1191,8 @@
 
     // End CSS3 Setters
 
+    void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
+
     void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
     void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
     void setRegionOverflow(RegionOverflow regionOverflow) { SET_VAR(rareNonInheritedData, m_regionOverflow, regionOverflow); }
@@ -1469,6 +1473,8 @@
     static StyleImage* initialBorderImageSource() { return 0; }
     static StyleImage* initialMaskBoxImageSource() { return 0; }
 
+    static const AtomicString& initialLineGrid() { return nullAtom; }
+
     static const AtomicString& initialFlowThread() { return nullAtom; }
     static const AtomicString& initialRegionThread() { return nullAtom; }
     static RegionOverflow initialRegionOverflow() { return AutoRegionOverflow; }

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (98637 => 98638)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2011-10-27 21:21:32 UTC (rev 98638)
@@ -56,6 +56,7 @@
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
     , hyphenationLimitLines(-1)
+    , m_lineGrid(RenderStyle::initialLineGrid())
 #if ENABLE(TOUCH_EVENTS)
     , tapHighlightColor(RenderStyle::initialTapHighlightColor())
 #endif    
@@ -101,6 +102,7 @@
     , hyphenationLimitLines(o.hyphenationLimitLines)
     , locale(o.locale)
     , textEmphasisCustomMark(o.textEmphasisCustomMark)
+    , m_lineGrid(o.m_lineGrid)
 #if ENABLE(TOUCH_EVENTS)
     , tapHighlightColor(o.tapHighlightColor)
 #endif
@@ -162,6 +164,7 @@
         && locale == o.locale
         && textEmphasisCustomMark == o.textEmphasisCustomMark
         && QuotesData::equal(quotes.get(), o.quotes.get())
+        && m_lineGrid == o.m_lineGrid
         && m_imageRendering == o.m_imageRendering;
 }
 

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (98637 => 98638)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2011-10-27 21:09:24 UTC (rev 98637)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2011-10-27 21:21:32 UTC (rev 98638)
@@ -102,6 +102,9 @@
 
     AtomicString textEmphasisCustomMark;
     RefPtr<QuotesData> quotes;
+    
+    AtomicString m_lineGrid;
+
 #if ENABLE(TOUCH_EVENTS)
     Color tapHighlightColor;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to