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"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLHtmlElement);
using namespace HTMLNames;
HTMLHtmlElement::HTMLHtmlElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(htmlTag));
}
Ref<HTMLHtmlElement> HTMLHtmlElement::create(Document& document)
{
return adoptRef(*new HTMLHtmlElement(htmlTag, document));
}
Ref<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;
auto documentLoader = makeRefPtr(document().frame()->loader().documentLoader());
if (!documentLoader)
return;
auto& manifest = attributeWithoutSynchronization(manifestAttr);
if (manifest.isEmpty())
documentLoader->applicationCacheHost().selectCacheWithoutManifest();
else {
document().addConsoleMessage(MessageSource::AppCache, MessageLevel::Warning, "ApplicationCache is deprecated. Please use ServiceWorkers instead."_s);
documentLoader->applicationCacheHost().selectCacheWithManifest(document().completeURL(manifest));
}
}
}