mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:37:35 +00:00
LibWeb: Implement the SVGAnimatedLength type
This commit is contained in:
parent
ebf3829f1c
commit
7a6b4e33ba
5 changed files with 71 additions and 0 deletions
|
@ -310,6 +310,7 @@ set(SOURCES
|
|||
ResizeObserver/ResizeObserver.cpp
|
||||
SVG/AttributeNames.cpp
|
||||
SVG/AttributeParser.cpp
|
||||
SVG/SVGAnimatedLength.cpp
|
||||
SVG/SVGElement.cpp
|
||||
SVG/SVGGElement.cpp
|
||||
SVG/SVGGeometryElement.cpp
|
||||
|
@ -571,6 +572,7 @@ libweb_js_wrapper(IntersectionObserver/IntersectionObserver)
|
|||
libweb_js_wrapper(NavigationTiming/PerformanceTiming)
|
||||
libweb_js_wrapper(RequestIdleCallback/IdleDeadline)
|
||||
libweb_js_wrapper(ResizeObserver/ResizeObserver)
|
||||
libweb_js_wrapper(SVG/SVGAnimatedLength)
|
||||
libweb_js_wrapper(SVG/SVGElement)
|
||||
libweb_js_wrapper(SVG/SVGGeometryElement)
|
||||
libweb_js_wrapper(SVG/SVGGraphicsElement)
|
||||
|
|
|
@ -286,6 +286,7 @@ class ResizeObserver;
|
|||
}
|
||||
|
||||
namespace Web::SVG {
|
||||
class SVGAnimatedLength;
|
||||
class SVGCircleElement;
|
||||
class SVGElement;
|
||||
class SVGEllipseElement;
|
||||
|
@ -510,6 +511,7 @@ class StyleSheetListWrapper;
|
|||
class StyleSheetWrapper;
|
||||
class SubmitEventWrapper;
|
||||
class SubtleCryptoWrapper;
|
||||
class SVGAnimatedLengthWrapper;
|
||||
class SVGCircleElementWrapper;
|
||||
class SVGElementWrapper;
|
||||
class SVGEllipseElementWrapper;
|
||||
|
|
24
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
Normal file
24
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
NonnullRefPtr<SVGAnimatedLength> SVGAnimatedLength::create(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val)
|
||||
{
|
||||
return adopt_ref(*new SVGAnimatedLength(move(base_val), move(anim_val)));
|
||||
}
|
||||
|
||||
SVGAnimatedLength::SVGAnimatedLength(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val)
|
||||
: m_base_val(move(base_val))
|
||||
, m_anim_val(move(anim_val))
|
||||
{
|
||||
// The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
|
||||
VERIFY(m_base_val.ptr() != m_anim_val.ptr());
|
||||
}
|
||||
|
||||
}
|
37
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h
Normal file
37
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/SVG/SVGLength.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedLength
|
||||
class SVGAnimatedLength
|
||||
: public RefCounted<SVGAnimatedLength>
|
||||
, public Bindings::Wrappable
|
||||
, public Weakable<SVGAnimatedLength> {
|
||||
public:
|
||||
using WrapperType = Bindings::SVGAnimatedLengthWrapper;
|
||||
|
||||
static NonnullRefPtr<SVGAnimatedLength> create(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val);
|
||||
virtual ~SVGAnimatedLength() = default;
|
||||
|
||||
NonnullRefPtr<SVGLength> const& base_val() const { return m_base_val; }
|
||||
NonnullRefPtr<SVGLength> const& anim_val() const { return m_anim_val; }
|
||||
|
||||
private:
|
||||
SVGAnimatedLength(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val);
|
||||
|
||||
NonnullRefPtr<SVGLength> m_base_val;
|
||||
NonnullRefPtr<SVGLength> m_anim_val;
|
||||
};
|
||||
|
||||
}
|
6
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.idl
Normal file
6
Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.idl
Normal file
|
@ -0,0 +1,6 @@
|
|||
#import <SVG/SVGLength.idl>
|
||||
|
||||
interface SVGAnimatedLength {
|
||||
readonly attribute SVGLength baseVal;
|
||||
readonly attribute SVGLength animVal;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue