Bug 1802415 [wpt PR 37155] - SVG: Ignore foreign-namespace elements even with display...
commit1dfc862c9215b195d3bbaee5de3caee0d6e696b4
authorKent Tamura <tkent@chromium.org>
Wed, 7 Dec 2022 13:57:38 +0000 (7 13:57 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Sun, 11 Dec 2022 12:07:29 +0000 (11 12:07 +0000)
tree8a7777ecdeba1fb897ec2081817e6447d5562f0c
parent5dadccd1f28c085ce97f0cfcb0f462a8fd8f2842
Bug 1802415 [wpt PR 37155] - SVG: Ignore foreign-namespace elements even with display:contents, a=testonly

Automatic update from web-platform-tests
SVG: Ignore foreign-namespace elements even with display:contents

SVG containers such as <svg> and <g> drop subtrees in foreign-
namespace elements. For example,

<svg>
 <div>
  <rect/>
 </div>
 ...
The <div> subtree is not used to render the <svg>.

We should do it even for elements with display:contents.
<svg>
 <div style="display:contents">
  <rect/>
 </div>
 ...
We failed to do it because the drop is handled with a LayoutObject
tree. This CL fixes it by checking DOM nodes in IsChildAllowed().

* Implementation
- Introduce SVGContentContainer::IsChildAllowed() to share
  the IsChildAllowed() logic in LayoutSVGModelObject and LayoutSVGRoot.
  It reject SVG LayoutObject child if its parent element is not a SVG.

- Update *CullRectUpdaterTest. svg1 doesn't have a LayoutObject
  after this CL.

Bug: 1393223
Change-Id: I6061b629fba2a0f45dcd8d902640be2aef75b168
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4054303
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1075693}

--

wpt-commits: 58eba72745d997d6409722902a6d169ae41b7114
wpt-pr: 37155
testing/web-platform/tests/svg/struct/reftests/nested-svg-through-display-contents.svg [new file with mode: 0644]
testing/web-platform/tests/svg/struct/reftests/reference/nested-svg-through-display-contents-ref.svg [new file with mode: 0644]