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

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 703193004: XSLT-in-PrivateScript (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static inline AtomicString toAtomicString(const xmlChar* string, size_t length) 93 static inline AtomicString toAtomicString(const xmlChar* string, size_t length)
94 { 94 {
95 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string), length) ; 95 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string), length) ;
96 } 96 }
97 97
98 static inline AtomicString toAtomicString(const xmlChar* string) 98 static inline AtomicString toAtomicString(const xmlChar* string)
99 { 99 {
100 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string)); 100 return AtomicString::fromUTF8(reinterpret_cast<const char*>(string));
101 } 101 }
102 102
103 static bool xsltTransformed(Document* document)
104 {
105 bool xsltTransformed;
106 if (!V8Document::PrivateScript::xsltTransformedMethod(document->frame(), doc ument, &xsltTransformed))
107 return false;
108 return xsltTransformed;
109 }
110
103 static inline bool hasNoStyleInformation(Document* document) 111 static inline bool hasNoStyleInformation(Document* document)
104 { 112 {
105 if (document->sawElementsInKnownNamespaces() || document->transformSourceDoc ument()) 113 if (document->sawElementsInKnownNamespaces() || xsltTransformed(document))
106 return false; 114 return false;
107 115
108 if (!document->frame() || !document->frame()->page()) 116 if (!document->frame() || !document->frame()->page())
109 return false; 117 return false;
110 118
111 if (document->frame()->tree().parent()) 119 if (document->frame()->tree().parent())
112 return false; // This document is not in a top frame 120 return false; // This document is not in a top frame
113 121
114 if (SVGImage::isInSVGImage(document)) 122 if (SVGImage::isInSVGImage(document))
115 return false; 123 return false;
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1166
1159 pi->setCreatedByParser(false); 1167 pi->setCreatedByParser(false);
1160 1168
1161 if (pi->isCSS()) 1169 if (pi->isCSS())
1162 m_sawCSS = true; 1170 m_sawCSS = true;
1163 1171
1164 if (!RuntimeEnabledFeatures::xsltEnabled()) 1172 if (!RuntimeEnabledFeatures::xsltEnabled())
1165 return; 1173 return;
1166 1174
1167 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); 1175 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
1168 if (m_sawXSLTransform && !document()->transformSourceDocument()) { 1176 if (m_sawXSLTransform && !xsltTransformed(document())) {
1169 // This behavior is very tricky. We call stopParsing() here because we 1177 // 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 1178 // 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 1179 // transform, but we actually still want to be fed decoded string pieces
1172 // to accumulate in m_originalSourceForTransform. So, we call 1180 // to accumulate in m_originalSourceForTransform. So, we call
1173 // stopParsing() here and check isStopped() in element callbacks. 1181 // stopParsing() here and check isStopped() in element callbacks.
1174 // FIXME: This contradicts the contract of DocumentParser. 1182 // FIXME: This contradicts the contract of DocumentParser.
1175 stopParsing(); 1183 stopParsing();
1176 } 1184 }
1177 } 1185 }
1178 1186
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 sax.initialized = XML_SAX2_MAGIC; 1652 sax.initialized = XML_SAX2_MAGIC;
1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1653 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1654 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1647 parseChunk(parser->context(), parseString); 1655 parseChunk(parser->context(), parseString);
1648 finishParsing(parser->context()); 1656 finishParsing(parser->context());
1649 attrsOK = state.gotAttributes; 1657 attrsOK = state.gotAttributes;
1650 return state.attributes; 1658 return state.attributes;
1651 } 1659 }
1652 1660
1653 } // namespace blink 1661 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698