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

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.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 unified diff | Download patch
« no previous file with comments | « Source/core/xml/XSLTProcessor.cpp ('k') | Source/core/xml/parser/XMLErrors.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/fetch/ScriptResource.h" 46 #include "core/fetch/ScriptResource.h"
47 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
48 #include "core/frame/UseCounter.h" 48 #include "core/frame/UseCounter.h"
49 #include "core/html/HTMLHtmlElement.h" 49 #include "core/html/HTMLHtmlElement.h"
50 #include "core/html/HTMLTemplateElement.h" 50 #include "core/html/HTMLTemplateElement.h"
51 #include "core/html/parser/HTMLEntityParser.h" 51 #include "core/html/parser/HTMLEntityParser.h"
52 #include "core/html/parser/TextResourceDecoder.h" 52 #include "core/html/parser/TextResourceDecoder.h"
53 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
54 #include "core/loader/ImageLoader.h" 54 #include "core/loader/ImageLoader.h"
55 #include "core/svg/graphics/SVGImage.h" 55 #include "core/svg/graphics/SVGImage.h"
56 #include "core/xml/DocumentXSLT.h"
56 #include "core/xml/parser/SharedBufferReader.h" 57 #include "core/xml/parser/SharedBufferReader.h"
57 #include "core/xml/parser/XMLDocumentParserScope.h" 58 #include "core/xml/parser/XMLDocumentParserScope.h"
58 #include "core/xml/parser/XMLParserInput.h" 59 #include "core/xml/parser/XMLParserInput.h"
59 #include "platform/RuntimeEnabledFeatures.h" 60 #include "platform/RuntimeEnabledFeatures.h"
60 #include "platform/SharedBuffer.h" 61 #include "platform/SharedBuffer.h"
61 #include "platform/TraceEvent.h" 62 #include "platform/TraceEvent.h"
62 #include "platform/network/ResourceError.h" 63 #include "platform/network/ResourceError.h"
63 #include "platform/network/ResourceRequest.h" 64 #include "platform/network/ResourceRequest.h"
64 #include "platform/network/ResourceResponse.h" 65 #include "platform/network/ResourceResponse.h"
65 #include "platform/weborigin/SecurityOrigin.h" 66 #include "platform/weborigin/SecurityOrigin.h"
(...skipping 29 matching lines...) Expand all
95 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string), length) ; 96 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string), length) ;
96 } 97 }
97 98
98 static inline AtomicString toAtomicString(const xmlChar* string) 99 static inline AtomicString toAtomicString(const xmlChar* string)
99 { 100 {
100 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string)); 101 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string));
101 } 102 }
102 103
103 static inline bool hasNoStyleInformation(Document* document) 104 static inline bool hasNoStyleInformation(Document* document)
104 { 105 {
105 if (document->sawElementsInKnownNamespaces() || document->transformSourceDoc ument()) 106 if (document->sawElementsInKnownNamespaces() || DocumentXSLT::hasTransformSo urceDocument(*document))
106 return false; 107 return false;
107 108
108 if (!document->frame() || !document->frame()->page()) 109 if (!document->frame() || !document->frame()->page())
109 return false; 110 return false;
110 111
111 if (document->frame()->tree().parent()) 112 if (document->frame()->tree().parent())
112 return false; // This document is not in a top frame 113 return false; // This document is not in a top frame
113 114
114 if (SVGImage::isInSVGImage(document)) 115 if (SVGImage::isInSVGImage(document))
115 return false; 116 return false;
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1159
1159 pi->setCreatedByParser(false); 1160 pi->setCreatedByParser(false);
1160 1161
1161 if (pi->isCSS()) 1162 if (pi->isCSS())
1162 m_sawCSS = true; 1163 m_sawCSS = true;
1163 1164
1164 if (!RuntimeEnabledFeatures::xsltEnabled()) 1165 if (!RuntimeEnabledFeatures::xsltEnabled())
1165 return; 1166 return;
1166 1167
1167 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); 1168 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
1168 if (m_sawXSLTransform && !document()->transformSourceDocument()) { 1169 if (m_sawXSLTransform && !DocumentXSLT::hasTransformSourceDocument(*document ())) {
1169 // This behavior is very tricky. We call stopParsing() here because we 1170 // This behavior is very tricky. We call stopParsing() here because we
1170 // want to stop processing the document until we're ready to apply the 1171 // want to stop processing the document until we're ready to apply the
1171 // transform, but we actually still want to be fed decoded string pieces 1172 // transform, but we actually still want to be fed decoded string pieces
1172 // to accumulate in m_originalSourceForTransform. So, we call 1173 // to accumulate in m_originalSourceForTransform. So, we call
1173 // stopParsing() here and check isStopped() in element callbacks. 1174 // stopParsing() here and check isStopped() in element callbacks.
1174 // FIXME: This contradicts the contract of DocumentParser. 1175 // FIXME: This contradicts the contract of DocumentParser.
1175 stopParsing(); 1176 stopParsing();
1176 } 1177 }
1177 } 1178 }
1178 1179
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 sax.initialized = XML_SAX2_MAGIC; 1645 sax.initialized = XML_SAX2_MAGIC;
1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1646 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1647 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1647 parseChunk(parser->context(), parseString); 1648 parseChunk(parser->context(), parseString);
1648 finishParsing(parser->context()); 1649 finishParsing(parser->context());
1649 attrsOK = state.gotAttributes; 1650 attrsOK = state.gotAttributes;
1650 return state.attributes; 1651 return state.attributes;
1651 } 1652 }
1652 1653
1653 } // namespace blink 1654 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/xml/XSLTProcessor.cpp ('k') | Source/core/xml/parser/XMLErrors.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698