mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 23:19:44 +00:00
LibWeb: Move common SVGViewport code into an SVGFitToViewBox class
Special handling for SVGClipPathElement and SVGMaskElement, which use a a ViewBox and PreserveAspectRatio value internally, has been moved to `SVGFormattingContext`.
This commit is contained in:
parent
c8d24d4966
commit
ea41aba6c7
Notes:
github-actions[bot]
2025-08-28 13:44:09 +00:00
Author: https://github.com/tcl3
Commit: ea41aba6c7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6008
Reviewed-by: https://github.com/gmta ✅
16 changed files with 144 additions and 152 deletions
|
@ -12,7 +12,6 @@
|
|||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGCircleElement.h>
|
||||
#include <LibWeb/SVG/SVGViewport.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
|
@ -58,6 +57,13 @@ void SVGCircleElement::apply_presentational_hints(GC::Ref<CSS::CascadedPropertie
|
|||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::R, r_value.release_nonnull());
|
||||
}
|
||||
|
||||
static CSSPixels normalized_diagonal_length(CSSPixelSize viewport_size)
|
||||
{
|
||||
if (viewport_size.width() == viewport_size.height())
|
||||
return viewport_size.width();
|
||||
return sqrt((viewport_size.width() * viewport_size.width()) + (viewport_size.height() * viewport_size.height())) / CSSPixels::nearest_value_for(AK::Sqrt2<float>);
|
||||
}
|
||||
|
||||
Gfx::Path SVGCircleElement::get_path(CSSPixelSize viewport_size)
|
||||
{
|
||||
auto node = layout_node();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue