Bug 136253

Summary: Subpixel layout: Remove float to LayoutUnit ceil/round function wrappers.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 136275    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description zalan 2014-08-26 08:25:28 PDT
ceiledLayoutUnit()
roundedLayoutUnit()

These functions ceil/round float to LayoutUnit. Their usage are limited and can easily be confused with the snapping functions (snap to css/device pixels).
Comment 1 zalan 2014-08-26 10:43:51 PDT
Created attachment 237156 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-08-26 10:59:28 PDT
Comment on attachment 237156 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=237156&action=review

> Source/WebCore/platform/LayoutUnit.h:926
> +// When this occurs while accumulating converted LayoutUnit values, we can wind up with a result smaller than expected.

That doesn't explain the ceil though. This comment is pretty confusing. The caller really needs to know whether ceiling or flooring is appropriate for them.

> Source/WebCore/platform/LayoutUnit.h:927
> +inline LayoutUnit ceilFloatForSubPixelLayout(float value)

I don't think the "ForSubPixelLayout" adds anything. I think the name "ceiledLayoutUnit" is as good.
Comment 3 zalan 2014-08-26 11:16:27 PDT
Created attachment 237158 [details]
Patch
Comment 4 zalan 2014-08-26 11:43:37 PDT
Created attachment 237160 [details]
Patch
Comment 5 Simon Fraser (smfr) 2014-08-26 11:48:50 PDT
Comment on attachment 237160 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=237160&action=review

> Source/WebCore/rendering/RenderBlock.cpp:2902
> +    preferredWidth = std::max(LayoutUnit::fromFloatCeil(result), preferredWidth);

You lost some of the comment here, which I think is useful to explain why this code uses ceil.
Comment 6 WebKit Commit Bot 2014-08-26 12:29:22 PDT
Comment on attachment 237160 [details]
Patch

Clearing flags on attachment: 237160

Committed r172970: <http://trac.webkit.org/changeset/172970>
Comment 7 WebKit Commit Bot 2014-08-26 12:29:25 PDT
All reviewed patches have been landed.  Closing bug.