1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:15:06 +00:00

LibWeb: Add basic <object> element support

This patch implements a simple <object> element with fallback content.
If the URL from the data attribute fails to load (including 404),
we render the DOM tree inside the <object> as fallback content.

This works by generating a different layout tree for the <object>
depending on the state and success of the data load. Since we cannot
currently do incremental layout tree updates, we have to force a
complete layout tree rebuild when the resource load finishes/fails.
This commit is contained in:
Andreas Kling 2020-06-13 22:24:49 +02:00
parent 95d70addd8
commit 3cc0c477db
5 changed files with 146 additions and 1 deletions

View file

@ -40,6 +40,7 @@
#include <LibWeb/DOM/HTMLImageElement.h>
#include <LibWeb/DOM/HTMLInputElement.h>
#include <LibWeb/DOM/HTMLLinkElement.h>
#include <LibWeb/DOM/HTMLObjectElement.h>
#include <LibWeb/DOM/HTMLScriptElement.h>
#include <LibWeb/DOM/HTMLStyleElement.h>
#include <LibWeb/DOM/HTMLTableCellElement.h>
@ -94,6 +95,8 @@ NonnullRefPtr<Element> create_element(Document& document, const FlyString& tag_n
return adopt(*new HTMLScriptElement(document, lowercase_tag_name));
if (lowercase_tag_name == HTML::TagNames::canvas)
return adopt(*new HTMLCanvasElement(document, lowercase_tag_name));
if (lowercase_tag_name == HTML::TagNames::object)
return adopt(*new HTMLObjectElement(document, lowercase_tag_name));
return adopt(*new Element(document, lowercase_tag_name));
}