Title: [101943] trunk/Source/WebCore
Revision
101943
Author
[email protected]
Date
2011-12-03 19:51:27 -0800 (Sat, 03 Dec 2011)

Log Message

CSSStyleSheet: Parent rule can only ever be @import, enforce this at compile time.
<http://webkit.org/b/73725>

Reviewed by Darin Adler.

Made StyleSheet::m_parentRule a CSSImportRule* rather than a CSSRule*
and updated getters, setters and constructors accordingly.

There is no change in behavior, this simply enforces the status quo.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMBinding.h:
* bindings/scripts/CodeGeneratorV8.pm:
(AddIncludesForType):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::CSSStyleSheet):
* css/CSSStyleSheet.h:
(WebCore::CSSStyleSheet::create):
(WebCore::CSSStyleSheet::ownerRule):
* css/StyleSheet.cpp:
(WebCore::StyleSheet::StyleSheet):
* css/StyleSheet.h:
(WebCore::StyleSheet::parentRule):
(WebCore::StyleSheet::setParentRule):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101942 => 101943)


--- trunk/Source/WebCore/ChangeLog	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/ChangeLog	2011-12-04 03:51:27 UTC (rev 101943)
@@ -1,5 +1,32 @@
 2011-12-03  Andreas Kling  <[email protected]>
 
+        CSSStyleSheet: Parent rule can only ever be @import, enforce this at compile time.
+        <http://webkit.org/b/73725>
+
+        Reviewed by Darin Adler.
+
+        Made StyleSheet::m_parentRule a CSSImportRule* rather than a CSSRule*
+        and updated getters, setters and constructors accordingly.
+
+        There is no change in behavior, this simply enforces the status quo.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMBinding.h:
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (AddIncludesForType):
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::CSSStyleSheet):
+        * css/CSSStyleSheet.h:
+        (WebCore::CSSStyleSheet::create):
+        (WebCore::CSSStyleSheet::ownerRule):
+        * css/StyleSheet.cpp:
+        (WebCore::StyleSheet::StyleSheet):
+        * css/StyleSheet.h:
+        (WebCore::StyleSheet::parentRule):
+        (WebCore::StyleSheet::setParentRule):
+
+2011-12-03  Andreas Kling  <[email protected]>
+
         Unreviewed, revert accidental change from r101932.
 
         * bindings/scripts/CodeGeneratorV8.pm:

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (101942 => 101943)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-12-04 03:51:27 UTC (rev 101943)
@@ -3524,7 +3524,7 @@
 		A80E6CF30A1989CA007FB8C5 /* FontFamilyValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CC90A1989CA007FB8C5 /* FontFamilyValue.h */; };
 		A80E6CF40A1989CA007FB8C5 /* ShadowValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CCA0A1989CA007FB8C5 /* ShadowValue.cpp */; };
 		A80E6CF50A1989CA007FB8C5 /* CSSPageRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CCB0A1989CA007FB8C5 /* CSSPageRule.cpp */; };
-		A80E6CF60A1989CA007FB8C5 /* CSSImportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCC0A1989CA007FB8C5 /* CSSImportRule.h */; };
+		A80E6CF60A1989CA007FB8C5 /* CSSImportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCC0A1989CA007FB8C5 /* CSSImportRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A80E6CF70A1989CA007FB8C5 /* CSSProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CCD0A1989CA007FB8C5 /* CSSProperty.cpp */; };
 		A80E6CF90A1989CA007FB8C5 /* CSSCharsetRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCF0A1989CA007FB8C5 /* CSSCharsetRule.h */; };
 		A80E6CFA0A1989CA007FB8C5 /* CSSImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CD00A1989CA007FB8C5 /* CSSImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5770,7 +5770,7 @@
 		D0A3A7311405A39800FB8ED3 /* ResourceLoaderOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D0B0556609C6700100307E43 /* CreateLinkCommand.h */; };
 		D0B0556909C6700100307E43 /* CreateLinkCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */; };
-		D0BC54491443AC4A00E105DA /* CachedStyleSheetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */; };
+		D0BC54491443AC4A00E105DA /* CachedStyleSheetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D0CE58F8125E4CC200F3F199 /* ResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0CE58F6125E4CC200F3F199 /* ResourceLoadScheduler.cpp */; };
 		D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = D0CE58F7125E4CC200F3F199 /* ResourceLoadScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D0EDA774143E303C0028E383 /* CachedRawResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0EDA772143E303C0028E383 /* CachedRawResource.cpp */; };

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (101942 => 101943)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-04 03:51:27 UTC (rev 101943)
@@ -22,8 +22,8 @@
 #ifndef JSDOMBinding_h
 #define JSDOMBinding_h
 
+#include "CSSImportRule.h"
 #include "CSSMutableStyleDeclaration.h"
-#include "CSSRule.h"
 #include "CSSStyleSheet.h"
 #include "JSDOMGlobalObject.h"
 #include "JSDOMWrapper.h"

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (101942 => 101943)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-12-04 03:51:27 UTC (rev 101943)
@@ -180,6 +180,10 @@
         AddToImplIncludes("PlatformString.h");
     }
 
+    if ($type eq "CSSStyleSheet" or $type eq "StyleSheet") {
+        AddToImplIncludes("CSSImportRule.h");
+    }
+
     if ($type eq "CSSStyleDeclaration") {
         AddToImplIncludes("CSSMutableStyleDeclaration.h");
     }

Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (101942 => 101943)


--- trunk/Source/WebCore/css/CSSStyleSheet.cpp	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp	2011-12-04 03:51:27 UTC (rev 101943)
@@ -64,7 +64,7 @@
     ASSERT(isAcceptableCSSStyleSheetParent(parentNode));
 }
 
-CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
+CSSStyleSheet::CSSStyleSheet(CSSImportRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
     : StyleSheet(ownerRule, href, baseURL)
     , m_charset(charset)
     , m_loadCompleted(false)

Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (101942 => 101943)


--- trunk/Source/WebCore/css/CSSStyleSheet.h	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h	2011-12-04 03:51:27 UTC (rev 101943)
@@ -38,7 +38,7 @@
 public:
     static PassRefPtr<CSSStyleSheet> create()
     {
-        return adoptRef(new CSSStyleSheet(static_cast<CSSRule*>(0), String(), KURL(), String()));
+        return adoptRef(new CSSStyleSheet(static_cast<CSSImportRule*>(0), String(), KURL(), String()));
     }
     static PassRefPtr<CSSStyleSheet> create(Node* ownerNode)
     {
@@ -48,7 +48,7 @@
     {
         return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, charset));
     }
-    static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset)
+    static PassRefPtr<CSSStyleSheet> create(CSSImportRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset)
     {
         return adoptRef(new CSSStyleSheet(ownerRule, originalURL, finalURL, charset));
     }
@@ -66,7 +66,7 @@
         return static_cast<CSSStyleSheet*>(parentSheet);
     }
 
-    CSSRule* ownerRule() const { return parentRule(); }
+    CSSImportRule* ownerRule() const { return parentRule(); }
     PassRefPtr<CSSRuleList> cssRules(bool omitCharsetRules = false);
     unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
     void deleteRule(unsigned index, ExceptionCode&);
@@ -117,7 +117,7 @@
 
 private:
     CSSStyleSheet(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset);
-    CSSStyleSheet(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset);
+    CSSStyleSheet(CSSImportRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset);
 
     virtual bool isCSSStyleSheet() const { return true; }
     virtual String type() const { return "text/css"; }

Modified: trunk/Source/WebCore/css/StyleSheet.cpp (101942 => 101943)


--- trunk/Source/WebCore/css/StyleSheet.cpp	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/css/StyleSheet.cpp	2011-12-04 03:51:27 UTC (rev 101943)
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "StyleSheet.h"
 
-#include "CSSRule.h"
+#include "CSSImportRule.h"
 #include "CSSStyleSheet.h"
 #include "Document.h"
 #include "MediaList.h"
@@ -37,7 +37,7 @@
 {
 }
 
-StyleSheet::StyleSheet(CSSRule* parentRule, const String& originalURL, const KURL& finalURL)
+StyleSheet::StyleSheet(CSSImportRule* parentRule, const String& originalURL, const KURL& finalURL)
     : m_disabled(false)
     , m_parentRule(parentRule)
     , m_parentNode(0)

Modified: trunk/Source/WebCore/css/StyleSheet.h (101942 => 101943)


--- trunk/Source/WebCore/css/StyleSheet.h	2011-12-04 03:45:11 UTC (rev 101942)
+++ trunk/Source/WebCore/css/StyleSheet.h	2011-12-04 03:51:27 UTC (rev 101943)
@@ -28,8 +28,7 @@
 
 namespace WebCore {
 
-class CachedCSSStyleSheet;
-class CSSRule;
+class CSSImportRule;
 class MediaList;
 class Node;
 
@@ -45,8 +44,8 @@
 
     StyleSheet* parentStyleSheet() const;
 
-    CSSRule* parentRule() const { return m_parentRule; }
-    void setParentRule(CSSRule* rule) { m_parentRule = rule; }
+    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
@@ -73,11 +72,11 @@
 
 protected:
     StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL);
-    StyleSheet(CSSRule* parentRule, const String& href, const KURL& finalURL);
+    StyleSheet(CSSImportRule* parentRule, const String& href, const KURL& finalURL);
 
 private:
     bool m_disabled;
-    CSSRule* m_parentRule;
+    CSSImportRule* m_parentRule;
     Node* m_parentNode;
     String m_originalURL;
     KURL m_finalURL;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to