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:
Andreas Kling 2019-10-07 19:06:47 +02:00
parent c136fd3fe2
commit 71e8ddcd1c
Notes: sideshowbarker 2024-07-19 11:45:40 +09:00
8 changed files with 89 additions and 1 deletions

View file

@ -12,6 +12,7 @@
#include <LibHTML/DOM/HTMLImageElement.h>
#include <LibHTML/DOM/HTMLStyleElement.h>
#include <LibHTML/DOM/HTMLTitleElement.h>
#include <LibHTML/DOM/HTMLLinkElement.h>
#include <LibHTML/DOM/Text.h>
#include <LibHTML/Parser/HTMLParser.h>
#include <ctype.h>
@ -36,6 +37,8 @@ static NonnullRefPtr<Element> create_element(Document& document, const String& t
return adopt(*new HTMLStyleElement(document, tag_name));
if (lowercase_tag_name == "title")
return adopt(*new HTMLTitleElement(document, tag_name));
if (lowercase_tag_name == "link")
return adopt(*new HTMLLinkElement(document, tag_name));
if (lowercase_tag_name == "img")
return adopt(*new HTMLImageElement(document, tag_name));
if (lowercase_tag_name == "h1"