2011-07-06 Mihnea Ovidenie <mihnea@adobe.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 05:36:13 +0000 (05:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 05:36:13 +0000 (05:36 +0000)
        Reviewed by David Hyatt.

        [CSSRegions] Parse flow property
        https://bugs.webkit.org/show_bug.cgi?id=61730

        * fast/regions/script-tests/TEMPLATE.html: Added.
        * fast/regions/script-tests/webkit-flow-parsing.js: Added.
        (test):
        (testComputedStyle):
        (testNotInherited):
        * fast/regions/webkit-flow-parsing-expected.txt: Added.
        * fast/regions/webkit-flow-parsing.html: Added.
2011-07-06  Mihnea Ovidenie  <mihnea@adobe.com>

        Reviewed by David Hyatt.

        [CSSRegions] Parse flow property
        https://bugs.webkit.org/show_bug.cgi?id=61730

        Test: fast/regions/webkit-flow-parsing.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parseFlowThread):
        * css/CSSParser.h:
        * css/CSSPropertyNames.in:
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::diff):
        * rendering/style/RenderStyle.h:
        (WebCore::InheritedFlags::flowThread):
        (WebCore::InheritedFlags::setFlowThread):
        (WebCore::InheritedFlags::initialFlowThread):
        * rendering/style/StyleRareNonInheritedData.cpp:
        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
        (WebCore::StyleRareNonInheritedData::operator==):
        * rendering/style/StyleRareNonInheritedData.h:

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/regions/script-tests/TEMPLATE.html [new file with mode: 0644]
LayoutTests/fast/regions/script-tests/webkit-flow-parsing.js [new file with mode: 0644]
LayoutTests/fast/regions/webkit-flow-parsing-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/webkit-flow-parsing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h

index 36d25ce479ae69c77442ca09c778a2c17cacea2e..bca6c15b1e038571d3a4b4fac0bae626b24467cd 100644 (file)
@@ -1,3 +1,18 @@
+2011-07-06  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        Reviewed by David Hyatt.
+
+        [CSSRegions] Parse flow property
+        https://bugs.webkit.org/show_bug.cgi?id=61730
+
+        * fast/regions/script-tests/TEMPLATE.html: Added.
+        * fast/regions/script-tests/webkit-flow-parsing.js: Added.
+        (test):
+        (testComputedStyle):
+        (testNotInherited):
+        * fast/regions/webkit-flow-parsing-expected.txt: Added.
+        * fast/regions/webkit-flow-parsing.html: Added.
+
 2011-07-06  MORITA Hajime  <morrita@google.com>
 
         [ShadowContentElement] Redundant RenderText objects are created on the content boundaries.
diff --git a/LayoutTests/fast/regions/script-tests/TEMPLATE.html b/LayoutTests/fast/regions/script-tests/TEMPLATE.html
new file mode 100644 (file)
index 0000000..70ce56c
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/regions/script-tests/webkit-flow-parsing.js b/LayoutTests/fast/regions/script-tests/webkit-flow-parsing.js
new file mode 100644 (file)
index 0000000..a3e86cc
--- /dev/null
@@ -0,0 +1,64 @@
+description('Test parsing of the CSS webkit-flow property.');
+
+function test(declaration) {
+    var div = document.createElement("div");
+    div.setAttribute("style", declaration);
+    return div.style.webkitFlow;
+}
+
+function testComputedStyle(value) {
+    var div = document.createElement("div");
+    document.body.appendChild(div);
+    div.style.setProperty("-webkit-flow", value);
+    var webkitFlowComputedValue = getComputedStyle(div).getPropertyValue("-webkit-flow");
+    document.body.removeChild(div);
+    return webkitFlowComputedValue;
+}
+
+function testNotInherited(parentValue, childValue) {
+    var parentDiv = document.createElement("div");
+    document.body.appendChild(parentDiv);
+    parentDiv.style.setProperty("-webkit-flow", parentValue);
+
+    var childDiv = document.createElement("div");
+    parentDiv.appendChild(childDiv);
+    childDiv.style.setProperty("-webkit-flow", childValue);
+
+    var childWebKitFlowComputedValue = getComputedStyle(childDiv).getPropertyValue("-webkit-flow");
+
+    parentDiv.removeChild(childDiv);
+    document.body.removeChild(parentDiv);
+
+    return childWebKitFlowComputedValue;
+}
+
+shouldBeEqualToString('test("-webkit-flow: auto")', "auto");
+shouldBeEqualToString('test("-webkit-flow: initial")', "initial");
+shouldBeEqualToString('test("-webkit-flow: inherit")', "inherit");
+shouldBeEqualToString('test("-webkit-flow: \'first-flow\'")', "first-flow");
+shouldBeEqualToString('test("-webkit-flow: \'first flow\'")', "'first flow'");
+shouldBeEqualToString('test("-webkit-flow: \'auto\';")', "auto");
+shouldBeEqualToString('test("-webkit-flow: \'\'")', "auto");
+shouldBeEqualToString('test("-webkit-flow: ;")', "");
+shouldBeEqualToString('test("-webkit-flow: 1")', "");
+shouldBeEqualToString('test("-webkit-flow: 1.2")', "");
+shouldBeEqualToString('test("-webkit-flow: -1")', "");
+shouldBeEqualToString('test("-webkit-flow: 12px")', "");
+shouldBeEqualToString('test("-webkit-flow: first-flow;")', "");
+shouldBeEqualToString('test("-webkit-flow: first flow")', "");
+
+shouldBeEqualToString('testComputedStyle("auto")', "auto");
+shouldBeEqualToString('testComputedStyle("")', "auto");
+shouldBeEqualToString('testComputedStyle("\'auto\'")', "auto");
+shouldBeEqualToString('testComputedStyle("\'first-flow\'")', "first-flow");
+shouldBeEqualToString('testComputedStyle("first-flow")', "auto");
+shouldBeEqualToString('testComputedStyle("inherited")', "auto");
+shouldBeEqualToString('testComputedStyle("initial")', "auto");
+shouldBeEqualToString('testComputedStyle("12px")', "auto");
+
+shouldBeEqualToString('testNotInherited("auto", "auto")', "auto");
+shouldBeEqualToString('testNotInherited("auto", "\'child-flow\'")', "child-flow");
+shouldBeEqualToString('testNotInherited("\'parent-flow\'", "auto")', "auto");
+shouldBeEqualToString('testNotInherited("\'parent-flow\'", "\'child-flow\'")', "child-flow");
+
+successfullyParsed = true;
diff --git a/LayoutTests/fast/regions/webkit-flow-parsing-expected.txt b/LayoutTests/fast/regions/webkit-flow-parsing-expected.txt
new file mode 100644 (file)
index 0000000..a847a2f
--- /dev/null
@@ -0,0 +1,35 @@
+Test parsing of the CSS webkit-flow property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test("-webkit-flow: auto") is "auto"
+PASS test("-webkit-flow: initial") is "initial"
+PASS test("-webkit-flow: inherit") is "inherit"
+PASS test("-webkit-flow: 'first-flow'") is "first-flow"
+PASS test("-webkit-flow: 'first flow'") is "'first flow'"
+PASS test("-webkit-flow: 'auto';") is "auto"
+PASS test("-webkit-flow: ''") is "auto"
+PASS test("-webkit-flow: ;") is ""
+PASS test("-webkit-flow: 1") is ""
+PASS test("-webkit-flow: 1.2") is ""
+PASS test("-webkit-flow: -1") is ""
+PASS test("-webkit-flow: 12px") is ""
+PASS test("-webkit-flow: first-flow;") is ""
+PASS test("-webkit-flow: first flow") is ""
+PASS testComputedStyle("auto") is "auto"
+PASS testComputedStyle("") is "auto"
+PASS testComputedStyle("'auto'") is "auto"
+PASS testComputedStyle("'first-flow'") is "first-flow"
+PASS testComputedStyle("first-flow") is "auto"
+PASS testComputedStyle("inherited") is "auto"
+PASS testComputedStyle("initial") is "auto"
+PASS testComputedStyle("12px") is "auto"
+PASS testNotInherited("auto", "auto") is "auto"
+PASS testNotInherited("auto", "'child-flow'") is "child-flow"
+PASS testNotInherited("'parent-flow'", "auto") is "auto"
+PASS testNotInherited("'parent-flow'", "'child-flow'") is "child-flow"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/regions/webkit-flow-parsing.html b/LayoutTests/fast/regions/webkit-flow-parsing.html
new file mode 100644 (file)
index 0000000..ddeb2a4
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/webkit-flow-parsing.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index aca765661e4650495a99758deca2c1375c455959..eb83a40bbae08a7b3eef3d67dff82ccb1596cff7 100644 (file)
@@ -1,3 +1,32 @@
+2011-07-06  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        Reviewed by David Hyatt.
+
+        [CSSRegions] Parse flow property
+        https://bugs.webkit.org/show_bug.cgi?id=61730
+
+        Test: fast/regions/webkit-flow-parsing.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFlowThread):
+        * css/CSSParser.h:
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::flowThread):
+        (WebCore::InheritedFlags::setFlowThread):
+        (WebCore::InheritedFlags::initialFlowThread):
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2011-07-06  MORITA Hajime  <morrita@google.com>
 
         [ShadowContentElement] Redundant RenderText objects are created on the content boundaries.
