Convert selection handling code to new layout abstraction.
Created attachment 99389 [details] Patch
No rounding methods where harmed in making this patch.
Comment on attachment 99389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=99389&action=review > Source/WebCore/rendering/InlineTextBox.cpp:118 > + LayoutUnit sPos = max(startPos - m_start, static_cast<LayoutUnit>(0)); I don't think you'll need this cast in the float case. Will you?
(In reply to comment #3) > (From update of attachment 99389 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=99389&action=review > > > Source/WebCore/rendering/InlineTextBox.cpp:118 > > + LayoutUnit sPos = max(startPos - m_start, static_cast<LayoutUnit>(0)); > > I don't think you'll need this cast in the float case. Will you? Sadly you do. The max method either takes int, int or float, float. In the float case without the cast this would result in a compiler error.
This was one of the most frustrating things to deal with when building our proof of concept. Since we max with zero all over the code, I'm thinking it could make sense to have an inline function clapToZero which would remove our need to cast zero.
I thought the compiler was smart enough to treat '0' like whatever type it needed to. I guess not. I strongly support the addition of some sort of maxWithZero or whatever function and deploying it wherever you see fit.
Comment on attachment 99389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=99389&action=review >>> Source/WebCore/rendering/InlineTextBox.cpp:118 >>> + LayoutUnit sPos = max(startPos - m_start, static_cast<LayoutUnit>(0)); >> >> I don't think you'll need this cast in the float case. Will you? > > Sadly you do. The max method either takes int, int or float, float. In the float case without the cast this would result in a compiler error. The good way to write this is: max<LayoutUnit>(startPos - m_start, 0);
(In reply to comment #5) > I'm thinking it could make sense to have an inline function clapToZero which would remove our need to cast zero. That would be fine. I would probably not name it maxWithZero or clapToZero or even clampToZero, though.
Created attachment 99843 [details] Patch
Changed max/min to use the template form rather than relying on casts. Thanks for the tip!
Created attachment 100035 [details] Patch
Comment on attachment 100035 [details] Patch LGTM.
Comment on attachment 100035 [details] Patch Clearing flags on attachment: 100035 Committed r90596: <http://trac.webkit.org/changeset/90596>
All reviewed patches have been landed. Closing bug.