Bug 92374 - Inaccurate layoutMod
Summary: Inaccurate layoutMod
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Allan Sandfeld Jensen
URL:
Keywords:
Depends on: 93249
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-26 06:01 PDT by Allan Sandfeld Jensen
Modified: 2012-08-07 03:31 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.85 KB, patch)
2012-07-26 06:04 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff
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 Details
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 Details
Patch (5.53 KB, patch)
2012-07-27 04:14 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff
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 Details
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 Details
Patch (7.79 KB, patch)
2012-08-02 06:13 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff
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 Details
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 Details
Patch (7.96 KB, patch)
2012-08-03 03:41 PDT, Allan Sandfeld Jensen
leviw: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Sandfeld Jensen 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.
Comment 1 Allan Sandfeld Jensen 2012-07-26 06:04:39 PDT
Created attachment 154628 [details]
Patch
Comment 2 Emil A Eklund 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.
Comment 3 WebKit Review Bot 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
Comment 4 WebKit Review Bot 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
Comment 5 Allan Sandfeld Jensen 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.
Comment 6 Emil A Eklund 2012-07-26 15:58:38 PDT
Let me know if there is anything I can do to help.
Comment 7 WebKit Review Bot 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
Comment 8 WebKit Review Bot 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
Comment 9 Allan Sandfeld Jensen 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.
Comment 10 Allan Sandfeld Jensen 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.
Comment 11 Allan Sandfeld Jensen 2012-07-27 04:14:05 PDT
Created attachment 154900 [details]
Patch
Comment 12 Allan Sandfeld Jensen 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.
Comment 13 WebKit Review Bot 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
Comment 14 WebKit Review Bot 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
Comment 15 Allan Sandfeld Jensen 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.
Comment 16 WebKit Review Bot 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
Comment 17 WebKit Review Bot 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
Comment 18 Allan Sandfeld Jensen 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?
Comment 19 Levi Weintraub 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.
Comment 20 Allan Sandfeld Jensen 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.
Comment 21 Allan Sandfeld Jensen 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.
Comment 22 Allan Sandfeld Jensen 2012-08-02 06:13:54 PDT
Created attachment 156061 [details]
Patch
Comment 23 WebKit Review Bot 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
Comment 24 WebKit Review Bot 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
Comment 25 Allan Sandfeld Jensen 2012-08-02 11:49:33 PDT
Comment on attachment 156061 [details]
Patch

Wrong syntax in the testexpectations.
Comment 26 WebKit Review Bot 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
Comment 27 WebKit Review Bot 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
Comment 28 Allan Sandfeld Jensen 2012-08-03 03:41:10 PDT
Created attachment 156310 [details]
Patch

Fixed TestExpectation syntax
Comment 29 Levi Weintraub 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.
Comment 30 Allan Sandfeld Jensen 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?
Comment 31 Levi Weintraub 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 :)
Comment 32 Allan Sandfeld Jensen 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.
Comment 33 Allan Sandfeld Jensen 2012-08-06 02:38:33 PDT
Committed r124745: <http://trac.webkit.org/changeset/124745>
Comment 34 WebKit Review Bot 2012-08-06 03:40:05 PDT
Re-opened since this is blocked by 93249
Comment 35 Allan Sandfeld Jensen 2012-08-06 05:12:18 PDT
Bug #93249 has been closed again.
Comment 36 Allan Sandfeld Jensen 2012-08-07 03:31:05 PDT
Rebaseline of skipped tests landed in r124874