index d420aaaf52492b6295797617950d08833a60bdcc..6f55ac8f9a0fb4ee89b9e73b7b263f3966a52209 100644 (file)
@@ -246,7 +246,9 @@ static const int computedProperties[] = {
     CSSPropertyWebkitUserModify,
     CSSPropertyWebkitUserSelect,
     CSSPropertyWebkitWritingMode
-
+#if ENABLE(CSS_REGIONS)
+    , CSSPropertyWebkitFlow
+#endif
 #if ENABLE(SVG)
     ,
     CSSPropertyClipPath,
@@ -1656,7 +1658,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
             return counterToCSSValue(style.get(), propertyID, primitiveValueCache);
         case CSSPropertyCounterReset:
             return counterToCSSValue(style.get(), propertyID, primitiveValueCache);
-        
+#if ENABLE(CSS_REGIONS)
+        case CSSPropertyWebkitFlow:
+            if (style->flowThread().isNull())
+                return primitiveValueCache->createIdentifierValue(CSSValueAuto);
+            return primitiveValueCache->createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
+#endif
         /* Shorthand properties, currently not supported see bug 13658*/
         case CSSPropertyBackground:
         case CSSPropertyBorder:
index ff43a2dcef86909d0377007409ab2d104b6e49ea..acf77522693148828913edb5f5014a439f776b16 100644 (file)
@@ -1586,6 +1586,10 @@ bool CSSParser::parseValue(int propId, bool important)
         else
             validPrimitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict);
         break;
+#endif
+#if ENABLE(CSS_REGIONS)
+    case CSSPropertyWebkitFlow:
+        return parseFlowThread(propId, important);
 #endif
     case CSSPropertyWebkitUserDrag: // auto | none | element
         if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement)
@@ -5832,6 +5836,37 @@ PassRefPtr<CSSValueList> CSSParser::parseTransform()
     return list.release();
 }
 
+#if ENABLE(CSS_REGIONS)
+// auto | <flow_name>
+bool CSSParser::parseFlowThread(int propId, bool important)
+{
+    ASSERT(propId == CSSPropertyWebkitFlow);
+
+    if (m_valueList->size() != 1)
+        return false;
+
+    CSSParserValue* value = m_valueList->current();
+    if (!value)
+        return false;
+
+    if (value->id == CSSValueAuto) {
+        addProperty(propId, primitiveValueCache()->createIdentifierValue(value->id), important);
+        return true;
+    }
+
+    if (!value->id && value->unit == CSSPrimitiveValue::CSS_STRING) {
+        String inputProperty = String(value->string);
+        if (!inputProperty.isEmpty())
+            addProperty(propId, primitiveValueCache()->createValue(inputProperty, CSSPrimitiveValue::CSS_STRING), important);
+        else
+            addProperty(propId, primitiveValueCache()->createIdentifierValue(CSSValueAuto), important);
+        return true;
+    }
+
+    return false;
+}
+#endif
+
 bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
 {
     propId1 = propId;
index c6f078a9b9fbd70d55f9ecf6664b5f93ceb723eb..c175cabc8e0d0f3eb29cd4bc8432c90396bc9caa 100644 (file)
@@ -156,6 +156,9 @@ namespace WebCore {
         PassRefPtr<CSSValue> parseWCSSInputProperty();
 #endif
 
+#if ENABLE(CSS_REGIONS)
+        bool parseFlowThread(int propId, bool important);
+#endif
         // CSS3 Parsing Routines (for properties specific to CSS3)
         bool parseShadow(int propId, bool important);
         bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&);
index 7747d49afed1546a0de569f9eb09525c296e41d8..2823000f6f98f66050afff3c86bd1bc36543d524 100644 (file)
@@ -326,3 +326,6 @@ z-index
 -webkit-user-drag
 -webkit-user-modify
 -webkit-user-select
+#if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
+-webkit-flow
+#endif
index 1c1e9310e8f604182b2e8ec5c3865d3bce267f6a..6f84faef7f03557ff7c1f66b88789e7e4b55ab21 100644 (file)
@@ -4868,6 +4868,20 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
             }
         }
         return;
