| 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) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2004, 2006 Apple Computer, Inc. | 6 * Copyright (C) 2004, 2006 Apple Computer, Inc. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 */ | 22 */ |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "HTMLHtmlElement.h" | 24 #include "HTMLHtmlElement.h" |
| 25 | 25 |
| 26 #include "ApplicationCacheGroup.h" | |
| 27 #include "Document.h" | 26 #include "Document.h" |
| 28 #include "HTMLNames.h" | 27 #include "HTMLNames.h" |
| 29 | 28 |
| 29 // FIXME: The use of these two flags to should be a temporary situation. |
| 30 // Eventually we should use ENABLE(APPLICATION_CACHE) for this feature in |
| 31 // all cases. |
| 32 #if ENABLE(OFFLINE_WEB_APPLICATIONS) && ENABLE(APPLICATION_CACHE) |
| 33 #error APPLICATION_CACHE and OFFLINE_WEB_APPLICATIONS are mutually exclusive fla
gs |
| 34 #endif |
| 35 |
| 36 #if ENABLE(OFFLINE_WEB_APPLICATIONS) |
| 37 #include "ApplicationCacheGroup.h" |
| 38 #elif ENABLE(APPLICATION_CACHE) |
| 39 #include "Frame.h" |
| 40 #include "FrameLoader.h" |
| 41 #endif |
| 42 |
| 30 namespace WebCore { | 43 namespace WebCore { |
| 31 | 44 |
| 32 using namespace HTMLNames; | 45 using namespace HTMLNames; |
| 33 | 46 |
| 47 #if ENABLE(OFFLINE_WEB_APPLICATIONS) || ENABLE(APPLICATION_CACHE) |
| 48 |
| 49 static void selectCacheWithoutManifest(Frame* frame) |
| 50 { |
| 51 #if ENABLE(OFFLINE_WEB_APPLICATIONS) |
| 52 ApplicationCacheGroup::selectCacheWithoutManifestURL(frame); |
| 53 #elif ENABLE(APPLICATION_CACHE) |
| 54 frame->loader()->selectApplicationCacheWithoutManifest(); |
| 55 #endif |
| 56 } |
| 57 |
| 58 static void selectCacheWithManifest(Frame* frame, const KURL& manifestURL) |
| 59 { |
| 60 #if ENABLE(OFFLINE_WEB_APPLICATIONS) |
| 61 ApplicationCacheGroup::selectCache(frame, manifestURL); |
| 62 #elif ENABLE(APPLICATION_CACHE) |
| 63 frame->loader()->selectApplicationCacheWithManifest(manifestURL); |
| 64 #endif |
| 65 } |
| 66 |
| 67 #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) || ENABLE(APPLICATION_CACHE) |
| 68 |
| 34 HTMLHtmlElement::HTMLHtmlElement(const QualifiedName& tagName, Document* doc) | 69 HTMLHtmlElement::HTMLHtmlElement(const QualifiedName& tagName, Document* doc) |
| 35 : HTMLElement(tagName, doc) | 70 : HTMLElement(tagName, doc) |
| 36 { | 71 { |
| 37 ASSERT(hasTagName(htmlTag)); | 72 ASSERT(hasTagName(htmlTag)); |
| 38 } | 73 } |
| 39 | 74 |
| 40 HTMLHtmlElement::~HTMLHtmlElement() | 75 HTMLHtmlElement::~HTMLHtmlElement() |
| 41 { | 76 { |
| 42 } | 77 } |
| 43 | 78 |
| 44 String HTMLHtmlElement::version() const | 79 String HTMLHtmlElement::version() const |
| 45 { | 80 { |
| 46 return getAttribute(versionAttr); | 81 return getAttribute(versionAttr); |
| 47 } | 82 } |
| 48 | 83 |
| 49 void HTMLHtmlElement::setVersion(const String &value) | 84 void HTMLHtmlElement::setVersion(const String &value) |
| 50 { | 85 { |
| 51 setAttribute(versionAttr, value); | 86 setAttribute(versionAttr, value); |
| 52 } | 87 } |
| 53 | 88 |
| 54 bool HTMLHtmlElement::checkDTD(const Node* newChild) | 89 bool HTMLHtmlElement::checkDTD(const Node* newChild) |
| 55 { | 90 { |
| 56 return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) || | 91 return newChild->hasTagName(headTag) || newChild->hasTagName(bodyTag) || |
| 57 newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag
); | 92 newChild->hasTagName(framesetTag) || newChild->hasTagName(noframesTag
); |
| 58 } | 93 } |
| 59 | 94 |
| 60 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | 95 #if ENABLE(OFFLINE_WEB_APPLICATIONS) || ENABLE(APPLICATION_CACHE) |
| 61 void HTMLHtmlElement::insertedIntoDocument() | 96 void HTMLHtmlElement::insertedIntoDocument() |
| 62 { | 97 { |
| 63 HTMLElement::insertedIntoDocument(); | 98 HTMLElement::insertedIntoDocument(); |
| 64 | 99 |
| 65 if (!document()->parsing()) | 100 if (!document()->parsing()) |
| 66 return; | 101 return; |
| 67 | 102 |
| 68 if (!document()->frame()) | 103 if (!document()->frame()) |
| 69 return; | 104 return; |
| 70 | 105 |
| 71 // Check the manifest attribute | 106 // Check the manifest attribute |
| 72 AtomicString manifest = getAttribute(manifestAttr); | 107 AtomicString manifest = getAttribute(manifestAttr); |
| 73 if (manifest.isNull()) | 108 if (manifest.isNull() || manifest.isEmpty()) |
| 74 ApplicationCacheGroup::selectCacheWithoutManifestURL(document()->frame()
); | 109 selectCacheWithoutManifest(document()->frame()); |
| 75 else | 110 else |
| 76 ApplicationCacheGroup::selectCache(document()->frame(), document()->comp
leteURL(manifest)); | 111 selectCacheWithManifest(document()->frame(), document()->completeURL(man
ifest)); |
| 77 } | 112 } |
| 78 #endif | 113 #endif |
| 79 | 114 |
| 80 } | 115 } |
| OLD | NEW |