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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 break; | 3096 break; |
3097 } | 3097 } |
3098 } | 3098 } |
3099 | 3099 |
3100 if (numElements > 1 || numDoctypes > 1) | 3100 if (numElements > 1 || numDoctypes > 1) |
3101 return false; | 3101 return false; |
3102 | 3102 |
3103 return true; | 3103 return true; |
3104 } | 3104 } |
3105 | 3105 |
3106 PassRefPtr<Node> Document::cloneNode(bool /*deep*/) | 3106 PassRefPtr<Node> Document::cloneNode(bool deep) |
3107 { | 3107 { |
3108 // Spec says cloning Document nodes is "implementation dependent" | 3108 RefPtr<Document> clone = cloneDocumentWithoutChildren(); |
3109 // so we do not support it... | 3109 clone->cloneDataFromDocument(*this); |
3110 return 0; | 3110 if (deep) |
| 3111 cloneChildNodes(clone.get()); |
| 3112 return clone.release(); |
| 3113 } |
| 3114 |
| 3115 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() |
| 3116 { |
| 3117 DocumentInit init(url()); |
| 3118 if (isXHTMLDocument()) |
| 3119 return createXHTML(init.withRegistrationContext(registrationContext())); |
| 3120 return create(init); |
| 3121 } |
| 3122 |
| 3123 void Document::cloneDataFromDocument(const Document& other) |
| 3124 { |
| 3125 setCompatibilityMode(other.compatibilityMode()); |
| 3126 setEncoding(other.encoding()); |
| 3127 setContextFeatures(other.contextFeatures()); |
| 3128 setSecurityOrigin(other.securityOrigin()->isolatedCopy()); |
3111 } | 3129 } |
3112 | 3130 |
3113 StyleSheetList* Document::styleSheets() | 3131 StyleSheetList* Document::styleSheets() |
3114 { | 3132 { |
3115 if (!m_styleSheetList) | 3133 if (!m_styleSheetList) |
3116 m_styleSheetList = StyleSheetList::create(this); | 3134 m_styleSheetList = StyleSheetList::create(this); |
3117 return m_styleSheetList.get(); | 3135 return m_styleSheetList.get(); |
3118 } | 3136 } |
3119 | 3137 |
3120 String Document::preferredStylesheetSet() const | 3138 String Document::preferredStylesheetSet() const |
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5290 { | 5308 { |
5291 return DocumentLifecycleNotifier::create(this); | 5309 return DocumentLifecycleNotifier::create(this); |
5292 } | 5310 } |
5293 | 5311 |
5294 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5312 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5295 { | 5313 { |
5296 return static_cast<DocumentLifecycleNotifier*>(ExecutionContext::lifecycleNo
tifier()); | 5314 return static_cast<DocumentLifecycleNotifier*>(ExecutionContext::lifecycleNo
tifier()); |
5297 } | 5315 } |
5298 | 5316 |
5299 } // namespace WebCore | 5317 } // namespace WebCore |
OLD | NEW |