mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Add the bare minimum to render SVGAElement (<a>
)
This commit is contained in:
parent
ae906ca497
commit
85a4cfc59b
Notes:
sideshowbarker
2024-07-17 14:33:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/85a4cfc59b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/258
9 changed files with 87 additions and 3 deletions
|
@ -6,9 +6,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
frag 1 from TextNode start: 0, length: 1, rect: [310,146 8x17] baseline: 13.296875
|
||||
" "
|
||||
frag 2 from BlockContainer start: 0, length: 0, rect: [319,51 0x108] baseline: 110
|
||||
SVGSVGBox <svg> at (9,9) content-size 300x150 [SVG] children: inline
|
||||
InlineNode <a>
|
||||
SVGTextBox <text> (not painted) children: inline
|
||||
SVGSVGBox <svg> at (9,9) content-size 300x150 [SVG] children: not-inline
|
||||
SVGGraphicsBox <a> at (29,25.015625) content-size 193.59375x67.578125 children: not-inline
|
||||
SVGTextBox <text> at (29,25.015625) content-size 193.59375x67.578125 children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
BlockContainer <math> at (319,51) content-size 0x108 children: not-inline
|
||||
|
@ -28,6 +28,8 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x201]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x155]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 302x152]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<a>) [29,25.015625 193.59375x67.578125]
|
||||
SVGPathPaintable (SVGTextBox<text>) [29,25.015625 193.59375x67.578125]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<math>) [318,50 2x110] overflow: [319,51 100x100]
|
||||
PaintableWithLines (BlockContainer<a>) [319,51 100x100]
|
||||
|
|
|
@ -616,6 +616,7 @@ set(SOURCES
|
|||
Streams/WritableStreamDefaultWriter.cpp
|
||||
SVG/AttributeNames.cpp
|
||||
SVG/AttributeParser.cpp
|
||||
SVG/SVGAElement.cpp
|
||||
SVG/SVGAnimatedLength.cpp
|
||||
SVG/SVGAnimatedNumber.cpp
|
||||
SVG/SVGAnimatedRect.cpp
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
#include <LibWeb/MathML/MathMLElement.h>
|
||||
#include <LibWeb/MathML/TagNames.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/SVG/SVGAElement.h>
|
||||
#include <LibWeb/SVG/SVGCircleElement.h>
|
||||
#include <LibWeb/SVG/SVGClipPathElement.h>
|
||||
#include <LibWeb/SVG/SVGDefsElement.h>
|
||||
|
@ -482,6 +483,8 @@ static JS::GCPtr<SVG::SVGElement> create_svg_element(JS::Realm& realm, Document&
|
|||
return realm.heap().allocate<SVG::SVGUseElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::script)
|
||||
return realm.heap().allocate<SVG::SVGScriptElement>(realm, document, move(qualified_name));
|
||||
if (local_name == SVG::TagNames::a)
|
||||
return realm.heap().allocate<SVG::SVGAElement>(realm, document, move(qualified_name));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <LibWeb/Layout/SVGFormattingContext.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
#include <LibWeb/Layout/SVGMaskBox.h>
|
||||
#include <LibWeb/SVG/SVGAElement.h>
|
||||
#include <LibWeb/SVG/SVGClipPathElement.h>
|
||||
#include <LibWeb/SVG/SVGForeignObjectElement.h>
|
||||
#include <LibWeb/SVG/SVGGElement.h>
|
||||
|
@ -154,6 +155,8 @@ static bool is_container_element(Node const& node)
|
|||
auto* dom_node = node.dom_node();
|
||||
if (!dom_node)
|
||||
return false;
|
||||
if (is<SVG::SVGAElement>(dom_node))
|
||||
return true;
|
||||
if (is<SVG::SVGUseElement>(dom_node))
|
||||
return true;
|
||||
if (is<SVG::SVGSymbolElement>(dom_node))
|
||||
|
|
26
Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
Normal file
26
Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
||||
#include <LibWeb/SVG/SVGAElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGAElement);
|
||||
|
||||
SVGAElement::SVGAElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
}
|
||||
|
||||
SVGAElement::~SVGAElement() = default;
|
||||
|
||||
JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
}
|
25
Userland/Libraries/LibWeb/SVG/SVGAElement.h
Normal file
25
Userland/Libraries/LibWeb/SVG/SVGAElement.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
class SVGAElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGAElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGAElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGAElement() override;
|
||||
|
||||
SVGAElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
};
|
||||
|
||||
}
|
22
Userland/Libraries/LibWeb/SVG/SVGAElement.idl
Normal file
22
Userland/Libraries/LibWeb/SVG/SVGAElement.idl
Normal file
|
@ -0,0 +1,22 @@
|
|||
#import <HTML/HTMLHyperlinkElementUtils.idl>
|
||||
#import <SVG/SVGURIReference.idl>
|
||||
|
||||
[Exposed=Window]
|
||||
interface SVGAElement : SVGGraphicsElement {
|
||||
|
||||
[FIXME, SameObject] readonly attribute SVGAnimatedString target;
|
||||
[FIXME] attribute DOMString download;
|
||||
[FIXME] attribute USVString ping;
|
||||
[FIXME] attribute DOMString rel;
|
||||
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
|
||||
[FIXME] attribute DOMString hreflang;
|
||||
[FIXME] attribute DOMString type;
|
||||
|
||||
[FIXME] attribute DOMString text;
|
||||
|
||||
[FIXME] attribute DOMString referrerPolicy;
|
||||
|
||||
};
|
||||
|
||||
// FIXME: SVGAElement includes SVGURIReference;
|
||||
// FIXME: SVGAElement includes HTMLHyperlinkElementUtils;
|
|
@ -12,6 +12,7 @@
|
|||
namespace Web::SVG::TagNames {
|
||||
|
||||
#define ENUMERATE_SVG_GRAPHICS_TAGS \
|
||||
__ENUMERATE_SVG_TAG(a) \
|
||||
__ENUMERATE_SVG_TAG(circle) \
|
||||
__ENUMERATE_SVG_TAG(ellipse) \
|
||||
__ENUMERATE_SVG_TAG(g) \
|
||||
|
|
|
@ -250,6 +250,7 @@ libweb_js_bindings(Streams/TransformStreamDefaultController)
|
|||
libweb_js_bindings(Streams/WritableStream)
|
||||
libweb_js_bindings(Streams/WritableStreamDefaultController)
|
||||
libweb_js_bindings(Streams/WritableStreamDefaultWriter)
|
||||
libweb_js_bindings(SVG/SVGAElement)
|
||||
libweb_js_bindings(SVG/SVGAnimatedLength)
|
||||
libweb_js_bindings(SVG/SVGAnimatedNumber)
|
||||
libweb_js_bindings(SVG/SVGAnimatedRect)
|
||||
|
|
Loading…
Add table
Reference in a new issue