mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibHTML: Start adding support for <link rel="stylesheet">
This patch adds basic support for external stylesheets. It currently only works with file:// URLs. We do a synchronous full relayout after loading a stylesheet, which is definitely on the aggressive side, but it gives us something to work on improving. :^)
This commit is contained in:
parent
c136fd3fe2
commit
71e8ddcd1c
8 changed files with 89 additions and 1 deletions
21
Libraries/LibHTML/DOM/HTMLLinkElement.h
Normal file
21
Libraries/LibHTML/DOM/HTMLLinkElement.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibHTML/DOM/HTMLElement.h>
|
||||
|
||||
class HTMLLinkElement final : public HTMLElement {
|
||||
public:
|
||||
HTMLLinkElement(Document&, const String& tag_name);
|
||||
virtual ~HTMLLinkElement() override;
|
||||
|
||||
virtual void inserted_into(Node&) override;
|
||||
|
||||
String rel() const { return attribute("rel"); }
|
||||
String type() const { return attribute("type"); }
|
||||
String href() const { return attribute("href"); }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool is<HTMLLinkElement>(const Node& node)
|
||||
{
|
||||
return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "link";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue