Title: [147295] trunk
Revision
147295
Author
hay...@chromium.org
Date
2013-03-31 20:44:36 -0700 (Sun, 31 Mar 2013)

Log Message

Text representation of pseudo elements, '::-webkit-distributed', is wrong in CSSSelector::selectorText().
https://bugs.webkit.org/show_bug.cgi?id=113560

Reviewed by Dimitri Glazkov.

Source/WebCore:

Fix the text representation of distributed functional pseudo elements in CSSSelector::selectorText().

Test: fast/dom/shadow/distributed-pseudo-element-css-text.html

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
(CSSSelector):

LayoutTests:

* fast/dom/shadow/distributed-pseudo-element-css-text-expected.txt: Added.
* fast/dom/shadow/distributed-pseudo-element-css-text.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147294 => 147295)


--- trunk/LayoutTests/ChangeLog	2013-04-01 03:06:57 UTC (rev 147294)
+++ trunk/LayoutTests/ChangeLog	2013-04-01 03:44:36 UTC (rev 147295)
@@ -1,3 +1,13 @@
+2013-03-31  Hayato Ito  <hay...@chromium.org>
+
+        Text representation of pseudo elements, '::-webkit-distributed', is wrong in CSSSelector::selectorText().
+        https://bugs.webkit.org/show_bug.cgi?id=113560
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/shadow/distributed-pseudo-element-css-text-expected.txt: Added.
+        * fast/dom/shadow/distributed-pseudo-element-css-text.html: Added.
+
 2013-03-31  Rafael Weinstein  <rafa...@chromium.org>
 
         HTMLLinkElement should resolve resource URLs when resources will be fetched

Added: trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text-expected.txt (0 => 147295)


--- trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text-expected.txt	2013-04-01 03:44:36 UTC (rev 147295)
@@ -0,0 +1,10 @@
+Test for cssText of '::distributed()' rule.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('style1').sheet.cssRules.item(0).cssText is ".foo::-webkit-distributed(div .bar::before) { display: block; }"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text.html (0 => 147295)


--- trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-pseudo-element-css-text.html	2013-04-01 03:44:36 UTC (rev 147295)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style id="style1">
+.foo::-webkit-distributed(div .bar::before) { display: block; }
+</style>
+</head>
+<script>
+description("Test for cssText of '::distributed()' rule.");
+shouldBeEqualToString("document.getElementById('style1').sheet.cssRules.item(0).cssText", ".foo::-webkit-distributed(div .bar::before) { display: block; }");
+</script>
+<script src=""
+</html>

Modified: trunk/Source/WebCore/ChangeLog (147294 => 147295)


--- trunk/Source/WebCore/ChangeLog	2013-04-01 03:06:57 UTC (rev 147294)
+++ trunk/Source/WebCore/ChangeLog	2013-04-01 03:44:36 UTC (rev 147295)
@@ -1,3 +1,19 @@
+2013-03-31  Hayato Ito  <hay...@chromium.org>
+
+        Text representation of pseudo elements, '::-webkit-distributed', is wrong in CSSSelector::selectorText().
+        https://bugs.webkit.org/show_bug.cgi?id=113560
+
+        Reviewed by Dimitri Glazkov.
+
+        Fix the text representation of distributed functional pseudo elements in CSSSelector::selectorText().
+
+        Test: fast/dom/shadow/distributed-pseudo-element-css-text.html
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::selectorText):
+        * css/CSSSelector.h:
+        (CSSSelector):
+
 2013-03-31  Adam Barth  <aba...@webkit.org>
 
         [Chromium] Yarr should build using a separate GYP file from _javascript_Core

Modified: trunk/Source/WebCore/css/CSSSelector.cpp (147294 => 147295)


--- trunk/Source/WebCore/css/CSSSelector.cpp	2013-04-01 03:06:57 UTC (rev 147294)
+++ trunk/Source/WebCore/css/CSSSelector.cpp	2013-04-01 03:44:36 UTC (rev 147295)
@@ -608,7 +608,7 @@
     return true;
 }
 
-String CSSSelector::selectorText() const
+String CSSSelector::selectorText(const String& rightSide) const
 {
     StringBuilder str;
 
@@ -709,28 +709,26 @@
     }
 
     if (const CSSSelector* tagHistory = cs->tagHistory()) {
-        String tagHistoryText = tagHistory->selectorText();
         switch (cs->relation()) {
         case CSSSelector::Descendant:
-            return tagHistoryText + " " + str.toString();
+            return tagHistory->selectorText(" " + str.toString() + rightSide);
         case CSSSelector::Child:
-            return tagHistoryText + " > " + str.toString();
+            return tagHistory->selectorText(" > " + str.toString() + rightSide);
         case CSSSelector::DirectAdjacent:
-            return tagHistoryText + " + " + str.toString();
+            return tagHistory->selectorText(" + " + str.toString() + rightSide);
         case CSSSelector::IndirectAdjacent:
-            return tagHistoryText + " ~ " + str.toString();
+            return tagHistory->selectorText(" ~ " + str.toString() + rightSide);
         case CSSSelector::SubSelector:
             ASSERT_NOT_REACHED();
         case CSSSelector::ShadowDescendant:
-            return tagHistoryText + str.toString();
+            return tagHistory->selectorText(str.toString() + rightSide);
 #if ENABLE(SHADOW_DOM)
         case CSSSelector::ShadowDistributed:
-            return tagHistoryText + "::-webkit-distributed(" + str.toString() + ")";
+            return tagHistory->selectorText("::-webkit-distributed(" + str.toString() + rightSide + ")");
 #endif
         }
     }
-
-    return str.toString();
+    return str.toString() + rightSide;
 }
 
 void CSSSelector::setAttribute(const QualifiedName& value)

Modified: trunk/Source/WebCore/css/CSSSelector.h (147294 => 147295)


--- trunk/Source/WebCore/css/CSSSelector.h	2013-04-01 03:06:57 UTC (rev 147294)
+++ trunk/Source/WebCore/css/CSSSelector.h	2013-04-01 03:44:36 UTC (rev 147295)
@@ -44,7 +44,7 @@
         /**
          * Re-create selector text from selector's data
          */
-        String selectorText() const;
+        String selectorText(const String& = "") const;
 
         // checks if the 2 selectors (including sub selectors) agree.
         bool operator==(const CSSSelector&) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to