mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 23:19:44 +00:00
LibWeb: Implement SVGLength's read-only property
An SVGLength can be read-only, e.g. all animVal values cannot be modified. Implement this for all instantiations of SVGLength. While we're here, add `fake_animated_length_fixme()` so we can easily find all sites where we need to improve our animated length game.
This commit is contained in:
parent
f9a13ecb13
commit
676f5837b3
Notes:
github-actions[bot]
2025-08-27 09:51:30 +00:00
Author: https://github.com/gmta
Commit: 676f5837b3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5994
16 changed files with 175 additions and 113 deletions
|
@ -81,10 +81,8 @@ void SVGImageElement::attribute_changed(FlyString const& name, Optional<String>
|
|||
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__x
|
||||
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::x()
|
||||
{
|
||||
if (!m_x) {
|
||||
auto& realm = this->realm();
|
||||
m_x = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
}
|
||||
if (!m_x)
|
||||
m_x = fake_animated_length_fixme();
|
||||
|
||||
return *m_x;
|
||||
}
|
||||
|
@ -92,10 +90,8 @@ GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::x()
|
|||
// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__y
|
||||
GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::y()
|
||||
{
|
||||
if (!m_y) {
|
||||
auto& realm = this->realm();
|
||||
m_y = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
}
|
||||
if (!m_y)
|
||||
m_y = fake_animated_length_fixme();
|
||||
|
||||
return *m_y;
|
||||
}
|
||||
|
@ -105,7 +101,10 @@ GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::width()
|
|||
{
|
||||
if (!m_width) {
|
||||
auto& realm = this->realm();
|
||||
m_width = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, intrinsic_width().value_or(0).to_double()), SVGLength::create(realm, 0, 0));
|
||||
m_width = SVGAnimatedLength::create(
|
||||
realm,
|
||||
SVGLength::create(realm, 0, intrinsic_width().value_or(0).to_double(), SVGLength::ReadOnly::No),
|
||||
SVGLength::create(realm, 0, 0, SVGLength::ReadOnly::Yes));
|
||||
}
|
||||
|
||||
return *m_width;
|
||||
|
@ -116,7 +115,10 @@ GC::Ref<SVG::SVGAnimatedLength> SVGImageElement::height()
|
|||
{
|
||||
if (!m_height) {
|
||||
auto& realm = this->realm();
|
||||
m_height = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, intrinsic_height().value_or(0).to_double()), SVGLength::create(realm, 0, 0));
|
||||
m_height = SVGAnimatedLength::create(
|
||||
realm,
|
||||
SVGLength::create(realm, 0, intrinsic_height().value_or(0).to_double(), SVGLength::ReadOnly::No),
|
||||
SVGLength::create(realm, 0, 0, SVGLength::ReadOnly::Yes));
|
||||
}
|
||||
|
||||
return *m_height;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue