[Webkit-unassigned] [Bug 101425] Correct absolute rect calculation for scaled fixed position elements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 7 16:59:28 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=101425





--- Comment #3 from Tien-Ren Chen <trchen at chromium.org>  2012-11-07 17:01:02 PST ---
(In reply to comment #2)
> (From update of attachment 172709 [details])
> Is this the same as bug 100912?

Nope. This patch fixes a bug with absoluteRect on scaled fixed position elements. We had this fix in downstream for a while but only drew my attention until 100912.

My understanding is that we use RenderView::scrollOffsetForFixedPosition() to adjust the in-document position of them. When pageScaleFactor == 1.0 scrollOffsetForFixedPosition() equals to scrollPosition() most of the time (except clamped to the scroll range, for the over scroll effect on iOS).

When pageScaleFactor != 1.0, scrollOffsetForFixedPosition() is measured in CSS pixels, while scrollPosition() is in physical pixels. It is understandable that scrollPosition() needs to be in physical pixel for pixel-smooth scrolling. However when we layout the fixed position elements it needs to be snapped to integral CSS pixels, probably because the layout engine couldn't handle fractional offsets until we changed to FractionalLayoutUnit recently.

The bug is that the position adjustment is applied too late. Logically it should be that the fixed position is located at (topLeft + scrollOffsetForFixedPosition) in the RenderView, then we magnify the RenderView, so: absoluteCoords = (topLeft + scrollOffsetForFixedPosition) * transform
In the original code it was: absoluteCoords = topLeft * transform + scrollOffsetForFixedPosition

It is debatable whether we should switch to physical pixel scrollOffsetForFixedPosition, so we can avoid the juddering effect due to pixel rounding. For a short term solution, I think it is safer to keep the old approach but make it correct.

A layout test is included to demonstrate the buggy absoluteRect. Without the patch, getBoundingClientRect() returns bogus value on fixed position element when page is scaled+scrolled.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list