Bug 83497

Summary: Replace numeric_limits<LayoutUnit>::min/max with constants
Product: WebKit Reporter: Emil A Eklund <eae>
Component: PlatformAssignee: Emil A Eklund <eae>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric, leviw, simon.fraser, 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 Emil A Eklund 2012-04-09 12:28:42 PDT
As came up in the original review of the FractionalLayoutUnit code we should not register numeric_limits for the FractionalLayoutUnit in the std namespace and instead use constants for the min/max value.
Comment 1 Emil A Eklund 2012-04-09 13:43:45 PDT
Created attachment 136298 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-04-09 13:55:32 PDT
Comment on attachment 136298 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        Replace all uses of numeric_limits<LayoutUnit>::min/max with
> +        MIN_LAYOUT_UNIT and MAX_LAYOUT_UNIT respectively in preparation for the
> +        switch to subpixel layout.

Why does this make the switch easier?
Comment 3 Emil A Eklund 2012-04-09 14:01:18 PDT
(In reply to comment #2)
> (From update of attachment 136298 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=136298&action=review
> 
> > Source/WebCore/ChangeLog:10
> > +        Replace all uses of numeric_limits<LayoutUnit>::min/max with
> > +        MIN_LAYOUT_UNIT and MAX_LAYOUT_UNIT respectively in preparation for the
> > +        switch to subpixel layout.
> 
> Why does this make the switch easier?

It allows us to use an abstraction to represent the min/max values for ints (for now) and FractionalLayoutUnits (after the switch). We originally planed to just leave it as is and define numeric_limits for FractionalLayoutUnit but that was shoot down during the initial review of FractionalLayoutUnit.h as it would involve declaring it in the std namespace.
Comment 4 Eric Seidel (no email) 2012-04-09 14:41:03 PDT
Comment on attachment 136298 [details]
Patch

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

>>> Source/WebCore/ChangeLog:10
>>> +        switch to subpixel layout.
>> 
>> Why does this make the switch easier?
> 
> It allows us to use an abstraction to represent the min/max values for ints (for now) and FractionalLayoutUnits (after the switch). We originally planed to just leave it as is and define numeric_limits for FractionalLayoutUnit but that was shoot down during the initial review of FractionalLayoutUnit.h as it would involve declaring it in the std namespace.

OK.

I think I might prefer LayoutUnit::maxValue and LayoutUnit::zeroValue, etc.  But I understand that's impractical at this juncture.
Comment 5 Levi Weintraub 2012-04-09 14:43:01 PDT
(In reply to comment #4)
> (From update of attachment 136298 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=136298&action=review
> 
> >>> Source/WebCore/ChangeLog:10
> >>> +        switch to subpixel layout.
> >> 
> >> Why does this make the switch easier?
> > 
> > It allows us to use an abstraction to represent the min/max values for ints (for now) and FractionalLayoutUnits (after the switch). We originally planed to just leave it as is and define numeric_limits for FractionalLayoutUnit but that was shoot down during the initial review of FractionalLayoutUnit.h as it would involve declaring it in the std namespace.
> 
> OK.
> 
> I think I might prefer LayoutUnit::maxValue and LayoutUnit::zeroValue, etc.  But I understand that's impractical at this juncture.

We have FractionalLayoutUnit::max and min, and would be happy to add a ::zero. That'll definitely be part of our cleanup pass once we've flipped the switch.
Comment 6 Emil A Eklund 2012-04-09 19:02:53 PDT
Comment on attachment 136298 [details]
Patch

Will do a cleanup pass once we've made the switch to make it LayoutUnit::max/min/zero as suggested.
Comment 7 WebKit Review Bot 2012-04-09 19:54:46 PDT
Comment on attachment 136298 [details]
Patch

Clearing flags on attachment: 136298

Committed r113665: <http://trac.webkit.org/changeset/113665>
Comment 8 WebKit Review Bot 2012-04-09 19:54:51 PDT
All reviewed patches have been landed.  Closing bug.