ladybird/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h
Andreas Kling 5bb2e6597a LibWeb: Preload resources hinted by <link rel="preload">
If a page is nice enough to give us some preload hints, we can tell
RequestServer to get started on downloading the resources right away,
instead of waiting until discovering them later on during parsing.
2021-09-27 02:07:55 +02:00

45 lines
1.1 KiB
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/Loader/CSSLoader.h>
namespace Web::HTML {
class HTMLLinkElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLLinkElementWrapper;
HTMLLinkElement(DOM::Document&, QualifiedName);
virtual ~HTMLLinkElement() override;
virtual void inserted() override;
String rel() const { return attribute(HTML::AttributeNames::rel); }
String type() const { return attribute(HTML::AttributeNames::type); }
String href() const { return attribute(HTML::AttributeNames::href); }
private:
void parse_attribute(const FlyString&, const String&) override;
struct Relationship {
enum {
Alternate = 1 << 0,
Stylesheet = 1 << 1,
Preload = 1 << 2,
};
};
RefPtr<Resource> m_preload_resource;
CSSLoader m_css_loader;
unsigned m_relationship { 0 };
};
}