New issue
Advanced search Search tips

Issue 849617 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug-Regression



Sign in to add a comment

presence of foreignObject in an svg element stops document.elementsFromPoint reporting rect elements

Reported by andy.tur...@simomics.com, Jun 5 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36

Steps to reproduce the problem:
1. Load the given test.html
2. (correct) Click on the yellow rectangle in the blue svg - observe the presence of the rect in the console output
3. (incorrect) Click on the yellow rectangle in the red svg which contains an additional foreignObject - observe that the rect is no longer present in the console output

What is the expected behavior?
That the rect is reported by elementsFromPoint when the given x and y interest with a rect and the wider svg element contains a foreignObject

What went wrong?
elementsFromPoint did not report the rect element

Did this work before? Yes 65.0.3325.181

Does this work in other browsers? Yes

Chrome version: 67.0.3396.62  Channel: stable
OS Version: Linux Mint 18.2 Cinnamon 64-bit
Flash Version: 

We haven't tested in 66.0.3359.181
 
test.html
1.2 KB View Download
Owner: chrishtr@chromium.org
Status: Assigned (was: Unconfirmed)
christhtr@, which bug is this duplicate of?

Comment 2 by f...@opera.com, Jun 5 2018

I think this is the reason we raised https://github.com/w3c/svgwg/issues/427

Comment 3 by f...@opera.com, Jun 5 2018

...actually, scratch that. I thought this might've been something about event transparency, but looking at the TC it does look like it. So probably  issue 842668 ?
A bit more info on this bug. The presence of a foreignObject anywhere in an svg stops document.elementsFromPoint from reporting any other svg element in the svg except the oldest foreignObject present in the svg when it is clicked. See the attached test file.

1. Click on the left blue circle and only the first foreignObject is reported in the console
2. Click the right blue circle, no foreignObject or circle or rect are reported
3. Click "Remove ForeignObject" button (this removes the foreignObject on the left)
4. Click the right blue circle and now the second foreignObject is reported, but nothing else in the SVG
5. Click "Remove ForeignObject" button again (this removes the second foreignObject, no foreignObjects are left in the svg)
6. Click any part of the svg and what is reported by elementsFromPoint is now as expected

Tested in 67.0.3396.79 and 69.0.3451.0

svg-foreignobject.html
1.8 KB View Download

Comment 5 by f...@opera.com, Jun 11 2018

Cc: chrishtr@chromium.org
Owner: f...@opera.com
Project Member

Comment 6 by bugdroid1@chromium.org, Jun 12 2018

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

commit 31c3829005a8bd2f699eb61d565a0da2dd855d01
Author: Fredrik Söderquist <fs@opera.com>
Date: Tue Jun 12 11:52:55 2018

Don't corrupt list-based hit-test results in LayoutSVGForeignObject

Assigning the HitTestResult used for the PaintLayer will corrupt (reset)
any result acquired previously. So results from the foreground phase
would be erased by any later phase(s). Use HitTestResult::Append
instead if we're performing a list-based hit-test.

Bug:  849617 
Change-Id: I5f53cad7e8396377815af51bd52db924b3fe6d5a
Reviewed-on: https://chromium-review.googlesource.com/1095182
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566382}
[modify] https://crrev.com/31c3829005a8bd2f699eb61d565a0da2dd855d01/third_party/WebKit/LayoutTests/fast/dom/elementsFromPoint/elementsFromPoint-svg-expected.txt
[modify] https://crrev.com/31c3829005a8bd2f699eb61d565a0da2dd855d01/third_party/WebKit/LayoutTests/fast/dom/elementsFromPoint/elementsFromPoint-svg.html
[modify] https://crrev.com/31c3829005a8bd2f699eb61d565a0da2dd855d01/third_party/blink/renderer/core/layout/svg/layout_svg_foreign_object.cc

Comment 7 by f...@opera.com, Jun 13 2018

Status: Fixed (was: Assigned)

Comment 8 by f...@opera.com, Jun 13 2018

Labels: Merge-Request-68
Thanks for fixing promptly, it is much appreciated.

Project Member

Comment 10 by sheriffbot@chromium.org, Jun 13 2018

Labels: -Merge-Request-68 Hotlist-Merge-Review Merge-Review-68
This bug requires manual review: M68 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), kariahda@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-68 Merge-Rejected-68
Let's target the fix for M69, since this bug has been present in M66 and M67. We're already post branch for 68. 

Sign in to add a comment