summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSStyleSheet.cpp
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2010-12-07 17:22:45 -0800
committerShimeng (Simon) Wang <swang@google.com>2010-12-22 14:15:40 -0800
commit4576aa36e9a9671459299c7963ac95aa94beaea9 (patch)
tree3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/css/CSSStyleSheet.cpp
parent55323ac613cc31553107b68603cb627264d22bb0 (diff)
downloadexternal_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip
external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz
external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/css/CSSStyleSheet.cpp')
-rw-r--r--WebCore/css/CSSStyleSheet.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 9bbcb8b..04df693 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -27,13 +27,30 @@
#include "CSSRuleList.h"
#include "Document.h"
#include "ExceptionCode.h"
+#include "HTMLNames.h"
#include "Node.h"
+#include "SVGNames.h"
#include "SecurityOrigin.h"
#include "TextEncoding.h"
#include <wtf/Deque.h>
namespace WebCore {
+#if !ASSERT_DISABLED
+static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
+{
+ // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document.
+ return !parentNode
+ || parentNode->isDocumentNode()
+ || parentNode->hasTagName(HTMLNames::linkTag)
+ || parentNode->hasTagName(HTMLNames::styleTag)
+#if ENABLE(SVG)
+ || parentNode->hasTagName(SVGNames::styleTag)
+#endif
+ || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE;
+}
+#endif
+
CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(parentSheet, href, baseURL)
, m_document(parentSheet ? parentSheet->document() : 0)
@@ -54,6 +71,7 @@ CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& b
, m_isUserStyleSheet(false)
, m_hasSyntacticallyValidCSSHeader(true)
{
+ ASSERT(isAcceptableCSSStyleSheetParent(parentNode));
}
CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)