Skip to content

Commit 45d2ff0

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
[LegacySVG] Margin collapsing should not occur at the foreignObject boundary
https://bugs.webkit.org/show_bug.cgi?id=23963 rdar://97208795 Reviewed by Alan Baradlay. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Merge: https://chromium.googlesource.com/chromium/src.git/+/eb26f063d73fce4d8a2cf64541667e0863cb6421 This patch makes foreignObject a block formatting context (BFC) which prevents margin collapsing across the foreignObject boundary. This function (createsNewFormattingContext) is limited to BFC context nowadays. https://svgwg.org/svg2-draft/single-page.html#embedded-ForeignObjectElement * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::createsNewFormattingContext const): * LayoutTests/platform/glib/svg/custom/dominant-baseline-hanging-expected.txt: * LayoutTests/platform/ios/svg/custom/dominant-baseline-hanging-expected.txt: * LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt: * LayoutTests/platform/win/svg/custom/dominant-baseline-hanging-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt: Progressions * LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/getboundingclientrect-expected.txt: Progressions Canonical link: https://commits.webkit.org/304916@main
1 parent c97896f commit 45d2ff0

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL position assert_equals: offsetTop expected 5 but got 0
2+
PASS position
33

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL foreignObject: Element.prototype.getBoundingClientRect() assert_equals: top expected 24 but got 18
2+
PASS foreignObject: Element.prototype.getBoundingClientRect()
33

LayoutTests/platform/glib/svg/custom/dominant-baseline-hanging-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ layer at (0,0) size 400x400
2222
RenderSVGInlineText {#text} at (0,0) size 323x22
2323
chunk 1 text run 1 at (2.00,14.40) startOffset 0 endOffset 40 width 323.00: "This is hanging from the top-left corner"
2424
RenderSVGForeignObject {foreignObject} at (10,45) size 380x150
25-
RenderBlock {html} at (0,0) size 380x124
25+
RenderBlock {html} at (0,16) size 380x124
2626
RenderBody {body} at (8,0) size 364x124
2727
RenderBlock {p} at (0,0) size 364x90
2828
RenderText {#text} at (0,0) size 347x35

LayoutTests/platform/ios/svg/custom/dominant-baseline-hanging-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ layer at (0,0) size 400x400
2222
RenderSVGInlineText {#text} at (0,0) size 317x23
2323
chunk 1 text run 1 at (2.00,14.40) startOffset 0 endOffset 40 width 316.58: "This is hanging from the top-left corner"
2424
RenderSVGForeignObject {foreignObject} at (10,45) size 380x150
25-
RenderBlock {html} at (0,0) size 380x136
25+
RenderBlock {html} at (0,16) size 380x136
2626
RenderBody {body} at (8,0) size 364x136
2727
RenderBlock {p} at (0,0) size 364x100
2828
RenderText {#text} at (0,0) size 353x39

LayoutTests/platform/mac/svg/custom/dominant-baseline-hanging-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ layer at (0,0) size 400x400
2222
RenderSVGInlineText {#text} at (0,0) size 317x23
2323
chunk 1 text run 1 at (2.00,14.40) startOffset 0 endOffset 40 width 316.58: "This is hanging from the top-left corner"
2424
RenderSVGForeignObject {foreignObject} at (10,45) size 380x150
25-
RenderBlock {html} at (0,0) size 380x124
25+
RenderBlock {html} at (0,16) size 380x124
2626
RenderBody {body} at (8,0) size 364x124
2727
RenderBlock {p} at (0,0) size 364x90
2828
RenderText {#text} at (0,0) size 353x36

LayoutTests/platform/win/svg/custom/dominant-baseline-hanging-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ layer at (0,0) size 400x400
2222
RenderSVGInlineText {#text} at (0,0) size 308x22
2323
chunk 1 text run 1 at (2.00,13.60) startOffset 0 endOffset 40 width 308.00: "This is hanging from the top-left corner"
2424
RenderSVGForeignObject {foreignObject} at (10,45) size 380x150
25-
RenderBlock {html} at (0,0) size 380x136
25+
RenderBlock {html} at (0,16) size 380x136
2626
RenderBody {body} at (8,0) size 364x136
2727
RenderBlock {p} at (0,0) size 364x100
2828
RenderText {#text} at (0,0) size 349x39

Source/WebCore/rendering/RenderBlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ bool RenderBlock::createsNewFormattingContext() const
13551355
|| isFieldset()
13561356
|| isDocumentElementRenderer()
13571357
|| isRenderFragmentedFlow()
1358-
|| isRenderSVGForeignObject()
1358+
|| isRenderOrLegacyRenderSVGForeignObject()
13591359
|| style.specifiesColumns()
13601360
|| style.columnSpan() == ColumnSpan::All
13611361
|| style.display() == DisplayType::FlowRoot

0 commit comments

Comments
 (0)