summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSStyleSheet.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-02-16 13:06:58 +0000
committerSteve Block <steveblock@google.com>2011-02-16 13:10:08 +0000
commitf7f6d6409be37f76dc308902285d24806dc87ef2 (patch)
treef2cb1de65a785a078cb6b0df502f22f31e56f7f4 /WebCore/css/CSSStyleSheet.cpp
parenta38cdf7feffba4f61bd533e43fcacec7418ea150 (diff)
downloadexternal_webkit-f7f6d6409be37f76dc308902285d24806dc87ef2.zip
external_webkit-f7f6d6409be37f76dc308902285d24806dc87ef2.tar.gz
external_webkit-f7f6d6409be37f76dc308902285d24806dc87ef2.tar.bz2
Merge WebKit at Chromium 9.0.597.106: Initial merge by Git
Note that we are tracking the Chromium 9.0.597 release branch, which is WebKit r72805 + stability cherry picks. This corresponds to r78455 on the 597 release branch. Change-Id: I72375d9b61a767449086f0c9dc4105b2a6b62ddc
Diffstat (limited to 'WebCore/css/CSSStyleSheet.cpp')
-rw-r--r--WebCore/css/CSSStyleSheet.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index d5487a1..16c2ba8 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -53,7 +53,6 @@ static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
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(CSSStyleSheet* parentSheet, const String& href, con
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 @@ CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL&
, 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 @@ void CSSStyleSheet::checkLoaded()
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;