[Webkit-unassigned] [Bug 48640] Add layout test that check getBoundingClientRect w/ zooming
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Oct 29 09:24:54 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=48640
Nikolas Zimmermann <zimmermann at kde.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #72341|review? |review-
Flag| |
--- Comment #3 from Nikolas Zimmermann <zimmermann at kde.org> 2010-10-29 09:24:54 PST ---
(From update of attachment 72341)
View in context: https://bugs.webkit.org/attachment.cgi?id=72341&action=review
Hi Cosmin,
good job, though in the wrong direction I fear. I was confused what you mean with rounding problems. I thought you wanted to solve it in the code, rather than in the tests :-)
> LayoutTests/svg/custom/getBoundingClientRect.xhtml:7
> +<div style="width:500px;height=100px;">
This can't work :-) s/=/:/
> LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml:53
> + shouldBeApprox('div1.left', '0', '1');
The last argument doesn't need to be a string, but it's okay, you don't need to change it everywhere.
> LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml:54
> + shouldBeApprox('div1.top', '0', '1');
I don't get the whole story behind shouldBeApprox.
CSSOM defines getBoundingClientRect to return a ClientRect() object, containing 'float' coordinates.
See http://dev.w3.org/csswg/cssom-view/#clientrect.
FloatRect localRect;
if (svgElement->boundingBox(localRect))
quads.append(renderer()->localToAbsoluteQuad(localRect));
localToAbsoluteQuad gives you a FloatRect, stored in localRect.
The problem is the " IntRect result = quads[0].enclosingBoundingBox();" usage here.
When using boundingBox() instead of enclosingBoundingBox() you'd get a FloatRect as result, which is really what ought to be used here.
Instead of using "adjustIntRectForAbsoluteZoom(IntRect& rect, RenderObject* renderer)" a adjustFloatRectForAbsoluteZoom should be added to RenderObject.h (there's already a FloatQuad version and a FloatPoint version).
That should fix the real issue.
Of course when testing, you might get results like 50.000001 or sth else when zooming (due the rounding error accumulation).
You can solve this by using shouldBe("div1.width.toFixed(2)", "50.00").... (toFixed is the key here)
Does this help to solve the underlying problem?
--
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