Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Unified Diff: Source/core/dom/ProcessingInstruction.cpp

Issue 730003002: Refactoring XSLT (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed ASSERT crashes when xsltEnabled() returns false Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | Source/core/dom/StyleEngine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ProcessingInstruction.cpp
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index 2a6eced3750e5638964983dacaa21606591b50e1..1459449179d1f40f08a7bb9da07274463f9812cd 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -32,6 +32,7 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/XSLStyleSheetResource.h"
+#include "core/xml/DocumentXSLT.h"
#include "core/xml/XSLStyleSheet.h"
#include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes()
@@ -45,6 +46,7 @@ inline ProcessingInstruction::ProcessingInstruction(Document& document, const St
, m_createdByParser(false)
, m_isCSS(false)
, m_isXSL(false)
+ , m_listenerForXSLT(nullptr)
{
}
@@ -62,12 +64,8 @@ ProcessingInstruction::~ProcessingInstruction()
// FIXME: ProcessingInstruction should not be in document here.
// However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml
// crashes. We need to investigate ProcessingInstruction lifetime.
- if (inDocument()) {
- if (m_isCSS)
- document().styleEngine()->removeStyleSheetCandidateNode(this);
- else if (m_isXSL)
- document().styleEngine()->removeXSLStyleSheet(this);
- }
+ if (inDocument() && m_isCSS)
+ document().styleEngine()->removeStyleSheetCandidateNode(this);
#endif
}
@@ -139,7 +137,7 @@ void ProcessingInstruction::process(const String& href, const String& charset)
// We need to make a synthetic XSLStyleSheet that is embedded.
// It needs to be able to kick off import/include loads that
// can hang off some parent sheet.
- if (m_isXSL) {
+ if (m_isXSL && RuntimeEnabledFeatures::xsltEnabled()) {
KURL finalURL(ParsedURLString, m_localHref);
m_sheet = XSLStyleSheet::createEmbedded(this, finalURL);
m_loading = false;
@@ -154,7 +152,8 @@ void ProcessingInstruction::process(const String& href, const String& charset)
ResourcePtr<StyleSheetResource> resource;
FetchRequest request(ResourceRequest(document().completeURL(href)), FetchInitiatorTypeNames::processinginstruction);
if (m_isXSL) {
- resource = document().fetcher()->fetchXSLStyleSheet(request);
+ if (RuntimeEnabledFeatures::xsltEnabled())
+ resource = document().fetcher()->fetchXSLStyleSheet(request);
} else {
request.setCharset(charset.isEmpty() ? document().charset() : charset);
resource = document().fetcher()->fetchCSSStyleSheet(request);
@@ -162,7 +161,8 @@ void ProcessingInstruction::process(const String& href, const String& charset)
if (resource) {
m_loading = true;
- document().styleEngine()->addPendingSheet();
+ if (!m_isXSL)
+ document().styleEngine()->addPendingSheet();
setResource(resource);
}
}
@@ -179,7 +179,8 @@ bool ProcessingInstruction::isLoading() const
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document().styleEngine()->removePendingSheet(this);
+ if (!DocumentXSLT::sheetLoaded(document(), this))
+ document().styleEngine()->removePendingSheet(this);
return true;
}
return false;
@@ -258,10 +259,8 @@ Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
String href;
String charset;
bool isValid = checkStyleSheet(href, charset);
- if (m_isCSS)
+ if (!DocumentXSLT::processingInstructionInsertedIntoDocument(document(), this))
document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser);
- else if (m_isXSL)
- document().styleEngine()->addXSLStyleSheet(this, m_createdByParser);
if (isValid)
process(href, charset);
return InsertionDone;
@@ -273,11 +272,10 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
if (!insertionPoint->inDocument())
return;
- if (m_isCSS)
+ if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this))
document().styleEngine()->removeStyleSheetCandidateNode(this);
- else if (m_isXSL)
- document().styleEngine()->removeXSLStyleSheet(this);
+ // No need to remove XSLStyleSheet from StyleEngine.
RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet;
if (m_sheet) {
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698