New issue
Advanced search Search tips

Issue 711193 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Compat



Sign in to add a comment

getBoundingClientRect() returns wrong value for td and its descendants for a vertical table

Reported by yuki.sek...@access-company.com, Apr 13 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce the problem:
1. Open the attached getBoundingClientRect-vertical-under-td-orig.html
2. It should show SUCCESS but shows FAILED with the actual rect.

What is the expected behavior?
The rect of td is contained by the rect of its tr.

What went wrong?
The content checks whether the rect of td is contained by the rect of its tr. getBoundingClientRect()  returns the rect of td which is very far from the rect of tr.

Inspector shows a wrong rect for td as well.

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 57.0.2987.133  Channel: stable
OS Version: OS X 10.12.3
Flash Version:
 
getBoundingClientRect-vertical-under-td-orig.html
3.3 KB View Download
The proposed patch is https://codereview.chromium.org/2816983002
The corresponding bug in WebKit: https://bugs.webkit.org/show_bug.cgi?id=170768
Note: Firefox works well.
The screenshot which the inspector highlights wrong position for td.
vertical-table-td-wrong-in-inspector.png
194 KB View Download

Comment 3 by phistuck@gmail.com, Apr 13 2017

So WebKit gets it wrong for <tr> while Blink does not. Is that right?
Yes, it is.

Blink sets a logical location to a LayoutTableRow. This is right.
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp?q=LayoutTableSection+package:%5Echromium$&dr=CSs&l=1152

WebKit sets a physical location to a RenderTableRow. This is wrong, so I'm fixing it.
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/rendering/RenderTableSection.cpp#L613

Comment 5 by e...@chromium.org, Apr 18 2017

Cc: dgro...@chromium.org
Components: -Blink>Layout Blink>Layout>Table
Labels: -Type-Bug Type-Compat
Status: Available (was: Unconfirmed)
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 26 2017

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

commit 5cdd84c272ce41e804a9d4447b288f44d748c6af
Author: yuki.sekiguchi <yuki.sekiguchi@access-company.com>
Date: Wed Apr 26 21:45:25 2017

LayoutTableCell::OffsetFromContainer() should use the flipped offset of its parent.

Since LayoutTableCell is relative to LayoutTableSection, it should subtract the
offset of the LayoutTableRow. OffsetFromContainer() is flipped value, but
LayoutTableCell::OffsetFromContainer() uses LocationOffset() which is an unflipped
location. Therefore, the rect of td goes outside of tr.

It should use PhysicalLocationOffset() which returns a flipped location.

BUG= 711193 

Review-Url: https://codereview.chromium.org/2816983002
Cr-Commit-Position: refs/heads/master@{#467467}

[modify] https://crrev.com/5cdd84c272ce41e804a9d4447b288f44d748c6af/AUTHORS
[add] https://crrev.com/5cdd84c272ce41e804a9d4447b288f44d748c6af/third_party/WebKit/LayoutTests/fast/dom/Element/getBoundingClientRect-vertical-child.html
[modify] https://crrev.com/5cdd84c272ce41e804a9d4447b288f44d748c6af/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp

Yuki, I think this issue is fixed now. If not, would you mind outlining what else needs to be done?
Yes. This is fixed now. I confirmed that getBoundingClientRect-vertical-under-td-orig.html is fixed on ToT.

Since I don't have a right to close a bug, could someone close this bug?
Status: Fixed (was: Available)

Sign in to add a comment