Title: [90642] trunk
Revision
90642
Author
[email protected]
Date
2011-07-08 10:29:10 -0700 (Fri, 08 Jul 2011)

Log Message

[CSSRegions]Parse content: -webkit-from-flow
https://bugs.webkit.org/show_bug.cgi?id=63133

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

Source/WebCore:

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

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::contentToCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseContent):
(WebCore::CSSParser::parseFromFlowContent):
* css/CSSParser.h:
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::getStringValue):
(WebCore::CSSPrimitiveValue::cssText):
* css/CSSPrimitiveValue.h:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::regionThread):
(WebCore::InheritedFlags::setRegionThread):
(WebCore::InheritedFlags::initialRegionThread):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90641 => 90642)


--- trunk/LayoutTests/ChangeLog	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/LayoutTests/ChangeLog	2011-07-08 17:29:10 UTC (rev 90642)
@@ -1,3 +1,14 @@
+2011-07-08  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions]Parse content: -webkit-from-flow
+        https://bugs.webkit.org/show_bug.cgi?id=63133
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/content-webkit-from-flow-parsing-expected.txt: Added.
+        * fast/regions/content-webkit-from-flow-parsing.html: Added.
+        * fast/regions/script-tests/content-webkit-from-flow-parsing.js: Added.
+
 2011-07-08  Vsevolod Vlasov  <[email protected]>
 
         REGRESSION (r90557): http/tests/inspector/network/network-embed.html fails

Added: trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing-expected.txt (0 => 90642)


--- trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing-expected.txt	2011-07-08 17:29:10 UTC (rev 90642)
@@ -0,0 +1,38 @@
+Tests being able to set content to -webkit-from-flow
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testCSSText("content: -webkit-from-flow('first-flow')") is "-webkit-from-flow(first-flow)"
+PASS testCSSText("content: -webkit-from-flow('first flow')") is "-webkit-from-flow('first flow')"
+PASS testCSSText("content: -webkit-from-flow('auto')") is "-webkit-from-flow(auto)"
+PASS testCSSText("content: -webkit-from-flow(auto)") is ""
+PASS testCSSText("content: -webkit-from-flow(initial)") is ""
+PASS testCSSText("content: -webkit-from-flow(inherit)") is ""
+PASS testCSSText("content: -webkit-from-flow()") is ""
+PASS testCSSText("content: -webkit-from-flow('')") is "-webkit-from-flow('')"
+PASS testCSSText("content: ;") is ""
+PASS testCSSText("content: -webkit-from-flow(1)") is ""
+PASS testCSSText("content: -webkit-from-flow(1.2)") is ""
+PASS testCSSText("content: -webkit-from-flow(-1)") is ""
+PASS testCSSText("content: -webkit-from-flow(12px)") is ""
+PASS testCSSText("content: -webkit-from-flow(first flow)") is ""
+PASS testCSSText("content: -webkit-from-flow(first-flow)") is ""
+PASS testComputedStyle("'first-flow'") is "first-flow"
+PASS testComputedStyle("'first flow'") is "'first flow'"
+PASS testComputedStyle("'auto'") is "auto"
+PASS testComputedStyle("auto") is ""
+PASS testComputedStyle("initial") is ""
+PASS testComputedStyle("inherit") is ""
+PASS testComputedStyle("") is ""
+PASS testComputedStyle("1") is ""
+PASS testComputedStyle("1.2") is ""
+PASS testComputedStyle("-1") is ""
+PASS testComputedStyle("12px") is ""
+PASS testComputedStyle("''") is "''"
+PASS testComputedStyle("first flow") is ""
+PASS testComputedStyle("first-flow") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing.html (0 => 90642)


--- trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/content-webkit-from-flow-parsing.html	2011-07-08 17:29:10 UTC (rev 90642)
@@ -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>

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


--- trunk/LayoutTests/fast/regions/script-tests/content-webkit-from-flow-parsing.js	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/script-tests/content-webkit-from-flow-parsing.js	2011-07-08 17:29:10 UTC (rev 90642)
@@ -0,0 +1,50 @@
+description('Tests being able to set content to -webkit-from-flow');
+
+function testCSSText(declaration) {
+    var div = document.createElement("div");
+    div.setAttribute("style", declaration);
+    return div.style.content;
+}
+
+function testComputedStyle(declaration) {
+    var div = document.createElement("div");
+    document.body.appendChild(div);
+    div.style.setProperty("content", declaration);
+
+    var contentComputedValue = getComputedStyle(div).getPropertyValue("content");
+    document.body.removeChild(div);
+    return contentComputedValue;
+}
+
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(\'first-flow\')")', "-webkit-from-flow(first-flow)");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(\'first flow\')")', "-webkit-from-flow('first flow')");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(\'auto\')")', "-webkit-from-flow(auto)");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(auto)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(initial)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(inherit)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow()")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(\'\')")', "-webkit-from-flow('')");
+shouldBeEqualToString('testCSSText("content: ;")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(1)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(1.2)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(-1)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(12px)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(first flow)")', "");
+shouldBeEqualToString('testCSSText("content: -webkit-from-flow(first-flow)")', "");
+
+shouldBeEqualToString('testComputedStyle("\'first-flow\'")', "first-flow");
+shouldBeEqualToString('testComputedStyle("\'first flow\'")', "'first flow'");
+shouldBeEqualToString('testComputedStyle("\'auto\'")', "auto");
+shouldBeEqualToString('testComputedStyle("auto")', "");
+shouldBeEqualToString('testComputedStyle("initial")', "");
+shouldBeEqualToString('testComputedStyle("inherit")', "");
+shouldBeEqualToString('testComputedStyle("")', "");
+shouldBeEqualToString('testComputedStyle("1")', "");
+shouldBeEqualToString('testComputedStyle("1.2")', "");
+shouldBeEqualToString('testComputedStyle("-1")', "");
+shouldBeEqualToString('testComputedStyle("12px")', "");
+shouldBeEqualToString('testComputedStyle("\'\'")', "''");
+shouldBeEqualToString('testComputedStyle("first flow")', "");
+shouldBeEqualToString('testComputedStyle("first-flow")', "");
+
+successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (90641 => 90642)


--- trunk/Source/WebCore/ChangeLog	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/ChangeLog	2011-07-08 17:29:10 UTC (rev 90642)
@@ -1,3 +1,36 @@
+2011-07-08  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions]Parse content: -webkit-from-flow
+        https://bugs.webkit.org/show_bug.cgi?id=63133
+
+        Reviewed by David Hyatt.
+
+        Test: fast/regions/content-webkit-from-flow-parsing.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::contentToCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseContent):
+        (WebCore::CSSParser::parseFromFlowContent):
+        * css/CSSParser.h:
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::cleanup):
+        (WebCore::CSSPrimitiveValue::getStringValue):
+        (WebCore::CSSPrimitiveValue::cssText):
+        * css/CSSPrimitiveValue.h:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::regionThread):
+        (WebCore::InheritedFlags::setRegionThread):
+        (WebCore::InheritedFlags::initialRegionThread):
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2011-07-08  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: NetworkPanel search failed if the matched sting is in the query part of url

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (90641 => 90642)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -767,6 +767,10 @@
         } else if (contentData->isText())
             list->append(primitiveValueCache->createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
     }
+#if ENABLE(CSS_REGIONS)
+    if (!style->regionThread().isNull())
+        list->append(primitiveValueCache->createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
+#endif
     return list.release();
 }
 

Modified: trunk/Source/WebCore/css/CSSParser.cpp (90641 => 90642)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -2657,6 +2657,12 @@
             } else if (isGeneratedImageValue(val)) {
                 if (!parseGeneratedImage(parsedValue))
                     return false;
+#if ENABLE(CSS_REGIONS)
+            } else if (equalIgnoringCase(val->function->name, "-webkit-from-flow(")) {
+                parsedValue = parseFromFlowContent(args);
+                if (!parsedValue)
+                    return false;
+#endif
             } else
                 return false;
         } else if (val->unit == CSSPrimitiveValue::CSS_IDENT) {
@@ -5865,6 +5871,22 @@
 
     return false;
 }
+
+// The region name is now specified as an argument to the content property:
+// content: from-flow(flow_thread_name)
+PassRefPtr<CSSValue> CSSParser::parseFromFlowContent(CSSParserValueList* args)
+{
+    // It should be only one name for the region thread.
+    if (args->size() != 1)
+        return 0;
+
+    CSSParserValue* argFlowThreadName = args->current();
+
+    if (argFlowThreadName->unit != CSSPrimitiveValue::CSS_STRING)
+        return 0;
+
+    return CSSPrimitiveValue::create(argFlowThreadName->string, CSSPrimitiveValue::CSS_FROM_FLOW);
+}
 #endif
 
 bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)

Modified: trunk/Source/WebCore/css/CSSParser.h (90641 => 90642)


--- trunk/Source/WebCore/css/CSSParser.h	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSParser.h	2011-07-08 17:29:10 UTC (rev 90642)
@@ -158,6 +158,7 @@
 
 #if ENABLE(CSS_REGIONS)
         bool parseFlowThread(int propId, bool important);
+        PassRefPtr<CSSValue> parseFromFlowContent(CSSParserValueList*);
 #endif
         // CSS3 Parsing Routines (for properties specific to CSS3)
         bool parseShadow(int propId, bool important);

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (90641 => 90642)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -221,6 +221,9 @@
         case CSS_STRING:
         case CSS_URI:
         case CSS_ATTR:
+#if ENABLE(CSS_REGIONS)
+        case CSS_FROM_FLOW:
+#endif
         case CSS_PARSER_HEXCOLOR:
             if (m_value.string)
                 m_value.string->deref();
@@ -504,6 +507,9 @@
         case CSS_STRING:
         case CSS_ATTR:
         case CSS_URI:
