| 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 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
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 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 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 * | 10 * |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 return toHTMLElement(i); | 2024 return toHTMLElement(i); |
| 2025 | 2025 |
| 2026 if (i->hasTagName(bodyTag) && !body) | 2026 if (i->hasTagName(bodyTag) && !body) |
| 2027 body = i; | 2027 body = i; |
| 2028 } | 2028 } |
| 2029 return toHTMLElement(body); | 2029 return toHTMLElement(body); |
| 2030 } | 2030 } |
| 2031 | 2031 |
| 2032 void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec) | 2032 void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec) |
| 2033 { | 2033 { |
| 2034 if (!newBody || !documentElement()) { | 2034 ec = 0; |
| 2035 |
| 2036 if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) { |
| 2035 ec = HIERARCHY_REQUEST_ERR; | 2037 ec = HIERARCHY_REQUEST_ERR; |
| 2036 return; | 2038 return; |
| 2037 } | 2039 } |
| 2038 | 2040 |
| 2041 if (newBody->document() && newBody->document() != this) { |
| 2042 RefPtr<Node> node = importNode(newBody.get(), true, ec); |
| 2043 if (ec) |
| 2044 return; |
| 2045 |
| 2046 newBody = toHTMLElement(node.get()); |
| 2047 } |
| 2048 |
| 2039 HTMLElement* b = body(); | 2049 HTMLElement* b = body(); |
| 2040 if (!b) | 2050 if (!b) |
| 2041 documentElement()->appendChild(newBody, ec); | 2051 documentElement()->appendChild(newBody, ec); |
| 2042 else | 2052 else |
| 2043 documentElement()->replaceChild(newBody, b, ec); | 2053 documentElement()->replaceChild(newBody, b, ec); |
| 2044 } | 2054 } |
| 2045 | 2055 |
| 2046 HTMLHeadElement* Document::head() | 2056 HTMLHeadElement* Document::head() |
| 2047 { | 2057 { |
| 2048 Node* de = documentElement(); | 2058 Node* de = documentElement(); |
| (...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5155 if (!loader) | 5165 if (!loader) |
| 5156 return 0; | 5166 return 0; |
| 5157 | 5167 |
| 5158 if (m_frame->document() != this) | 5168 if (m_frame->document() != this) |
| 5159 return 0; | 5169 return 0; |
| 5160 | 5170 |
| 5161 return loader; | 5171 return loader; |
| 5162 } | 5172 } |
| 5163 | 5173 |
| 5164 } // namespace WebCore | 5174 } // namespace WebCore |
| OLD | NEW |