https://bugs.webkit.org/show_bug.cgi?id=103934
Patch by Pablo Flouret <pablof@motorola.com> on 2013-02-12
Reviewed by Antti Koivisto.
Source/WebCore:
Tests 021, 024, 031, and 033 in
http://hg.csswg.org/test/file/
5f94e4b03ed9/contributors/opera/submitted/css3-conditional
fail because there's no explicit error recovery in @support's grammar.
Opera and Firefox pass the tests.
No new tests, modified css3/supports{,-cssom}.html
* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::createSupportsRule):
(WebCore::CSSParser::markSupportsRuleHeaderEnd):
(WebCore::CSSParser::popSupportsRuleData):
* css/CSSParser.h:
LayoutTests:
* css3/supports-cssom.html:
* css3/supports-expected.txt:
* css3/supports.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142640
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-12 Pablo Flouret <pablof@motorola.com>
+
+ Handle error recovery in @supports
+ https://bugs.webkit.org/show_bug.cgi?id=103934
+
+ Reviewed by Antti Koivisto.
+
+ * css3/supports-cssom.html:
+ * css3/supports-expected.txt:
+ * css3/supports.html:
+
2013-02-12 Emil A Eklund <eae@chromium.org>
TransformState::move should not round offset to int
@supports (( ( padding: 0) and (display: none)) or (display: rainbow)) {
dfn { width:0; }
+
@supports (width: 0) {
br { height:0; }
}
+
+ /* Rules with syntax errors should be ignored. */
+ @supports (display: none);
+ @supports (display: none)) ;
+ @supports;
+ @supports ;
+ @supports (display: none)) {}
+ @supports (display: )) {}
+ @supports ((display: none) and {}
+ @supports (display: none) {}
+ );
+ @supports ((display: none) and ;
+ @supports (display: none) {}
+ );
+
ol { display:none; }
}
PASS getComputedStyle(document.getElementById('t34')).content is "UNTOUCHED"
PASS getComputedStyle(document.getElementById('t35')).content is "APPLIED"
PASS getComputedStyle(document.getElementById('t36')).content is "UNTOUCHED"
+PASS getComputedStyle(document.getElementById('t37')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t38')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t39')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t40')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t41')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t42')).content is "APPLIED"
+PASS getComputedStyle(document.getElementById('t43')).content is "UNTOUCHED"
+PASS getComputedStyle(document.getElementById('t44')).content is "UNTOUCHED"
PASS successfullyParsed is true
TEST COMPLETE
#t36 { content: "FAIL" }
}
}
+
+ /* Invalid syntax error recovery */
+
+ @supports (display: none);
+ @supports (display: none) and ( (display: none) ) {
+ #t37 { content: "APPLIED" }
+ }
+
+ @supports (display: none)) ;
+ @supports (display: none) {
+ #t38 { content: "APPLIED" }
+ }
+
+ @supports;
+ @supports (display: none) {
+ #t39 { content: "APPLIED" }
+ }
+
+ @supports ;
+ @supports (display: none) {
+ #t40 { content: "APPLIED" }
+ }
+
+ @supports (display: none)) {
+ #t41 { content: "FAIL" }
+ }
+ @supports (display: none) {
+ #t41 { content: "APPLIED" }
+ }
+
+ @supports (display: )) {
+ #t42 { content: "FAIL" }
+ }
+ @supports (display: none) {
+ #t42 { content: "APPLIED" }
+ }
+
+ @supports ((display: none) and {
+ #t43 { content: "FAIL" }
+ }
+ @supports (display: none) {
+ #t43 { content: "FAIL" }
+ }
+ );
+
+ @supports ((display: none) and ;
+ @supports (display: none) {
+ #t44 { content: "FAIL" }
+ }
+ );
+
</style>
</head>
<body>
<script>
description("Test the @supports rule.");
- var numTests = 37;
- var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34, 36]; // Tests whose content shouldn't change from the UNTOUCHED default.
+ var numTests = 45;
+ var untouchedTests = [1, 3, 5, 8, 12, 13, 14, 18, 28, 29, 34, 36, 43, 44]; // Tests whose content shouldn't change from the UNTOUCHED default.
var container = document.getElementById("test_container");
for (var i=0; i < numTests; i++) {
+2013-02-12 Pablo Flouret <pablof@motorola.com>
+
+ Handle error recovery in @supports
+ https://bugs.webkit.org/show_bug.cgi?id=103934
+
+ Reviewed by Antti Koivisto.
+
+ Tests 021, 024, 031, and 033 in
+ http://hg.csswg.org/test/file/5f94e4b03ed9/contributors/opera/submitted/css3-conditional
+ fail because there's no explicit error recovery in @support's grammar.
+ Opera and Firefox pass the tests.
+
+ No new tests, modified css3/supports{,-cssom}.html
+
+ * css/CSSGrammar.y.in:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::createSupportsRule):
+ (WebCore::CSSParser::markSupportsRuleHeaderEnd):
+ (WebCore::CSSParser::popSupportsRuleData):
+ * css/CSSParser.h:
+
2013-02-12 Eric Carlson <eric.carlson@apple.com>
[Mac] guard against NULL languages array
%type <boolean> supports_conjunction
%type <boolean> supports_disjunction
%type <boolean> supports_declaration_condition
+%type <boolean> supports_error
#endif
%type <string> keyframe_name
before_supports_rule SUPPORTS_SYM maybe_space supports_condition at_supports_rule_header_end '{' at_rule_body_start maybe_space block_rule_list save_block {
$$ = parser->createSupportsRule($4, $9);
}
+ | before_supports_rule SUPPORTS_SYM supports_error {
+ parser->popRuleData();
+ parser->popSupportsRuleData();
+ }
;
+supports_error:
+ error ';'
+ | error invalid_block
+
before_supports_rule:
/* empty */ {
parser->markRuleHeaderStart(CSSRuleSourceData::SUPPORTS_RULE);
$$ = $3;
}
| supports_declaration_condition
+ | '(' error ')'
;
supports_declaration_condition:
{
m_allowImportRules = m_allowNamespaceDeclarations = false;
- ASSERT(!m_supportsRuleDataStack->isEmpty());
- RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last();
- m_supportsRuleDataStack->removeLast();
- if (m_supportsRuleDataStack->isEmpty())
- m_supportsRuleDataStack.clear();
-
+ RefPtr<CSSRuleSourceData> data = popSupportsRuleData();
RefPtr<StyleRuleSupports> rule;
String conditionText;
unsigned conditionOffset = data->ruleHeaderRange.start + 9;
void CSSParser::markSupportsRuleHeaderEnd()
{
- ASSERT(!m_supportsRuleDataStack->isEmpty());
+ ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty());
if (is8BitSource())
m_supportsRuleDataStack->last()->ruleHeaderRange.end = tokenStart<LChar>() - m_dataStart8.get();
else
m_supportsRuleDataStack->last()->ruleHeaderRange.end = tokenStart<UChar>() - m_dataStart16.get();
}
+
+PassRefPtr<CSSRuleSourceData> CSSParser::popSupportsRuleData()
+{
+ ASSERT(m_supportsRuleDataStack && !m_supportsRuleDataStack->isEmpty());
+ RefPtr<CSSRuleSourceData> data = m_supportsRuleDataStack->last();
+ m_supportsRuleDataStack->removeLast();
+ return data.release();
+}
+
#endif
CSSParser::RuleList* CSSParser::createRuleList()
StyleRuleBase* createSupportsRule(bool conditionIsSupported, RuleList*);
void markSupportsRuleHeaderStart();
void markSupportsRuleHeaderEnd();
+ PassRefPtr<CSSRuleSourceData> popSupportsRuleData();
#endif
#if ENABLE(SHADOW_DOM)
StyleRuleBase* createHostRule(RuleList* rules);