WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
122367
[MathML] Use of floating point floor/ceil operations on LayoutUnits seems wrong
https://bugs.webkit.org/show_bug.cgi?id=122367
Summary
[MathML] Use of floating point floor/ceil operations on LayoutUnits seems wrong
Brent Fulgham
Reported
2013-10-04 18:04:31 PDT
While investigating another problem, I noticed the following code in RenderMathMLOperator::paintCharacter: switch (trim) { case TrimTop: glyphPaintRect.shiftYEdgeTo(ceil(glyphPaintRect.y()) + 1); clipBounds.shiftYEdgeTo(glyphPaintRect.y()); break; case TrimBottom: glyphPaintRect.shiftMaxYEdgeTo(floor(glyphPaintRect.maxY()) - 1); clipBounds.shiftMaxYEdgeTo(glyphPaintRect.maxY()); break; case TrimTopAndBottom: glyphPaintRect.shiftYEdgeTo(ceil(glyphPaintRect.y() + 1)); glyphPaintRect.shiftMaxYEdgeTo(floor(glyphPaintRect.maxY()) - 1); clipBounds.shiftYEdgeTo(glyphPaintRect.y()); clipBounds.shiftMaxYEdgeTo(glyphPaintRect.maxY()); break; } The various paint rects in this code are LayoutRects, and the y()/maxY() methods return LayoutUnits. The LayoutRect and LayoutUnit wrap an 'int' type. So the calls to the ceil/floor C API results in an implicit cast from LayoutUnit->float, then a call to floor/ceil. Since we are already working with integer types, these calls seem at best wasteful. Given that the layout units do some magic internally for dealing with sub-pixel layout for their ceil() and floor() methods, I feel like this code should be revised as outlined in the attached patch.
Attachments
Patch
(2.10 KB, patch)
2013-10-04 18:08 PDT
,
Brent Fulgham
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Brent Fulgham
Comment 1
2013-10-04 18:08:26 PDT
Created
attachment 213428
[details]
Patch
Martin Robinson
Comment 2
2013-10-04 19:47:06 PDT
landing I would like to verify that this fits not regress rendering quality on GTK+, if you don't mind.
Martin Robinson
Comment 3
2013-10-07 19:13:37 PDT
This looks good on GTK+ so feel free to land this when it looks like the the patch for 12146 sticks.
Radar WebKit Bug Importer
Comment 4
2013-10-08 09:25:56 PDT
<
rdar://problem/15176294
>
Brent Fulgham
Comment 5
2013-10-08 13:41:18 PDT
Committed
r157135
: <
http://trac.webkit.org/changeset/157135
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug