HTMLHtmlElement.cpp [plain text]
#include "config.h"
#include "HTMLHtmlElement.h"
#include "ApplicationCacheHost.h"
#include "Document.h"
#include "DocumentLoader.h"
#include "DocumentParser.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLNames.h"
namespace WebCore {
using namespace HTMLNames;
HTMLHtmlElement::HTMLHtmlElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(htmlTag));
}
PassRefPtr<HTMLHtmlElement> HTMLHtmlElement::create(Document* document)
{
return adoptRef(new HTMLHtmlElement(htmlTag, document));
}
PassRefPtr<HTMLHtmlElement> HTMLHtmlElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLHtmlElement(tagName, document));
}
bool HTMLHtmlElement::isURLAttribute(const Attribute& attribute) const
{
return attribute.name() == manifestAttr || HTMLElement::isURLAttribute(attribute);
}
void HTMLHtmlElement::insertedByParser()
{
if (!document()->parser() || !document()->parser()->documentWasLoadedAsPartOfNavigation())
return;
if (!document()->frame())
return;
DocumentLoader* documentLoader = document()->frame()->loader()->documentLoader();
if (!documentLoader)
return;
const AtomicString& manifest = getAttribute(manifestAttr);
if (manifest.isEmpty())
documentLoader->applicationCacheHost()->selectCacheWithoutManifest();
else
documentLoader->applicationCacheHost()->selectCacheWithManifest(document()->completeURL(manifest));
}
}