mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Implement SVGAnimatedNumber
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
ffcf91cd30
commit
97fa0be16e
Notes:
github-actions[bot]
2025-07-11 10:27:20 +00:00
Author: https://github.com/gmta
Commit: 97fa0be16e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5389
Reviewed-by: https://github.com/tcl3 ✅
11 changed files with 235 additions and 47 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -9,7 +10,6 @@
|
|||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGStopElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
@ -21,15 +21,6 @@ SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
|
||||
{
|
||||
Base::attribute_changed(name, old_value, value, namespace_);
|
||||
|
||||
if (name == SVG::AttributeNames::offset) {
|
||||
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
||||
}
|
||||
}
|
||||
|
||||
bool SVGStopElement::is_presentational_hint(FlyString const& name) const
|
||||
{
|
||||
if (Base::is_presentational_hint(name))
|
||||
|
@ -69,10 +60,12 @@ float SVGStopElement::stop_opacity() const
|
|||
return 1;
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedNumber> SVGStopElement::offset() const
|
||||
// https://svgwg.org/svg2-draft/pservers.html#StopElementOffsetAttribute
|
||||
GC::Ref<SVGAnimatedNumber> SVGStopElement::offset()
|
||||
{
|
||||
// FIXME: Implement this properly.
|
||||
return SVGAnimatedNumber::create(realm(), 0, 0);
|
||||
if (!m_stop_offset)
|
||||
m_stop_offset = SVGAnimatedNumber::create(realm(), *this, AttributeNames::offset, 0.f);
|
||||
return *m_stop_offset;
|
||||
}
|
||||
|
||||
void SVGStopElement::initialize(JS::Realm& realm)
|
||||
|
@ -81,4 +74,10 @@ void SVGStopElement::initialize(JS::Realm& realm)
|
|||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
void SVGStopElement::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_stop_offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue