[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
yael.aharon at nokia.com
yael.aharon at nokia.com
Fri Jan 21 15:14:08 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 011403cdc846b1cfa0738ac80d22f668ae9e3a70
Author: yael.aharon at nokia.com <yael.aharon at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 10 13:50:32 2011 +0000
Specificity of negated selectors apparently miscalculated
https://bugs.webkit.org/show_bug.cgi?id=41206
Reviewed by Simon Fraser.
Source/WebCore:
Give negated selectors the specificity of the selector they are negating.
This is the same as the behavior of other browsers.
Test: fast/css/pseudo-not.html
* css/CSSSelector.cpp:
(WebCore::CSSSelector::specificityForOneSelector):
LayoutTests:
* fast/css/pseudo-not-expected.txt: Added.
* fast/css/pseudo-not.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a15aff3..861d5d6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-10 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Simon Fraser.
+
+ Specificity of negated selectors apparently miscalculated
+ https://bugs.webkit.org/show_bug.cgi?id=41206
+
+ * fast/css/pseudo-not-expected.txt: Added.
+ * fast/css/pseudo-not.html: Added.
+
2011-01-09 Justin Garcia <justin.garcia at apple.com>
Unreviewed. Adding svg/text/caret-in-svg-text.xhtml to Skipped list for gtk, where there
diff --git a/LayoutTests/fast/css/pseudo-not-expected.txt b/LayoutTests/fast/css/pseudo-not-expected.txt
new file mode 100644
index 0000000..0e072af
--- /dev/null
+++ b/LayoutTests/fast/css/pseudo-not-expected.txt
@@ -0,0 +1,36 @@
+This test if the :not selector gets the specificity of its simple selector in various scenarios.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+debug("These spans should alternate red and green");
+span id= span10 class = evenclass1 span id= span11 class = oddclass1 span id= span12 class = evenclass1 span id= span13 class = oddclass1
+
+debug("These spans should alternate green and blue");
+span id= span20 class = evenclass2 span id= span21 class = oddclass2 span id= span22 class = evenclass2 span id= span23 class = oddclass2
+
+debug("These spans should alternate blue and gray");
+span id= span30 class = evenclass3 span id= span31 class = oddclass3 span id= span32 class = evenclass3 span id= span33 class = oddclass3
+
+debug("These spans should be red, green, blue, green");
+span id= span40 class = evenclass4 span id= span41 class = oddclass4 span id= span42 class = evenclass4 span id= span43 class = oddclass4
+
+
+Test that :not selector with class name gets higher specificity than :not selector with tag name, or a selector with tag name
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(255, 0, 0)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 128, 0)'
+Test that :not selector with tag name does not get higher specificity than a selector with class name
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 128, 0)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 0, 255)'
+Test that :not selector with class name gets the same specificity as any selector with class name
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 0, 255)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(128, 128, 128)'
+Test that :not selector with id gets higher specificity than a selector with class name, but the same specificity as any selector with id
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(255, 0, 0)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 128, 0)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 0, 255)'
+PASS document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color') is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/pseudo-not.html b/LayoutTests/fast/css/pseudo-not.html
new file mode 100644
index 0000000..4062113
--- /dev/null
+++ b/LayoutTests/fast/css/pseudo-not.html
@@ -0,0 +1,107 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<style>
+
+#test1 :not(.evenclass1) { background-color: green; }
+#test1 :not(h1) { background-color: blue; }
+#test1 span { background-color: red; }
+
+#test2 .evenclass2 { background-color: green; }
+#test2 :not(h1) { background-color: blue; }
+
+#test3 .evenclass3 { background-color: green; }
+#test3 :not(.oddclass3) { background-color: red; }
+#test3 :not(.evenclass3) { background-color: gray; }
+#test3 .evenclass3 { background-color: blue; }
+
+#test4 span { background-color: blue; }
+#test4 :not(#span40) { background-color: green; }
+#test4 .evenclass4 { background-color: red; }
+#test4 #span42 { background-color: blue; }
+
+</style>
+
+</head>
+<body>
+<p id="description"></p>
+
+debug("These spans should alternate red and green");
+<div id="test1"></div><br>
+debug("These spans should alternate green and blue");
+<div id="test2"></div><br>
+debug("These spans should alternate blue and gray");
+<div id="test3"></div><br>
+debug("These spans should be red, green, blue, green");
+<div id="test4"></div><br>
+
+
+<br>
+<script>
+
+function classForI(i) {
+ if (Number(i) % 2 == 0)
+ return "evenclass";
+ return "oddclass";
+}
+
+var j = 1;
+var i = 0;
+for (; j < 5; j++) {
+ var str = "";
+ for (i = 0 ; i < 4; i++) {
+ var theId = "span" + j + i;
+ var theClass = classForI(i) + j;
+ str += '<span class="' + theClass + '" id="' + theId + '" foo="' + theId + '"> span id= ' + theId + ' class = ' + theClass + '</span>';
+ }
+ document.getElementById("test" + j).innerHTML = str;
+}
+
+
+</script>
+
+<div id="console"></div>
+<script>
+description('This test if the :not selector gets the specificity of its simple selector in various scenarios.');
+
+debug("Test that :not selector with class name gets higher specificity than :not selector with tag name, or a selector with tag name");
+el = document.getElementById("span10");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
+
+el = document.getElementById("span11");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");
+
+debug("Test that :not selector with tag name does not get higher specificity than a selector with class name");
+el = document.getElementById("span20");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");
+
+el = document.getElementById("span21");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 0, 255)'");
+
+debug("Test that :not selector with class name gets the same specificity as any selector with class name");
+el = document.getElementById("span30");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 0, 255)'");
+
+el = document.getElementById("span31");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(128, 128, 128)'");
+
+debug("Test that :not selector with id gets higher specificity than a selector with class name, but the same specificity as any selector with id");
+el = document.getElementById("span40");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
+
+el = document.getElementById("span41");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");
+
+el = document.getElementById("span42");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 0, 255)'");
+
+el = document.getElementById("span43");
+shouldBe("document.defaultView.getComputedStyle(el, null).getPropertyValue('background-color')", "'rgb(0, 128, 0)'");
+
+var successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index dcf4c08..dbf6b41 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2011-01-10 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Simon Fraser.
+
+ Specificity of negated selectors apparently miscalculated
+ https://bugs.webkit.org/show_bug.cgi?id=41206
+
+ Give negated selectors the specificity of the selector they are negating.
+ This is the same as the behavior of other browsers.
+
+ Test: fast/css/pseudo-not.html
+
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::specificityForOneSelector):
+
2011-01-10 Adam Roben <aroben at apple.com>
Windows build fix after r75353
diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp
index c139dbf..90fa17e 100644
--- a/Source/WebCore/css/CSSSelector.cpp
+++ b/Source/WebCore/css/CSSSelector.cpp
@@ -99,7 +99,10 @@ inline unsigned CSSSelector::specificityForOneSelector() const
case Contain:
case Begin:
case End:
- s += 0x100;
+ if (pseudoType() == PseudoNot && simpleSelector())
+ s += simpleSelector()->specificityForOneSelector();
+ else
+ s += 0x100;
case None:
break;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list