mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Add (and use) CSS property to SVGAnimatedLength
helper
No behaviour change.
This commit is contained in:
parent
6d72f40d8d
commit
d2918b8204
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/MacDue
Commit: d2918b8204
Pull-request: https://github.com/SerenityOS/serenity/pull/23793
Reviewed-by: https://github.com/shannonbooth
3 changed files with 19 additions and 27 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/HTML/DOMStringMap.h>
|
||||
|
@ -107,4 +108,17 @@ void SVGElement::blur()
|
|||
dbgln("(STUBBED) SVGElement::blur()");
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedLength> SVGElement::svg_animated_length_for_property(CSS::PropertyID property) const
|
||||
{
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto make_length = [&] {
|
||||
if (auto const* style = computed_css_values(); style) {
|
||||
if (auto length = style->length_percentage(property); length.has_value())
|
||||
return SVGLength::from_length_percentage(realm(), *length);
|
||||
}
|
||||
return SVGLength::create(realm(), 0, 0.0f);
|
||||
};
|
||||
return SVGAnimatedLength::create(realm(), make_length(), make_length());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue