Title: [101972] trunk/Source/WebCore
Revision
101972
Author
kl...@webkit.org
Date
2011-12-04 21:44:02 -0800 (Sun, 04 Dec 2011)

Log Message

CSSStyleSheet can't be reparented, enforce this at compile time.
<http://webkit.org/b/73793>

Reviewed by Benjamin Poulain.

* css/StyleSheet.h:
(WebCore::StyleSheet::clearOwnerRule):

    Changed setParentRule(CSSImportRule*) to clearOwnerRule() to document and
    enforce the fact that style sheets should never be reparented after creation.

(WebCore::StyleSheet::ownerRule):

    Renamed parentRule() to ownerRule() to match the CSSOM name.

(WebCore::StyleSheet::ownerNode):
(WebCore::StyleSheet::clearOwnerNode):

    Also renamed StyleSheet::m_parentNode to m_ownerNode to match its accessors.

* css/CSSStyleSheet.h:

    Removed ownerRule() as we now inherit it from StyleSheet.

* bindings/js/JSDOMBinding.h:
(WebCore::root):
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::~CSSImportRule):
(WebCore::CSSImportRule::setCSSStyleSheet):
* css/StyleSheet.cpp:
(WebCore::StyleSheet::StyleSheet):
(WebCore::StyleSheet::parentStyleSheet):
(WebCore::StyleSheet::baseURL):
* inspector/InspectorStyleSheet.cpp:
(WebCore::fillMediaListChain):

    Update call sites to use the new names.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101971 => 101972)


--- trunk/Source/WebCore/ChangeLog	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/ChangeLog	2011-12-05 05:44:02 UTC (rev 101972)
@@ -1,5 +1,45 @@
 2011-12-04  Andreas Kling  <kl...@webkit.org>
 
+        CSSStyleSheet can't be reparented, enforce this at compile time.
+        <http://webkit.org/b/73793>
+
+        Reviewed by Benjamin Poulain.
+
+        * css/StyleSheet.h:
+        (WebCore::StyleSheet::clearOwnerRule):
+
+            Changed setParentRule(CSSImportRule*) to clearOwnerRule() to document and
+            enforce the fact that style sheets should never be reparented after creation.
+
+        (WebCore::StyleSheet::ownerRule):
+
+            Renamed parentRule() to ownerRule() to match the CSSOM name.
+
+        (WebCore::StyleSheet::ownerNode):
+        (WebCore::StyleSheet::clearOwnerNode):
+
+            Also renamed StyleSheet::m_parentNode to m_ownerNode to match its accessors.
+
+        * css/CSSStyleSheet.h:
+
+            Removed ownerRule() as we now inherit it from StyleSheet.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::root):
+        * css/CSSImportRule.cpp:
+        (WebCore::CSSImportRule::~CSSImportRule):
+        (WebCore::CSSImportRule::setCSSStyleSheet):
+        * css/StyleSheet.cpp:
+        (WebCore::StyleSheet::StyleSheet):
+        (WebCore::StyleSheet::parentStyleSheet):
+        (WebCore::StyleSheet::baseURL):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::fillMediaListChain):
+
+            Update call sites to use the new names.
+
+2011-12-04  Andreas Kling  <kl...@webkit.org>
+
         border-width: initial and border-color: initial cannot be removed via CSSOM.
         <http://webkit.org/b/68551>
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (101971 => 101972)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-05 05:44:02 UTC (rev 101972)
@@ -194,8 +194,8 @@
 
     inline void* root(StyleSheet* styleSheet)
     {
-        if (styleSheet->parentRule())
-            return root(styleSheet->parentRule());
+        if (styleSheet->ownerRule())
+            return root(styleSheet->ownerRule());
         if (styleSheet->ownerNode())
             return root(styleSheet->ownerNode());
         return styleSheet;

Modified: trunk/Source/WebCore/css/CSSImportRule.cpp (101971 => 101972)


--- trunk/Source/WebCore/css/CSSImportRule.cpp	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/css/CSSImportRule.cpp	2011-12-05 05:44:02 UTC (rev 101972)
@@ -50,7 +50,7 @@
     if (m_lstMedia)
         m_lstMedia->setParentStyleSheet(0);
     if (m_styleSheet)
-        m_styleSheet->setParentRule(0);
+        m_styleSheet->clearOwnerRule();
     if (m_cachedSheet)
         m_cachedSheet->removeClient(&m_styleSheetClient);
 }
