haikuwebkit/LayoutTests/css3/supports-not-selector.html

44 lines
1.4 KiB
HTML
Raw Permalink Normal View History

REGRESSION: CSS not() selector does not work when it appears after or within @supports https://bugs.webkit.org/show_bug.cgi?id=136063 Patch by Yuki Sekiguchi <yuki.sekiguchi@access-company.com> on 2014-08-21 Reviewed by Darin Adler. Source/WebCore: CSSParser changes its m_parsingMode to SupportsMode when it finds "@supports" token. However, the mode will be never changed to NormalMode. This changes parsing algorithm for "not" token forever, and it cannot parse not pseudo class selector. When we finish parsing @supports rule, we should change to normal mode. @media does the same thing. This patch changed CharacterEndMediaQuery to CharacterEndConditionQuery, and we change parsing mode from SupportsMode to NormalMode when the parser finished to parse @supports rule. Like "@-webkit-mediaquery", we cannot use '{' to "@-webkit-supports-condition". Changed "@-webkit-supports-condition" parsing rule and parseSupportsCondition() not to use '{'. Tests: css3/supports-not-selector-cssom.html css3/supports-not-selector.html * css/CSSGrammar.y.in: * css/CSSParser.cpp: (WebCore::CSSParser::parseSupportsCondition): (WebCore::isCSSLetter): (WebCore::CSSParser::realLex): LayoutTests: Test that @supports doesn't break "not" pseudo class selector. * css3/supports-not-selector-cssom-expected.txt: Added. * css3/supports-not-selector-cssom.html: Added. * css3/supports-not-selector-expected.html: Added. * css3/supports-not-selector.html: Added. Canonical link: https://commits.webkit.org/153969@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-08-21 20:29:43 +00:00
<!DOCTYPE html>
<style>
div { color: red; }
</style>
<style>
@supports (display:block) {
div:not(.outside).valid { color: green; }
}
div:not(.inside).valid {
color:green;
}
</style>
<style>
div.nocondition.inside { color: green; }
@supports {
div:not(.outside).nocondition { color: red; }
}
div:not(.inside).nocondition {
color:green;
}
</style>
<style>
div.norule.outside { color: green; }
@supports (display:block)
div:not(.inside).norule {
color:red;
}
</style>
<style>
@supports;
div:not(.inside).semicolon {
color:green;
}
</style>
<div class="inside valid">This should be green if not() pseudo class selector works inside @supports rule.</div>
<div class="outside valid">This should be green if not() pseudo class selector works after/outside @supports rule.</div>
<div class="inside nocondition">This should be green if not() pseudo class selector DOES NOT work inside @supports rule without condition.</div>
<div class="outside nocondition">This should be green if not() pseudo class selector works after/outside @supports rule without condition.</div>
<div class="outside norule">This should be green if not() pseudo class selector DOES NOT work after/outside @supports rule without rule.</div>
<div class="outside semicolon">This should be green if not() pseudo class selector works after/outside @supports rule without condition and rule.</div>