haikuwebkit/LayoutTests/css3/supports-cssom-expected.txt

63 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

Implement CSSSupportsRule https://bugs.webkit.org/show_bug.cgi?id=104822 Patch by Pablo Flouret <pablof@motorola.com> on 2013-01-16 Reviewed by Allan Sandfeld Jensen. Source/WebCore: http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface Right now, @supports is not implemented as a proper CSSRule. Apart from the CSSOM implications it gives wrong results when, for instance, an @supports rule is nested inside a @media rule. Test: css3/supports-cssom.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * Target.pri: * WebCore.exp.in: * WebCore.gypi: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: Add CSSSupportsRule.* and associated files. * bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJS): * bindings/objc/DOMCSS.mm: (kitClass): * bindings/v8/custom/V8CSSRuleCustom.cpp: (WebCore::wrap): Create the correct wrappers for the rule. * css/CSSGrammar.y.in: * css/CSSParser.cpp: (WebCore::CSSParser::createSupportsRule): (WebCore::CSSParser::markSupportsRuleHeaderStart): (WebCore::CSSParser::markSupportsRuleHeaderEnd): * css/CSSParser.h: Create the supports rule when parsing and add it where it corresponds, instead of directly adding the child rules to the stylesheet. * css/CSSPropertySourceData.h: * css/CSSRule.h: * css/CSSRule.idl: Add SUPPORTS_RULE type to enums. * css/CSSSupportsRule.cpp: Added. (WebCore::CSSSupportsRule::CSSSupportsRule): (WebCore::CSSSupportsRule::~CSSSupportsRule): (WebCore::CSSSupportsRule::cssText): (WebCore::CSSSupportsRule::conditionText): * css/CSSSupportsRule.h: Added. (WebCore::CSSSupportsRule::create): * css/CSSSupportsRule.idl: Added. DOM interface. * css/RuleSet.cpp: (WebCore::RuleSet::addChildRules): Add rules included in the @supports rule. * css/StyleResolver.cpp: (WebCore::collectCSSOMWrappers): Collect CSSSupportsRule wrappers. * css/StyleRule.cpp: (WebCore::StyleRuleBase::reportMemoryUsage): (WebCore::StyleRuleBase::destroy): (WebCore::StyleRuleBase::copy): (WebCore::StyleRuleBase::createCSSOMWrapper): (WebCore::StyleRuleSupports::StyleRuleSupports): * css/StyleRule.h: (StyleRuleBase): (WebCore::StyleRuleBase::isSupportsRule): (StyleRuleSupports): (WebCore::StyleRuleSupports::create): (WebCore::StyleRuleSupports::conditionText): (WebCore::StyleRuleSupports::conditionIsSupported): (WebCore::StyleRuleSupports::copy): (WebCore::toStyleRuleSupports): New subclass of StyleRuleBlock: StyleRuleSupports. * css/StyleSheetContents.cpp: (WebCore::childRulesHaveFailedOrCanceledSubresources): * inspector/InspectorStyleSheet.cpp: (flattenSourceData): (WebCore::asCSSRuleList): Handle @supports rules where needed. LayoutTests: * css3/supports-cssom-expected.txt: Added. * css3/supports-cssom.html: Added. * css3/supports-expected.txt: * css3/supports.html: * platform/chromium/TestExpectations: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/mac/TestExpectations: * platform/qt/TestExpectations: * platform/win/TestExpectations: * platform/wincairo/TestExpectations: * platform/wk2/TestExpectations: Canonical link: https://commits.webkit.org/125247@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-16 11:30:50 +00:00
Test CSSSupportRule.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS CSSRule.SUPPORTS_RULE is defined.
rules = document.styleSheets[1].cssRules
PASS rules.length is 4
PASS rules[0].type is CSSRule.SUPPORTS_RULE
PASS rules[0].cssRules.length is 2
PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE
PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE
PASS rules[0].cssRules[1].cssRules.length is 1
PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE
PASS rules[0].conditionText is "(width: 0)"
PASS rules[0].cssText is "@supports (width: 0) {\n s { width: 0px; }\n @supports (width: 1) {\n s { color: rgb(0, 0, 0); }\n}\n}"
Inserting and deleting rules.
rules[0].insertRule('@media all { #s { width: 0px; } }', 2)
PASS rules[0].cssRules.length is 3
PASS rules[0].cssRules[2].type is CSSRule.MEDIA_RULE
rules[0].deleteRule(2)
PASS rules[0].cssRules.length is 2
rules[0].cssRules[1].insertRule('@supports (display: rainbow) {}', 1)
PASS rules[0].cssRules[1].cssRules.length is 2
PASS rules[0].cssRules[1].cssRules[1].type is CSSRule.SUPPORTS_RULE
rules[0].cssRules[1].deleteRule(1)
PASS rules[0].cssRules.length is 2
@charset, @namespace, @import rules are not allowed inside @supports.
PASS rules[0].insertRule('@charset "UTF-8"', 2) threw exception SyntaxError: The string did not match the expected pattern..
PASS rules[0].insertRule('@namespace ""', 2) threw exception HierarchyRequestError: The operation would yield an incorrect node tree..
PASS rules[0].insertRule('@import url("../fast/cssom/resources/import.css")', 2) threw exception HierarchyRequestError: The operation would yield an incorrect node tree..
Implement CSSSupportsRule https://bugs.webkit.org/show_bug.cgi?id=104822 Patch by Pablo Flouret <pablof@motorola.com> on 2013-01-16 Reviewed by Allan Sandfeld Jensen. Source/WebCore: http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface Right now, @supports is not implemented as a proper CSSRule. Apart from the CSSOM implications it gives wrong results when, for instance, an @supports rule is nested inside a @media rule. Test: css3/supports-cssom.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * Target.pri: * WebCore.exp.in: * WebCore.gypi: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: Add CSSSupportsRule.* and associated files. * bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJS): * bindings/objc/DOMCSS.mm: (kitClass): * bindings/v8/custom/V8CSSRuleCustom.cpp: (WebCore::wrap): Create the correct wrappers for the rule. * css/CSSGrammar.y.in: * css/CSSParser.cpp: (WebCore::CSSParser::createSupportsRule): (WebCore::CSSParser::markSupportsRuleHeaderStart): (WebCore::CSSParser::markSupportsRuleHeaderEnd): * css/CSSParser.h: Create the supports rule when parsing and add it where it corresponds, instead of directly adding the child rules to the stylesheet. * css/CSSPropertySourceData.h: * css/CSSRule.h: * css/CSSRule.idl: Add SUPPORTS_RULE type to enums. * css/CSSSupportsRule.cpp: Added. (WebCore::CSSSupportsRule::CSSSupportsRule): (WebCore::CSSSupportsRule::~CSSSupportsRule): (WebCore::CSSSupportsRule::cssText): (WebCore::CSSSupportsRule::conditionText): * css/CSSSupportsRule.h: Added. (WebCore::CSSSupportsRule::create): * css/CSSSupportsRule.idl: Added. DOM interface. * css/RuleSet.cpp: (WebCore::RuleSet::addChildRules): Add rules included in the @supports rule. * css/StyleResolver.cpp: (WebCore::collectCSSOMWrappers): Collect CSSSupportsRule wrappers. * css/StyleRule.cpp: (WebCore::StyleRuleBase::reportMemoryUsage): (WebCore::StyleRuleBase::destroy): (WebCore::StyleRuleBase::copy): (WebCore::StyleRuleBase::createCSSOMWrapper): (WebCore::StyleRuleSupports::StyleRuleSupports): * css/StyleRule.h: (StyleRuleBase): (WebCore::StyleRuleBase::isSupportsRule): (StyleRuleSupports): (WebCore::StyleRuleSupports::create): (WebCore::StyleRuleSupports::conditionText): (WebCore::StyleRuleSupports::conditionIsSupported): (WebCore::StyleRuleSupports::copy): (WebCore::toStyleRuleSupports): New subclass of StyleRuleBlock: StyleRuleSupports. * css/StyleSheetContents.cpp: (WebCore::childRulesHaveFailedOrCanceledSubresources): * inspector/InspectorStyleSheet.cpp: (flattenSourceData): (WebCore::asCSSRuleList): Handle @supports rules where needed. LayoutTests: * css3/supports-cssom-expected.txt: Added. * css3/supports-cssom.html: Added. * css3/supports-expected.txt: * css3/supports.html: * platform/chromium/TestExpectations: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/mac/TestExpectations: * platform/qt/TestExpectations: * platform/win/TestExpectations: * platform/wincairo/TestExpectations: * platform/wk2/TestExpectations: Canonical link: https://commits.webkit.org/125247@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-16 11:30:50 +00:00
Whitespace and formatting should be preserved within the condition, whitespace outside the condition should be trimmed.
PASS rules[1].conditionText is "(( ( padding: 0) and (display: none)) or (display: rainbow))"
Implement CSSSupportsRule https://bugs.webkit.org/show_bug.cgi?id=104822 Patch by Pablo Flouret <pablof@motorola.com> on 2013-01-16 Reviewed by Allan Sandfeld Jensen. Source/WebCore: http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface Right now, @supports is not implemented as a proper CSSRule. Apart from the CSSOM implications it gives wrong results when, for instance, an @supports rule is nested inside a @media rule. Test: css3/supports-cssom.html * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * Target.pri: * WebCore.exp.in: * WebCore.gypi: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: Add CSSSupportsRule.* and associated files. * bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJS): * bindings/objc/DOMCSS.mm: (kitClass): * bindings/v8/custom/V8CSSRuleCustom.cpp: (WebCore::wrap): Create the correct wrappers for the rule. * css/CSSGrammar.y.in: * css/CSSParser.cpp: (WebCore::CSSParser::createSupportsRule): (WebCore::CSSParser::markSupportsRuleHeaderStart): (WebCore::CSSParser::markSupportsRuleHeaderEnd): * css/CSSParser.h: Create the supports rule when parsing and add it where it corresponds, instead of directly adding the child rules to the stylesheet. * css/CSSPropertySourceData.h: * css/CSSRule.h: * css/CSSRule.idl: Add SUPPORTS_RULE type to enums. * css/CSSSupportsRule.cpp: Added. (WebCore::CSSSupportsRule::CSSSupportsRule): (WebCore::CSSSupportsRule::~CSSSupportsRule): (WebCore::CSSSupportsRule::cssText): (WebCore::CSSSupportsRule::conditionText): * css/CSSSupportsRule.h: Added. (WebCore::CSSSupportsRule::create): * css/CSSSupportsRule.idl: Added. DOM interface. * css/RuleSet.cpp: (WebCore::RuleSet::addChildRules): Add rules included in the @supports rule. * css/StyleResolver.cpp: (WebCore::collectCSSOMWrappers): Collect CSSSupportsRule wrappers. * css/StyleRule.cpp: (WebCore::StyleRuleBase::reportMemoryUsage): (WebCore::StyleRuleBase::destroy): (WebCore::StyleRuleBase::copy): (WebCore::StyleRuleBase::createCSSOMWrapper): (WebCore::StyleRuleSupports::StyleRuleSupports): * css/StyleRule.h: (StyleRuleBase): (WebCore::StyleRuleBase::isSupportsRule): (StyleRuleSupports): (WebCore::StyleRuleSupports::create): (WebCore::StyleRuleSupports::conditionText): (WebCore::StyleRuleSupports::conditionIsSupported): (WebCore::StyleRuleSupports::copy): (WebCore::toStyleRuleSupports): New subclass of StyleRuleBlock: StyleRuleSupports. * css/StyleSheetContents.cpp: (WebCore::childRulesHaveFailedOrCanceledSubresources): * inspector/InspectorStyleSheet.cpp: (flattenSourceData): (WebCore::asCSSRuleList): Handle @supports rules where needed. LayoutTests: * css3/supports-cssom-expected.txt: Added. * css3/supports-cssom.html: Added. * css3/supports-expected.txt: * css3/supports.html: * platform/chromium/TestExpectations: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/mac/TestExpectations: * platform/qt/TestExpectations: * platform/win/TestExpectations: * platform/wincairo/TestExpectations: * platform/wk2/TestExpectations: Canonical link: https://commits.webkit.org/125247@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-01-16 11:30:50 +00:00
@supports rule nested inside a media rule.
PASS rules[2].type is CSSRule.MEDIA_RULE
PASS rules[2].cssRules.length is 1
PASS rules[2].cssRules[0].type is CSSRule.SUPPORTS_RULE
PASS rules[2].cssRules[0].conditionText is "( padding: 0)"
PASS rules[0].cssRules[1].cssRules.length is 1
PASS rules[2].cssRules[0].cssRules[0].type is CSSRule.PAGE_RULE
PASS rules[2].cssText is "@media all { \n @supports ( padding: 0) {\n @page :left { top: 0px; }\n}\n}"
No extra parens should be added to the conditionText.
PASS rules[3].conditionText is "(border: black) and (padding: 0) and (width: 0)"
Deleting a top-level rule should work correctly.
document.styleSheets[1].deleteRule(3)
PASS rules.length is 3
PASS rules[0].type is CSSRule.SUPPORTS_RULE
PASS rules[0].cssRules.length is 2
PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE
PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE
PASS rules[0].cssRules[1].cssRules.length is 1
PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE
PASS successfullyParsed is true
TEST COMPLETE