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

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

Issue 479753003: Transform XML tree viewer to blink-in-js implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing! 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
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 12 matching lines...) Expand all
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/xml/parser/XMLDocumentParser.h" 27 #include "core/xml/parser/XMLDocumentParser.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
31 #include "bindings/core/v8/ScriptController.h" 31 #include "bindings/core/v8/ScriptController.h"
32 #include "bindings/core/v8/ScriptSourceCode.h" 32 #include "bindings/core/v8/ScriptSourceCode.h"
33 #include "bindings/core/v8/V8Document.h"
33 #include "core/FetchInitiatorTypeNames.h" 34 #include "core/FetchInitiatorTypeNames.h"
34 #include "core/HTMLNames.h" 35 #include "core/HTMLNames.h"
35 #include "core/XMLNSNames.h" 36 #include "core/XMLNSNames.h"
36 #include "core/dom/CDATASection.h" 37 #include "core/dom/CDATASection.h"
37 #include "core/dom/Comment.h" 38 #include "core/dom/Comment.h"
38 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
39 #include "core/dom/DocumentFragment.h" 40 #include "core/dom/DocumentFragment.h"
40 #include "core/dom/DocumentType.h" 41 #include "core/dom/DocumentType.h"
41 #include "core/dom/ProcessingInstruction.h" 42 #include "core/dom/ProcessingInstruction.h"
42 #include "core/dom/ScriptLoader.h" 43 #include "core/dom/ScriptLoader.h"
43 #include "core/dom/TransformSource.h" 44 #include "core/dom/TransformSource.h"
44 #include "core/fetch/ResourceFetcher.h" 45 #include "core/fetch/ResourceFetcher.h"
45 #include "core/fetch/ScriptResource.h" 46 #include "core/fetch/ScriptResource.h"
46 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
47 #include "core/frame/UseCounter.h" 48 #include "core/frame/UseCounter.h"
48 #include "core/html/HTMLHtmlElement.h" 49 #include "core/html/HTMLHtmlElement.h"
49 #include "core/html/HTMLTemplateElement.h" 50 #include "core/html/HTMLTemplateElement.h"
50 #include "core/html/parser/HTMLEntityParser.h" 51 #include "core/html/parser/HTMLEntityParser.h"
51 #include "core/html/parser/TextResourceDecoder.h" 52 #include "core/html/parser/TextResourceDecoder.h"
52 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
53 #include "core/loader/ImageLoader.h" 54 #include "core/loader/ImageLoader.h"
54 #include "core/svg/graphics/SVGImage.h" 55 #include "core/svg/graphics/SVGImage.h"
55 #include "core/xml/XMLTreeViewer.h"
56 #include "core/xml/parser/SharedBufferReader.h" 56 #include "core/xml/parser/SharedBufferReader.h"
57 #include "core/xml/parser/XMLDocumentParserScope.h" 57 #include "core/xml/parser/XMLDocumentParserScope.h"
58 #include "core/xml/parser/XMLParserInput.h" 58 #include "core/xml/parser/XMLParserInput.h"
59 #include "platform/RuntimeEnabledFeatures.h" 59 #include "platform/RuntimeEnabledFeatures.h"
60 #include "platform/SharedBuffer.h" 60 #include "platform/SharedBuffer.h"
61 #include "platform/TraceEvent.h" 61 #include "platform/TraceEvent.h"
62 #include "platform/network/ResourceError.h" 62 #include "platform/network/ResourceError.h"
63 #include "platform/network/ResourceRequest.h" 63 #include "platform/network/ResourceRequest.h"
64 #include "platform/network/ResourceResponse.h" 64 #include "platform/network/ResourceResponse.h"
65 #include "platform/weborigin/SecurityOrigin.h" 65 #include "platform/weborigin/SecurityOrigin.h"
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 XMLDocumentParserScope scope(document()->fetcher()); 1463 XMLDocumentParserScope scope(document()->fetcher());
1464 finishParsing(context()); 1464 finishParsing(context());
1465 } 1465 }
1466 1466
1467 m_context = nullptr; 1467 m_context = nullptr;
1468 } 1468 }
1469 } 1469 }
1470 1470
1471 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document()); 1471 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document());
1472 if (xmlViewerMode) { 1472 if (xmlViewerMode) {
1473 XMLTreeViewer xmlTreeViewer(document()); 1473 document()->setIsViewSource(true);
1474 xmlTreeViewer.transformDocumentToTreeView(); 1474 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()- >frame(), document());
1475 } else if (m_sawXSLTransform) { 1475 } else if (m_sawXSLTransform) {
1476 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string()); 1476 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string());
1477 document()->setTransformSource(adoptPtr(new TransformSource(doc))); 1477 document()->setTransformSource(adoptPtr(new TransformSource(doc)));
1478 // Make the document think it's done, so it will apply XSL stylesheets. 1478 // Make the document think it's done, so it will apply XSL stylesheets.
1479 document()->setParsing(false); 1479 document()->setParsing(false);
1480 document()->styleResolverChanged(); 1480 document()->styleResolverChanged();
1481 1481
1482 // styleResolverChanged() call can detach the parser and null out its 1482 // styleResolverChanged() call can detach the parser and null out its
1483 // document. In that case, we just bail out. 1483 // document. In that case, we just bail out.
1484 if (isDetached()) 1484 if (isDetached())
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 sax.initialized = XML_SAX2_MAGIC; 1634 sax.initialized = XML_SAX2_MAGIC;
1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1637 parseChunk(parser->context(), parseString); 1637 parseChunk(parser->context(), parseString);
1638 finishParsing(parser->context()); 1638 finishParsing(parser->context());
1639 attrsOK = state.gotAttributes; 1639 attrsOK = state.gotAttributes;
1640 return state.attributes; 1640 return state.attributes;
1641 } 1641 }
1642 1642
1643 } // namespace blink 1643 } // namespace blink
OLDNEW
« Source/core/xml/DocumentXMLTreeViewer.js ('K') | « Source/core/xml/XMLTreeViewer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698