New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 643493 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 31
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

SVG <g> containing <foreignObject /> gives wrong bounding rectangle

Reported by m...@mail.ru, Sep 2 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0

Steps to reproduce the problem:
1. Visit https://codepen.io/djFD/pen/ALAZzk
2. On a first load there is SVG group <g> with included <foreignObject />, right after page load, bounding client rectangle of that group is taken and shown
3. Later on you can programmatically remove/insert <foreignObject /> element into the same group using provided checkbox

What is the expected behavior?
It is expected that bounding rectangle returned is the same in all cases

What went wrong?
On a first invocation bounding rectangle is calculated incorrect, later on inserting/removal of foreignObject programmatically gives correct bounding rectangle of containing group

Did this work before? N/A 

Chrome version: 51.0.2704.79 (Developer Build) Ubuntu 16.04 (64-bit)  Channel: stable
OS Version: Ubuntu 16.04 LTS
Flash Version: Shockwave Flash 11.2 r202
 
bcr-chromium.png
100 KB View Download

Comment 1 by f...@opera.com, Sep 2 2016

Components: -Blink Blink>SVG
Labels: -OS-Linux
Status: Available (was: Unconfirmed)
Reduced testcase: https://jsfiddle.net/6a2podfj/1/

Looks like the empty <fO> is spanning the bbox of the <g>.
Cc: hyunjune...@samsung.com
Project Member

Comment 3 by sheriffbot@chromium.org, Oct 30 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 4 by f...@opera.com, Oct 30 2017

Labels: -Hotlist-Recharge-Cold
Status: Available (was: Untriaged)
Project Member

Comment 5 by sheriffbot@chromium.org, Oct 30

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)
Owner: f...@opera.com
Status: Assigned (was: Available)
Project Member

Comment 8 by bugdroid1@chromium.org, Oct 31

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e47e6e98afe2de2d737ac7827e9309430e68b60b

commit e47e6e98afe2de2d737ac7827e9309430e68b60b
Author: Fredrik Söderquist <fs@opera.com>
Date: Wed Oct 31 16:10:51 2018

Fix ancestor bounding box for "disabled" <foreignObject> and <image>

Per:

 "A value of zero for either width or height disables rendering of the
  element and its embedded content."

 (https://svgwg.org/svg2-draft/embedded.html#Placement)

and:

 "For each descendant graphics element child of parent:
  * If child is not rendered then continue to the next descendant
    graphics element."

 (https://svgwg.org/svg2-draft/coords.html#BoundingBoxes)

<foreignObject> / <image> with 'width' or 'height' zero should not
contribute to an ancestor container's bounding box.

Bug:  643493 
Change-Id: I097d9d28faaa52fc793dab251f22bc7b2610d6ad
Reviewed-on: https://chromium-review.googlesource.com/c/1309773
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#604276}
[modify] https://crrev.com/e47e6e98afe2de2d737ac7827e9309430e68b60b/third_party/WebKit/LayoutTests/svg/dom/getbbox.html
[modify] https://crrev.com/e47e6e98afe2de2d737ac7827e9309430e68b60b/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.h
[modify] https://crrev.com/e47e6e98afe2de2d737ac7827e9309430e68b60b/third_party/blink/renderer/core/layout/svg/layout_svg_image.h
[modify] https://crrev.com/e47e6e98afe2de2d737ac7827e9309430e68b60b/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc

Status: Fixed (was: Assigned)

Sign in to add a comment