mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb: Implement SVGElement.viewportElement
This commit is contained in:
parent
879cba762b
commit
1dc6425ede
Notes:
github-actions[bot]
2025-05-16 18:37:07 +00:00
Author: https://github.com/awesomekling
Commit: 1dc6425ede
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4775
4 changed files with 55 additions and 38 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/SVG/SVGDescElement.h>
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
#include <LibWeb/SVG/SVGSymbolElement.h>
|
||||
#include <LibWeb/SVG/SVGTitleElement.h>
|
||||
#include <LibWeb/SVG/SVGUseElement.h>
|
||||
|
||||
|
@ -251,6 +252,21 @@ GC::Ptr<SVGSVGElement> SVGElement::owner_svg_element()
|
|||
return shadow_including_first_ancestor_of_type<SVGSVGElement>();
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/types.html#__svg__SVGElement__viewportElement
|
||||
GC::Ptr<SVGElement> SVGElement::viewport_element()
|
||||
{
|
||||
for (auto* node = parent(); node; node = node->parent_or_shadow_host()) {
|
||||
// https://svgwg.org/svg2-draft/coords.html#EstablishingANewSVGViewport
|
||||
// The following elements establish new SVG viewports:
|
||||
// - The ‘svg’ element
|
||||
// - A ‘symbol’ element that is instanced by a ‘use’ element.
|
||||
if (is<SVGSVGElement>(*node) || is<SVGSymbolElement>(*node)) {
|
||||
return static_cast<SVGElement*>(node);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedLength> SVGElement::svg_animated_length_for_property(CSS::PropertyID property) const
|
||||
{
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue