This mapping has 86 all-to-all groups: every node on one side corresponds to every node on the other, and none is deleted or inserted. Each member carries an all N:M badge; selecting one highlights all of its counterparts, in the tree and in the code view alike.

Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–17 unchanged (17 lines)
18#include <LibWeb/Layout/DominantBaseline.h>
19#include <LibWeb/Layout/SVGClipBox.h>
20#include <LibWeb/Layout/SVGFormattingContext.h>
21#include <LibWeb/Layout/SVGGeometryBox.h>
22#include <LibWeb/Layout/SVGImageBox.h>
23#include <LibWeb/Layout/SVGMaskBox.h>
24#include <LibWeb/Layout/Viewport.h>
25#include <LibWeb/SVG/SVGAElement.h>
26#include <LibWeb/SVG/SVGClipPathElement.h>
27#include <LibWeb/SVG/SVGForeignObjectElement.h>
28#include <LibWeb/SVG/SVGGElement.h>
29#include <LibWeb/SVG/SVGImageElement.h>
30#include <LibWeb/SVG/SVGMaskElement.h>
…lines 31–199 unchanged (169 lines)
200 // I'm not sure if this is good or bad, but our viewport transform logic depends on it.
201 svg_box_state.set_has_definite_width(true);
202 svg_box_state.set_has_definite_height(true);
203
204 auto* dom_node = context_box().dom_node();
205 VERIFY(dom_node);
206 auto& svg_graphics_element = as<SVG::SVGGraphicsElement>(*dom_node);
207 auto active_view_box = svg_graphics_element.active_view_box();
208 // https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute
209 if (active_view_box.has_value()) {
210 if (active_view_box->width < 0 || active_view_box->height < 0) {
211 // A negative value for <width> or <height> is an error and invalidates the ‘viewBox’ attribute.
212 active_view_box = {};
213 } else if (active_view_box->width == 0 || active_view_box->height == 0) {
214 // A value of zero disables rendering of the element.
…lines 215–451 unchanged (237 lines)
452}
453
454Gfx::AffineTransform SVGFormattingContext::get_parent_svg_transform(SVGGraphicsBox const& box) const
455{
456 // Mask/clip boxes are transform boundaries — the target's transform is applied separately at paint time.
457 for (auto* ancestor = box.parent(); ancestor; ancestor = ancestor->parent()) {
458 if (is<SVGMaskBox>(*ancestor) || is<SVGClipBox>(*ancestor))
459 return {};
460 if (auto const* svg_graphics_ancestor = as_if<SVGGraphicsBox>(*ancestor)) {
461 auto const& ancestor_state = m_state.get(*svg_graphics_ancestor);
462 if (ancestor_state.computed_svg_transforms().has_value())
463 return ancestor_state.computed_svg_transforms()->svg_transform();
464 }
…lines 465–486 unchanged (22 lines)
487
488 if (auto* mask_box = graphics_box.first_child_of_type<SVGMaskBox>())
489 layout_mask_or_clip(*mask_box);
490
491 if (auto* clip_box = graphics_box.first_child_of_type<SVGClipBox>())
492 layout_mask_or_clip(*clip_box);
493}
494
495void SVGFormattingContext::layout_image_element(SVGImageBox const& image_box)
496{
497 auto& box_state = m_state.get_mutable(image_box);
498 VERIFY(box_state.computed_svg_transforms().has_value());
499
…lines 500–513 unchanged (14 lines)
514{
515 SVG::SVGUnits content_units {};
516 if (is<SVGMaskBox>(mask_or_clip))
517 content_units = static_cast<SVGMaskBox const&>(mask_or_clip).dom_node().mask_content_units();
518 else if (is<SVGClipBox>(mask_or_clip))
519 content_units = static_cast<SVGClipBox const&>(mask_or_clip).dom_node().clip_path_units();
520 else
521 VERIFY_NOT_REACHED();
522 // FIXME: Somehow limit <clipPath> contents to: shape elements, <text>, and <use>.
523 auto& layout_state = m_state.get_mutable(mask_or_clip);
524 auto parent_viewbox_transform = m_current_viewbox_transform;
525 if (content_units == SVG::SVGUnits::ObjectBoundingBox) {
526 auto* parent_node = mask_or_clip.parent();
527 auto& parent_node_state = m_state.get(*parent_node);
528 layout_state.set_content_width(parent_node_state.content_width());
529 layout_state.set_content_height(parent_node_state.content_height());
530 parent_viewbox_transform = Gfx::AffineTransform {}.translate(parent_node_state.offset.to_type<float>());
531 } else {
532 layout_state.set_content_width(m_viewport_size.width());
533 layout_state.set_content_height(m_viewport_size.height());
534 }
535 // Pretend masks/clips are a viewport so we can scale the contents depending on the `contentUnits`.
536 SVGFormattingContext nested_context(m_state, m_layout_mode, mask_or_clip, this, parent_viewbox_transform);
…lines 537–540 unchanged (4 lines)
541
542void SVGFormattingContext::layout_container_element(SVGBox const& container)
543{
544 auto& box_state = m_state.get_mutable(container);
545 Gfx::BoundingBox<CSSPixels> bounding_box;
546 container.for_each_child_of_type<Box>([&](Box const& child) {
547 // Masks/clips do not change the bounding box of their parents.
548 if (is<SVGMaskBox>(child) || is<SVGClipBox>(child))
549 return IterationDecision::Continue;
550 layout_svg_element(child);
551 auto& child_state = m_state.get(child);
552 bounding_box.add_point(child_state.offset);
553 bounding_box.add_point(child_state.offset.translated(child_state.content_width(), child_state.content_height()));
554 return IterationDecision::Continue;
…lines 555–565 unchanged (11 lines)

After

…lines 1–17 unchanged (17 lines)
18#include <LibWeb/Layout/DominantBaseline.h>
19#include <LibWeb/Layout/SVGClipBox.h>
20#include <LibWeb/Layout/SVGFormattingContext.h>
21#include <LibWeb/Layout/SVGGeometryBox.h>
22#include <LibWeb/Layout/SVGImageBox.h>
23#include <LibWeb/Layout/SVGMaskBox.h>
24#include <LibWeb/Layout/SVGPatternBox.h>
25#include <LibWeb/Layout/Viewport.h>
26#include <LibWeb/SVG/SVGAElement.h>
27#include <LibWeb/SVG/SVGClipPathElement.h>
28#include <LibWeb/SVG/SVGForeignObjectElement.h>
29#include <LibWeb/SVG/SVGGElement.h>
30#include <LibWeb/SVG/SVGImageElement.h>
…lines 31–200 unchanged (170 lines)
201 // I'm not sure if this is good or bad, but our viewport transform logic depends on it.
202 svg_box_state.set_has_definite_width(true);
203 svg_box_state.set_has_definite_height(true);
204
205 auto* dom_node = context_box().dom_node();
206 VERIFY(dom_node);
207 Optional<SVG::ViewBox> active_view_box;
208 if (auto* svg_graphics_element = as_if<SVG::SVGGraphicsElement>(*dom_node))
209 active_view_box = svg_graphics_element->active_view_box();
210 else if (auto* svg_fit_to_view_box = as_if<SVG::SVGFitToViewBox>(*dom_node))
211 active_view_box = svg_fit_to_view_box->view_box();
212 // https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute
213 if (active_view_box.has_value()) {
214 if (active_view_box->width < 0 || active_view_box->height < 0) {
215 // A negative value for <width> or <height> is an error and invalidates the ‘viewBox’ attribute.
216 active_view_box = {};
217 } else if (active_view_box->width == 0 || active_view_box->height == 0) {
…lines 218–455 unchanged (238 lines)
456}
457
458Gfx::AffineTransform SVGFormattingContext::get_parent_svg_transform(SVGGraphicsBox const& box) const
459{
460 // Mask/clip boxes are transform boundaries — the target's transform is applied separately at paint time.
461 for (auto* ancestor = box.parent(); ancestor; ancestor = ancestor->parent()) {
462 if (is<SVGMaskBox>(*ancestor) || is<SVGClipBox>(*ancestor) || is<SVGPatternBox>(*ancestor))
463 return {};
464 if (auto const* svg_graphics_ancestor = as_if<SVGGraphicsBox>(*ancestor)) {
465 auto const& ancestor_state = m_state.get(*svg_graphics_ancestor);
466 if (ancestor_state.computed_svg_transforms().has_value())
467 return ancestor_state.computed_svg_transforms()->svg_transform();
468 }
…lines 469–491 unchanged (23 lines)
492 if (auto* mask_box = graphics_box.first_child_of_type<SVGMaskBox>())
493 layout_mask_or_clip(*mask_box);
494
495 if (auto* clip_box = graphics_box.first_child_of_type<SVGClipBox>())
496 layout_mask_or_clip(*clip_box);
497
498 graphics_box.for_each_child_of_type<SVGPatternBox>([&](auto const& pattern_box) {
499 layout_mask_or_clip(pattern_box);
500 return IterationDecision::Continue;
501 });
502}
503
504void SVGFormattingContext::layout_image_element(SVGImageBox const& image_box)
505{
506 auto& box_state = m_state.get_mutable(image_box);
507 VERIFY(box_state.computed_svg_transforms().has_value());
…lines 508–522 unchanged (15 lines)
523{
524 SVG::SVGUnits content_units {};
525 if (is<SVGMaskBox>(mask_or_clip))
526 content_units = static_cast<SVGMaskBox const&>(mask_or_clip).dom_node().mask_content_units();
527 else if (is<SVGClipBox>(mask_or_clip))
528 content_units = static_cast<SVGClipBox const&>(mask_or_clip).dom_node().clip_path_units();
529 else if (is<SVGPatternBox>(mask_or_clip))
530 content_units = static_cast<SVGPatternBox const&>(mask_or_clip).dom_node().pattern_content_units();
531 else
532 VERIFY_NOT_REACHED();
533 // FIXME: Somehow limit <clipPath> contents to: shape elements, <text>, and <use>.
534 auto& layout_state = m_state.get_mutable(mask_or_clip);
535 auto parent_viewbox_transform = m_current_viewbox_transform;
536
537 auto const* pattern_box = as_if<SVGPatternBox>(mask_or_clip);
538 if (pattern_box && pattern_box->dom_node().view_box().has_value()) {
539 auto const& pattern = pattern_box->dom_node();
540 if (pattern.pattern_units() == SVG::SVGUnits::UserSpaceOnUse) {
541 layout_state.set_content_width(CSSPixels::nearest_value_for(pattern.pattern_width().resolve_relative_to(m_viewport_size.width().to_float())));
542 layout_state.set_content_height(CSSPixels::nearest_value_for(pattern.pattern_height().resolve_relative_to(m_viewport_size.height().to_float())));
543 } else {
544 auto& parent_node_state = m_state.get(*mask_or_clip.parent());
545 layout_state.set_content_width(CSSPixels::nearest_value_for(pattern.pattern_width().value() * parent_node_state.content_width().to_double()));
546 layout_state.set_content_height(CSSPixels::nearest_value_for(pattern.pattern_height().value() * parent_node_state.content_height().to_double()));
547 parent_viewbox_transform = Gfx::AffineTransform {}.translate(parent_node_state.offset.to_type<float>());
548 }
549 } else if (content_units == SVG::SVGUnits::ObjectBoundingBox) {
550 auto& parent_node_state = m_state.get(*mask_or_clip.parent());
551 layout_state.set_content_width(parent_node_state.content_width());
552 layout_state.set_content_height(parent_node_state.content_height());
553 // https://svgwg.org/svg2-draft/pservers.html#PatternElementPatternContentUnitsAttribute
554 parent_viewbox_transform = Gfx::AffineTransform {}.translate(parent_node_state.offset.to_type<float>());
555 if (pattern_box)
556 parent_viewbox_transform.scale(parent_node_state.content_width().to_float(), parent_node_state.content_height().to_float());
557 } else {
558 layout_state.set_content_width(m_viewport_size.width());
559 layout_state.set_content_height(m_viewport_size.height());
560 }
561 // Pretend masks/clips are a viewport so we can scale the contents depending on the `contentUnits`.
562 SVGFormattingContext nested_context(m_state, m_layout_mode, mask_or_clip, this, parent_viewbox_transform);
…lines 563–566 unchanged (4 lines)
567
568void SVGFormattingContext::layout_container_element(SVGBox const& container)
569{
570 auto& box_state = m_state.get_mutable(container);
571 Gfx::BoundingBox<CSSPixels> bounding_box;
572 container.for_each_child_of_type<Box>([&](Box const& child) {
573 // Masks/clips/patterns do not change the bounding box of their parents.
574 if (is<SVGMaskBox>(child) || is<SVGClipBox>(child) || is<SVGPatternBox>(child))
575 return IterationDecision::Continue;
576 layout_svg_element(child);
577 auto& child_state = m_state.get(child);
578 bounding_box.add_point(child_state.offset);
579 bounding_box.add_point(child_state.offset.translated(child_state.content_width(), child_state.content_height()));
580 return IterationDecision::Continue;
…lines 581–591 unchanged (11 lines)

Before

translation_unit
comment "/*\n * Copyright (c) 2021-2023, Andreas Kling <andreas@ladybi"...
preproc_include
#include "#include"
system_lib_string "<AK/Debug.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/BoundingBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/Font/Font.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/Path.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/TextLayout.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/DOM/Document.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/BlockFormattingContext.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/DominantBaseline.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGClipBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGFormattingContext.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGGeometryBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGImageBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGMaskBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/Viewport.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGAElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGClipPathElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGForeignObjectElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGGElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGImageElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGMaskElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGSVGElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGSymbolElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGUseElement.h>"
namespace_definition
namespace "namespace"
nested_namespace_specifier
namespace_identifier "Web"
:: "::"
namespace_identifier "Layout"
declaration_list
{ "{"
function_definition (+68 nodes collapsed)
function_definition
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
destructor_name
~ "~"
identifier "SVGFormattingContext"
parameter_list
( "("
) ")"
default_method_clause
= "="
default "default"
; ";"
function_definition
type_identifier "CSSPixels"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "automatic_content_width"
parameter_list
( "("
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
type_identifier "CSSPixels"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "automatic_content_height"
parameter_list
( "("
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
struct_specifier
struct "struct"
type_identifier "ViewBoxTransform"
field_declaration_list
{ "{"
field_declaration
type_identifier "CSSPixelPoint"
field_identifier "offset"
; ";"
field_declaration
primitive_type "double"
field_identifier "scale_factor_x"
; ";"
field_declaration
primitive_type "double"
field_identifier "scale_factor_y"
; ";"
} "}"
; ";"
comment "// https://svgwg.org/svg2-draft/coords.html#PreserveAspectRa"...
function_definition (+877 nodes collapsed)
function_definition (+173 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "run"
parameter_list
( "("
parameter_declaration
type_identifier "AvailableSpace"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "available_space"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "FORMATTING_CONTEXT_TRACE"
argument_list
( "("
) ")"
; ";"
comment "// NOTE: SVG doesn't have a \"formatting context\" in the spec"...
comment "// obvious way to drive SVG layout in our engine at th"...
declaration (+22 nodes collapsed)
declaration (+23 nodes collapsed)
if_statement (+222 nodes collapsed)
comment "// NOTE: We consider all SVG root elements to have definite "...
comment "// I'm not sure if this is good or bad, but our viewpo"...
expression_statement
call_expression
field_expression
identifier "svg_box_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "svg_box_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
declaration (+21 nodes collapsed)
expression_statement
call_expression
identifier "VERIFY"
argument_list
( "("
identifier "dom_node"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "svg_graphics_element"
= "="
call_expression
template_function
identifier "as"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "SVGGraphicsElement"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "dom_node"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "active_view_box" all 1:3
= "=" all 1:2
call_expression
field_expression
identifier "svg_graphics_element"
. "."
field_identifier "active_view_box"
argument_list
( "("
) ")"
; ";"
comment "// https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute"
if_statement (+79 nodes collapsed)
expression_statement
assignment_expression
identifier "m_current_viewbox_transform"
= "="
identifier "m_parent_viewbox_transform"
; ";"
if_statement (+372 nodes collapsed)
comment "// NOTE: Calculate viewport dimensions BEFORE scaling the co"...
comment "// For userSpaceOnUse clips (which have no viewBox), we need"...
comment "// not the final pixel dimensions. Otherwise, nested clips c"...
declaration (+93 nodes collapsed)
declaration (+93 nodes collapsed)
expression_statement
assignment_expression
identifier "m_available_space"
= "="
identifier "available_space"
; ";"
expression_statement
assignment_expression
identifier "m_svg_offset"
= "="
field_expression
identifier "svg_box_state"
. "."
field_identifier "offset"
; ";"
expression_statement
assignment_expression
identifier "m_viewport_size"
= "="
initializer_list
{ "{"
identifier "viewport_width"
, ","
identifier "viewport_height"
} "}"
; ";"
if_statement (+202 nodes collapsed)
expression_statement (+55 nodes collapsed)
} "}"
function_definition (+580 nodes collapsed)
function_definition (+356 nodes collapsed)
function_definition (+307 nodes collapsed)
function_definition (+170 nodes collapsed)
function_definition (+602 nodes collapsed)
function_definition
qualified_identifier
namespace_identifier "Gfx"
:: "::"
type_identifier "AffineTransform"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "get_parent_svg_transform"
parameter_list
( "("
parameter_declaration
type_identifier "SVGGraphicsBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "box"
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
comment "// Mask/clip boxes are transform boundaries — the target's t"...
for_statement
for "for"
( "("
declaration
placeholder_type_specifier
auto "auto"
init_declarator
pointer_declarator
* "*"
identifier "ancestor"
= "="
call_expression
field_expression
identifier "box"
. "."
field_identifier "parent"
argument_list
( "("
) ")"
; ";"
identifier "ancestor"
; ";"
assignment_expression
identifier "ancestor"
= "="
call_expression
field_expression
identifier "ancestor"
-> "->"
field_identifier "parent"
argument_list
( "("
) ")"
) ")"
compound_statement
{ "{"
if_statement
if "if"
condition_clause
( "("
binary_expression
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "ancestor"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "ancestor"
) ")"
) ")"
return_statement
return "return"
initializer_list
{ "{"
} "}"
; ";"
if_statement (+91 nodes collapsed)
} "}"
return_statement
return "return"
initializer_list
{ "{"
} "}"
; ";"
} "}"
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_graphics_element"
parameter_list
( "("
parameter_declaration
type_identifier "SVGGraphicsBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "graphics_box"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "graphics_box_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "graphics_box"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "parent_svg_transform"
= "="
call_expression
identifier "get_parent_svg_transform"
argument_list
( "("
identifier "graphics_box"
) ")"
; ";"
declaration (+43 nodes collapsed)
expression_statement (+24 nodes collapsed)
if_statement (+84 nodes collapsed)
if_statement (+36 nodes collapsed)
if_statement (+36 nodes collapsed)
} "}"
function_definition (+242 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_mask_or_clip"
parameter_list
( "("
parameter_declaration
type_identifier "SVGBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "mask_or_clip"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "SVGUnits"
init_declarator
identifier "content_units"
initializer_list
{ "{"
} "}"
; ";"
if_statement
if "if"
condition_clause
( "("
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
) ")"
expression_statement (+35 nodes collapsed)
else_clause
else "else"
if_statement
if "if"
condition_clause
( "("
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
) ")"
expression_statement (+35 nodes collapsed)
else_clause
else "else"
expression_statement
call_expression
identifier "VERIFY_NOT_REACHED"
argument_list
( "("
) ")"
; ";"
comment "// FIXME: Somehow limit <clipPath> contents to: shape elemen"...
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "layout_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "mask_or_clip"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "parent_viewbox_transform"
= "="
identifier "m_current_viewbox_transform"
; ";"
if_statement
if "if"
condition_clause
( "("
binary_expression
identifier "content_units"
== "=="
qualified_identifier
namespace_identifier "SVG"
:: "::"
qualified_identifier
namespace_identifier "SVGUnits"
:: "::"
identifier "ObjectBoundingBox"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
pointer_declarator
* "*"
identifier "parent_node"
= "="
call_expression all 1:2
field_expression all 1:2
identifier "mask_or_clip" all 1:2
. "." all 1:2
field_identifier "parent" all 1:2
argument_list all 1:2
( "(" all 1:2
) ")" all 1:2
; ";"
declaration all 1:2
placeholder_type_specifier all 1:2
auto "auto" all 1:2
init_declarator all 1:2
reference_declarator all 1:2
& "&" all 1:2
identifier "parent_node_state" all 1:2
= "=" all 1:2
call_expression all 1:2
field_expression all 1:2
identifier "m_state" all 1:2
. "." all 1:2
field_identifier "get" all 1:2
argument_list all 1:2
( "(" all 1:2
pointer_expression all 1:2
* "*" all 1:2
identifier "parent_node"
) ")" all 1:2
; ";" all 1:2
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_width" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_width"
argument_list
( "("
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_height" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_height"
argument_list
( "("
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement (+37 nodes collapsed) all 1:2
} "}"
else_clause (+41 nodes collapsed)
comment "// Pretend masks/clips are a viewport so we can scale the co"...
declaration (+22 nodes collapsed)
expression_statement
call_expression
field_expression
identifier "layout_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "layout_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "nested_context"
. "."
field_identifier "run"
argument_list
( "("
pointer_expression
* "*"
identifier "m_available_space"
) ")"
; ";"
} "}"
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_container_element"
parameter_list
( "("
parameter_declaration
type_identifier "SVGBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "container"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "box_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "container"
) ")"
; ";"
declaration
qualified_identifier
namespace_identifier "Gfx"
:: "::"
template_type
type_identifier "BoundingBox"
template_argument_list
< "<"
type_descriptor
type_identifier "CSSPixels"
> ">"
identifier "bounding_box"
; ";"
expression_statement
call_expression
field_expression
identifier "container"
. "."
template_method
field_identifier "for_each_child_of_type"
template_argument_list
< "<"
type_descriptor
type_identifier "Box"
> ">"
argument_list
( "("
lambda_expression
lambda_capture_specifier
[ "["
lambda_default_capture
& "&"
] "]"
abstract_function_declarator
parameter_list
( "("
parameter_declaration
type_identifier "Box"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "child"
) ")"
compound_statement
{ "{"
comment "// Masks/clips do not change the bounding box of their paren"...
if_statement
if "if"
condition_clause
( "("
binary_expression
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
identifier "child"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
identifier "child"
) ")"
) ")"
return_statement
return "return"
qualified_identifier
namespace_identifier "IterationDecision"
:: "::"
identifier "Continue"
; ";"
expression_statement
call_expression
identifier "layout_svg_element"
argument_list
( "("
identifier "child"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "child_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get"
argument_list
( "("
identifier "child"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "add_point"
argument_list
( "("
field_expression
identifier "child_state"
. "."
field_identifier "offset"
) ")"
; ";"
expression_statement (+38 nodes collapsed)
return_statement
return "return"
qualified_identifier
namespace_identifier "IterationDecision"
:: "::"
identifier "Continue"
; ";"
} "}"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_x"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "x"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_y"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "y"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_width"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "width"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_height"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "height"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
} "}"
} "}"

After

translation_unit
comment "/*\n * Copyright (c) 2021-2023, Andreas Kling <andreas@ladybi"...
preproc_include
#include "#include"
system_lib_string "<AK/Debug.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/BoundingBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/Font/Font.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/Path.h>"
preproc_include
#include "#include"
system_lib_string "<LibGfx/TextLayout.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/DOM/Document.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/BlockFormattingContext.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/DominantBaseline.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGClipBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGFormattingContext.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGGeometryBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGImageBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGMaskBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/SVGPatternBox.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/Layout/Viewport.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGAElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGClipPathElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGForeignObjectElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGGElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGImageElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGMaskElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGSVGElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGSymbolElement.h>"
preproc_include
#include "#include"
system_lib_string "<LibWeb/SVG/SVGUseElement.h>"
namespace_definition
namespace "namespace"
nested_namespace_specifier
namespace_identifier "Web"
:: "::"
namespace_identifier "Layout"
declaration_list
{ "{"
function_definition (+68 nodes collapsed)
function_definition
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
destructor_name
~ "~"
identifier "SVGFormattingContext"
parameter_list
( "("
) ")"
default_method_clause
= "="
default "default"
; ";"
function_definition
type_identifier "CSSPixels"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "automatic_content_width"
parameter_list
( "("
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
type_identifier "CSSPixels"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "automatic_content_height"
parameter_list
( "("
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
struct_specifier
struct "struct"
type_identifier "ViewBoxTransform"
field_declaration_list
{ "{"
field_declaration
type_identifier "CSSPixelPoint"
field_identifier "offset"
; ";"
field_declaration
primitive_type "double"
field_identifier "scale_factor_x"
; ";"
field_declaration
primitive_type "double"
field_identifier "scale_factor_y"
; ";"
} "}"
; ";"
comment "// https://svgwg.org/svg2-draft/coords.html#PreserveAspectRa"...
function_definition (+877 nodes collapsed)
function_definition (+173 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "run"
parameter_list
( "("
parameter_declaration
type_identifier "AvailableSpace"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "available_space"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "FORMATTING_CONTEXT_TRACE"
argument_list
( "("
) ")"
; ";"
comment "// NOTE: SVG doesn't have a \"formatting context\" in the spec"...
comment "// obvious way to drive SVG layout in our engine at th"...
declaration (+22 nodes collapsed)
declaration (+23 nodes collapsed)
if_statement (+222 nodes collapsed)
comment "// NOTE: We consider all SVG root elements to have definite "...
comment "// I'm not sure if this is good or bad, but our viewpo"...
expression_statement
call_expression
field_expression
identifier "svg_box_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "svg_box_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
declaration (+21 nodes collapsed)
expression_statement
call_expression
identifier "VERIFY"
argument_list
( "("
identifier "dom_node"
) ")"
; ";"
declaration
template_type
type_identifier "Optional"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "ViewBox"
> ">"
identifier "active_view_box" all 1:3
; ";"
if_statement
if "if"
condition_clause
( "("
declaration
placeholder_type_specifier
auto "auto"
pointer_declarator
* "*"
identifier "svg_graphics_element"
= "="
call_expression
template_function
identifier "as_if"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "SVGGraphicsElement"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "dom_node"
) ")"
) ")"
expression_statement
assignment_expression
identifier "active_view_box" all 1:3
= "=" all 1:2
call_expression
field_expression
identifier "svg_graphics_element"
-> "->"
field_identifier "active_view_box"
argument_list
( "("
) ")"
; ";"
else_clause
else "else"
if_statement
if "if"
condition_clause
( "("
declaration
placeholder_type_specifier
auto "auto"
pointer_declarator
* "*"
identifier "svg_fit_to_view_box"
= "="
call_expression
template_function
identifier "as_if"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "SVGFitToViewBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "dom_node"
) ")"
) ")"
expression_statement
assignment_expression
identifier "active_view_box" all 1:3
= "=" all 1:2
call_expression
field_expression
identifier "svg_fit_to_view_box"
-> "->"
field_identifier "view_box"
argument_list
( "("
) ")"
; ";"
comment "// https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute"
if_statement (+79 nodes collapsed)
expression_statement
assignment_expression
identifier "m_current_viewbox_transform"
= "="
identifier "m_parent_viewbox_transform"
; ";"
if_statement (+372 nodes collapsed)
comment "// NOTE: Calculate viewport dimensions BEFORE scaling the co"...
comment "// For userSpaceOnUse clips (which have no viewBox), we need"...
comment "// not the final pixel dimensions. Otherwise, nested clips c"...
declaration (+93 nodes collapsed)
declaration (+93 nodes collapsed)
expression_statement
assignment_expression
identifier "m_available_space"
= "="
identifier "available_space"
; ";"
expression_statement
assignment_expression
identifier "m_svg_offset"
= "="
field_expression
identifier "svg_box_state"
. "."
field_identifier "offset"
; ";"
expression_statement
assignment_expression
identifier "m_viewport_size"
= "="
initializer_list
{ "{"
identifier "viewport_width"
, ","
identifier "viewport_height"
} "}"
; ";"
if_statement (+202 nodes collapsed)
expression_statement (+55 nodes collapsed)
} "}"
function_definition (+580 nodes collapsed)
function_definition (+356 nodes collapsed)
function_definition (+307 nodes collapsed)
function_definition (+170 nodes collapsed)
function_definition (+602 nodes collapsed)
function_definition
qualified_identifier
namespace_identifier "Gfx"
:: "::"
type_identifier "AffineTransform"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "get_parent_svg_transform"
parameter_list
( "("
parameter_declaration
type_identifier "SVGGraphicsBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "box"
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
comment "// Mask/clip boxes are transform boundaries — the target's t"...
for_statement
for "for"
( "("
declaration
placeholder_type_specifier
auto "auto"
init_declarator
pointer_declarator
* "*"
identifier "ancestor"
= "="
call_expression
field_expression
identifier "box"
. "."
field_identifier "parent"
argument_list
( "("
) ")"
; ";"
identifier "ancestor"
; ";"
assignment_expression
identifier "ancestor"
= "="
call_expression
field_expression
identifier "ancestor"
-> "->"
field_identifier "parent"
argument_list
( "("
) ")"
) ")"
compound_statement
{ "{"
if_statement
if "if"
condition_clause
( "("
binary_expression
binary_expression
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "ancestor"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "ancestor"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
> ">"
argument_list
( "("
pointer_expression
* "*"
identifier "ancestor"
) ")"
) ")"
return_statement
return "return"
initializer_list
{ "{"
} "}"
; ";"
if_statement (+91 nodes collapsed)
} "}"
return_statement
return "return"
initializer_list
{ "{"
} "}"
; ";"
} "}"
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_graphics_element"
parameter_list
( "("
parameter_declaration
type_identifier "SVGGraphicsBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "graphics_box"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "graphics_box_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "graphics_box"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "parent_svg_transform"
= "="
call_expression
identifier "get_parent_svg_transform"
argument_list
( "("
identifier "graphics_box"
) ")"
; ";"
declaration (+43 nodes collapsed)
expression_statement (+24 nodes collapsed)
if_statement (+84 nodes collapsed)
if_statement (+36 nodes collapsed)
if_statement (+36 nodes collapsed)
expression_statement
call_expression
field_expression
identifier "graphics_box"
. "."
template_method
field_identifier "for_each_child_of_type"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
> ">"
argument_list
( "("
lambda_expression
lambda_capture_specifier
[ "["
lambda_default_capture
& "&"
] "]"
abstract_function_declarator
parameter_list
( "("
parameter_declaration
placeholder_type_specifier
auto "auto"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "pattern_box"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "layout_mask_or_clip"
argument_list
( "("
identifier "pattern_box"
) ")"
; ";"
return_statement
return "return"
qualified_identifier
namespace_identifier "IterationDecision"
:: "::"
identifier "Continue"
; ";"
} "}"
) ")"
; ";"
} "}"
function_definition (+242 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_mask_or_clip"
parameter_list
( "("
parameter_declaration
type_identifier "SVGBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "mask_or_clip"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "SVG"
:: "::"
type_identifier "SVGUnits"
init_declarator
identifier "content_units"
initializer_list
{ "{"
} "}"
; ";"
if_statement
if "if"
condition_clause
( "("
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
) ")"
expression_statement (+35 nodes collapsed)
else_clause
else "else"
if_statement
if "if"
condition_clause
( "("
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
) ")"
expression_statement (+35 nodes collapsed)
else_clause
else "else"
if_statement
if "if"
condition_clause
( "("
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
) ")"
expression_statement
assignment_expression
identifier "content_units"
= "="
call_expression
field_expression
call_expression
field_expression
call_expression
template_function
identifier "static_cast"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
type_qualifier
const "const"
abstract_reference_declarator
& "&"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
. "."
field_identifier "dom_node"
argument_list
( "("
) ")"
. "."
field_identifier "pattern_content_units"
argument_list
( "("
) ")"
; ";"
else_clause
else "else"
expression_statement
call_expression
identifier "VERIFY_NOT_REACHED"
argument_list
( "("
) ")"
; ";"
comment "// FIXME: Somehow limit <clipPath> contents to: shape elemen"...
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "layout_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "mask_or_clip"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "parent_viewbox_transform"
= "="
identifier "m_current_viewbox_transform"
; ";"
declaration
placeholder_type_specifier
auto "auto"
type_qualifier
const "const"
init_declarator
pointer_declarator
* "*"
identifier "pattern_box"
= "="
call_expression
template_function
identifier "as_if"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
> ">"
argument_list
( "("
identifier "mask_or_clip"
) ")"
; ";"
if_statement
if "if"
condition_clause
( "("
binary_expression
identifier "pattern_box"
&& "&&"
call_expression
field_expression
call_expression
field_expression
call_expression
field_expression
identifier "pattern_box"
-> "->"
field_identifier "dom_node"
argument_list
( "("
) ")"
. "."
field_identifier "view_box"
argument_list
( "("
) ")"
. "."
field_identifier "has_value"
argument_list
( "("
) ")"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
type_qualifier
const "const"
init_declarator
reference_declarator
& "&"
identifier "pattern"
= "="
call_expression
field_expression
identifier "pattern_box"
-> "->"
field_identifier "dom_node"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
condition_clause
( "("
binary_expression
call_expression
field_expression
identifier "pattern"
. "."
field_identifier "pattern_units"
argument_list
( "("
) ")"
== "=="
qualified_identifier
namespace_identifier "SVG"
:: "::"
qualified_identifier
namespace_identifier "SVGUnits"
:: "::"
identifier "UserSpaceOnUse"
) ")"
compound_statement
{ "{"
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_width" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
qualified_identifier
namespace_identifier "CSSPixels"
:: "::"
identifier "nearest_value_for"
argument_list
( "("
call_expression
field_expression
call_expression
field_expression
identifier "pattern"
. "."
field_identifier "pattern_width"
argument_list
( "("
) ")"
. "."
field_identifier "resolve_relative_to"
argument_list
( "("
call_expression
field_expression
call_expression
field_expression
identifier "m_viewport_size"
. "."
field_identifier "width"
argument_list
( "("
) ")"
. "."
field_identifier "to_float"
argument_list
( "("
) ")"
) ")"
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_height" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
qualified_identifier
namespace_identifier "CSSPixels"
:: "::"
identifier "nearest_value_for"
argument_list
( "("
call_expression
field_expression
call_expression
field_expression
identifier "pattern"
. "."
field_identifier "pattern_height"
argument_list
( "("
) ")"
. "."
field_identifier "resolve_relative_to"
argument_list
( "("
call_expression
field_expression
call_expression
field_expression
identifier "m_viewport_size"
. "."
field_identifier "height"
argument_list
( "("
) ")"
. "."
field_identifier "to_float"
argument_list
( "("
) ")"
) ")"
) ")"
) ")" all 1:3
; ";" all 1:3
} "}"
else_clause
else "else"
compound_statement
{ "{"
declaration all 1:2
placeholder_type_specifier all 1:2
auto "auto" all 1:2
init_declarator all 1:2
reference_declarator all 1:2
& "&" all 1:2
identifier "parent_node_state" all 1:2
= "=" all 1:2
call_expression all 1:2
field_expression all 1:2
identifier "m_state" all 1:2
. "." all 1:2
field_identifier "get" all 1:2
argument_list all 1:2
( "(" all 1:2
pointer_expression all 1:2
* "*" all 1:2
call_expression all 1:2
field_expression all 1:2
identifier "mask_or_clip" all 1:2
. "." all 1:2
field_identifier "parent" all 1:2
argument_list all 1:2
( "(" all 1:2
) ")" all 1:2
) ")" all 1:2
; ";" all 1:2
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_width" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
qualified_identifier
namespace_identifier "CSSPixels"
:: "::"
identifier "nearest_value_for"
argument_list
( "("
binary_expression
call_expression
field_expression
call_expression
field_expression
identifier "pattern"
. "."
field_identifier "pattern_width"
argument_list
( "("
) ")"
. "."
field_identifier "value"
argument_list
( "("
) ")"
* "*"
call_expression
field_expression
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_width"
argument_list
( "("
) ")"
. "."
field_identifier "to_double"
argument_list
( "("
) ")"
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_height" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
qualified_identifier
namespace_identifier "CSSPixels"
:: "::"
identifier "nearest_value_for"
argument_list
( "("
binary_expression
call_expression
field_expression
call_expression
field_expression
identifier "pattern"
. "."
field_identifier "pattern_height"
argument_list
( "("
) ")"
. "."
field_identifier "value"
argument_list
( "("
) ")"
* "*"
call_expression
field_expression
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_height"
argument_list
( "("
) ")"
. "."
field_identifier "to_double"
argument_list
( "("
) ")"
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement (+37 nodes collapsed) all 1:2
} "}"
} "}"
else_clause
else "else"
if_statement
if "if"
condition_clause
( "("
binary_expression
identifier "content_units"
== "=="
qualified_identifier
namespace_identifier "SVG"
:: "::"
qualified_identifier
namespace_identifier "SVGUnits"
:: "::"
identifier "ObjectBoundingBox"
) ")"
compound_statement
{ "{"
declaration all 1:2
placeholder_type_specifier all 1:2
auto "auto" all 1:2
init_declarator all 1:2
reference_declarator all 1:2
& "&" all 1:2
identifier "parent_node_state" all 1:2
= "=" all 1:2
call_expression all 1:2
field_expression all 1:2
identifier "m_state" all 1:2
. "." all 1:2
field_identifier "get" all 1:2
argument_list all 1:2
( "(" all 1:2
pointer_expression all 1:2
* "*" all 1:2
call_expression all 1:2
field_expression all 1:2
identifier "mask_or_clip" all 1:2
. "." all 1:2
field_identifier "parent" all 1:2
argument_list all 1:2
( "(" all 1:2
) ")" all 1:2
) ")" all 1:2
; ";" all 1:2
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_width" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_width"
argument_list
( "("
) ")"
) ")" all 1:3
; ";" all 1:3
expression_statement all 1:3
call_expression all 1:3
field_expression all 1:3
identifier "layout_state" all 1:3
. "." all 1:3
field_identifier "set_content_height" all 1:3
argument_list all 1:3
( "(" all 1:3
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_height"
argument_list
( "("
) ")"
) ")" all 1:3
; ";" all 1:3
comment "// https://svgwg.org/svg2-draft/pservers.html#PatternElement"...
expression_statement (+37 nodes collapsed) all 1:2
if_statement
if "if"
condition_clause
( "("
identifier "pattern_box"
) ")"
expression_statement
call_expression
field_expression
identifier "parent_viewbox_transform"
. "."
field_identifier "scale"
argument_list
( "("
call_expression
field_expression
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_width"
argument_list
( "("
) ")"
. "."
field_identifier "to_float"
argument_list
( "("
) ")"
, ","
call_expression
field_expression
call_expression
field_expression
identifier "parent_node_state"
. "."
field_identifier "content_height"
argument_list
( "("
) ")"
. "."
field_identifier "to_float"
argument_list
( "("
) ")"
) ")"
; ";"
} "}"
else_clause (+41 nodes collapsed)
comment "// Pretend masks/clips are a viewport so we can scale the co"...
declaration (+22 nodes collapsed)
expression_statement
call_expression
field_expression
identifier "layout_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "layout_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "nested_context"
. "."
field_identifier "run"
argument_list
( "("
pointer_expression
* "*"
identifier "m_available_space"
) ")"
; ";"
} "}"
function_definition
primitive_type "void"
function_declarator
qualified_identifier
namespace_identifier "SVGFormattingContext"
:: "::"
identifier "layout_container_element"
parameter_list
( "("
parameter_declaration
type_identifier "SVGBox"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "container"
) ")"
compound_statement
{ "{"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "box_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get_mutable"
argument_list
( "("
identifier "container"
) ")"
; ";"
declaration
qualified_identifier
namespace_identifier "Gfx"
:: "::"
template_type
type_identifier "BoundingBox"
template_argument_list
< "<"
type_descriptor
type_identifier "CSSPixels"
> ">"
identifier "bounding_box"
; ";"
expression_statement
call_expression
field_expression
identifier "container"
. "."
template_method
field_identifier "for_each_child_of_type"
template_argument_list
< "<"
type_descriptor
type_identifier "Box"
> ">"
argument_list
( "("
lambda_expression
lambda_capture_specifier
[ "["
lambda_default_capture
& "&"
] "]"
abstract_function_declarator
parameter_list
( "("
parameter_declaration
type_identifier "Box"
type_qualifier
const "const"
reference_declarator
& "&"
identifier "child"
) ")"
compound_statement
{ "{"
comment "// Masks/clips/patterns do not change the bounding box of th"...
if_statement
if "if"
condition_clause
( "("
binary_expression
binary_expression
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGMaskBox"
> ">"
argument_list
( "("
identifier "child"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGClipBox"
> ">"
argument_list
( "("
identifier "child"
) ")"
|| "||"
call_expression
template_function
identifier "is"
template_argument_list
< "<"
type_descriptor
type_identifier "SVGPatternBox"
> ">"
argument_list
( "("
identifier "child"
) ")"
) ")"
return_statement
return "return"
qualified_identifier
namespace_identifier "IterationDecision"
:: "::"
identifier "Continue"
; ";"
expression_statement
call_expression
identifier "layout_svg_element"
argument_list
( "("
identifier "child"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "child_state"
= "="
call_expression
field_expression
identifier "m_state"
. "."
field_identifier "get"
argument_list
( "("
identifier "child"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "add_point"
argument_list
( "("
field_expression
identifier "child_state"
. "."
field_identifier "offset"
) ")"
; ";"
expression_statement (+38 nodes collapsed)
return_statement
return "return"
qualified_identifier
namespace_identifier "IterationDecision"
:: "::"
identifier "Continue"
; ";"
} "}"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_x"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "x"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_y"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "y"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_width"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "width"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_content_height"
argument_list
( "("
call_expression
field_expression
identifier "bounding_box"
. "."
field_identifier "height"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_has_definite_width"
argument_list
( "("
true "true"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "box_state"
. "."
field_identifier "set_has_definite_height"
argument_list
( "("
true "true"
) ")"
; ";"
} "}"
} "}"