Diff
Modified: trunk/LayoutTests/ChangeLog (176240 => 176241)
--- trunk/LayoutTests/ChangeLog 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/ChangeLog 2014-11-18 02:21:39 UTC (rev 176241)
@@ -1,3 +1,17 @@
+2014-11-17 Sukolsak Sakshuwong <[email protected]>
+
+ Add parsing for :role()
+ https://bugs.webkit.org/show_bug.cgi?id=138310
+
+ Reviewed by Benjamin Poulain.
+
+ * fast/css/css-selector-text-expected.txt:
+ * fast/css/css-selector-text.html:
+ * fast/css/css-set-selector-text-expected.txt:
+ * fast/css/css-set-selector-text.html:
+ * fast/selectors/invalid-functional-pseudo-class-expected.txt:
+ * fast/selectors/invalid-functional-pseudo-class.html:
+
2014-11-17 Chris Dumez <[email protected]>
Add initial layout testing coverage for timer throttling
Modified: trunk/LayoutTests/fast/css/css-selector-text-expected.txt (176240 => 176241)
--- trunk/LayoutTests/fast/css/css-selector-text-expected.txt 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/css/css-selector-text-expected.txt 2014-11-18 02:21:39 UTC (rev 176241)
@@ -297,6 +297,20 @@
PASS parseThenSerializeRule(':lang([) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
PASS parseThenSerializeRule(':lang([]) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
PASS parseThenSerializeRule(':lang(@media screen {}) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+
+PASS parseThenSerializeRule(':role(a) { }') is ':role(a) { }'
+PASS parseThenSerializeRule(':role(button) { }') is ':role(button) { }'
+PASS parseThenSerializeRule(':role(LiNk) { }') is ':role(LiNk) { }'
+PASS parseThenSerializeRule(':role( a ) { }') is ':role(a) { }'
+
+PASS parseThenSerializeRule(':role() { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(42) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(a, b) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(}) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role()) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(role()) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(:role()) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
+PASS parseThenSerializeRule(':role(:role(a)) { }') threw exception TypeError: undefined is not an object (evaluating 'styleElement.sheet.cssRules[0].cssText').
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/css/css-selector-text.html (176240 => 176241)
--- trunk/LayoutTests/fast/css/css-selector-text.html 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/css/css-selector-text.html 2014-11-18 02:21:39 UTC (rev 176241)
@@ -375,6 +375,24 @@
shouldThrow("parseThenSerializeRule(':lang([]) { }')");
shouldThrow("parseThenSerializeRule(':lang(@media screen {}) { }')");
+debug('');
+
+testSelectorRoundTrip(":role(a)");
+testSelectorRoundTrip(":role(button)");
+testSelectorRoundTrip(":role(LiNk)");
+shouldBe("parseThenSerializeRule(':role( a ) { }')", "':role(a) { }'");
+
+debug('');
+
+shouldThrow("parseThenSerializeRule(':role() { }')");
+shouldThrow("parseThenSerializeRule(':role(42) { }')");
+shouldThrow("parseThenSerializeRule(':role(a, b) { }')");
+shouldThrow("parseThenSerializeRule(':role(}) { }')");
+shouldThrow("parseThenSerializeRule(':role()) { }')");
+shouldThrow("parseThenSerializeRule(':role(role()) { }')");
+shouldThrow("parseThenSerializeRule(':role(:role()) { }')");
+shouldThrow("parseThenSerializeRule(':role(:role(a)) { }')");
+
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt (176240 => 176241)
--- trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt 2014-11-18 02:21:39 UTC (rev 176241)
@@ -59,6 +59,7 @@
PASS setThenReadSelectorText(':lang(a)') is ':lang(a)'
PASS setThenReadSelectorText(':not(a)') is ':not(a)'
+PASS setThenReadSelectorText(':role(a)') is ':role(a)'
PASS setThenReadSelectorText(':-webkit-any(a,b,p)') is ':-webkit-any(a,b,p)'
PASS setThenReadSelectorText('::after') is '::after'
Modified: trunk/LayoutTests/fast/css/css-set-selector-text.html (176240 => 176241)
--- trunk/LayoutTests/fast/css/css-set-selector-text.html 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/css/css-set-selector-text.html 2014-11-18 02:21:39 UTC (rev 176241)
@@ -99,6 +99,7 @@
testSelectorRoundTrip(":lang(a)");
testSelectorRoundTrip(":not(a)");
+testSelectorRoundTrip(":role(a)");
testSelectorRoundTrip(":-webkit-any(a,b,p)");
debug('');
Modified: trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt (176240 => 176241)
--- trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class-expected.txt 2014-11-18 02:21:39 UTC (rev 176241)
@@ -435,6 +435,60 @@
PASS document.styleSheets[1].cssRules.length is 0
PASS document.styleSheets[1].cssRules.length is 0
PASS document.styleSheets[1].cssRules.length is 0
+PASS document.querySelectorAll(":role\").length threw exception SyntaxError: Unexpected EOF.
+PASS document.querySelectorAll(":role\\").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\").length threw exception SyntaxError: Unexpected EOF.
+PASS document.querySelectorAll(":role\\\\").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\(").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\(").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\(").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\(").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\ .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\ .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\ .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\ .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\( .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\( .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\( .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\( .foo").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\()").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\()").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\()").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\()").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\ .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\ .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\ .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\ .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\( .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\( .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.querySelectorAll(":role\\\\( .foo)").length threw exception Error: SyntaxError: DOM Exception 12.
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
+PASS document.styleSheets[1].cssRules.length is 0
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html (176240 => 176241)
--- trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/LayoutTests/fast/selectors/invalid-functional-pseudo-class.html 2014-11-18 02:21:39 UTC (rev 176241)
@@ -67,6 +67,7 @@
"nth-last-of-type",
"nth-of-type",
"matches",
+ "role",
];
for (var functionalPseudoClass of functionalPseudoClasses)
Modified: trunk/Source/WebCore/ChangeLog (176240 => 176241)
--- trunk/Source/WebCore/ChangeLog 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/ChangeLog 2014-11-18 02:21:39 UTC (rev 176241)
@@ -1,3 +1,26 @@
+2014-11-17 Sukolsak Sakshuwong <[email protected]>
+
+ Add parsing for :role()
+ https://bugs.webkit.org/show_bug.cgi?id=138310
+
+ Reviewed by Benjamin Poulain.
+
+ Add support for parsing :role() pseudo class. The implementation of selector
+ matching will be in a follow-up patch.
+
+ * css/CSSGrammar.y.in:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::detectFunctionTypeToken):
+ * css/CSSSelector.cpp:
+ (WebCore::appendPseudoClassFunctionTail):
+ (WebCore::CSSSelector::selectorText):
+ * css/CSSSelector.h:
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOne):
+ * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::addPseudoClassType):
+
2014-11-17 Simon Fraser <[email protected]>
[iOS WK1] Sometimes, missing tiles in -webkit-overflow-scrolling: touch in UIWebViews
Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (176240 => 176241)
--- trunk/Source/WebCore/css/CSSGrammar.y.in 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in 2014-11-18 02:21:39 UTC (rev 176241)
@@ -64,6 +64,7 @@
#if ENABLE_CSS_SELECTORS_LEVEL4
case LANGFUNCTION:
case MATCHESFUNCTION:
+ case ROLEFUNCTION:
#endif
case UNICODERANGE:
return true;
@@ -232,6 +233,7 @@
#if ENABLE_CSS_SELECTORS_LEVEL4
%token <string> LANGFUNCTION
%token <string> MATCHESFUNCTION
+%token <string> ROLEFUNCTION
#endif
%token <string> UNICODERANGE
@@ -1386,6 +1388,16 @@
$$ = selector.release();
}
}
+
+ | ':' ROLEFUNCTION maybe_space IDENT maybe_space ')' {
+ $$ = nullptr;
+ auto selector = std::make_unique<CSSParserSelector>();
+ selector->setMatch(CSSSelector::PseudoClass);
+ selector->setArgument($4);
+ selector->setPseudoClassValue($2);
+ if (selector->pseudoClassType() == CSSSelector::PseudoClassRole)
+ $$ = selector.release();
+ }
#endif
// Definition of :nth-child().
@@ -1879,7 +1891,7 @@
opening_parenthesis:
'(' | FUNCTION | CALCFUNCTION | MINFUNCTION | MAXFUNCTION | ANYFUNCTION | NOTFUNCTION
#if ENABLE_CSS_SELECTORS_LEVEL4
- | LANGFUNCTION | MATCHESFUNCTION
+ | LANGFUNCTION | MATCHESFUNCTION | ROLEFUNCTION
#endif
#if ENABLE_VIDEO_TRACK
| CUEFUNCTION
Modified: trunk/Source/WebCore/css/CSSParser.cpp (176240 => 176241)
--- trunk/Source/WebCore/css/CSSParser.cpp 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2014-11-18 02:21:39 UTC (rev 176241)
@@ -10725,6 +10725,10 @@
m_token = LANGFUNCTION;
return true;
}
+ if (isEqualToCSSIdentifier(name, "role")) {
+ m_token = ROLEFUNCTION;
+ return true;
+ }
#endif
return false;
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (176240 => 176241)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2014-11-18 02:21:39 UTC (rev 176241)
@@ -265,6 +265,9 @@
case CSSSelector::PseudoClassNthLastChild:
case CSSSelector::PseudoClassNthOfType:
case CSSSelector::PseudoClassNthLastOfType:
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ case CSSSelector::PseudoClassRole:
+#endif
str.append(selector->argument());
str.append(')');
break;
@@ -529,6 +532,12 @@
case CSSSelector::PseudoClassRequired:
str.appendLiteral(":required");
break;
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ case CSSSelector::PseudoClassRole:
+ str.appendLiteral(":role(");
+ appendPseudoClassFunctionTail(str, cs);
+ break;
+#endif
case CSSSelector::PseudoClassRoot:
str.appendLiteral(":root");
break;
Modified: trunk/Source/WebCore/css/CSSSelector.h (176240 => 176241)
--- trunk/Source/WebCore/css/CSSSelector.h 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/CSSSelector.h 2014-11-18 02:21:39 UTC (rev 176241)
@@ -158,6 +158,9 @@
PseudoClassFuture,
PseudoClassPast,
#endif
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ PseudoClassRole,
+#endif
};
enum PseudoElementType {
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (176240 => 176241)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2014-11-18 02:21:39 UTC (rev 176241)
@@ -1020,6 +1020,12 @@
case CSSSelector::PseudoClassCornerPresent:
return false;
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ // FIXME: Implement :role() selector.
+ case CSSSelector::PseudoClassRole:
+ return false;
+#endif
+
case CSSSelector::PseudoClassUnknown:
ASSERT_NOT_REACHED();
break;
Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (176240 => 176241)
--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in 2014-11-18 02:21:39 UTC (rev 176241)
@@ -51,6 +51,9 @@
read-only
read-write
required
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+role(
+#endif
root
scope
single-button
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (176240 => 176241)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2014-11-18 01:49:33 UTC (rev 176240)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2014-11-18 02:21:39 UTC (rev 176241)
@@ -563,6 +563,9 @@
case CSSSelector::PseudoClassNthLastChild:
case CSSSelector::PseudoClassNthLastOfType:
case CSSSelector::PseudoClassDrag:
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ case CSSSelector::PseudoClassRole:
+#endif
return FunctionType::CannotCompile;
// Optimized pseudo selectors.