mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 06:59:47 +00:00
LibWeb: Implement <feOffset>
SVG filter
This commit is contained in:
parent
89b59cb5c3
commit
1377dba7af
Notes:
github-actions[bot]
2025-08-07 14:43:35 +00:00
Author: https://github.com/gmta
Commit: 1377dba7af
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5742
11 changed files with 141 additions and 0 deletions
63
Libraries/LibWeb/SVG/SVGFEOffsetElement.cpp
Normal file
63
Libraries/LibWeb/SVG/SVGFEOffsetElement.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGFEOffsetElementPrototype.h>
|
||||
#include <LibWeb/SVG/SVGFEOffsetElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(SVGFEOffsetElement);
|
||||
|
||||
SVGFEOffsetElement::SVGFEOffsetElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, qualified_name)
|
||||
{
|
||||
}
|
||||
|
||||
void SVGFEOffsetElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEOffsetElement);
|
||||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
void SVGFEOffsetElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
SVGFilterPrimitiveStandardAttributes::visit_edges(visitor);
|
||||
visitor.visit(m_in1);
|
||||
visitor.visit(m_dx);
|
||||
visitor.visit(m_dy);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/filter-effects-1/#dom-svgfeoffsetelement-in1
|
||||
GC::Ref<SVGAnimatedString> SVGFEOffsetElement::in1()
|
||||
{
|
||||
if (!m_in1)
|
||||
m_in1 = SVGAnimatedString::create(realm(), *this, AttributeNames::in);
|
||||
|
||||
return *m_in1;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/filter-effects-1/#dom-svgfeoffsetelement-dx
|
||||
GC::Ref<SVGAnimatedNumber> SVGFEOffsetElement::dx()
|
||||
{
|
||||
if (!m_dx) {
|
||||
m_dx = SVGAnimatedNumber::create(realm(), *this, AttributeNames::dx, 0.f,
|
||||
SVGAnimatedNumber::SupportsSecondValue::Yes, SVGAnimatedNumber::ValueRepresented::First);
|
||||
}
|
||||
return *m_dx;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/filter-effects-1/#dom-svgfeoffsetelement-dy
|
||||
GC::Ref<SVGAnimatedNumber> SVGFEOffsetElement::dy()
|
||||
{
|
||||
if (!m_dy) {
|
||||
m_dy = SVGAnimatedNumber::create(realm(), *this, AttributeNames::dy, 0.f,
|
||||
SVGAnimatedNumber::SupportsSecondValue::Yes, SVGAnimatedNumber::ValueRepresented::Second);
|
||||
}
|
||||
return *m_dy;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue