Bug 81038

Summary: Update LayoutUnit usage in RenderListBox
Product: WebKit Reporter: Levi Weintraub <leviw>
Component: Layout and RenderingAssignee: Levi Weintraub <leviw>
Status: RESOLVED FIXED    
Severity: Normal CC: eae, eric, jchaffraix, tkent, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 60318    
Attachments:
Description Flags
Patch none

Description Levi Weintraub 2012-03-13 14:49:00 PDT
Rounding paint offsets, snapping painted rects, and rounding mouse coordinates, as laid out in https://trac.webkit.org/wiki/LayoutUnit.
Comment 1 Levi Weintraub 2012-03-13 15:33:15 PDT
Created attachment 131727 [details]
Patch
Comment 2 Julien Chaffraix 2012-03-16 07:57:09 PDT
Comment on attachment 131727 [details]
Patch

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

> Source/WebCore/ChangeLog:19
> +        (WebCore::RenderListBox::panScroll): EventHandler::currentMousePosition is an IntPoint,
> +        so it doesn't require additional rounding in RenderListBox.

It would be nice to make such conversion fail at compile time when you change the type of LayoutUnit to catch such unneeded copying.

> Source/WebCore/rendering/RenderListBox.cpp:425
> +    paintInfo.context->drawBidiText(itemFont, textRun, roundedIntPoint(r.location()));

I was going to ask about why rounding and then I saw that's what pixelSnappedIntRect does. I wonder if we could not make it more obvious that pixelSnappedIntRect is doing a roundedIntPoint on the location...
Comment 3 Levi Weintraub 2012-03-16 11:20:15 PDT
Comment on attachment 131727 [details]
Patch

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

>> Source/WebCore/ChangeLog:19
>> +        so it doesn't require additional rounding in RenderListBox.
> 
> It would be nice to make such conversion fail at compile time when you change the type of LayoutUnit to catch such unneeded copying.

Making IntPoint->LayoutPoint an explicit conversion would be a good idea, you're right.

>> Source/WebCore/rendering/RenderListBox.cpp:425
>> +    paintInfo.context->drawBidiText(itemFont, textRun, roundedIntPoint(r.location()));
> 
> I was going to ask about why rounding and then I saw that's what pixelSnappedIntRect does. I wonder if we could not make it more obvious that pixelSnappedIntRect is doing a roundedIntPoint on the location...

We could call it pixelSnappedIntPoint, but I feel like that doesn't actually make things clearer...
Comment 4 WebKit Review Bot 2012-03-16 12:07:42 PDT
Comment on attachment 131727 [details]
Patch

Clearing flags on attachment: 131727

Committed r111040: <http://trac.webkit.org/changeset/111040>
Comment 5 WebKit Review Bot 2012-03-16 12:07:47 PDT
All reviewed patches have been landed.  Closing bug.