mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibWeb/SVG: Implement <metadata> element
This commit is contained in:
parent
b3fa8f0ce2
commit
e2f599ebee
Notes:
github-actions[bot]
2024-08-17 05:41:34 +00:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/e2f599ebee6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1092
11 changed files with 75 additions and 0 deletions
|
@ -25,6 +25,7 @@ source_set("SVG") {
|
|||
"SVGLineElement.cpp",
|
||||
"SVGLinearGradientElement.cpp",
|
||||
"SVGMaskElement.cpp",
|
||||
"SVGMetadataElement.cpp",
|
||||
"SVGPathElement.cpp",
|
||||
"SVGPolygonElement.cpp",
|
||||
"SVGPolylineElement.cpp",
|
||||
|
|
|
@ -289,6 +289,7 @@ standard_idl_files = [
|
|||
"//Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGLineElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGMaskElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGMetadataElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGPathElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGPolygonElement.idl",
|
||||
"//Userland/Libraries/LibWeb/SVG/SVGPolylineElement.idl",
|
||||
|
|
|
@ -287,6 +287,7 @@ SVGLineElement
|
|||
SVGLinearGradientElement
|
||||
SVGMaskElement
|
||||
SVGMatrix
|
||||
SVGMetadataElement
|
||||
SVGPathElement
|
||||
SVGPoint
|
||||
SVGPolygonElement
|
||||
|
|
|
@ -654,6 +654,7 @@ set(SOURCES
|
|||
SVG/SVGLineElement.cpp
|
||||
SVG/SVGLinearGradientElement.cpp
|
||||
SVG/SVGMaskElement.cpp
|
||||
SVG/SVGMetadataElement.cpp
|
||||
SVG/SVGPolygonElement.cpp
|
||||
SVG/SVGPolylineElement.cpp
|
||||
SVG/SVGRectElement.cpp
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#include <LibWeb/SVG/SVGLineElement.h>
|
||||
#include <LibWeb/SVG/SVGLinearGradientElement.h>
|
||||
#include <LibWeb/SVG/SVGMaskElement.h>
|
||||
#include <LibWeb/SVG/SVGMetadataElement.h>
|
||||
#include <LibWeb/SVG/SVGPathElement.h>
|
||||
#include <LibWeb/SVG/SVGPolygonElement.h>
|
||||
#include <LibWeb/SVG/SVGPolylineElement.h>
|
||||
|
@ -453,6 +454,8 @@ static JS::GCPtr<SVG::SVGElement> create_svg_element(JS::Realm& realm, Document&
|
|||
return realm.heap().allocate<SVG::SVGLinearGradientElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::mask)
|
||||
return realm.heap().allocate<SVG::SVGMaskElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::metadata)
|
||||
return realm.heap().allocate<SVG::SVGMetadataElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::path)
|
||||
return realm.heap().allocate<SVG::SVGPathElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::polygon)
|
||||
|
|
|
@ -682,6 +682,7 @@ class SVGGraphicsElement;
|
|||
class SVGLength;
|
||||
class SVGLineElement;
|
||||
class SVGMaskElement;
|
||||
class SVGMetadataElement;
|
||||
class SVGPathElement;
|
||||
class SVGPolygonElement;
|
||||
class SVGPolylineElement;
|
||||
|
|
33
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.cpp
Normal file
33
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SVGMetadataElementPrototype.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/SVG/SVGMetadataElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGMetadataElement);
|
||||
|
||||
SVGMetadataElement::SVGMetadataElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
}
|
||||
|
||||
void SVGMetadataElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGMetadataElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGMetadataElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
26
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.h
Normal file
26
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
// https://svgwg.org/svg2-draft/struct.html#InterfaceSVGMetadataElement
|
||||
class SVGMetadataElement final : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGMetadataElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGMetadataElement);
|
||||
|
||||
private:
|
||||
SVGMetadataElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
};
|
||||
|
||||
}
|
6
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.idl
Normal file
6
Userland/Libraries/LibWeb/SVG/SVGMetadataElement.idl
Normal file
|
@ -0,0 +1,6 @@
|
|||
#import <SVG/SVGElement.idl>
|
||||
|
||||
// https://svgwg.org/svg2-draft/struct.html#InterfaceSVGMetadataElement
|
||||
[Exposed=Window]
|
||||
interface SVGMetadataElement : SVGElement {
|
||||
};
|
|
@ -34,6 +34,7 @@ namespace Web::SVG::TagNames {
|
|||
__ENUMERATE_SVG_TAG(foreignObject) \
|
||||
__ENUMERATE_SVG_TAG(linearGradient) \
|
||||
__ENUMERATE_SVG_TAG(mask) \
|
||||
__ENUMERATE_SVG_TAG(metadata) \
|
||||
__ENUMERATE_SVG_TAG(radialGradient) \
|
||||
__ENUMERATE_SVG_TAG(script) \
|
||||
__ENUMERATE_SVG_TAG(stop) \
|
||||
|
|
|
@ -278,6 +278,7 @@ libweb_js_bindings(SVG/SVGLength)
|
|||
libweb_js_bindings(SVG/SVGLineElement)
|
||||
libweb_js_bindings(SVG/SVGLinearGradientElement)
|
||||
libweb_js_bindings(SVG/SVGMaskElement)
|
||||
libweb_js_bindings(SVG/SVGMetadataElement)
|
||||
libweb_js_bindings(SVG/SVGPathElement)
|
||||
libweb_js_bindings(SVG/SVGPolygonElement)
|
||||
libweb_js_bindings(SVG/SVGPolylineElement)
|
||||
|
|
Loading…
Reference in a new issue