mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibWeb: Only negotiate NavigableContainerViewport size with objects
Size negotiation should not occur for other viewports, such as iframe, since that would allow content inside the iframe to affect the size of the iframe in the containing document. 300 new subtest passes on WPT. :^)
This commit is contained in:
parent
630028daa5
commit
a7b791050e
Notes:
github-actions[bot]
2024-11-27 13:48:02 +00:00
Author: https://github.com/awesomekling
Commit: a7b791050e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2608
4 changed files with 313 additions and 313 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/HTMLObjectElement.h>
|
||||
#include <LibWeb/Layout/NavigableContainerViewport.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Painting/NavigableContainerViewportPaintable.h>
|
||||
|
@ -24,13 +25,15 @@ NavigableContainerViewport::~NavigableContainerViewport() = default;
|
|||
|
||||
void NavigableContainerViewport::prepare_for_replaced_layout()
|
||||
{
|
||||
if (auto const* content_document = dom_node().content_document_without_origin_check()) {
|
||||
if (auto const* root_element = content_document->document_element(); root_element && root_element->is_svg_svg_element()) {
|
||||
auto natural_metrics = SVG::SVGSVGElement::negotiate_natural_metrics(static_cast<SVG::SVGSVGElement const&>(*root_element));
|
||||
set_natural_width(natural_metrics.width);
|
||||
set_natural_height(natural_metrics.height);
|
||||
set_natural_aspect_ratio(natural_metrics.aspect_ratio);
|
||||
return;
|
||||
if (is<HTML::HTMLObjectElement>(dom_node())) {
|
||||
if (auto const* content_document = dom_node().content_document_without_origin_check()) {
|
||||
if (auto const* root_element = content_document->document_element(); root_element && root_element->is_svg_svg_element()) {
|
||||
auto natural_metrics = SVG::SVGSVGElement::negotiate_natural_metrics(static_cast<SVG::SVGSVGElement const&>(*root_element));
|
||||
set_natural_width(natural_metrics.width);
|
||||
set_natural_height(natural_metrics.height);
|
||||
set_natural_aspect_ratio(natural_metrics.aspect_ratio);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME: Do proper error checking, etc.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue