RESOLVED FIXED92374
Inaccurate layoutMod
https://bugs.webkit.org/show_bug.cgi?id=92374
Summary Inaccurate layoutMod
Allan Sandfeld Jensen
Reported 2012-07-26 06:01:04 PDT
The layoutMod function performs the module in integer instead of FractionalLayoutUnit when subpixel units are enabled. This means the it for its main use; calculating remainer, returns an inaccurate result. To solve this, modulo operators should be defined for FractionalLayoutUnit and used. I here use the common definition of modulo which solves the equation: a = (a / b) * b + a % b.
Attachments
Patch (2.85 KB, patch)
2012-07-26 06:04 PDT, Allan Sandfeld Jensen
no flags
Archive of layout-test-results from gce-cr-linux-05 (1.78 MB, application/zip)
2012-07-26 15:07 PDT, WebKit Review Bot
no flags
Archive of layout-test-results from gce-cr-linux-06 (2.10 MB, application/zip)
2012-07-26 16:15 PDT, WebKit Review Bot
no flags
Patch (5.53 KB, patch)
2012-07-27 04:14 PDT, Allan Sandfeld Jensen
no flags
Archive of layout-test-results from gce-cr-linux-07 (1.71 MB, application/zip)
2012-07-27 07:35 PDT, WebKit Review Bot
no flags
Archive of layout-test-results from gce-cr-linux-08 (1.90 MB, application/zip)
2012-07-27 08:48 PDT, WebKit Review Bot
no flags
Patch (7.79 KB, patch)
2012-08-02 06:13 PDT, Allan Sandfeld Jensen
no flags
Archive of layout-test-results from gce-cr-linux-07 (1.67 MB, application/zip)
2012-08-02 10:49 PDT, WebKit Review Bot
no flags
Archive of layout-test-results from gce-cr-linux-02 (1.92 MB, application/zip)
2012-08-02 12:00 PDT, WebKit Review Bot
no flags
Patch (7.96 KB, patch)
2012-08-03 03:41 PDT, Allan Sandfeld Jensen
leviw: review+
Allan Sandfeld Jensen
Comment 1 2012-07-26 06:04:39 PDT
Emil A Eklund
Comment 2 2012-07-26 09:45:41 PDT
This is great, thank you. Lets see what the cr-linux bot thinks as it runs all the tests. We might need to update some expectations.
WebKit Review Bot
Comment 3 2012-07-26 15:07:54 PDT
Comment on attachment 154628 [details] Patch Attachment 154628 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13373018 New failing tests: fast/multicol/float-paginate.html fast/forms/range/slider-delete-while-dragging-thumb.html fast/loader/loadInProgress.html fast/multicol/float-paginate-complex.html fast/multicol/float-multicol.html fast/forms/search-vertical-alignment.html fast/multicol/block-axis-horizontal-tb.html fast/multicol/hit-test-end-of-column.html http/tests/security/script-crossorigin-loads-correctly.html fast/multicol/border-padding-pagination.html fast/css/input-search-padding.html fast/block/positioning/offsetLeft-offsetTop-multicolumn.html fast/multicol/column-break-with-balancing.html fast/forms/range/slider-mouse-events.html fast/frames/cached-frame-counter.html fast/multicol/block-axis-vertical-rl.html fast/dom/Element/getBoundingClientRect.html fast/multicol/column-rules-stacking.html fast/multicol/hit-test-gap-block-axis.html compositing/columns/composited-in-paginated.html fast/multicol/image-inside-nested-blocks-with-border.html fast/multicol/float-paginate-empty-lines.html fast/multicol/column-rules.html fast/multicol/block-axis-vertical-lr.html fast/multicol/block-axis-horizontal-bt.html fast/forms/range/slider-onchange-event.html fast/multicol/break-properties.html
WebKit Review Bot
Comment 4 2012-07-26 15:07:59 PDT
Created attachment 154761 [details] Archive of layout-test-results from gce-cr-linux-05 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-05 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 5 2012-07-26 15:32:30 PDT
Comment on attachment 154628 [details] Patch A few of the tests looks better, but several are obviously broken by this patch, which will require some investigation.
Emil A Eklund
Comment 6 2012-07-26 15:58:38 PDT
Let me know if there is anything I can do to help.
WebKit Review Bot
Comment 7 2012-07-26 16:15:47 PDT
Comment on attachment 154628 [details] Patch Attachment 154628 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13377024 New failing tests: fast/multicol/float-paginate.html fast/loader/loadInProgress.html fast/multicol/float-paginate-complex.html fast/multicol/margin-collapse.html fast/multicol/hit-test-gap-block-axis.html fast/forms/search-vertical-alignment.html fast/multicol/block-axis-horizontal-tb.html fast/multicol/hit-test-end-of-column.html http/tests/security/script-crossorigin-loads-correctly.html fast/multicol/border-padding-pagination.html fast/css/input-search-padding.html fast/multicol/layers-in-multicol.html fast/block/positioning/offsetLeft-offsetTop-multicolumn.html fast/multicol/column-break-with-balancing.html fast/frames/cached-frame-counter.html fast/multicol/nested-columns.html fast/multicol/block-axis-vertical-rl.html fast/dom/Element/getBoundingClientRect.html fast/multicol/column-rules-stacking.html compositing/columns/composited-in-paginated.html fast/multicol/image-inside-nested-blocks-with-border.html fast/multicol/float-paginate-empty-lines.html fast/multicol/column-rules.html fast/multicol/block-axis-vertical-lr.html fast/multicol/float-multicol.html fast/multicol/block-axis-horizontal-bt.html fast/multicol/break-properties.html
WebKit Review Bot
Comment 8 2012-07-26 16:15:53 PDT
Created attachment 154784 [details] Archive of layout-test-results from gce-cr-linux-06 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-06 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 9 2012-07-27 03:43:46 PDT
Okay, the problem is that layoutMod is used in some places to calculate the number of columns or pages. In those cases the fractional results makes no sense and the division and modulo should be performed in integer.
Allan Sandfeld Jensen
Comment 10 2012-07-27 04:07:05 PDT
This really comes down to two different way to do module for FractionalLayoutUnit: Imagine kFixedPointDenominator = 10. Is 5.5 % 6.0 = 5.5, because 0 * 6 + 5.5 = 5.5 or is 5.5 % 6.0 = 0.1, because 5.5 / 6.0 = 0.9 and 0.9 * 6 + 0.1 = 5.5 The second makes the most sense to me, but we need the first to calculate how much height is remaining after an unknown, but naturally integer, number of pages. I will make a second function in the next patch to solve this called layoutIntMod.
Allan Sandfeld Jensen
Comment 11 2012-07-27 04:14:05 PDT
Allan Sandfeld Jensen
Comment 12 2012-07-27 04:21:09 PDT
Btw, I considered another way of naming these two operations, so if anyone dislikes the naming used in the patch, I offer an alternative: We could let operator% always be the remainder after a division truncated to integer, and call the real remainder after a fractionlayoutunit division for 'remainder'. Or, we could not have any of them use operator%, to force programmers to actually think about which one they need, since we can't cover all common use-cases of integer-modulo in a single fractionallayoutunit modulo.
WebKit Review Bot
Comment 13 2012-07-27 07:35:06 PDT
Comment on attachment 154900 [details] Patch Attachment 154900 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13378371 New failing tests: fast/multicol/vertical-rl/float-multicol.html fast/multicol/nested-columns.html fast/multicol/vertical-lr/float-multicol.html fast/multicol/vertical-rl/nested-columns.html fast/speech/input-appearance-searchandspeech.html fast/multicol/vertical-lr/nested-columns.html fast/multicol/span/span-as-immediate-columns-child.html fast/multicol/span/anonymous-split-block-crash.html fast/forms/search-vertical-alignment.html fast/css/input-search-padding.html fast/table/colspanMinWidth-vertical.html fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html
WebKit Review Bot
Comment 14 2012-07-27 07:35:10 PDT
Created attachment 154945 [details] Archive of layout-test-results from gce-cr-linux-07 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-07 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 15 2012-07-27 07:58:53 PDT
(In reply to comment #13) > (From update of attachment 154900 [details]) > Attachment 154900 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/13378371 > > New failing tests: > fast/multicol/vertical-rl/float-multicol.html > fast/multicol/nested-columns.html > fast/multicol/vertical-lr/float-multicol.html > fast/multicol/vertical-rl/nested-columns.html > fast/speech/input-appearance-searchandspeech.html > fast/multicol/vertical-lr/nested-columns.html > fast/multicol/span/span-as-immediate-columns-child.html > fast/multicol/span/anonymous-split-block-crash.html > fast/forms/search-vertical-alignment.html > fast/css/input-search-padding.html > fast/table/colspanMinWidth-vertical.html > fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html These are all small 1px difference, which is too be expected when the precision of the layout is improved. None if them look wrong, though at 1px difference, they don't fix any obvious mistakes either.
WebKit Review Bot
Comment 16 2012-07-27 08:48:16 PDT
Comment on attachment 154900 [details] Patch Attachment 154900 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13375522 New failing tests: fast/multicol/vertical-rl/float-multicol.html fast/multicol/nested-columns.html fast/multicol/vertical-lr/float-multicol.html fast/multicol/vertical-rl/nested-columns.html fast/speech/input-appearance-searchandspeech.html fast/multicol/vertical-lr/nested-columns.html fast/multicol/span/span-as-immediate-columns-child.html fast/multicol/span/anonymous-split-block-crash.html fast/forms/search-vertical-alignment.html fast/css/input-search-padding.html fast/table/colspanMinWidth-vertical.html fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html
WebKit Review Bot
Comment 17 2012-07-27 08:48:20 PDT
Created attachment 154964 [details] Archive of layout-test-results from gce-cr-linux-08 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-08 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 18 2012-07-30 03:02:18 PDT
I can not create new baselines for chromium, so I propose landing the patch as is, and let chromium developers rebase. Is that acceptable?
Levi Weintraub
Comment 19 2012-07-31 12:18:35 PDT
(In reply to comment #18) > I can not create new baselines for chromium, so I propose landing the patch as is, and let chromium developers rebase. Is that acceptable? I'm not necessarily opposed to landing this without baselines, but I haven't had a chance to actually look at the diffs to verify they don't regress. If you're confident this doesn't regress, I can take your word. Also, you don't need Chromium Dev's to rebase, the proper solution is to mark them all as expected failures in Chromium's test expectations, then use the Rebaseline Tool http://trac.webkit.org/wiki/Rebaseline. This shouldn't be landed in a way that makes the bots red.
Allan Sandfeld Jensen
Comment 20 2012-08-01 01:40:17 PDT
(In reply to comment #19) > (In reply to comment #18) > > I can not create new baselines for chromium, so I propose landing the patch as is, and let chromium developers rebase. Is that acceptable? > > I'm not necessarily opposed to landing this without baselines, but I haven't had a chance to actually look at the diffs to verify they don't regress. If you're confident this doesn't regress, I can take your word. > I would feel more comfortable if someone else confirmed it. Especially someone with experience in looking at changes due to subpixel layout and chromium test results. > Also, you don't need Chromium Dev's to rebase, the proper solution is to mark them all as expected failures in Chromium's test expectations, then use the Rebaseline Tool http://trac.webkit.org/wiki/Rebaseline. This shouldn't be landed in a way that makes the bots red. That sounds nice. I will take a look.
Allan Sandfeld Jensen
Comment 21 2012-08-01 09:25:19 PDT
(In reply to comment #20) > (In reply to comment #19) > > Also, you don't need Chromium Dev's to rebase, the proper solution is to mark them all as expected failures in Chromium's test expectations, then use the Rebaseline Tool http://trac.webkit.org/wiki/Rebaseline. This shouldn't be landed in a way that makes the bots red. > > That sounds nice. I will take a look. Or I could just use the output provided by the bots and put in the archives here, but I guess that would be too easy.
Allan Sandfeld Jensen
Comment 22 2012-08-02 06:13:54 PDT
WebKit Review Bot
Comment 23 2012-08-02 10:48:58 PDT
Comment on attachment 156061 [details] Patch Attachment 156061 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13430049 New failing tests: fast/multicol/vertical-rl/float-multicol.html fast/multicol/nested-columns.html fast/multicol/vertical-lr/float-multicol.html fast/multicol/vertical-rl/nested-columns.html fast/speech/input-appearance-searchandspeech.html fast/multicol/vertical-lr/nested-columns.html fast/multicol/span/span-as-immediate-columns-child.html fast/multicol/span/anonymous-split-block-crash.html fast/forms/search-vertical-alignment.html fast/css/input-search-padding.html fast/table/colspanMinWidth-vertical.html fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html
WebKit Review Bot
Comment 24 2012-08-02 10:49:03 PDT
Created attachment 156121 [details] Archive of layout-test-results from gce-cr-linux-07 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-07 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 25 2012-08-02 11:49:33 PDT
Comment on attachment 156061 [details] Patch Wrong syntax in the testexpectations.
WebKit Review Bot
Comment 26 2012-08-02 11:59:57 PDT
Comment on attachment 156061 [details] Patch Attachment 156061 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13426268 New failing tests: fast/multicol/vertical-rl/float-multicol.html fast/multicol/nested-columns.html fast/multicol/vertical-lr/float-multicol.html fast/multicol/vertical-rl/nested-columns.html fast/speech/input-appearance-searchandspeech.html fast/multicol/vertical-lr/nested-columns.html fast/multicol/span/span-as-immediate-columns-child.html fast/multicol/span/anonymous-split-block-crash.html fast/forms/search-vertical-alignment.html fast/css/input-search-padding.html fast/table/colspanMinWidth-vertical.html fast/multicol/span/clone-anonymous-block-non-inline-child-crash.html
WebKit Review Bot
Comment 27 2012-08-02 12:00:01 PDT
Created attachment 156133 [details] Archive of layout-test-results from gce-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Allan Sandfeld Jensen
Comment 28 2012-08-03 03:41:10 PDT
Created attachment 156310 [details] Patch Fixed TestExpectation syntax
Levi Weintraub
Comment 29 2012-08-03 11:06:15 PDT
Comment on attachment 156310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156310&action=review Overall, great change! > Source/WebCore/rendering/LayoutTypes.h:150 > inline LayoutUnit layoutMod(const LayoutUnit& numerator, const LayoutUnit& denominator) So is the non-integer layoutMod used anywhere now? > Source/WebCore/rendering/LayoutTypes.h:156 > +inline LayoutUnit layoutIntMod(const LayoutUnit& numerator, const LayoutUnit& denominator) I think this level of indirection should just go away and callers should call directly into FractionalLayoutUnit's functions. LayoutTypes was created largely to ease the transition to FractionalLayoutUnits, which has occurred.
Allan Sandfeld Jensen
Comment 30 2012-08-03 11:37:39 PDT
(In reply to comment #29) > (From update of attachment 156310 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=156310&action=review > > Overall, great change! > > > Source/WebCore/rendering/LayoutTypes.h:150 > > inline LayoutUnit layoutMod(const LayoutUnit& numerator, const LayoutUnit& denominator) > > So is the non-integer layoutMod used anywhere now? > Yes, I think I left two or three places using layoutMod unchanged. > > Source/WebCore/rendering/LayoutTypes.h:156 > > +inline LayoutUnit layoutIntMod(const LayoutUnit& numerator, const LayoutUnit& denominator) > > I think this level of indirection should just go away and callers should call directly into FractionalLayoutUnit's functions. LayoutTypes was created largely to ease the transition to FractionalLayoutUnits, which has occurred. I thought that would be done when most platforms had switched subpixel layout, and FractionLayoutX could be renamed LayoutX?
Levi Weintraub
Comment 31 2012-08-03 12:56:09 PDT
Comment on attachment 156310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156310&action=review >>> Source/WebCore/rendering/LayoutTypes.h:156 >>> +inline LayoutUnit layoutIntMod(const LayoutUnit& numerator, const LayoutUnit& denominator) >> >> I think this level of indirection should just go away and callers should call directly into FractionalLayoutUnit's functions. LayoutTypes was created largely to ease the transition to FractionalLayoutUnits, which has occurred. > > I thought that would be done when most platforms had switched subpixel layout, and FractionLayoutX could be renamed LayoutX? We would like to do this rename, but we should minimize the duplication of functionality in LayoutTypes.h now that all platforms are using FractionalLayoutUnits. In the meantime, this isn't a gating issue. r=me pending results from the cr-linux bot, and provided you follow up with updated expectations once the bots have cycled with the patch. Let me know if you need help with that last part :)
Allan Sandfeld Jensen
Comment 32 2012-08-06 02:36:52 PDT
(In reply to comment #31) > We would like to do this rename, but we should minimize the duplication of functionality in LayoutTypes.h now that all platforms are using FractionalLayoutUnits. In the meantime, this isn't a gating issue. r=me pending results from the cr-linux bot The cr-linux bot was shortly green and then seemed to die for reason. I will assume the fact that it ran one iteration completely green that it actually work, so I will land the patch and watch the waterfall.
Allan Sandfeld Jensen
Comment 33 2012-08-06 02:38:33 PDT
WebKit Review Bot
Comment 34 2012-08-06 03:40:05 PDT
Re-opened since this is blocked by 93249
Allan Sandfeld Jensen
Comment 35 2012-08-06 05:12:18 PDT
Bug #93249 has been closed again.
Allan Sandfeld Jensen
Comment 36 2012-08-07 03:31:05 PDT
Rebaseline of skipped tests landed in r124874
Note You need to log in before you can comment on or make changes to this bug.