WebKit's behavior differs from Firefox and Opera when it comes to margin collapsing in an SVG foreignObject. In FF/Opera, margins don't extend outside of the foreignObject. In WebKit, they do.
Created attachment 27681 [details] Testcase; compare with Firefox
Notes from irc: [10:54am] dhyatt:if (!parent()->isBoxModelObject()) [10:54am] dhyatt: would be good enough i would think [10:55am] dhyatt: m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() && [10:55am] dhyatt: !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable(); [10:55am] dhyatt: line 91 of RenderBlock.cpp
dhyatt: we actually don't even let <html> collapse margins with its children [10:57am] dhyatt: could probably just ditch the isRenderView check and replace with !parent() || !parent()->isBoxModelObject() dhyatt: but before doing that would need to see if the <html> in a foreign object collapses with the <body> dhyatt: <html style="margin:100px;"><body style="margin:100px">Hello world dhyatt: in safari that will leave 200px of space above hello world
dhyatt: if <html> is special we may end up just having to ask about <html> [11:00am] dhyatt: so yeah the first thing i suggested would fix the isrenderview check [11:00am] dhyatt: but would also need to do something about the isroot check
*** Bug 205550 has been marked as a duplicate of this bug. ***
<rdar://problem/97208795>
It will be done with LBSE - https://bugs.webkit.org/show_bug.cgi?id=245908
*** This bug has been marked as a duplicate of bug 245908 ***
I manage to fix this locally, will do new PR. Had to use - isSVGForeignObjectOrLegacySVGForeignObject();
PR - https://github.com/WebKit/WebKit/pull/10991