RESOLVED FIXED97265
snapToSize rounds the incorrectly for negative locations
https://bugs.webkit.org/show_bug.cgi?id=97265
Summary snapToSize rounds the incorrectly for negative locations
Emil A Eklund
Reported 2012-09-20 15:22:57 PDT
In snapToSize we use the fraction of the location rather than the full location when adjusting the width. This results in the sign being lost which in turn affects rounding. Downstream chromium bug: http://code.google.com/p/chromium/issues/detail?id=150802
Attachments
Patch (10.74 KB, patch)
2012-09-20 15:46 PDT, Emil A Eklund
no flags
Patch (10.76 KB, patch)
2012-09-21 14:48 PDT, Emil A Eklund
no flags
Patch for landing (10.95 KB, patch)
2012-09-21 15:00 PDT, Emil A Eklund
no flags
Emil A Eklund
Comment 1 2012-09-20 15:46:08 PDT
Eric Seidel (no email)
Comment 2 2012-09-20 15:59:34 PDT
Comment on attachment 165002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=165002&action=review > Source/WebCore/platform/FractionalLayoutUnit.h:810 > + FractionalLayoutUnit fraction = (location - location.floor()) * (location < 0 ? -1 : 1); I this the most elegant way to do this? It seems you're undoing floor's magic, which presumably ignores sign.
Emil A Eklund
Comment 3 2012-09-20 16:01:44 PDT
(In reply to comment #2) > (From update of attachment 165002 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=165002&action=review > > > Source/WebCore/platform/FractionalLayoutUnit.h:810 > > + FractionalLayoutUnit fraction = (location - location.floor()) * (location < 0 ? -1 : 1); > > I this the most elegant way to do this? It seems you're undoing floor's magic, which presumably ignores sign. I'm sure it is not but it is the best I've managed to come up with so far. If you have any suggestions I'm all ears.
Levi Weintraub
Comment 4 2012-09-20 17:55:31 PDT
Comment on attachment 165002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=165002&action=review >>> Source/WebCore/platform/FractionalLayoutUnit.h:810 >>> + FractionalLayoutUnit fraction = (location - location.floor()) * (location < 0 ? -1 : 1); >> >> I this the most elegant way to do this? It seems you're undoing floor's magic, which presumably ignores sign. > > I'm sure it is not but it is the best I've managed to come up with so far. > If you have any suggestions I'm all ears. Isn't the fraction just location.rawValue() % kFixedPointDenominator?
WebKit Review Bot
Comment 5 2012-09-21 01:12:48 PDT
Comment on attachment 165002 [details] Patch Attachment 165002 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13932472 New failing tests: compositing/reflections/reflection-in-composited.html fast/writing-mode/Kusa-Makura-background-canvas.html css3/filters/nested-filter.html media/video-zoom-controls.html fast/multicol/vertical-lr/float-multicol.html
Emil A Eklund
Comment 6 2012-09-21 14:48:51 PDT
Eric Seidel (no email)
Comment 7 2012-09-21 14:53:13 PDT
Comment on attachment 165195 [details] Patch LGTM.
Eric Seidel (no email)
Comment 8 2012-09-21 14:53:44 PDT
Comment on attachment 165195 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=165195&action=review > Source/WebCore/platform/FractionalLayoutUnit.h:811 > + fraction.setRawValue(location.rawValue() % kFixedPointDenominator); A comment about why we do it this way might help, but this is also OK.
Emil A Eklund
Comment 9 2012-09-21 15:00:10 PDT
Created attachment 165199 [details] Patch for landing
Emil A Eklund
Comment 10 2012-09-21 15:00:35 PDT
Thanks Eric. Added a comment explaining why we do it this way.
WebKit Review Bot
Comment 11 2012-09-21 16:29:53 PDT
Comment on attachment 165199 [details] Patch for landing Rejecting attachment 165199 [details] from commit-queue. New failing tests: WebFilterOperationsTest.saveAndRestore media/video-zoom-controls.html Full output: http://queues.webkit.org/results/13956808
Emil A Eklund
Comment 12 2012-09-24 08:34:50 PDT
Note You need to log in before you can comment on or make changes to this bug.