Title: [90966] trunk
Revision
90966
Author
[email protected]
Date
2011-07-13 17:29:55 -0700 (Wed, 13 Jul 2011)

Log Message

[CSSRegions] Parse -webkit-content-order property
https://bugs.webkit.org/show_bug.cgi?id=63897

Patch by Mihnea Ovidenie <[email protected]> on 2011-07-13
Reviewed by David Hyatt.

Source/WebCore:

Test: fast/regions/webkit-content-order-parsing.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPropertyNames.in:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::regionIndex):
(WebCore::InheritedFlags::setRegionIndex):
(WebCore::InheritedFlags::initialRegionIndex):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

* fast/regions/script-tests/webkit-content-order-parsing.js: Added.
* fast/regions/webkit-content-order-parsing-expected.txt: Added.
* fast/regions/webkit-content-order-parsing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90965 => 90966)


--- trunk/LayoutTests/ChangeLog	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/LayoutTests/ChangeLog	2011-07-14 00:29:55 UTC (rev 90966)
@@ -1,3 +1,14 @@
+2011-07-13  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions] Parse -webkit-content-order property
+        https://bugs.webkit.org/show_bug.cgi?id=63897
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/script-tests/webkit-content-order-parsing.js: Added.
+        * fast/regions/webkit-content-order-parsing-expected.txt: Added.
+        * fast/regions/webkit-content-order-parsing.html: Added.
+
 2011-07-13  Michael Saboff  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=64202

Added: trunk/LayoutTests/fast/regions/script-tests/webkit-content-order-parsing.js (0 => 90966)


--- trunk/LayoutTests/fast/regions/script-tests/webkit-content-order-parsing.js	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/script-tests/webkit-content-order-parsing.js	2011-07-14 00:29:55 UTC (rev 90966)
@@ -0,0 +1,68 @@
+description('Tests parsing of webkit-content-order property');
+
+var webkitContentOrderProperty = "-webkit-content-order";
+
+function testCSSText(declaration) {
+    var div = document.createElement("div");
+    div.setAttribute("style", declaration);
+    return div.style.webkitContentOrder;
+}
+
+function testComputedStyle(declaration) {
+    var div = document.createElement("div");
+    document.body.appendChild(div);
+    div.style.setProperty(webkitContentOrderProperty, declaration);
+
+    var contentComputedValue = getComputedStyle(div).getPropertyValue(webkitContentOrderProperty);
+    document.body.removeChild(div);
+    return contentComputedValue;
+}
+
+function testNotInherited(parentValue, childValue) {
+    var parentDiv = document.createElement("div");
+    document.body.appendChild(parentDiv);
+    parentDiv.style.setProperty(webkitContentOrderProperty, parentValue);
+
+    var childDiv = document.createElement("div");
+    parentDiv.appendChild(childDiv);
+    childDiv.style.setProperty(webkitContentOrderProperty, childValue);
+
+    var childWebKitFlowComputedValue = getComputedStyle(childDiv).getPropertyValue(webkitContentOrderProperty);
+
+    parentDiv.removeChild(childDiv);
+    document.body.removeChild(parentDiv);
+
+    return childWebKitFlowComputedValue;
+}
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': auto")', "");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': initial")', "initial");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': inherit")', "inherit");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 1")', "1");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 0")', "0");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': -1")', "-1");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 2147483647")', "2147483647");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 2147483648")', "2147483648");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': -2147483648")', "-2147483648");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': -2147483649")', "-2147483649");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 12.5")', "");
+shouldBeEqualToString('testCSSText("' + webkitContentOrderProperty + ': 1px")', "");
+
+shouldBeEqualToString('testComputedStyle("auto")', "0");
+shouldBeEqualToString('testComputedStyle("initial")', "0");
+shouldBeEqualToString('testComputedStyle("inherit")', "0");
+shouldBeEqualToString('testComputedStyle("1")', "1");
+shouldBeEqualToString('testComputedStyle("0")', "0");
+shouldBeEqualToString('testComputedStyle("-1")', "-1");
+shouldBeEqualToString('testComputedStyle("2147483647")', "2147483647");
+shouldBeEqualToString('testComputedStyle("2147483648")', "2147483647");
+shouldBeEqualToString('testComputedStyle("-2147483648")', "-2147483648");
+shouldBeEqualToString('testComputedStyle("-2147483649")', "-2147483648");
+shouldBeEqualToString('testComputedStyle("12.5")', "0");
+shouldBeEqualToString('testComputedStyle("1px")', "0");
+
+shouldBeEqualToString('testNotInherited("0", "0")', "0");
+shouldBeEqualToString('testNotInherited("0", "1")', "1");
+shouldBeEqualToString('testNotInherited("1", "0")', "0");
+shouldBeEqualToString('testNotInherited("1", "2")', "2");
+
+successfullyParsed = true;

