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

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: Update newly added 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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 RefPtr<Document> clone = cloneDocumentWithoutChildren(); 3162 RefPtr<Document> clone = cloneDocumentWithoutChildren();
3159 clone->cloneDataFromDocument(*this); 3163 clone->cloneDataFromDocument(*this);
3160 if (deep) 3164 if (deep)
3161 cloneChildNodes(clone.get()); 3165 cloneChildNodes(clone.get());
3162 return clone.release(); 3166 return clone.release();
3163 } 3167 }
3164 3168
3165 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() 3169 PassRefPtr<Document> Document::cloneDocumentWithoutChildren()
3166 { 3170 {
3167 DocumentInit init(url()); 3171 DocumentInit init(url());
3168 if (isXHTMLDocument()) 3172 if (isXMLDocument()) {
3169 return createXHTML(init.withRegistrationContext(registrationContext())); 3173 if (isXHTMLDocument())
3174 return XMLDocument::createXHTML(init.withRegistrationContext(registr ationContext()));
3175 return XMLDocument::create(init);
3176 }
3170 return create(init); 3177 return create(init);
3171 } 3178 }
3172 3179
3173 void Document::cloneDataFromDocument(const Document& other) 3180 void Document::cloneDataFromDocument(const Document& other)
3174 { 3181 {
3175 setCompatibilityMode(other.compatibilityMode()); 3182 setCompatibilityMode(other.compatibilityMode());
3176 setEncodingData(other.m_encodingData); 3183 setEncodingData(other.m_encodingData);
3177 setContextFeatures(other.contextFeatures()); 3184 setContextFeatures(other.contextFeatures());
3178 setSecurityOrigin(other.securityOrigin()->isolatedCopy()); 3185 setSecurityOrigin(other.securityOrigin()->isolatedCopy());
3179 } 3186 }
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
5338 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5345 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5339 return false; 5346 return false;
5340 if (Frame* focusedFrame = page->focusController().focusedFrame()) { 5347 if (Frame* focusedFrame = page->focusController().focusedFrame()) {
5341 if (focusedFrame->tree().isDescendantOf(frame())) 5348 if (focusedFrame->tree().isDescendantOf(frame()))
5342 return true; 5349 return true;
5343 } 5350 }
5344 return false; 5351 return false;
5345 } 5352 }
5346 5353
5347 } // namespace WebCore 5354 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698