Hide HOST_RULE behind SHADOW_DOM flag.
authortasak@google.com <tasak@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 06:20:38 +0000 (06:20 +0000)
committertasak@google.com <tasak@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 06:20:38 +0000 (06:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102321

Reviewed by Dimitri Glazkov.

@host @-rules are only available when the rules are declared in styles
in shadow dom trees. So if SHADOW_DOM is disabled, we don't need
@host @-rules.

No new tests. Just hide HOST_RULE behind SHADOW_DOM flag.

* css/StyleResolver.h:
Hide "class ShadowRuleHost".
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::reportMemoryUsage):
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy):
(WebCore::StyleRuleBase::createCSSOMWrapper):
* css/StyleRule.h:
(StyleRuleBase):
Hide "Host" type and isHostRule.
(StyleRuleHost):
Hide "class StyleRuleHost".
* css/StyleSheetContents.cpp:
(WebCore::childRulesHaveFailedOrCanceledSubresources):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137417 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/StyleRule.cpp
Source/WebCore/css/StyleRule.h
Source/WebCore/css/StyleSheetContents.cpp

index 2c3e683..21b4657 100644 (file)
@@ -1,3 +1,31 @@
+2012-12-11  Takashi Sakamoto  <tasak@google.com>
+
+        Hide HOST_RULE behind SHADOW_DOM flag.
+        https://bugs.webkit.org/show_bug.cgi?id=102321
+
+        Reviewed by Dimitri Glazkov.
+
+        @host @-rules are only available when the rules are declared in styles
+        in shadow dom trees. So if SHADOW_DOM is disabled, we don't need
+        @host @-rules.
+
+        No new tests. Just hide HOST_RULE behind SHADOW_DOM flag.
+
+        * css/StyleResolver.h:
+        Hide "class ShadowRuleHost".
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::reportMemoryUsage):
+        (WebCore::StyleRuleBase::destroy):
+        (WebCore::StyleRuleBase::copy):
+        (WebCore::StyleRuleBase::createCSSOMWrapper):
+        * css/StyleRule.h:
+        (StyleRuleBase):
+        Hide "Host" type and isHostRule.
+        (StyleRuleHost):
+        Hide "class StyleRuleHost".
+        * css/StyleSheetContents.cpp:
+        (WebCore::childRulesHaveFailedOrCanceledSubresources):
+
 2012-12-11  Dominic Mazzoni  <dmazzoni@google.com>
 
         AX: accessibilityIsIgnored should avoid computing textUnderElement
index dc7ac8a..4cd7606 100644 (file)
@@ -85,7 +85,9 @@ class StyleKeyframe;
 class StylePendingImage;
 class StylePropertySet;
 class StyleRule;
+#if ENABLE(SHADOW_DOM)
 class StyleRuleHost;
+#endif
 class StyleRuleKeyframes;
 class StyleRulePage;
 class StyleRuleRegion;
index 03e1b9f..43e6a5e 100644 (file)
@@ -81,9 +81,11 @@ void StyleRuleBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     case Keyframes:
         static_cast<const StyleRuleKeyframes*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
+#if ENABLE(SHADOW_DOM)
     case Host:
         static_cast<const StyleRuleBlock*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
         return;
+#endif
 #if ENABLE(CSS_DEVICE_ADAPTATION)
     case Viewport:
         static_cast<const StyleRuleViewport*>(this)->reportDescendantMemoryUsage(memoryObjectInfo);
@@ -127,9 +129,11 @@ void StyleRuleBase::destroy()
     case Keyframes:
         delete static_cast<StyleRuleKeyframes*>(this);
         return;
+#if ENABLE(SHADOW_DOM)
     case Host:
         delete static_cast<StyleRuleHost*>(this);
         return;
+#endif
 #if ENABLE(CSS_DEVICE_ADAPTATION)
     case Viewport:
         delete static_cast<StyleRuleViewport*>(this);
@@ -168,8 +172,10 @@ PassRefPtr<StyleRuleBase> StyleRuleBase::copy() const
         return 0;
     case Keyframes:
         return static_cast<const StyleRuleKeyframes*>(this)->copy();
+#if ENABLE(SHADOW_DOM)
     case Host:
         return static_cast<const StyleRuleHost*>(this)->copy();
+#endif
 #if ENABLE(CSS_DEVICE_ADAPTATION)
     case Viewport:
         return static_cast<const StyleRuleViewport*>(this)->copy();
@@ -220,10 +226,12 @@ PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet
         rule = WebKitCSSViewportRule::create(static_cast<StyleRuleViewport*>(self), parentSheet);
         break;
 #endif
+#if ENABLE(SHADOW_DOM)
     case Host:
         // FIXME: The current CSSOM editor's draft (http://dev.w3.org/csswg/cssom/) does not handle @host rules (see bug 102344).
         rule = adoptRef(new CSSUnknownRule());
         break;
+#endif
     case Unknown:
     case Charset:
     case Keyframe:
index a66d842..4ef7642 100644 (file)
@@ -46,7 +46,9 @@ public:
         Page,
         Keyframes,
         Keyframe, // Not used. These are internally non-rule StyleKeyframe objects.
+#if ENABLE(SHADOW_DOM)
         Host,
+#endif
 #if ENABLE(CSS_DEVICE_ADAPTATION)
         Viewport = 15,
 #endif
@@ -65,7 +67,9 @@ public:
     bool isViewportRule() const { return type() == Viewport; }
 #endif
     bool isImportRule() const { return type() == Import; }
+#if ENABLE(SHADOW_DOM)
     bool isHostRule() const { return type() == Host; }
+#endif
 
     PassRefPtr<StyleRuleBase> copy() const;
 
@@ -231,6 +235,7 @@ private:
     CSSSelectorList m_selectorList;
 };
 
+#if ENABLE(SHADOW_DOM)
 class StyleRuleHost : public StyleRuleBlock {
 public:
     static PassRefPtr<StyleRuleHost> create(Vector<RefPtr<StyleRuleBase> >& adoptRules)
@@ -244,6 +249,7 @@ private:
     StyleRuleHost(Vector<RefPtr<StyleRuleBase> >& adoptRules) : StyleRuleBlock(Host, adoptRules) { }
     StyleRuleHost(const StyleRuleHost& o) : StyleRuleBlock(o) { }
 };
+#endif
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
 class StyleRuleViewport : public StyleRuleBase {
index b5e7d55..dc521df 100644 (file)
@@ -443,10 +443,12 @@ static bool childRulesHaveFailedOrCanceledSubresources(const Vector<RefPtr<Style
             if (childRulesHaveFailedOrCanceledSubresources(static_cast<const StyleRuleRegion*>(rule)->childRules()))
                 return true;
             break;
+#if ENABLE(SHADOW_DOM)
         case StyleRuleBase::Host:
             if (childRulesHaveFailedOrCanceledSubresources(static_cast<const StyleRuleHost*>(rule)->childRules()))
                 return true;
             break;
+#endif
         case StyleRuleBase::Import:
             ASSERT_NOT_REACHED();
         case StyleRuleBase::Page: