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

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

Issue 365873002: Implement a part of ProcessingInstruction by using PrivateScript (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WIP: async XHR, rewriting layout tests Created 6 years, 3 months 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 | Annotate | Revision Log
« 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 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 if (!RuntimeEnabledFeatures::xsltInPrivateScriptEnabled())
106 return document->transformSourceDocument();
107
108 bool xsltTransformed;
109 if (!V8Document::PrivateScript::xsltTransformedMethod(document->frame(), doc ument, &xsltTransformed))
110 return false;
111 return xsltTransformed;
112 }
113
103 static inline bool hasNoStyleInformation(Document* document) 114 static inline bool hasNoStyleInformation(Document* document)
104 { 115 {
105 if (document->sawElementsInKnownNamespaces() || document->transformSourceDoc ument()) 116 if (document->sawElementsInKnownNamespaces() || xsltTransformed(document))
106 return false; 117 return false;
107 118
108 if (!document->frame() || !document->frame()->page()) 119 if (!document->frame() || !document->frame()->page())
109 return false; 120 return false;
110 121
111 if (document->frame()->tree().parent()) 122 if (document->frame()->tree().parent())
112 return false; // This document is not in a top frame 123 return false; // This document is not in a top frame
113 124
114 if (SVGImage::isInSVGImage(document)) 125 if (SVGImage::isInSVGImage(document))
115 return false; 126 return false;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1160
1150 pi->setCreatedByParser(false); 1161 pi->setCreatedByParser(false);
1151 1162
1152 if (pi->isCSS()) 1163 if (pi->isCSS())
1153 m_sawCSS = true; 1164 m_sawCSS = true;
1154 1165
1155 if (!RuntimeEnabledFeatures::xsltEnabled()) 1166 if (!RuntimeEnabledFeatures::xsltEnabled())
1156 return; 1167 return;
1157 1168
1158 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL(); 1169 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
1159 if (m_sawXSLTransform && !document()->transformSourceDocument()) { 1170 if (m_sawXSLTransform && !xsltTransformed(document())) {
1160 // This behavior is very tricky. We call stopParsing() here because we 1171 // This behavior is very tricky. We call stopParsing() here because we
1161 // want to stop processing the document until we're ready to apply the 1172 // want to stop processing the document until we're ready to apply the
1162 // transform, but we actually still want to be fed decoded string pieces 1173 // transform, but we actually still want to be fed decoded string pieces
1163 // to accumulate in m_originalSourceForTransform. So, we call 1174 // to accumulate in m_originalSourceForTransform. So, we call
1164 // stopParsing() here and check isStopped() in element callbacks. 1175 // stopParsing() here and check isStopped() in element callbacks.
1165 // FIXME: This contradicts the contract of DocumentParser. 1176 // FIXME: This contradicts the contract of DocumentParser.
1166 stopParsing(); 1177 stopParsing();
1167 } 1178 }
1168 } 1179 }
1169 1180
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 sax.initialized = XML_SAX2_MAGIC; 1646 sax.initialized = XML_SAX2_MAGIC;
1636 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1647 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1637 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1648 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1638 parseChunk(parser->context(), parseString); 1649 parseChunk(parser->context(), parseString);
1639 finishParsing(parser->context()); 1650 finishParsing(parser->context());
1640 attrsOK = state.gotAttributes; 1651 attrsOK = state.gotAttributes;
1641 return state.attributes; 1652 return state.attributes;
1642 } 1653 }
1643 1654
1644 } // namespace blink 1655 } // 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