RESOLVED FIXED 102159
[chromium] Clamp negative sizes to zero when converting to gfx:: types
https://bugs.webkit.org/show_bug.cgi?id=102159
Summary [chromium] Clamp negative sizes to zero when converting to gfx:: types
Dana Jansens
Reported 2012-11-13 17:49:06 PST
[chromium] Clamp contentsRect to not have negative sizes
Attachments
Patch (1.95 KB, patch)
2012-11-13 17:50 PST, Dana Jansens
no flags
Patch (1.99 KB, patch)
2012-11-13 17:53 PST, Dana Jansens
no flags
Patch (3.14 KB, patch)
2012-11-14 18:18 PST, Dana Jansens
no flags
Patch for landing (3.14 KB, patch)
2012-11-14 18:40 PST, Dana Jansens
no flags
Dana Jansens
Comment 1 2012-11-13 17:50:47 PST
Dana Jansens
Comment 2 2012-11-13 17:53:13 PST
Created attachment 174040 [details] Patch Add bug to the changelog
Dana Jansens
Comment 3 2012-11-14 18:03:58 PST
Review ping
James Robinson
Comment 4 2012-11-14 18:06:32 PST
Comment on attachment 174040 [details] Patch Sorry, I thought I had already left feedback. Would it make more sense to do this in the WebFoo -> gfx::Foo conversions in webkit/compositor_bindings? I worry that trying to this here is going to be fragile to other rects/sizes that end up negative for who-knows-what reasons.
Dana Jansens
Comment 5 2012-11-14 18:07:57 PST
Sure, I'm good with that. I kind of like that new cases will come to attention easier. But then again it seems like negative sizes in WebCore aren't really a huge problem for us anyways and clamping seems reasonable.
Dana Jansens
Comment 6 2012-11-14 18:18:30 PST
WebKit Review Bot
Comment 7 2012-11-14 18:21:21 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
James Robinson
Comment 8 2012-11-14 18:23:25 PST
(In reply to comment #4) > (From update of attachment 174040 [details]) > in webkit/compositor_bindings do other WebKit API users have this restriction? If it's a compositor restriction we should do it ^^
Dana Jansens
Comment 9 2012-11-14 18:26:27 PST
Ohh. Well as soon as you try to make a gfx::Rect out of an IntRect with a negative size, it's going to assert. Anyone else who uses these methods to convert will suffer the same assertions. So unless you want to leave them with asserts but protect w_c_bindings, I think we should do it here.
James Robinson
Comment 10 2012-11-14 18:30:47 PST
I see. If it's a restriction of the gfx:: types then the only question is how loud we want to be when things other than the compositor pass negative values in to here. How long have the gfx:: types asserted? If it's been a while, then I think we can be pretty confident that nobody else depends on any particular behavior here.
Dana Jansens
Comment 11 2012-11-14 18:35:21 PST
They asserted before we came along and started the gtfo thing. Then we removed the assertions to try match webcore behaviour. Now I am putting them back, and there's a few places that we've found trigger them. We've been without them since Fri Sep 28 - chromium a25e25b907d387f0b76a2b8acd522193e777e793 One is contentsRect from GraphicsLayerChromium. One was the thumbLength for scrollbars. And the others were simple things that had cropped up in the meantime.
WebKit Review Bot
Comment 12 2012-11-14 18:37:03 PST
Comment on attachment 174310 [details] Patch Attachment 174310 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14845244
James Robinson
Comment 13 2012-11-14 18:39:39 PST
Comment on attachment 174310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=174310&action=review OK, thanks for the history. Seems reasonable except for the build failure. > Source/Platform/chromium/public/WebFloatRect.h:111 > + return gfx::RectF(x, y, std::max(0, width), std::max(0, height)); gonna need to use floating point literals or invoke the ::max() override you want with max<float>, i think
Dana Jansens
Comment 14 2012-11-14 18:40:37 PST
Created attachment 174313 [details] Patch for landing
Dana Jansens
Comment 15 2012-11-14 18:41:39 PST
Cool, thanks!
WebKit Review Bot
Comment 16 2012-11-14 19:06:28 PST
Comment on attachment 174313 [details] Patch for landing Clearing flags on attachment: 174313 Committed r134725: <http://trac.webkit.org/changeset/134725>
WebKit Review Bot
Comment 17 2012-11-14 19:06:34 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.