summaryrefslogtreecommitdiffstats
path: root/WebCore/css/StyleSheet.cpp
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2010-11-18 17:33:13 -0800
committerRussell Brenner <russellbrenner@google.com>2010-12-02 13:47:21 -0800
commit6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch)
tree103a13998c33944d6ab3b8318c509a037e639460 /WebCore/css/StyleSheet.cpp
parentbdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff)
downloadexternal_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/css/StyleSheet.cpp')
-rw-r--r--WebCore/css/StyleSheet.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 4f20a20..854b63c 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -20,10 +20,29 @@
#include "config.h"
#include "StyleSheet.h"
+#include "HTMLNames.h"
#include "MediaList.h"
+#include "Node.h"
+#include "SVGNames.h"
namespace WebCore {
+#if !ASSERT_DISABLED
+static bool isAcceptableStyleSheetParent(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)
+ || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE
+#if ENABLE(SVG)
+ || parentNode->hasTagName(SVGNames::styleTag)
+#endif
+ ;
+}
+#endif
+
StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL)
: StyleList(parentSheet)
, m_parentNode(0)
@@ -40,6 +59,7 @@ StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL&
, m_finalURL(finalURL)
, m_disabled(false)
{
+ ASSERT(isAcceptableStyleSheetParent(parentNode));
}
StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL)