mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibWeb: Respect width and height attributes of <iframe>
We have to respect the width and height attributes of <iframe> elements the same way as <img> elements.
This commit is contained in:
parent
8589f1115e
commit
6a7c560849
2 changed files with 17 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
#include <LibWeb/HTML/Origin.h>
|
||||||
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/Layout/FrameBox.h>
|
#include <LibWeb/Layout/FrameBox.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -126,6 +127,20 @@ void HTMLIFrameElement::load_src(String const& value)
|
||||||
m_nested_browsing_context->loader().load(url, FrameLoader::Type::IFrame);
|
m_nested_browsing_context->loader().load(url, FrameLoader::Type::IFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
|
||||||
|
void HTMLIFrameElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||||
|
{
|
||||||
|
for_each_attribute([&](auto& name, auto& value) {
|
||||||
|
if (name == HTML::AttributeNames::width) {
|
||||||
|
if (auto parsed_value = parse_dimension_value(value))
|
||||||
|
style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
|
||||||
|
} else if (name == HTML::AttributeNames::height) {
|
||||||
|
if (auto parsed_value = parse_dimension_value(value))
|
||||||
|
style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#iframe-load-event-steps
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#iframe-load-event-steps
|
||||||
void run_iframe_load_event_steps(HTML::HTMLIFrameElement& element)
|
void run_iframe_load_event_steps(HTML::HTMLIFrameElement& element)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
|
|
||||||
void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; }
|
void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; }
|
||||||
|
|
||||||
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);
|
HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue