Title: [103159] trunk/Source/WebCore
Revision
103159
Author
[email protected]
Date
2011-12-17 19:06:33 -0800 (Sat, 17 Dec 2011)

Log Message

RuleSet: Remove style sheet null-check in addRulesFromSheet().
<http://webkit.org/b/74792>

Reviewed by Antti Koivisto.

Replace the "sheet" null-check in addRulesFromSheet() by an assertion.
The only call-site where it could be null was when adding rules from
an @import'ed sheet, so add a check there instead.

* css/CSSStyleSelector.cpp:
(WebCore::RuleSet::addRulesFromSheet):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103158 => 103159)


--- trunk/Source/WebCore/ChangeLog	2011-12-18 03:00:43 UTC (rev 103158)
+++ trunk/Source/WebCore/ChangeLog	2011-12-18 03:06:33 UTC (rev 103159)
@@ -1,5 +1,19 @@
 2011-12-17  Andreas Kling  <[email protected]>
 
+        RuleSet: Remove style sheet null-check in addRulesFromSheet().
+        <http://webkit.org/b/74792>
+
+        Reviewed by Antti Koivisto.
+
+        Replace the "sheet" null-check in addRulesFromSheet() by an assertion.
+        The only call-site where it could be null was when adding rules from
+        an @import'ed sheet, so add a check there instead.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::RuleSet::addRulesFromSheet):
+
+2011-12-17  Andreas Kling  <[email protected]>
+
         CSSStyleSelector: Clean up getColorFromPrimitiveValue().
         <http://webkit.org/b/74789>
 

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (103158 => 103159)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-18 03:00:43 UTC (rev 103158)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-12-18 03:06:33 UTC (rev 103159)
@@ -1964,8 +1964,7 @@
 
 void RuleSet::addRulesFromSheet(CSSStyleSheet* sheet, const MediaQueryEvaluator& medium, CSSStyleSelector* styleSelector)
 {
-    if (!sheet)
-        return;
+    ASSERT(sheet);
 
     // No media implies "all", but if a media list exists it must
     // contain our current medium
@@ -1982,7 +1981,7 @@
             addPageRule(static_cast<CSSPageRule*>(rule));
         else if (rule->isImportRule()) {
             CSSImportRule* import = static_cast<CSSImportRule*>(rule);
-            if (!import->media() || medium.eval(import->media(), styleSelector))
+            if (import->styleSheet() && (!import->media() || medium.eval(import->media(), styleSelector)))
                 addRulesFromSheet(import->styleSheet(), medium, styleSelector);
         }
         else if (rule->isMediaRule()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to