diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-11 09:43:24 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-11 09:43:24 +0200 |
commit | 1b914638db989aaa98631a1c1e02c7b2d44805d8 (patch) | |
tree | 87f4fd2c7b38db320079a5de8877890d2ca3c485 /Source/WebCore/css/CSSRule.cpp | |
parent | 2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (diff) | |
download | qtwebkit-1b914638db989aaa98631a1c1e02c7b2d44805d8.tar.gz |
Imported WebKit commit 9a52e27980f47e8b0d8f8b7cc0fd7b5741bceb92 (http://svn.webkit.org/repository/webkit/trunk@116736)
New snapshot to include QDeclarative* -> QQml* build fixes
Diffstat (limited to 'Source/WebCore/css/CSSRule.cpp')
-rw-r--r-- | Source/WebCore/css/CSSRule.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/WebCore/css/CSSRule.cpp b/Source/WebCore/css/CSSRule.cpp index 13ad50ad3..09643ea9e 100644 --- a/Source/WebCore/css/CSSRule.cpp +++ b/Source/WebCore/css/CSSRule.cpp @@ -28,11 +28,13 @@ #include "CSSMediaRule.h" #include "CSSPageRule.h" #include "CSSStyleRule.h" +#include "CSSStyleSheet.h" #include "CSSUnknownRule.h" #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSRegionRule.h" #include "NotImplemented.h" +#include "StyleRule.h" namespace WebCore { @@ -113,4 +115,48 @@ void CSSRule::destroy() ASSERT_NOT_REACHED(); } +void CSSRule::reattach(StyleRuleBase* rule) +{ + switch (type()) { + case UNKNOWN_RULE: + return; + case STYLE_RULE: + static_cast<CSSStyleRule*>(this)->reattach(static_cast<StyleRule*>(rule)); + return; + case PAGE_RULE: + static_cast<CSSPageRule*>(this)->reattach(static_cast<StyleRulePage*>(rule)); + return; + case CHARSET_RULE: + ASSERT(!rule); + return; + case IMPORT_RULE: + // FIXME: Implement when enabling caching for stylesheets with import rules. + ASSERT_NOT_REACHED(); + return; + case MEDIA_RULE: + static_cast<CSSMediaRule*>(this)->reattach(static_cast<StyleRuleMedia*>(rule)); + return; + case FONT_FACE_RULE: + static_cast<CSSFontFaceRule*>(this)->reattach(static_cast<StyleRuleFontFace*>(rule)); + return; + case WEBKIT_KEYFRAMES_RULE: + static_cast<WebKitCSSKeyframesRule*>(this)->reattach(static_cast<StyleRuleKeyframes*>(rule)); + return; + case WEBKIT_KEYFRAME_RULE: + // No need to reattach, the underlying data is shareable on mutation. + ASSERT_NOT_REACHED(); + return; + case WEBKIT_REGION_RULE: + static_cast<WebKitCSSRegionRule*>(this)->reattach(static_cast<StyleRuleRegion*>(rule)); + return; + } + ASSERT_NOT_REACHED(); +} + +const CSSParserContext& CSSRule::parserContext() const +{ + CSSStyleSheet* styleSheet = parentStyleSheet(); + return styleSheet ? styleSheet->internal()->parserContext() : strictCSSParserContext(); +} + } // namespace WebCore |