Index: WebCore/css/CSSStyleSheet.cpp |
=================================================================== |
--- WebCore/css/CSSStyleSheet.cpp (revision 78365) |
+++ WebCore/css/CSSStyleSheet.cpp (working copy) |
@@ -53,6 +53,7 @@ |
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()) |
@@ -63,6 +64,7 @@ |
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) |
@@ -80,6 +82,7 @@ |
, m_hasSyntacticallyValidCSSHeader(true) |
{ |
CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0; |
+ m_document = parentSheet ? parentSheet->document() : 0; |
m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false; |
} |
@@ -230,24 +233,6 @@ |
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; |