mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/SVG: Implement SVGImageElement
This element allows images to be embedded within SVGs.
This commit is contained in:
parent
267420d5aa
commit
03bbc2b111
Notes:
github-actions[bot]
2024-08-29 04:29:33 +00:00
Author: https://github.com/tcl3
Commit: 03bbc2b111
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1198
17 changed files with 490 additions and 8 deletions
|
@ -16,11 +16,13 @@
|
|||
#include <LibWeb/Layout/SVGClipBox.h>
|
||||
#include <LibWeb/Layout/SVGFormattingContext.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
#include <LibWeb/Layout/SVGImageBox.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>
|
||||
#include <LibWeb/SVG/SVGImageElement.h>
|
||||
#include <LibWeb/SVG/SVGMaskElement.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
#include <LibWeb/SVG/SVGSymbolElement.h>
|
||||
|
@ -405,6 +407,8 @@ void SVGFormattingContext::layout_graphics_element(SVGGraphicsBox const& graphic
|
|||
// 5.2. Grouping: the ‘g’ element
|
||||
// The ‘g’ element is a container element for grouping together related graphics elements.
|
||||
layout_container_element(graphics_box);
|
||||
} else if (is<SVGImageBox>(graphics_box)) {
|
||||
layout_image_element(static_cast<SVGImageBox const&>(graphics_box));
|
||||
} else {
|
||||
// Assume this is a path-like element.
|
||||
layout_path_like_element(graphics_box);
|
||||
|
@ -417,6 +421,18 @@ void SVGFormattingContext::layout_graphics_element(SVGGraphicsBox const& graphic
|
|||
layout_mask_or_clip(*clip_box);
|
||||
}
|
||||
|
||||
void SVGFormattingContext::layout_image_element(SVGImageBox const& image_box)
|
||||
{
|
||||
auto& box_state = m_state.get_mutable(image_box);
|
||||
auto bounding_box = image_box.dom_node().bounding_box();
|
||||
box_state.set_content_x(bounding_box.x());
|
||||
box_state.set_content_y(bounding_box.y());
|
||||
box_state.set_content_width(bounding_box.width());
|
||||
box_state.set_content_height(bounding_box.height());
|
||||
box_state.set_has_definite_width(true);
|
||||
box_state.set_has_definite_height(true);
|
||||
}
|
||||
|
||||
void SVGFormattingContext::layout_mask_or_clip(SVGBox const& mask_or_clip)
|
||||
{
|
||||
SVG::SVGUnits content_units {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue