Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: Source/WebCore/css/CSSStyleSheet.cpp

Issue 6483001: Merge 76728 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/css/CSSStyleSheet.h ('k') | Source/WebCore/xml/XSLStyleSheet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/css/CSSStyleSheet.cpp
===================================================================
--- Source/WebCore/css/CSSStyleSheet.cpp (revision 78109)
+++ Source/WebCore/css/CSSStyleSheet.cpp (working copy)
@@ -53,7 +53,6 @@
CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(parentSheet, href, baseURL)
- , m_document(parentSheet ? parentSheet->document() : 0)
, m_charset(charset)
, m_loadCompleted(false)
, m_strictParsing(!parentSheet || parentSheet->useStrictParsing())
@@ -64,7 +63,6 @@
CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(parentNode, href, baseURL)
- , m_document(parentNode->document())
, m_charset(charset)
, m_loadCompleted(false)
, m_strictParsing(false)
@@ -82,7 +80,6 @@
, m_hasSyntacticallyValidCSSHeader(true)
{
CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0;
- m_document = parentSheet ? parentSheet->document() : 0;
m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false;
}
@@ -233,6 +230,24 @@
m_loadCompleted = ownerNode() ? ownerNode()->sheetLoaded() : true;
}
+Document* CSSStyleSheet::document()
+{
+ StyleBase* styleObject = this;
+ while (styleObject) {
+ if (styleObject->isCSSStyleSheet()) {
+ Node* ownerNode = static_cast<CSSStyleSheet*>(styleObject)->ownerNode();
+ if (ownerNode)
+ return ownerNode->document();
+ }
+ if (styleObject->isRule())
+ styleObject = static_cast<CSSRule*>(styleObject)->parentStyleSheet();
+ else
+ styleObject = styleObject->parent();
+ }
+
+ return 0;
+}
+
void CSSStyleSheet::styleSheetChanged()
{
StyleBase* root = this;
« no previous file with comments | « Source/WebCore/css/CSSStyleSheet.h ('k') | Source/WebCore/xml/XSLStyleSheet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698