+#endif
+#if ENABLE(CSS_REGIONS)
+    case CSSPropertyWebkitFlow:
+        if (isInitial)
+            HANDLE_INITIAL_COND(CSSPropertyWebkitFlow, FlowThread);
+        if (isInherit) {
+            m_style->setFlowThread(nullAtom);
+            return;
+        }
+        if (primitiveValue->getIdent() == CSSValueAuto)
+            m_style->setFlowThread(nullAtom);
+        else
+            m_style->setFlowThread(primitiveValue->getStringValue());
+        return;
 #endif
     case CSSPropertyWebkitMarqueeDirection:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)
index c304c1c1f58d88772bf6bcf60d7645c2e7efd855..c7aa84678a31e92279443b8b7d1561abf8af1f8a 100644 (file)
@@ -344,6 +344,10 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
             || rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow)
             return StyleDifferenceLayout;
 
+#if ENABLE(CSS_REGIONS)
+        if (rareNonInheritedData->m_flowThread != other->rareNonInheritedData->m_flowThread)
+             return StyleDifferenceLayout;
+#endif
         if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()
             && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->rareNonInheritedData->m_deprecatedFlexibleBox.get())
             return StyleDifferenceLayout;
index bda8ca695bfa9643b263f9967229b712ee159d74..ea864292f09615f06be9e36fec7b6d71b8493d4a 100644 (file)
@@ -743,6 +743,10 @@ public:
     bool hasTextCombine() const { return textCombine() != TextCombineNone; }
     // End CSS3 Getters
 
+#if ENABLE(CSS_REGIONS)
+    const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
+#endif
+
     // Apple-specific property getter methods
     EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
     const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
@@ -1091,6 +1095,10 @@ public:
     void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
     // End CSS3 Setters
 
+#if ENABLE(CSS_REGIONS)
+    void setFlowThread(const AtomicString& flowThread) { SET_VAR(rareNonInheritedData, m_flowThread, flowThread); }
+#endif
+
     // Apple-specific property setters
     void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
 
@@ -1320,6 +1328,10 @@ public:
     static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
     static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
 
+#if ENABLE(CSS_REGIONS)
+    static const AtomicString& initialFlowThread() { return nullAtom; }
+#endif
+
     // Keep these at the end.
     static LineClampValue initialLineClamp() { return LineClampValue(); }
     static bool initialTextSizeAdjust() { return true; }
index 810670721ac98aa5d6b851743942600fde7c34cd..1f491d318ece622bc3c5e262445b0157b4f9c992 100644 (file)
@@ -55,6 +55,9 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY())
     , m_pageSize()
     , m_pageSizeType(PAGE_SIZE_AUTO)
+#if ENABLE(CSS_REGIONS)
+    , m_flowThread(RenderStyle::initialFlowThread())
+#endif
 {
 }
 
@@ -94,6 +97,9 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
     , m_perspectiveOriginY(o.m_perspectiveOriginY)
     , m_pageSize(o.m_pageSize)
     , m_pageSizeType(o.m_pageSizeType)
+#if ENABLE(CSS_REGIONS)
+    , m_flowThread(o.m_flowThread)
+#endif
 {
 }
 
@@ -140,6 +146,9 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && (m_perspectiveOriginY == o.m_perspectiveOriginY)
         && (m_pageSize == o.m_pageSize)
         && (m_pageSizeType == o.m_pageSizeType)
+#if ENABLE(CSS_REGIONS)
+        && (m_flowThread == o.m_flowThread)
+#endif
         ;
 }
 
index 6847a6e150a1046ed33533f257f283f471d47214..a4236e838051754e5564abdc2a60e26ba4c8fa01 100644 (file)
@@ -131,6 +131,10 @@ public:
     LengthSize m_pageSize;
     PageSizeType m_pageSizeType;
 
+#if ENABLE(CSS_REGIONS)
+    AtomicString m_flowThread;
+#endif
+
 private:
     StyleRareNonInheritedData();
     StyleRareNonInheritedData(const StyleRareNonInheritedData&);