-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb/SVG: Implement SVGAnimatedInteger type
- Loading branch information
1 parent
53314b1
commit 2970ac9
Showing
8 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#include <LibWeb/Bindings/Intrinsics.h> | ||
#include <LibWeb/Bindings/SVGAnimatedIntegerPrototype.h> | ||
#include <LibWeb/SVG/SVGAnimatedInteger.h> | ||
|
||
namespace Web::SVG { | ||
|
||
JS_DEFINE_ALLOCATOR(SVGAnimatedInteger); | ||
|
||
JS::NonnullGCPtr<SVGAnimatedInteger> SVGAnimatedInteger::create(JS::Realm& realm, u32 base_val, u32 anim_val) | ||
{ | ||
return realm.heap().allocate<SVGAnimatedInteger>(realm, realm, base_val, anim_val); | ||
} | ||
|
||
SVGAnimatedInteger::SVGAnimatedInteger(JS::Realm& realm, u32 base_val, u32 anim_val) | ||
: PlatformObject(realm) | ||
, m_base_val(base_val) | ||
, m_anim_val(anim_val) | ||
{ | ||
} | ||
|
||
SVGAnimatedInteger::~SVGAnimatedInteger() = default; | ||
|
||
void SVGAnimatedInteger::initialize(JS::Realm& realm) | ||
{ | ||
Base::initialize(realm); | ||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedInteger); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <LibWeb/Bindings/PlatformObject.h> | ||
|
||
namespace Web::SVG { | ||
|
||
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedInteger | ||
class SVGAnimatedInteger final : public Bindings::PlatformObject { | ||
WEB_PLATFORM_OBJECT(SVGAnimatedInteger, Bindings::PlatformObject); | ||
JS_DECLARE_ALLOCATOR(SVGAnimatedInteger); | ||
|
||
public: | ||
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedInteger> create(JS::Realm&, u32 base_val, u32 anim_val); | ||
virtual ~SVGAnimatedInteger() override; | ||
|
||
u32 base_val() const { return m_base_val; } | ||
u32 anim_val() const { return m_anim_val; } | ||
|
||
void set_base_val(u32 base_val) { m_base_val = base_val; } | ||
|
||
private: | ||
SVGAnimatedInteger(JS::Realm&, u32 base_val, u32 anim_val); | ||
|
||
virtual void initialize(JS::Realm&) override; | ||
|
||
u32 m_base_val; | ||
u32 m_anim_val; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[Exposed=Window] | ||
interface SVGAnimatedInteger { | ||
attribute long baseVal; | ||
readonly attribute long animVal; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters