Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3083 break; | 3083 break; |
| 3084 } | 3084 } |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 if (numElements > 1 || numDoctypes > 1) | 3087 if (numElements > 1 || numDoctypes > 1) |
| 3088 return false; | 3088 return false; |
| 3089 | 3089 |
| 3090 return true; | 3090 return true; |
| 3091 } | 3091 } |
| 3092 | 3092 |
| 3093 PassRefPtr<Node> Document::cloneNode(bool /*deep*/) | 3093 PassRefPtr<Node> Document::cloneNode(bool deep) |
| 3094 { | 3094 { |
| 3095 // Spec says cloning Document nodes is "implementation dependent" | 3095 RefPtr<Document> clone = cloneDocumentWithoutChildren(); |
| 3096 // so we do not support it... | 3096 clone->cloneDataFromDocument(*this); |
| 3097 return 0; | 3097 if (deep) |
| 3098 cloneChildNodes(clone.get()); | |
| 3099 return clone.release(); | |
| 3100 } | |
| 3101 | |
| 3102 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() | |
| 3103 { | |
| 3104 DocumentInit init(url()); | |
| 3105 if (isXHTMLDocument()) | |
| 3106 return createXHTML(init.withRegistrationContext(registrationContext())); | |
| 3107 return create(init); | |
| 3108 } | |
| 3109 | |
| 3110 void Document::cloneDataFromDocument(const Document& other) | |
| 3111 { | |
| 3112 setCompatibilityMode(other.compatibilityMode()); | |
| 3113 setSecurityOrigin(other.securityOrigin()); | |
|
abarth-chromium
2013/08/26 21:04:55
You should make a copy of the security origin. Th
| |
| 3114 setContextFeatures(other.contextFeatures()); | |
| 3115 | |
| 3116 setDecoder(TextResourceDecoder::create(other.suggestedMIMEType(), other.enco ding())); | |
|
abarth-chromium
2013/08/26 21:04:55
This doesn't make a lot of sense... There is no t
jamesr
2013/08/26 21:07:51
Have you tested that the exposed encoding on the n
| |
| 3098 } | 3117 } |
| 3099 | 3118 |
| 3100 StyleSheetList* Document::styleSheets() | 3119 StyleSheetList* Document::styleSheets() |
| 3101 { | 3120 { |
| 3102 if (!m_styleSheetList) | 3121 if (!m_styleSheetList) |
| 3103 m_styleSheetList = StyleSheetList::create(this); | 3122 m_styleSheetList = StyleSheetList::create(this); |
| 3104 return m_styleSheetList.get(); | 3123 return m_styleSheetList.get(); |
| 3105 } | 3124 } |
| 3106 | 3125 |
| 3107 String Document::preferredStylesheetSet() const | 3126 String Document::preferredStylesheetSet() const |
| (...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5245 { | 5264 { |
| 5246 return DocumentLifecycleNotifier::create(this); | 5265 return DocumentLifecycleNotifier::create(this); |
| 5247 } | 5266 } |
| 5248 | 5267 |
| 5249 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5268 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
| 5250 { | 5269 { |
| 5251 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); | 5270 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); |
| 5252 } | 5271 } |
| 5253 | 5272 |
| 5254 } // namespace WebCore | 5273 } // namespace WebCore |
| OLD | NEW |