mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 16:07:34 +00:00
LibWeb: Remove content-size hack from SVGFormattingContext
Everything functions fine without it. :^)
This commit is contained in:
parent
5d2ce68f53
commit
48edaa2085
1 changed files with 1 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +8,6 @@
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <LibWeb/Layout/SVGFormattingContext.h>
|
#include <LibWeb/Layout/SVGFormattingContext.h>
|
||||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||||
#include <LibWeb/Layout/SVGSVGBox.h>
|
|
||||||
|
|
||||||
namespace Web::Layout {
|
namespace Web::Layout {
|
||||||
|
|
||||||
|
@ -22,12 +22,6 @@ SVGFormattingContext::~SVGFormattingContext()
|
||||||
|
|
||||||
void SVGFormattingContext::run(Box& box, LayoutMode)
|
void SVGFormattingContext::run(Box& box, LayoutMode)
|
||||||
{
|
{
|
||||||
// FIXME: This formatting context is basically a total hack.
|
|
||||||
// It works by computing the united bounding box of all <path>'s
|
|
||||||
// within an <svg>, and using that as the size of this box.
|
|
||||||
|
|
||||||
Gfx::FloatRect total_bounding_box;
|
|
||||||
|
|
||||||
box.for_each_in_subtree_of_type<SVGBox>([&](auto& descendant) {
|
box.for_each_in_subtree_of_type<SVGBox>([&](auto& descendant) {
|
||||||
if (is<SVGGeometryBox>(descendant)) {
|
if (is<SVGGeometryBox>(descendant)) {
|
||||||
auto& geometry_box = static_cast<SVGGeometryBox&>(descendant);
|
auto& geometry_box = static_cast<SVGGeometryBox&>(descendant);
|
||||||
|
@ -40,14 +34,10 @@ void SVGFormattingContext::run(Box& box, LayoutMode)
|
||||||
|
|
||||||
geometry_box.set_offset(bounding_box.top_left());
|
geometry_box.set_offset(bounding_box.top_left());
|
||||||
geometry_box.set_content_size(bounding_box.size());
|
geometry_box.set_content_size(bounding_box.size());
|
||||||
|
|
||||||
total_bounding_box = total_bounding_box.united(path.bounding_box());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
||||||
box.set_content_size(total_bounding_box.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue