Index: Source/core/xml/XSLStyleSheetLibxslt.cpp |
diff --git a/Source/core/xml/XSLStyleSheetLibxslt.cpp b/Source/core/xml/XSLStyleSheetLibxslt.cpp |
index 489108479b863942216d913c5ac6e61b543c423f..ec6f0b9f126ee1d3266b0707a1ab587079d79443 100644 |
--- a/Source/core/xml/XSLStyleSheetLibxslt.cpp |
+++ b/Source/core/xml/XSLStyleSheetLibxslt.cpp |
@@ -50,6 +50,7 @@ XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalUR |
, m_stylesheetDocTaken(false) |
, m_compilationFailed(false) |
, m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : 0) |
+ , m_ownerDocument(nullptr) |
{ |
} |
@@ -64,6 +65,22 @@ XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const |
, m_stylesheetDocTaken(false) |
, m_compilationFailed(false) |
, m_parentStyleSheet(nullptr) |
+ , m_ownerDocument(nullptr) |
+{ |
+} |
+ |
+XSLStyleSheet::XSLStyleSheet(Document* ownerDocument, Node* styleSheetRootNode, const String& originalURL, const KURL& finalURL, bool embedded) |
+ : m_ownerNode(styleSheetRootNode) |
+ , m_originalURL(originalURL) |
+ , m_finalURL(finalURL) |
+ , m_isDisabled(false) |
+ , m_embedded(embedded) |
+ , m_processed(true) // The root sheet starts off processed. |
+ , m_stylesheetDoc(0) |
+ , m_stylesheetDocTaken(false) |
+ , m_compilationFailed(false) |
+ , m_parentStyleSheet(nullptr) |
+ , m_ownerDocument(ownerDocument) |
{ |
} |
@@ -254,6 +271,8 @@ void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent) |
Document* XSLStyleSheet::ownerDocument() |
{ |
for (XSLStyleSheet* styleSheet = this; styleSheet; styleSheet = styleSheet->parentStyleSheet()) { |
+ if (styleSheet->m_ownerDocument) |
+ return styleSheet->m_ownerDocument.get(); |
Node* node = styleSheet->ownerNode(); |
if (node) |
return &node->document(); |