mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 00:49:46 +00:00
Prior to this change, SVGs were following the CSS painting order, which means SVG boxes could have established stacking context and be sorted by z-index. There is a section in the spec that defines what kind of SVG boxes should create a stacking context https://www.w3.org/TR/SVG2/render.html#EstablishingStackingContex Although this spec is marked as a draft and rendering order described in this spec does not match what other engines do. This spec issue comment has a good summary of what other engines actually do regarding painting order https://github.com/w3c/svgwg/issues/264#issuecomment-246432360 "as long as you're relying solely on the default z-index (which SVG1 does, by definition), nothing ever changes order when you apply opacity/filter/etc". This change aligns our implementation with other engines by forbidding SVGs to create a formatting context and painting them in order they are defined in tree tree.
32 lines
847 B
C++
32 lines
847 B
C++
/*
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Layout/SVGSVGBox.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
class SVGSVGPaintable final : public PaintableBox {
|
|
JS_CELL(SVGSVGPaintable, PaintableBox);
|
|
JS_DECLARE_ALLOCATOR(SVGSVGPaintable);
|
|
|
|
public:
|
|
static JS::NonnullGCPtr<SVGSVGPaintable> create(Layout::SVGSVGBox const&);
|
|
|
|
virtual void before_children_paint(PaintContext&, PaintPhase) const override;
|
|
virtual void after_children_paint(PaintContext&, PaintPhase) const override;
|
|
|
|
Layout::SVGSVGBox const& layout_box() const;
|
|
|
|
static void paint_descendants(PaintContext& context, PaintableBox const& paintable, PaintPhase phase);
|
|
|
|
protected:
|
|
SVGSVGPaintable(Layout::SVGSVGBox const&);
|
|
};
|
|
|
|
}
|