Added: trunk/LayoutTests/fast/regions/webkit-content-order-parsing-expected.txt (0 => 90966)


--- trunk/LayoutTests/fast/regions/webkit-content-order-parsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/webkit-content-order-parsing-expected.txt	2011-07-14 00:29:55 UTC (rev 90966)
@@ -0,0 +1,37 @@
+Tests parsing of webkit-content-order property
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testCSSText("-webkit-content-order: auto") is ""
+PASS testCSSText("-webkit-content-order: initial") is "initial"
+PASS testCSSText("-webkit-content-order: inherit") is "inherit"
+PASS testCSSText("-webkit-content-order: 1") is "1"
+PASS testCSSText("-webkit-content-order: 0") is "0"
+PASS testCSSText("-webkit-content-order: -1") is "-1"
+PASS testCSSText("-webkit-content-order: 2147483647") is "2147483647"
+PASS testCSSText("-webkit-content-order: 2147483648") is "2147483648"
+PASS testCSSText("-webkit-content-order: -2147483648") is "-2147483648"
+PASS testCSSText("-webkit-content-order: -2147483649") is "-2147483649"
+PASS testCSSText("-webkit-content-order: 12.5") is ""
+PASS testCSSText("-webkit-content-order: 1px") is ""
+PASS testComputedStyle("auto") is "0"
+PASS testComputedStyle("initial") is "0"
+PASS testComputedStyle("inherit") is "0"
+PASS testComputedStyle("1") is "1"
+PASS testComputedStyle("0") is "0"
+PASS testComputedStyle("-1") is "-1"
+PASS testComputedStyle("2147483647") is "2147483647"
+PASS testComputedStyle("2147483648") is "2147483647"
+PASS testComputedStyle("-2147483648") is "-2147483648"
+PASS testComputedStyle("-2147483649") is "-2147483648"
+PASS testComputedStyle("12.5") is "0"
+PASS testComputedStyle("1px") is "0"
+PASS testNotInherited("0", "0") is "0"
+PASS testNotInherited("0", "1") is "1"
+PASS testNotInherited("1", "0") is "0"
+PASS testNotInherited("1", "2") is "2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/regions/webkit-content-order-parsing.html (0 => 90966)


--- trunk/LayoutTests/fast/regions/webkit-content-order-parsing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/webkit-content-order-parsing.html	2011-07-14 00:29:55 UTC (rev 90966)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (90965 => 90966)


--- trunk/Source/WebCore/ChangeLog	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/ChangeLog	2011-07-14 00:29:55 UTC (rev 90966)
@@ -1,3 +1,30 @@
+2011-07-13  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions] Parse -webkit-content-order property
+        https://bugs.webkit.org/show_bug.cgi?id=63897
+
+        Reviewed by David Hyatt.
+
+        Test: fast/regions/webkit-content-order-parsing.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::regionIndex):
+        (WebCore::InheritedFlags::setRegionIndex):
+        (WebCore::InheritedFlags::initialRegionIndex):
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2011-07-13  James Robinson  <[email protected]>
 
         Reviewed by Kenneth Russell.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (90965 => 90966)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-07-14 00:29:55 UTC (rev 90966)
@@ -248,6 +248,7 @@
     CSSPropertyWebkitWritingMode
 #if ENABLE(CSS_REGIONS)
     , CSSPropertyWebkitFlow
+    , CSSPropertyWebkitContentOrder
 #endif
 #if ENABLE(SVG)
     ,
@@ -1667,6 +1668,8 @@
             if (style->flowThread().isNull())
                 return primitiveValueCache->createIdentifierValue(CSSValueAuto);
             return primitiveValueCache->createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
+        case CSSPropertyWebkitContentOrder:
+            return primitiveValueCache->createValue(style->regionIndex(), CSSPrimitiveValue::CSS_NUMBER);
 #endif
         /* Shorthand properties, currently not supported see bug 13658*/
         case CSSPropertyBackground:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (90965 => 90966)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-07-14 00:29:55 UTC (rev 90966)
@@ -1591,6 +1591,9 @@
 #if ENABLE(CSS_REGIONS)
     case CSSPropertyWebkitFlow:
         return parseFlowThread(propId, important);
+    case CSSPropertyWebkitContentOrder:
+        validPrimitive = validUnit(value, FInteger, m_strict);
+        break;
 #endif
     case CSSPropertyWebkitUserDrag: // auto | none | element
         if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement)

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (90965 => 90966)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2011-07-14 00:29:55 UTC (rev 90966)
@@ -328,6 +328,7 @@
 -webkit-user-select
 #if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
 -webkit-flow
+-webkit-content-order
 #endif
 #if defined(ENABLE_CSS_EXCLUSIONS) && ENABLE_CSS_EXCLUSIONS
 -webkit-wrap-shape

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (90965 => 90966)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-14 00:29:55 UTC (rev 90966)
@@ -4892,6 +4892,10 @@
         else
             m_style->setFlowThread(primitiveValue->getStringValue());
         return;
+    case CSSPropertyWebkitContentOrder:
+        HANDLE_INHERIT_AND_INITIAL(regionIndex, RegionIndex);
+        m_style->setRegionIndex(clampToInteger(primitiveValue->getDoubleValue()));
+        return;
 #endif
     case CSSPropertyWebkitMarqueeDirection:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (90965 => 90966)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-14 00:29:55 UTC (rev 90966)
@@ -347,7 +347,8 @@
 
 #if ENABLE(CSS_REGIONS)
         if (rareNonInheritedData->m_flowThread != other->rareNonInheritedData->m_flowThread
-            || rareNonInheritedData->m_regionThread != other->rareNonInheritedData->m_regionThread)
+            || rareNonInheritedData->m_regionThread != other->rareNonInheritedData->m_regionThread
+            || rareNonInheritedData->m_regionIndex != other->rareNonInheritedData->m_regionIndex)
             return StyleDifferenceLayout;
 #endif
         if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (90965 => 90966)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-14 00:29:55 UTC (rev 90966)
@@ -746,6 +746,7 @@
 #if ENABLE(CSS_REGIONS)
     const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
     const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
+    int regionIndex() const { return rareNonInheritedData->m_regionIndex; }
 #endif
 
     // Apple-specific property getter methods
@@ -1099,6 +1100,7 @@
 #if ENABLE(CSS_REGIONS)
     void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
     void setRegionThread(const AtomicString& regionThread) { SET_VAR(rareNonInheritedData, m_regionThread, regionThread); }
+    void setRegionIndex(int regionIndex) { SET_VAR(rareNonInheritedData, m_regionIndex, regionIndex); }
 #endif
 
     // Apple-specific property setters
@@ -1343,6 +1345,7 @@
 #if ENABLE(CSS_REGIONS)
     static const AtomicString& initialFlowThread() { return nullAtom; }
     static const AtomicString& initialRegionThread() { return nullAtom; }
+    static int initialRegionIndex() { return 0; }
 #endif
 
     // Keep these at the end.

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (90965 => 90966)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-07-14 00:29:55 UTC (rev 90966)
@@ -58,6 +58,7 @@
 #if ENABLE(CSS_REGIONS)
     , m_flowThread(RenderStyle::initialFlowThread())
     , m_regionThread(RenderStyle::initialRegionThread())
+    , m_regionIndex(RenderStyle::initialRegionIndex())
 #endif
 #if ENABLE(CSS_EXCLUSIONS)
     , m_wrapShape(RenderStyle::initialWrapShape())
@@ -104,6 +105,7 @@
 #if ENABLE(CSS_REGIONS)
     , m_flowThread(o.m_flowThread)
     , m_regionThread(o.m_regionThread)
+    , m_regionIndex(o.m_regionIndex)
 #endif
 #if ENABLE(CSS_EXCLUSIONS)
     , m_wrapShape(o.m_wrapShape)
@@ -157,6 +159,7 @@
 #if ENABLE(CSS_REGIONS)
         && (m_flowThread == o.m_flowThread)
         && (m_regionThread == o.m_regionThread)
+        && (m_regionIndex == o.m_regionIndex)
 #endif
 #if ENABLE(CSS_EXCLUSIONS)
         && (m_wrapShape == o.m_wrapShape)

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (90965 => 90966)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-13 23:45:17 UTC (rev 90965)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-14 00:29:55 UTC (rev 90966)
@@ -135,6 +135,7 @@
 #if ENABLE(CSS_REGIONS)
     AtomicString m_flowThread;
     AtomicString m_regionThread;
+    int m_regionIndex;
 #endif
 
 #if ENABLE(CSS_EXCLUSIONS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to