Changeset 113730 in webkit


Ignore:
Timestamp:
Apr 10, 2012 10:11:10 AM (12 years ago)
Author:
eae@chromium.org
Message:

Add missing methods and operators to FractionalLayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=82403

Reviewed by Eric Seidel.

Add missing methods and operators and from branch version of
FractionalLayoutUnit. Also fix overflow assertion and add const keyword
to a couple of methods.

No new tests.

  • platform/FractionalLayoutUnit.h:

(WebCore::FractionalLayoutUnit::abs):
(FractionalLayoutUnit):
(WebCore::FractionalLayoutUnit::ceil):
(WebCore::FractionalLayoutUnit::round):
(WebCore::FractionalLayoutUnit::floor):
(WebCore::FractionalLayoutUnit::isInBounds):
(WebCore::operator<):
(WebCore):
(WebCore::operator-):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113728 r113730  
     12012-04-10  Emil A Eklund  <eae@chromium.org>
     2
     3        Add missing methods and operators to FractionalLayoutUnit
     4        https://bugs.webkit.org/show_bug.cgi?id=82403
     5
     6        Reviewed by Eric Seidel.
     7
     8        Add missing methods and operators and from branch version of
     9        FractionalLayoutUnit. Also fix overflow assertion and add const keyword
     10        to a couple of methods.
     11
     12        No new tests.
     13
     14        * platform/FractionalLayoutUnit.h:
     15        (WebCore::FractionalLayoutUnit::abs):
     16        (FractionalLayoutUnit):
     17        (WebCore::FractionalLayoutUnit::ceil):
     18        (WebCore::FractionalLayoutUnit::round):
     19        (WebCore::FractionalLayoutUnit::floor):
     20        (WebCore::FractionalLayoutUnit::isInBounds):
     21        (WebCore::operator<):
     22        (WebCore):
     23        (WebCore::operator-):
     24
    1252011-12-14  Jer Noble  <jer.noble@apple.com>
    226
  • trunk/Source/WebCore/platform/FractionalLayoutUnit.h

    r111362 r113730  
    7272    }
    7373
    74     inline FractionalLayoutUnit abs()
     74    inline FractionalLayoutUnit abs() const
    7575    {
    7676        FractionalLayoutUnit returnValue;
     
    7979    }
    8080#if OS(DARWIN)
    81     inline int wtf_ceil()
     81    inline int wtf_ceil() const
    8282#else
    83     inline int ceil()
     83    inline int ceil() const
    8484#endif
    8585    {
     
    8888        return (m_value - kFixedPointDenominator + 1) / kFixedPointDenominator;
    8989    }
    90     inline int round()
     90    inline int round() const
    9191    {
    9292        if (m_value > 0)
     
    9595    }
    9696
    97     inline int floor()
     97    inline int floor() const
    9898    {
    9999        return toInt();
     
    117117    inline bool isInBounds(int value)
    118118    {
    119         return ::abs(value) < std::numeric_limits<int>::max() / kFixedPointDenominator;
     119        return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
    120120    }
    121121    inline bool isInBounds(unsigned value)
    122122    {
    123         return value < static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
     123        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
    124124    }
    125125    inline bool isInBounds(double value)
    126126    {
    127         return ::fabs(value) < std::numeric_limits<int>::max() / kFixedPointDenominator;
     127        return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
    128128    }
    129129
     
    194194{
    195195    return a.toFloat() < b;
     196}
     197
     198inline bool operator<(const FractionalLayoutUnit& a, double b)
     199{
     200    return a.toDouble() < b;
    196201}
    197202
     
    434439}
    435440
     441inline FractionalLayoutUnit operator-(const FractionalLayoutUnit& a, unsigned b)
     442{
     443    return a - FractionalLayoutUnit(b);
     444}
     445
    436446inline float operator-(const FractionalLayoutUnit& a, float b)
    437447{
Note: See TracChangeset for help on using the changeset viewer.