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

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: Created 6 years, 4 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"
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 XMLDocumentParserScope scope(document()->fetcher()); 1464 XMLDocumentParserScope scope(document()->fetcher());
1464 finishParsing(context()); 1465 finishParsing(context());
1465 } 1466 }
1466 1467
1467 m_context = nullptr; 1468 m_context = nullptr;
1468 } 1469 }
1469 } 1470 }
1470 1471
1471 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document()); 1472 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document());
1472 if (xmlViewerMode) { 1473 if (xmlViewerMode) {
1473 XMLTreeViewer xmlTreeViewer(document()); 1474 document()->setIsViewSource(true);
1474 xmlTreeViewer.transformDocumentToTreeView(); 1475 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()- >frame(), document());
1475 } else if (m_sawXSLTransform) { 1476 } else if (m_sawXSLTransform) {
1476 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string()); 1477 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string());
1477 document()->setTransformSource(adoptPtr(new TransformSource(doc))); 1478 document()->setTransformSource(adoptPtr(new TransformSource(doc)));
1478 // Make the document think it's done, so it will apply XSL stylesheets. 1479 // Make the document think it's done, so it will apply XSL stylesheets.
1479 document()->setParsing(false); 1480 document()->setParsing(false);
1480 document()->styleResolverChanged(); 1481 document()->styleResolverChanged();
1481 1482
1482 // styleResolverChanged() call can detach the parser and null out its 1483 // styleResolverChanged() call can detach the parser and null out its
1483 // document. In that case, we just bail out. 1484 // document. In that case, we just bail out.
1484 if (isDetached()) 1485 if (isDetached())
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 sax.initialized = XML_SAX2_MAGIC; 1635 sax.initialized = XML_SAX2_MAGIC;
1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1636 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1637 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1637 parseChunk(parser->context(), parseString); 1638 parseChunk(parser->context(), parseString);
1638 finishParsing(parser->context()); 1639 finishParsing(parser->context());
1639 attrsOK = state.gotAttributes; 1640 attrsOK = state.gotAttributes;
1640 return state.attributes; 1641 return state.attributes;
1641 } 1642 }
1642 1643
1643 } // namespace blink 1644 } // namespace blink
OLDNEW
« Source/core/xml/XMLTreeViewer.js ('K') | « Source/core/xml/XMLTreeViewer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698