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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 144063004: Add support for DOM4's XMLDocument interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout test Created 6 years, 11 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "core/dom/ProcessingInstruction.h" 87 #include "core/dom/ProcessingInstruction.h"
88 #include "core/dom/RequestAnimationFrameCallback.h" 88 #include "core/dom/RequestAnimationFrameCallback.h"
89 #include "core/dom/ScriptRunner.h" 89 #include "core/dom/ScriptRunner.h"
90 #include "core/dom/ScriptedAnimationController.h" 90 #include "core/dom/ScriptedAnimationController.h"
91 #include "core/dom/SelectorQuery.h" 91 #include "core/dom/SelectorQuery.h"
92 #include "core/dom/StyleEngine.h" 92 #include "core/dom/StyleEngine.h"
93 #include "core/dom/TouchList.h" 93 #include "core/dom/TouchList.h"
94 #include "core/dom/TransformSource.h" 94 #include "core/dom/TransformSource.h"
95 #include "core/dom/TreeWalker.h" 95 #include "core/dom/TreeWalker.h"
96 #include "core/dom/VisitedLinkState.h" 96 #include "core/dom/VisitedLinkState.h"
97 #include "core/dom/XMLDocument.h"
97 #include "core/dom/custom/CustomElementRegistrationContext.h" 98 #include "core/dom/custom/CustomElementRegistrationContext.h"
98 #include "core/dom/shadow/ElementShadow.h" 99 #include "core/dom/shadow/ElementShadow.h"
99 #include "core/dom/shadow/ShadowRoot.h" 100 #include "core/dom/shadow/ShadowRoot.h"
100 #include "core/editing/Editor.h" 101 #include "core/editing/Editor.h"
101 #include "core/editing/FrameSelection.h" 102 #include "core/editing/FrameSelection.h"
102 #include "core/editing/SpellChecker.h" 103 #include "core/editing/SpellChecker.h"
103 #include "core/events/BeforeUnloadEvent.h" 104 #include "core/events/BeforeUnloadEvent.h"
104 #include "core/events/Event.h" 105 #include "core/events/Event.h"
105 #include "core/events/EventFactory.h" 106 #include "core/events/EventFactory.h"
106 #include "core/events/EventListener.h" 107 #include "core/events/EventListener.h"
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 // not implemented for the XML parser as it's normally synonymous with 1196 // not implemented for the XML parser as it's normally synonymous with
1196 // document.write(). append() will end up yielding, but close() will 1197 // document.write(). append() will end up yielding, but close() will
1197 // pump the tokenizer syncrhonously and finish the parse. 1198 // pump the tokenizer syncrhonously and finish the parse.
1198 m_parser->pinToMainThread(); 1199 m_parser->pinToMainThread();
1199 m_parser->append(content.impl()); 1200 m_parser->append(content.impl());
1200 close(); 1201 close();
1201 } 1202 }
1202 1203
1203 String Document::suggestedMIMEType() const 1204 String Document::suggestedMIMEType() const
1204 { 1205 {
1205 if (isXHTMLDocument()) 1206 if (isXMLDocument()) {
1206 return "application/xhtml+xml"; 1207 if (isXHTMLDocument())
1207 if (isSVGDocument()) 1208 return "application/xhtml+xml";
1208 return "image/svg+xml"; 1209 if (isSVGDocument())
1210 return "image/svg+xml";
1211 return "application/xml";
1212 }
1209 if (xmlStandalone()) 1213 if (xmlStandalone())
1210 return "text/xml"; 1214 return "text/xml";
1211 if (isHTMLDocument()) 1215 if (isHTMLDocument())
1212 return "text/html"; 1216 return "text/html";
1213 1217
1214 if (DocumentLoader* documentLoader = loader()) 1218 if (DocumentLoader* documentLoader = loader())
1215 return documentLoader->responseMIMEType(); 1219 return documentLoader->responseMIMEType();
1216 return String(); 1220 return String();
1217 } 1221 }
1218 1222
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 RefPtr<Document> clone = cloneDocumentWithoutChildren(); 3171 RefPtr<Document> clone = cloneDocumentWithoutChildren();
3168 clone->cloneDataFromDocument(*this); 3172 clone->cloneDataFromDocument(*this);
3169 if (deep) 3173 if (deep)
3170 cloneChildNodes(clone.get()); 3174 cloneChildNodes(clone.get());
3171 return clone.release(); 3175 return clone.release();
3172 } 3176 }
3173 3177
3174 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() 3178 PassRefPtr<Document> Document::cloneDocumentWithoutChildren()
3175 { 3179 {
3176 DocumentInit init(url()); 3180 DocumentInit init(url());
3177 if (isXHTMLDocument()) 3181 if (isXMLDocument()) {
3178 return createXHTML(init.withRegistrationContext(registrationContext())); 3182 if (isXHTMLDocument())
3183 return XMLDocument::createXHTML(init.withRegistrationContext(registr ationContext()));
3184 return XMLDocument::create(init);
3185 }
3179 return create(init); 3186 return create(init);
3180 } 3187 }
3181 3188
3182 void Document::cloneDataFromDocument(const Document& other) 3189 void Document::cloneDataFromDocument(const Document& other)
3183 { 3190 {
3184 setCompatibilityMode(other.compatibilityMode()); 3191 setCompatibilityMode(other.compatibilityMode());
3185 setEncodingData(other.m_encodingData); 3192 setEncodingData(other.m_encodingData);
3186 setContextFeatures(other.contextFeatures()); 3193 setContextFeatures(other.contextFeatures());
3187 setSecurityOrigin(other.securityOrigin()->isolatedCopy()); 3194 setSecurityOrigin(other.securityOrigin()->isolatedCopy());
3188 } 3195 }
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 } 5323 }
5317 if (m_hasAutofocused) 5324 if (m_hasAutofocused)
5318 return; 5325 return;
5319 m_hasAutofocused = true; 5326 m_hasAutofocused = true;
5320 ASSERT(!m_autofocusElement); 5327 ASSERT(!m_autofocusElement);
5321 m_autofocusElement = element; 5328 m_autofocusElement = element;
5322 m_taskRunner->postTask(AutofocusTask::create()); 5329 m_taskRunner->postTask(AutofocusTask::create());
5323 } 5330 }
5324 5331
5325 } // namespace WebCore 5332 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698