Title: [97991] trunk/Source/WebCore
Revision
97991
Author
andreas.kl...@nokia.com
Date
2011-10-20 09:57:16 -0700 (Thu, 20 Oct 2011)

Log Message

Simplify CSSParser::document().
https://bugs.webkit.org/show_bug.cgi?id=70518

Reviewed by Antti Koivisto.

We don't need to climb up the entire parent chain here to find the
Document, just grab it from m_styleSheet (which will do the climbing
for us if necessary.)

* css/CSSParser.cpp:
(WebCore::CSSParser::document):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97990 => 97991)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 16:49:11 UTC (rev 97990)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 16:57:16 UTC (rev 97991)
@@ -1,3 +1,17 @@
+2011-10-20  Andreas Kling  <kl...@webkit.org>
+
+        Simplify CSSParser::document().
+        https://bugs.webkit.org/show_bug.cgi?id=70518
+
+        Reviewed by Antti Koivisto.
+
+        We don't need to climb up the entire parent chain here to find the
+        Document, just grab it from m_styleSheet (which will do the climbing
+        for us if necessary.)
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::document):
+
 2011-10-20  Pierre Rossi  <pierre.ro...@gmail.com>
 
         [Qt] FontCache::createFontPlatformData() is broken, a default font is returned

Modified: trunk/Source/WebCore/css/CSSParser.cpp (97990 => 97991)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-10-20 16:49:11 UTC (rev 97990)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-10-20 16:57:16 UTC (rev 97991)
@@ -648,14 +648,9 @@
 
 Document* CSSParser::document() const
 {
-    StyleBase* root = m_styleSheet;
-    while (root && root->parent())
-        root = root->parent();
-    if (!root)
+    if (!m_styleSheet)
         return 0;
-    if (!root->isCSSStyleSheet())
-        return 0;
-    return static_cast<CSSStyleSheet*>(root)->document();
+    return m_styleSheet->document();
 }
 
 bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, bool strict)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to