+#if ENABLE(CSS_REGIONS)
+        case CSS_FROM_FLOW:
+#endif
             return m_value.string;
         case CSS_IDENT:
             return valueOrPropertyName(m_value.ident);
@@ -684,6 +690,11 @@
         case CSS_STRING:
             text = quoteCSSStringIfNeeded(m_value.string);
             break;
+#if ENABLE(CSS_REGIONS)
+        case CSS_FROM_FLOW:
+            text = "-webkit-from-flow(" + quoteCSSStringIfNeeded(m_value.string) + ")";
+            break;
+#endif
         case CSS_URI:
             text = "url(" + quoteCSSURLIfNeeded(m_value.string) + ")";
             break;

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (90641 => 90642)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.h	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h	2011-07-08 17:29:10 UTC (rev 90642)
@@ -94,7 +94,8 @@
         CSS_REMS = 108,
 
         // This is used internally for counter names (as opposed to counter values)
-        CSS_COUNTER_NAME = 109
+        CSS_COUNTER_NAME = 109,
+        CSS_FROM_FLOW = 110
     };
     
     // This enum follows the CSSParser::Units enum augmented with UNIT_FREQUENCY for frequencies.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (90641 => 90642)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -4140,6 +4140,16 @@
         CSSValueList* list = static_cast<CSSValueList*>(value);
         int len = list->length();
 
+#if ENABLE(CSS_REGIONS)
+        if (len == 1 && list->itemWithoutBoundsCheck(0)->isPrimitiveValue()) {
+            CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(list->itemWithoutBoundsCheck(0));
+            if (contentValue->primitiveType() == CSSPrimitiveValue::CSS_FROM_FLOW) {
+                m_style->setRegionThread(contentValue->getStringValue().impl());
+                return;
+            }
+        }
+#endif
+
         bool didSet = false;
         for (int i = 0; i < len; i++) {
             CSSValue* item = list->itemWithoutBoundsCheck(i);
@@ -4147,10 +4157,10 @@
                 m_style->setContent(static_cast<CSSImageGeneratorValue*>(item)->generatedImage(), didSet);
                 didSet = true;
             }
-            
+
             if (!item->isPrimitiveValue())
                 continue;
-            
+
             CSSPrimitiveValue* contentValue = static_cast<CSSPrimitiveValue*>(item);
             switch (contentValue->primitiveType()) {
             case CSSPrimitiveValue::CSS_STRING:

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (90641 => 90642)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -345,8 +345,9 @@
             return StyleDifferenceLayout;
 
 #if ENABLE(CSS_REGIONS)
-        if (rareNonInheritedData->m_flowThread != other->rareNonInheritedData->m_flowThread)
-             return StyleDifferenceLayout;
+        if (rareNonInheritedData->m_flowThread != other->rareNonInheritedData->m_flowThread
+            || rareNonInheritedData->m_regionThread != other->rareNonInheritedData->m_regionThread)
+            return StyleDifferenceLayout;
 #endif
         if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()
             && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other->rareNonInheritedData->m_deprecatedFlexibleBox.get())

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (90641 => 90642)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2011-07-08 17:29:10 UTC (rev 90642)
@@ -745,6 +745,7 @@
 
 #if ENABLE(CSS_REGIONS)
     const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
+    const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
 #endif
 
     // Apple-specific property getter methods
@@ -1097,6 +1098,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); }
 #endif
 
     // Apple-specific property setters
@@ -1330,6 +1332,7 @@
 
 #if ENABLE(CSS_REGIONS)
     static const AtomicString& initialFlowThread() { return nullAtom; }
+    static const AtomicString& initialRegionThread() { return nullAtom; }
 #endif
 
     // Keep these at the end.

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (90641 => 90642)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-07-08 17:29:10 UTC (rev 90642)
@@ -57,6 +57,7 @@
     , m_pageSizeType(PAGE_SIZE_AUTO)
 #if ENABLE(CSS_REGIONS)
     , m_flowThread(RenderStyle::initialFlowThread())
+    , m_regionThread(RenderStyle::initialRegionThread())
 #endif
 {
 }
@@ -99,6 +100,7 @@
     , m_pageSizeType(o.m_pageSizeType)
 #if ENABLE(CSS_REGIONS)
     , m_flowThread(o.m_flowThread)
+    , m_regionThread(o.m_regionThread)
 #endif
 {
 }
@@ -148,6 +150,7 @@
         && (m_pageSizeType == o.m_pageSizeType)
 #if ENABLE(CSS_REGIONS)
         && (m_flowThread == o.m_flowThread)
+        && (m_regionThread == o.m_regionThread)
 #endif
         ;
 }

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (90641 => 90642)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-08 17:24:51 UTC (rev 90641)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2011-07-08 17:29:10 UTC (rev 90642)
@@ -133,6 +133,7 @@
 
 #if ENABLE(CSS_REGIONS)
     AtomicString m_flowThread;
+    AtomicString m_regionThread;
 #endif
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to