Bug 103984 - IntSize::scale() should return rounded value
Summary: IntSize::scale() should return rounded value
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mikhail Pozdnyakov
URL:
Keywords:
Depends on: 104015
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-04 01:32 PST by Mikhail Pozdnyakov
Modified: 2012-12-04 10:46 PST (History)
6 users (show)

See Also:


Attachments
patch (3.28 KB, patch)
2012-12-04 01:38 PST, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Pozdnyakov 2012-12-04 01:32:37 PST
Currently IntSize::scale() just casts 'float' result to 'int' loosing all the data after '.' instead of 
rounding the float value to the nearest integer. For example scaling (10, 10) by 0.999999 will result (9,9).
Also it's causing flakiness of css3/device-adapt/viewport-width-not-affecting-next-page.html on WK2 EFL.
Comment 1 Mikhail Pozdnyakov 2012-12-04 01:38:56 PST
Created attachment 177447 [details]
patch
Comment 2 Kenneth Rohde Christiansen 2012-12-04 01:45:15 PST
Comment on attachment 177447 [details]
patch

I assume you ran layout tests and checked other call sites
Comment 3 Dominik Röttsches (drott) 2012-12-04 02:35:28 PST
(In reply to comment #0)
> Currently IntSize::scale() just casts 'float' result to 'int' loosing all the data after '.' instead of 
> rounding the float value to the nearest integer. For example scaling (10, 10) by 0.999999 will result (9,9).
> Also it's causing flakiness of css3/device-adapt/viewport-width-not-affecting-next-page.html on WK2 EFL.

Should the viewport code maybe use LayoutUnits instead? (without knowing much about it).
Comment 4 Mikhail Pozdnyakov 2012-12-04 03:28:44 PST
(In reply to comment #2)
> (From update of attachment 177447 [details])
> I assume you ran layout tests and checked other call sites

Some EWS bots (chromium at least) check layout tests as well.
Anyway I've just run the tests locally and did not discover regressions.
Comment 5 WebKit Review Bot 2012-12-04 07:42:39 PST
Comment on attachment 177447 [details]
patch

Clearing flags on attachment: 177447

Committed r136509: <http://trac.webkit.org/changeset/136509>
Comment 6 WebKit Review Bot 2012-12-04 07:42:42 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Emil A Eklund 2012-12-04 09:27:47 PST
This change broke at least 12 tests. Most of them seem harmless but this one is worrying as it changes how the image is aligned: http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=fast%2Fbackgrounds%2Fsize%2Fcontain-and-cover-zoomed.html
Comment 8 Darin Adler 2012-12-04 09:45:35 PST
This is a really low level change to make. We have to look at every call site and make sure that rounding is desired. It wasn’t an accident before that this function truncated; how did we determine call sites did not depend on that?
Comment 9 Darin Adler 2012-12-04 09:46:34 PST
A much safer change would be to rename scale to describe the rounding vs. truncating behavior and possibly splitting it into more than one function if callers need more than one kind of behavior. If there are many tests broken, this should be rolled out and the change should be redone more carefully.
Comment 10 Emil A Eklund 2012-12-04 09:58:21 PST
I'm with Darin on this one. Unless I hear back from either of you in the next hour or so I'll rollout this change.
Comment 11 Kenneth Rohde Christiansen 2012-12-04 10:41:41 PST
Fine with me, please roll out. As I wrote before "I assume you ran layout tests and checked other call sites"
Comment 12 WebKit Review Bot 2012-12-04 10:46:04 PST
Re-opened since this is blocked by bug 104015