Title: [181900] trunk
Revision
181900
Author
[email protected]
Date
2015-03-24 12:56:34 -0700 (Tue, 24 Mar 2015)

Log Message

CSS Selectors Level 4: enable case-insensitive attribute matching by default
https://bugs.webkit.org/show_bug.cgi?id=142960

Reviewed by Andreas Kling.

Source/WebCore:

All open issues have been resolved, enable the feature by default.

Test: fast/css/attribute-selector-case-insensitive.html

* css/CSSGrammar.y.in:

LayoutTests:

This test is imported from blink. That's the only test
they have for this feature.

* fast/css/attribute-selector-case-insensitive-expected.txt: Added.
* fast/css/attribute-selector-case-insensitive.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181899 => 181900)


--- trunk/LayoutTests/ChangeLog	2015-03-24 19:53:17 UTC (rev 181899)
+++ trunk/LayoutTests/ChangeLog	2015-03-24 19:56:34 UTC (rev 181900)
@@ -1,3 +1,16 @@
+2015-03-24  Benjamin Poulain  <[email protected]>
+
+        CSS Selectors Level 4: enable case-insensitive attribute matching by default
+        https://bugs.webkit.org/show_bug.cgi?id=142960
+
+        Reviewed by Andreas Kling.
+
+        This test is imported from blink. That's the only test
+        they have for this feature.
+
+        * fast/css/attribute-selector-case-insensitive-expected.txt: Added.
+        * fast/css/attribute-selector-case-insensitive.html: Added.
+
 2015-03-24  Yoav Weiss  <[email protected]>
 
         Stop image from displaying when src attribute is removed or emptied

Added: trunk/LayoutTests/fast/css/attribute-selector-case-insensitive-expected.txt (0 => 181900)


--- trunk/LayoutTests/fast/css/attribute-selector-case-insensitive-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/attribute-selector-case-insensitive-expected.txt	2015-03-24 19:56:34 UTC (rev 181900)
@@ -0,0 +1,34 @@
+Testing exact attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+Testing list attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+Testing hyphen attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+Testing begin attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+Testing end attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+Testing contains attribute selector.
+PASS window.getComputedStyle(element).borderTopColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderRightColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderBottomColor is 'rgb(0, 128, 0)'
+PASS window.getComputedStyle(element).borderLeftColor is 'rgb(0, 128, 0)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS if all elements borders are all green, not red.

Added: trunk/LayoutTests/fast/css/attribute-selector-case-insensitive.html (0 => 181900)


--- trunk/LayoutTests/fast/css/attribute-selector-case-insensitive.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/attribute-selector-case-insensitive.html	2015-03-24 19:56:34 UTC (rev 181900)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+
+<style type="text/css">
+  div { border: 2px solid red; }
+  div[attr1="LOWER"] { border-top-color: yellow }
+  div[attr1="lower"] { border-top-color: green }
+  div[attr2="upper"] { border-right-color: yellow }
+  div[attr2="UPPER"] { border-right-color: green }
+  div[attr3="lower" i] { border-bottom-color: green }
+  div[attr4="UPPER" i] { border-left-color: green }
+
+  div[attr-list~="BaR" i] { border: 2px solid green; }
+  div[attr-hyphen|="FoO" i] { border: 2px solid green; }
+  div[attr-begin^="FoO" i] { border: 2px solid green; }
+  div[attr-end$="BaR" i] { border: 2px solid green; }
+  div[attr-contain*="OoB" i] { border: 2px solid green; }
+</style>
+
+<div id="element-exact" attr1="lower" attr2="UPPER" attr3="LOWER" attr4="upper"></div>
+<div id="element-list" attr-list="foo bar"></div>
+<div id="element-hyphen" attr-hyphen="foo-bar"></div>
+<div id="element-begin" attr-begin="foobar"></div>
+<div id="element-end" attr-end="foobar"></div>
+<div id="element-contains" attr-end="foobar"></div>
+
+<p>
+  PASS if all elements borders are all green, not red.
+</p>
+
+<script src=""
+<script>
+  if (window.testRunner)
+    testRunner.dumpAsText();
+
+  function checkBorders(elementId) {
+    debug("Testing " + elementId.split('-')[1] + " attribute selector.");
+    element = document.getElementById(elementId);
+    shouldBe("window.getComputedStyle(element).borderTopColor", "'rgb(0, 128, 0)'");
+    shouldBe("window.getComputedStyle(element).borderRightColor", "'rgb(0, 128, 0)'");
+    shouldBe("window.getComputedStyle(element).borderBottomColor", "'rgb(0, 128, 0)'");
+    shouldBe("window.getComputedStyle(element).borderLeftColor", "'rgb(0, 128, 0)'");
+  }
+
+  checkBorders("element-exact");
+  checkBorders("element-list");
+  checkBorders("element-hyphen");
+  checkBorders("element-begin");
+  checkBorders("element-end");
+  checkBorders("element-contains");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (181899 => 181900)


--- trunk/Source/WebCore/ChangeLog	2015-03-24 19:53:17 UTC (rev 181899)
+++ trunk/Source/WebCore/ChangeLog	2015-03-24 19:56:34 UTC (rev 181900)
@@ -1,3 +1,16 @@
+2015-03-24  Benjamin Poulain  <[email protected]>
+
+        CSS Selectors Level 4: enable case-insensitive attribute matching by default
+        https://bugs.webkit.org/show_bug.cgi?id=142960
+
+        Reviewed by Andreas Kling.
+
+        All open issues have been resolved, enable the feature by default.
+
+        Test: fast/css/attribute-selector-case-insensitive.html
+
+        * css/CSSGrammar.y.in:
+
 2015-03-24  Dean Jackson  <[email protected]>
 
         MediaControls: Scrubber and Time displays have the incorrect blending

Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (181899 => 181900)


--- trunk/Source/WebCore/css/CSSGrammar.y.in	2015-03-24 19:53:17 UTC (rev 181899)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in	2015-03-24 19:56:34 UTC (rev 181900)
@@ -1277,14 +1277,12 @@
   ;
 
 attrib_flags:
-#if ENABLE_CSS_SELECTORS_LEVEL4
     IDENT maybe_space {
         if (UNLIKELY($1.length() != 1 || !isASCIIAlphaCaselessEqual($1[0], 'i')))
             YYERROR;
         $$ = true;
     }
     |
-#endif
     /* empty */ {
         $$ = false;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to