Skip to content
Permalink
Browse files
[LBSE] Not all 'outermost' <svg> elements enforce a stacking context
https://bugs.webkit.org/show_bug.cgi?id=244965

Reviewed by Rob Buis.

Add missing condition in Style::Adjuster::adjustSVGElementStyle() to enforce
a stacking context if the element that receives the style is an outermost
<svg> element (or acts as such). It is mentioned in the SVG2 spec note just
a few lines above, but not implemented yet.

* LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/css/text-shadow-multiple-expected.txt:
* LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/custom/image-parent-translation-expected.txt:
* LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/custom/second-inline-text-expected.txt:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjustSVGElementStyle):

Canonical link: https://commits.webkit.org/254314@main
  • Loading branch information
nikolaszimmermann committed Sep 9, 2022
1 parent 952ebeb commit a57723e637107f43ea2bd1c5284dffe714da13da
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
@@ -13,10 +13,6 @@ layer at (0,0) size 800x408
text run at (0,0) width 567: "The next two texts have subtle differences, as the stroke/fill is painted seperated in SVG."
RenderBlock (anonymous) at (0,238) size 800x154
RenderText {#text} at (0,0) size 0x0
layer at (0,100) size 800x100
RenderSVGRoot {svg} at (0,50) size 800x100
layer at (0,304) size 800x100
RenderSVGRoot {svg} at (0,50) size 800x100
layer at (20,50) size 717x58
RenderBlock (positioned) {div} at (20,50) size 717x58
RenderInline {span} at (0,0) size 95x56 [textStrokeWidth=1.00]
@@ -35,6 +31,8 @@ layer at (20,50) size 717x58
RenderText {#text} at (505,1) size 212x56
text run at (505,1) width 15: " "
text run at (519,1) width 198: "shadows"
layer at (0,100) size 800x100
RenderSVGRoot {svg} at (0,50) size 800x100
layer at (0,100) size 800x100
RenderSVGViewportContainer at (0,0) size 800x100
layer at (20,121) size 717x56
@@ -73,6 +71,8 @@ layer at (20,254) size 717x58
RenderText {#text} at (505,1) size 212x56
text run at (505,1) width 15: " "
text run at (519,1) width 198: "shadows"
layer at (0,304) size 800x100
RenderSVGRoot {svg} at (0,50) size 800x100
layer at (0,304) size 800x100
RenderSVGViewportContainer at (0,0) size 800x100
layer at (20,325) size 717x56
@@ -22,14 +22,14 @@ layer at (0,0) size 800x219
RenderText {#text} at (0,0) size 0x0
layer at (8,132) size 75x75
RenderSVGRoot {svg} at (0,0) size 75x75
layer at (87,132) size 75x75
RenderSVGRoot {svg} at (79,0) size 75x75
layer at (8,132) size 75x75
RenderSVGViewportContainer at (0,0) size 75x75
layer at (8,132) size 75x75
RenderSVGImage {image} at (0,0) size 75x75
layer at (8,132) size 75x75
RenderSVGRect {rect} at (0,0) size 75x75 [stroke={[type=SOLID] [color=#FF0000] [stroke width=6.00]}] [x=0.00] [y=0.00] [width=75.00] [height=75.00]
layer at (87,132) size 75x75
RenderSVGRoot {svg} at (79,0) size 75x75
layer at (87,132) size 75x75
RenderSVGViewportContainer at (0,0) size 75x75
layer at (87,132) size 75x75
@@ -12,8 +12,6 @@ layer at (0,0) size 800x162
RenderText {#text} at (0,0) size 0x0
layer at (8,50) size 100x100
RenderSVGRoot {svg} at (0,0) size 100x100
layer at (112,50) size 100x100
RenderSVGRoot {svg} at (104,0) size 100x100
layer at (8,50) size 100x100
RenderSVGViewportContainer at (0,0) size 100x100
layer at (36,69) size 45x63
@@ -22,6 +20,8 @@ layer at (18,86) size 38x18
RenderSVGText {text} at (10,36) size 39x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 39x18
chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 4 width 38.25: "PASS"
layer at (112,50) size 100x100
RenderSVGRoot {svg} at (104,0) size 100x100
layer at (112,50) size 100x100
RenderSVGViewportContainer at (0,0) size 100x100
layer at (140,69) size 45x63
@@ -709,7 +709,8 @@ void Adjuster::adjustSVGElementStyle(RenderStyle& style, const SVGElement& svgEl
ASSERT(!style.clipPath());
ASSERT(!style.hasFilter());

if (svgElement.hasTagName(SVGNames::foreignObjectTag)
if (svgElement.isOutermostSVGSVGElement()
|| svgElement.hasTagName(SVGNames::foreignObjectTag)
|| svgElement.hasTagName(SVGNames::imageTag)
|| svgElement.hasTagName(SVGNames::markerTag)
|| svgElement.hasTagName(SVGNames::maskTag)

0 comments on commit a57723e

Please sign in to comment.