[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

apavlov at chromium.org apavlov at chromium.org
Wed Dec 22 13:47:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dba1d5aeb651139c19b32d120fd463f247cf3639
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 27 13:36:47 2010 +0000

    2010-09-27  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Sam Weinig.
    
            Implement CSSStyleRule::setSelectorText()
    
            This involves removing the "selectorText" "setter raises(DOMException)" clause from the IDL files,
            since the setter no longer raises the exception, as per http://dev.w3.org/csswg/cssom/#dom-cssstylerule-selectortext
            https://bugs.webkit.org/show_bug.cgi?id=46487
    
            Test: fast/css/css-set-selector-text.html
    
            WebCore:
            * css/CSSPageRule.idl:
            * css/CSSStyleRule.cpp:
            (WebCore::CSSStyleRule::setSelectorText):
            * css/CSSStyleRule.h:
            * css/CSSStyleRule.idl:
    
            LayoutTests:
            * fast/css/css-set-selector-text-expected.txt: Added.
            * fast/css/css-set-selector-text.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 179505d..e87922e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-27  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Sam Weinig.
+
+        Implement CSSStyleRule::setSelectorText()
+        https://bugs.webkit.org/show_bug.cgi?id=46487
+
+        * fast/css/css-set-selector-text-expected.txt: Added.
+        * fast/css/css-set-selector-text.html: Added.
+
 2010-09-27  Andrey Kosyakov  <caseq at chromium.org>
 
         Unreviewed. Updated chromium expectations for ifast/block/basic/016.html (mac expectations changed in r68362)
diff --git a/LayoutTests/fast/css/css-set-selector-text-expected.txt b/LayoutTests/fast/css/css-set-selector-text-expected.txt
new file mode 100644
index 0000000..8b1c564
--- /dev/null
+++ b/LayoutTests/fast/css/css-set-selector-text-expected.txt
@@ -0,0 +1,96 @@
+This tests setting and re-serialization of some CSS selectors.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS setThenReadSelectorText('') is '_foo'
+PASS setThenReadSelectorText('123') is '_foo'
+PASS setThenReadSelectorText('-') is '_foo'
+PASS setThenReadSelectorText('$') is '_foo'
+PASS setThenReadSelectorText(':') is '_foo'
+PASS setThenReadSelectorText('.') is '_foo'
+PASS setThenReadSelectorText('#') is '_foo'
+PASS setThenReadSelectorText('[]') is '_foo'
+PASS setThenReadSelectorText('()') is '_foo'
+
+PASS setThenReadSelectorText('*') is '*'
+PASS setThenReadSelectorText('a') is 'a'
+PASS setThenReadSelectorText('#a') is '#a'
+PASS setThenReadSelectorText('.a') is '.a'
+PASS setThenReadSelectorText(':active') is ':active'
+PASS setThenReadSelectorText('[a]') is '[a]'
+PASS setThenReadSelectorText('[a="b"]') is '[a="b"]'
+PASS setThenReadSelectorText('[a~="b"]') is '[a~="b"]'
+PASS setThenReadSelectorText('[a|="b"]') is '[a|="b"]'
+PASS setThenReadSelectorText('[a^="b"]') is '[a^="b"]'
+PASS setThenReadSelectorText('[a$="b"]') is '[a$="b"]'
+PASS setThenReadSelectorText('[a*="b"]') is '[a*="b"]'
+
+PASS setThenReadSelectorText('*|a') is '*|a'
+PASS setThenReadSelectorText('n|a') is 'n|a'
+PASS setThenReadSelectorText('*|*') is '*|*'
+PASS setThenReadSelectorText('n|*') is 'n|*'
+PASS setThenReadSelectorText('[*|a]') is '[*|a]'
+PASS setThenReadSelectorText('[n|a]') is '[n|a]'
+
+PASS setThenReadSelectorText('a:active') is 'a:active'
+PASS setThenReadSelectorText('a b') is 'a b'
+PASS setThenReadSelectorText('a + b') is 'a + b'
+PASS setThenReadSelectorText('a ~ b') is 'a ~ b'
+PASS setThenReadSelectorText('a > b') is 'a > b'
+
+PASS setThenReadSelectorText(':active') is ':active'
+PASS setThenReadSelectorText(':checked') is ':checked'
+PASS setThenReadSelectorText(':disabled') is ':disabled'
+PASS setThenReadSelectorText(':empty') is ':empty'
+PASS setThenReadSelectorText(':enabled') is ':enabled'
+PASS setThenReadSelectorText(':first-child') is ':first-child'
+PASS setThenReadSelectorText(':first-of-type') is ':first-of-type'
+PASS setThenReadSelectorText(':focus') is ':focus'
+PASS setThenReadSelectorText(':hover') is ':hover'
+PASS setThenReadSelectorText(':indeterminate') is ':indeterminate'
+PASS setThenReadSelectorText(':link') is ':link'
+PASS setThenReadSelectorText(':root') is ':root'
+PASS setThenReadSelectorText(':target') is ':target'
+PASS setThenReadSelectorText(':visited') is ':visited'
+
+PASS setThenReadSelectorText(':lang(a)') is ':lang(a)'
+PASS setThenReadSelectorText(':not(a)') is ':not(a)'
+
+PASS setThenReadSelectorText('::after') is '::after'
+PASS setThenReadSelectorText('::before') is '::before'
+PASS setThenReadSelectorText('::first-letter') is '::first-letter'
+PASS setThenReadSelectorText('::first-line') is '::first-line'
+PASS setThenReadSelectorText('::selection') is '::selection'
+
+PASS setThenReadSelectorText(':-webkit-any-link') is ':-webkit-any-link'
+PASS setThenReadSelectorText(':-webkit-autofill') is ':-webkit-autofill'
+PASS setThenReadSelectorText(':-webkit-drag') is ':-webkit-drag'
+
+PASS setThenReadSelectorText('::-webkit-file-upload-button') is '::-webkit-file-upload-button'
+PASS setThenReadSelectorText('::-webkit-search-cancel-button') is '::-webkit-search-cancel-button'
+PASS setThenReadSelectorText('::-webkit-search-decoration') is '::-webkit-search-decoration'
+PASS setThenReadSelectorText('::-webkit-search-results-button') is '::-webkit-search-results-button'
+PASS setThenReadSelectorText('::-webkit-search-results-decoration') is '::-webkit-search-results-decoration'
+PASS setThenReadSelectorText('::-webkit-slider-thumb') is '::-webkit-slider-thumb'
+
+PASS setThenReadSelectorText('input:not([type="file"]):focus') is 'input:not([type="file"]):focus'
+
+PASS setThenReadSelectorText('*:active') is ':active'
+PASS setThenReadSelectorText('|a') is 'a'
+
+PASS setThenReadSelectorText('input[type=file]:focus') is 'input[type="file"]:focus'
+
+PASS setThenReadSelectorText('a+b') is 'a + b'
+PASS setThenReadSelectorText('a~b') is 'a ~ b'
+PASS setThenReadSelectorText('a>b') is 'a > b'
+
+PASS setThenReadSelectorText(':after') is '::after'
+PASS setThenReadSelectorText(':before') is '::before'
+PASS setThenReadSelectorText(':first-letter') is '::first-letter'
+PASS setThenReadSelectorText(':first-line') is '::first-line'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/css-set-selector-text.html b/LayoutTests/fast/css/css-set-selector-text.html
new file mode 100644
index 0000000..c954f83
--- /dev/null
+++ b/LayoutTests/fast/css/css-set-selector-text.html
@@ -0,0 +1,159 @@
+<html>
+<head id="head">
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests setting and re-serialization of some CSS selectors.");
+
+var bogusSelector = "_foo";
+
+function setThenReadSelectorText(selector)
+{
+    var styleElement = document.getElementById("style");
+    var head = document.getElementById("head");
+    if (styleElement)
+        head.removeChild(styleElement);
+
+    styleElement = document.createElement("style");
+    styleElement.id = "style";
+    var head = document.getElementById("head");
+    head.appendChild(styleElement);
+
+    // First, create a rule with a bogus selector.
+    styleElement.appendChild(document.createTextNode(bogusSelector + " { }"));
+    // Now, set the desired selector text.
+    styleElement.sheet.cssRules[0].selectorText = selector;
+    return styleElement.sheet.cssRules[0].selectorText;
+}
+
+function testSelectorRoundTrip(selector, expectFailure)
+{
+    shouldBe("setThenReadSelectorText('" + selector + "')", "'" + (expectFailure ? bogusSelector : selector) + "'");
+}
+
+testSelectorRoundTrip('', true);
+testSelectorRoundTrip('123', true);
+testSelectorRoundTrip('-', true);
+testSelectorRoundTrip('$', true);
+testSelectorRoundTrip(':', true);
+testSelectorRoundTrip('.', true);
+testSelectorRoundTrip('#', true);
+testSelectorRoundTrip('[]', true);
+testSelectorRoundTrip('()', true);
+
+debug('');
+
+testSelectorRoundTrip('*');
+testSelectorRoundTrip('a');
+testSelectorRoundTrip('#a');
+testSelectorRoundTrip('.a');
+testSelectorRoundTrip(':active');
+testSelectorRoundTrip('[a]');
+testSelectorRoundTrip('[a="b"]');
+testSelectorRoundTrip('[a~="b"]');
+testSelectorRoundTrip('[a|="b"]');
+testSelectorRoundTrip('[a^="b"]');
+testSelectorRoundTrip('[a$="b"]');
+testSelectorRoundTrip('[a*="b"]');
+
+debug('');
+
+testSelectorRoundTrip('*|a');
+testSelectorRoundTrip('n|a');
+testSelectorRoundTrip('*|*');
+testSelectorRoundTrip('n|*');
+testSelectorRoundTrip('[*|a]');
+testSelectorRoundTrip('[n|a]');
+
+debug('');
+
+testSelectorRoundTrip('a:active');
+testSelectorRoundTrip('a b');
+testSelectorRoundTrip('a + b');
+testSelectorRoundTrip('a ~ b');
+testSelectorRoundTrip('a > b');
+
+debug('');
+
+testSelectorRoundTrip(":active");
+testSelectorRoundTrip(":checked");
+testSelectorRoundTrip(":disabled");
+testSelectorRoundTrip(":empty");
+testSelectorRoundTrip(":enabled");
+testSelectorRoundTrip(":first-child");
+testSelectorRoundTrip(":first-of-type");
+testSelectorRoundTrip(":focus");
+testSelectorRoundTrip(":hover");
+testSelectorRoundTrip(":indeterminate");
+testSelectorRoundTrip(":link");
+testSelectorRoundTrip(":root");
+testSelectorRoundTrip(":target");
+testSelectorRoundTrip(":visited");
+
+debug('');
+
+testSelectorRoundTrip(":lang(a)");
+testSelectorRoundTrip(":not(a)");
+
+debug('');
+
+testSelectorRoundTrip("::after");
+testSelectorRoundTrip("::before");
+testSelectorRoundTrip("::first-letter");
+testSelectorRoundTrip("::first-line");
+testSelectorRoundTrip("::selection");
+
+debug('');
+
+testSelectorRoundTrip(":-webkit-any-link");
+testSelectorRoundTrip(":-webkit-autofill");
+testSelectorRoundTrip(":-webkit-drag");
+
+debug('');
+
+testSelectorRoundTrip("::-webkit-file-upload-button");
+testSelectorRoundTrip("::-webkit-search-cancel-button");
+testSelectorRoundTrip("::-webkit-search-decoration");
+testSelectorRoundTrip("::-webkit-search-results-button");
+testSelectorRoundTrip("::-webkit-search-results-decoration");
+testSelectorRoundTrip("::-webkit-slider-thumb");
+
+debug('');
+
+testSelectorRoundTrip('input:not([type="file"]):focus');
+
+debug('');
+
+shouldBe("setThenReadSelectorText('*:active')", "':active'");
+shouldBe("setThenReadSelectorText('|a')", "'a'");
+
+debug('');
+
+shouldBe("setThenReadSelectorText('input[type=file]:focus')", "'input[type=\"file\"]:focus'");
+
+debug('');
+
+shouldBe("setThenReadSelectorText('a+b')", "'a + b'");
+shouldBe("setThenReadSelectorText('a~b')", "'a ~ b'");
+shouldBe("setThenReadSelectorText('a>b')", "'a > b'");
+
+debug('');
+
+shouldBe("setThenReadSelectorText(':after')", "'::after'");
+shouldBe("setThenReadSelectorText(':before')", "'::before'");
+shouldBe("setThenReadSelectorText(':first-letter')", "'::first-letter'");
+shouldBe("setThenReadSelectorText(':first-line')", "'::first-line'");
+
+debug('');
+
+successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d42a66a..75810c0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-27  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Sam Weinig.
+
+        Implement CSSStyleRule::setSelectorText()
+
+        This involves removing the "selectorText" "setter raises(DOMException)" clause from the IDL files,
+        since the setter no longer raises the exception, as per http://dev.w3.org/csswg/cssom/#dom-cssstylerule-selectortext
+        https://bugs.webkit.org/show_bug.cgi?id=46487
+
+        Test: fast/css/css-set-selector-text.html
+
+        * css/CSSPageRule.idl:
+        * css/CSSStyleRule.cpp:
+        (WebCore::CSSStyleRule::setSelectorText):
+        * css/CSSStyleRule.h:
+        * css/CSSStyleRule.idl:
+
 2010-09-27  Zoltan Herczeg  <zherczeg at webkit.org>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/css/CSSPageRule.idl b/WebCore/css/CSSPageRule.idl
index 6b50b6d..989fd8d 100644
--- a/WebCore/css/CSSPageRule.idl
+++ b/WebCore/css/CSSPageRule.idl
@@ -23,8 +23,7 @@ module css {
     // Introduced in DOM Level 2:
     interface CSSPageRule : CSSRule {
 
-                 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText
-                     setter raises(DOMException);
+                 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText;
 
         readonly attribute CSSStyleDeclaration style;
 
diff --git a/WebCore/css/CSSStyleRule.cpp b/WebCore/css/CSSStyleRule.cpp
index 1036e8f..faf60b0 100644
--- a/WebCore/css/CSSStyleRule.cpp
+++ b/WebCore/css/CSSStyleRule.cpp
@@ -23,7 +23,11 @@
 #include "CSSStyleRule.h"
 
 #include "CSSMutableStyleDeclaration.h"
+#include "CSSParser.h"
 #include "CSSSelector.h"
+#include "CSSStyleSheet.h"
+#include "Document.h"
+#include "StyleSheet.h"
 
 namespace WebCore {
 
@@ -50,9 +54,34 @@ String CSSStyleRule::selectorText() const
     return str;
 }
 
-void CSSStyleRule::setSelectorText(const String& /*selectorText*/, ExceptionCode& /*ec*/)
+void CSSStyleRule::setSelectorText(const String& selectorText)
 {
-    // FIXME: Implement!
+    Document* doc = 0;
+    StyleSheet* ownerStyleSheet = m_style->stylesheet();
+    if (ownerStyleSheet) {
+        if (ownerStyleSheet->isCSSStyleSheet())
+            doc = static_cast<CSSStyleSheet*>(ownerStyleSheet)->document();
+        if (!doc)
+            doc = ownerStyleSheet->ownerNode() ? ownerStyleSheet->ownerNode()->document() : 0;
+    }
+    if (!doc)
+        doc = m_style->node() ? m_style->node()->document() : 0;
+
+    if (!doc)
+        return;
+
+    CSSParser p;
+    CSSSelectorList selectorList;
+    p.parseSelector(selectorText, doc, selectorList);
+    if (!selectorList.first())
+        return;
+
+    String oldSelectorText = this->selectorText();
+    m_selectorList.adopt(selectorList);
+    if (this->selectorText() == oldSelectorText)
+        return;
+
+    doc->styleSelectorChanged(DeferRecalcStyle);
 }
 
 String CSSStyleRule::cssText() const
diff --git a/WebCore/css/CSSStyleRule.h b/WebCore/css/CSSStyleRule.h
index d797c73..171b636 100644
--- a/WebCore/css/CSSStyleRule.h
+++ b/WebCore/css/CSSStyleRule.h
@@ -41,7 +41,7 @@ public:
     virtual ~CSSStyleRule();
 
     virtual String selectorText() const;
-    void setSelectorText(const String&, ExceptionCode&);
+    void setSelectorText(const String&);
 
     CSSMutableStyleDeclaration* style() const { return m_style.get(); }
 
diff --git a/WebCore/css/CSSStyleRule.idl b/WebCore/css/CSSStyleRule.idl
index 862acd8..4abfbfc 100644
--- a/WebCore/css/CSSStyleRule.idl
+++ b/WebCore/css/CSSStyleRule.idl
@@ -23,8 +23,7 @@ module css {
     // Introduced in DOM Level 2:
     interface CSSStyleRule : CSSRule {
 
-                 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText
-                     setter raises(DOMException);
+                 attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText;
 
         readonly attribute CSSStyleDeclaration style;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list