@@ -58,7 +58,7 @@
 void CSSImportRule::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet)
 {
     if (m_styleSheet)
-        m_styleSheet->setParentRule(0);
+        m_styleSheet->clearOwnerRule();
     m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset);
 
     bool crossOriginCSS = false;

Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (101971 => 101972)


--- trunk/Source/WebCore/css/CSSStyleSheet.h	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h	2011-12-05 05:44:02 UTC (rev 101972)
@@ -66,7 +66,6 @@
         return static_cast<CSSStyleSheet*>(parentSheet);
     }
 
-    CSSImportRule* ownerRule() const { return parentRule(); }
     PassRefPtr<CSSRuleList> cssRules(bool omitCharsetRules = false);
     unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
     void deleteRule(unsigned index, ExceptionCode&);

Modified: trunk/Source/WebCore/css/StyleSheet.cpp (101971 => 101972)


--- trunk/Source/WebCore/css/StyleSheet.cpp	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/css/StyleSheet.cpp	2011-12-05 05:44:02 UTC (rev 101972)
@@ -30,8 +30,8 @@
 
 StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL)
     : m_disabled(false)
-    , m_parentRule(0)
-    , m_parentNode(parentNode)
+    , m_ownerRule(0)
+    , m_ownerNode(parentNode)
     , m_originalURL(originalURL)
     , m_finalURL(finalURL)
 {
@@ -39,8 +39,8 @@
 
 StyleSheet::StyleSheet(CSSImportRule* parentRule, const String& originalURL, const KURL& finalURL)
     : m_disabled(false)
-    , m_parentRule(parentRule)
-    , m_parentNode(0)
+    , m_ownerRule(parentRule)
+    , m_ownerNode(0)
     , m_originalURL(originalURL)
     , m_finalURL(finalURL)
 {
@@ -55,7 +55,7 @@
 StyleSheet* StyleSheet::parentStyleSheet() const
 {
     ASSERT(isCSSStyleSheet());
-    return m_parentRule ? m_parentRule->parentStyleSheet() : 0;
+    return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;
 }
 
 void StyleSheet::setMedia(PassRefPtr<MediaList> media)
@@ -76,9 +76,9 @@
         return m_finalURL;
     if (StyleSheet* parentSheet = parentStyleSheet())
         return parentSheet->baseURL();
-    if (!m_parentNode)
+    if (!m_ownerNode)
         return KURL();
-    return m_parentNode->document()->baseURL();
+    return m_ownerNode->document()->baseURL();
 }
 
 void StyleSheet::setDisabled(bool disabled)

Modified: trunk/Source/WebCore/css/StyleSheet.h (101971 => 101972)


--- trunk/Source/WebCore/css/StyleSheet.h	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/css/StyleSheet.h	2011-12-05 05:44:02 UTC (rev 101972)
@@ -39,14 +39,14 @@
     bool disabled() const { return m_disabled; }
     void setDisabled(bool);
 
-    Node* ownerNode() const { return m_parentNode; }
-    void clearOwnerNode() { m_parentNode = 0; }
+    Node* ownerNode() const { return m_ownerNode; }
+    void clearOwnerNode() { m_ownerNode = 0; }
 
+    CSSImportRule* ownerRule() const { return m_ownerRule; }
+    void clearOwnerRule() { m_ownerRule = 0; }
+
     StyleSheet* parentStyleSheet() const;
 
-    CSSImportRule* parentRule() const { return m_parentRule; }
-    void setParentRule(CSSImportRule* rule) { m_parentRule = rule; }
-
     // Note that href is the URL that started the redirect chain that led to
     // this style sheet. This property probably isn't useful for much except
     // the _javascript_ binding (which needs to use this value for security).
@@ -76,8 +76,8 @@
 
 private:
     bool m_disabled;
-    CSSImportRule* m_parentRule;
-    Node* m_parentNode;
+    CSSImportRule* m_ownerRule;
+    Node* m_ownerNode;
     String m_originalURL;
     KURL m_finalURL;
     String m_strTitle;

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (101971 => 101972)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-12-05 05:24:38 UTC (rev 101971)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2011-12-05 05:44:02 UTC (rev 101972)
@@ -212,7 +212,7 @@
                         sourceURL = "";
                     mediaArray->pushObject(buildMediaObject(mediaList, styleSheet->ownerNode() ? MediaListSourceLinkedSheet : MediaListSourceInlineSheet, sourceURL));
                 }
-                parentRule = styleSheet->parentRule();
+                parentRule = styleSheet->ownerRule();
                 if (parentRule)
                     break;
                 styleSheet = styleSheet->parentStyleSheet();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to