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 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 return toHTMLElement(i); | 1959 return toHTMLElement(i); |
1960 | 1960 |
1961 if (i->hasTagName(bodyTag) && !body) | 1961 if (i->hasTagName(bodyTag) && !body) |
1962 body = i; | 1962 body = i; |
1963 } | 1963 } |
1964 return toHTMLElement(body); | 1964 return toHTMLElement(body); |
1965 } | 1965 } |
1966 | 1966 |
1967 void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec) | 1967 void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec) |
1968 { | 1968 { |
1969 if (!newBody || !documentElement()) { | 1969 ec = 0; |
| 1970 |
| 1971 if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) { |
1970 ec = HIERARCHY_REQUEST_ERR; | 1972 ec = HIERARCHY_REQUEST_ERR; |
1971 return; | 1973 return; |
1972 } | 1974 } |
1973 | 1975 |
| 1976 if (newBody->document() && newBody->document() != this) { |
| 1977 RefPtr<Node> node = importNode(newBody.get(), true, ec); |
| 1978 if (ec) |
| 1979 return; |
| 1980 |
| 1981 newBody = toHTMLElement(node.get()); |
| 1982 } |
| 1983 |
1974 HTMLElement* b = body(); | 1984 HTMLElement* b = body(); |
1975 if (!b) | 1985 if (!b) |
1976 documentElement()->appendChild(newBody, ec); | 1986 documentElement()->appendChild(newBody, ec); |
1977 else | 1987 else |
1978 documentElement()->replaceChild(newBody, b, ec); | 1988 documentElement()->replaceChild(newBody, b, ec); |
1979 } | 1989 } |
1980 | 1990 |
1981 HTMLHeadElement* Document::head() | 1991 HTMLHeadElement* Document::head() |
1982 { | 1992 { |
1983 Node* de = documentElement(); | 1993 Node* de = documentElement(); |
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4972 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY); | 4982 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag
eY); |
4973 } | 4983 } |
4974 | 4984 |
4975 PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const | 4985 PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const |
4976 { | 4986 { |
4977 return TouchList::create(); | 4987 return TouchList::create(); |
4978 } | 4988 } |
4979 #endif | 4989 #endif |
4980 | 4990 |
4981 } // namespace WebCore | 4991 } // namespace WebCore |
OLD | NEW |