Changeset 115928 in webkit
- Timestamp:
- May 2, 2012 7:01:30 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r115926 r115928 1 2012-05-02 Levi Weintraub <leviw@chromium.org> 2 3 Convert FractionalLayoutUnit overflow assertions to stderr warnings 4 https://bugs.webkit.org/show_bug.cgi?id=85393 5 6 Reviewed by Eric Seidel. 7 8 Writing warnings to stderr when FractionalLayoutUnits overflow on debug builds instead of asserting 9 and crashing. It can be very useful to WebKit developers know when overflow is occurring, but it's 10 not always a programming error, so assert wasn't the right action. 11 12 No new tests. No change in behavior. 13 14 * platform/FractionalLayoutUnit.h: 15 (WebCore): 16 (WebCore::FractionalLayoutUnit::FractionalLayoutUnit): 17 (WebCore::FractionalLayoutUnit::toUnsigned): 18 (WebCore::FractionalLayoutUnit::setRawValue): 19 1 20 2012-04-18 Jon Honeycutt <jhoneycutt@apple.com> 2 21 -
trunk/Source/WebCore/platform/FractionalLayoutUnit.h
r115647 r115928 39 39 namespace WebCore { 40 40 41 #ifdef NDEBUG 42 43 #define REPORT_OVERFLOW(doesOverflow) ((void)0) 44 45 #else 46 47 #define REPORT_OVERFLOW(doesOverflow) do \ 48 if (!(doesOverflow)) { \ 49 WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, "!(%s)", #doesOverflow); \ 50 } \ 51 while (0) 52 53 #endif 54 41 55 #if ENABLE(SUBPIXEL_LAYOUT) 42 56 static const int kFixedPointDenominator = 60; … … 54 68 55 69 FractionalLayoutUnit() : m_value(0) { } 56 FractionalLayoutUnit(int value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }57 FractionalLayoutUnit(unsigned short value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }58 FractionalLayoutUnit(unsigned int value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }59 FractionalLayoutUnit(float value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }60 FractionalLayoutUnit(double value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }70 FractionalLayoutUnit(int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } 71 FractionalLayoutUnit(unsigned short value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } 72 FractionalLayoutUnit(unsigned int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } 73 FractionalLayoutUnit(float value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } 74 FractionalLayoutUnit(double value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } 61 75 FractionalLayoutUnit(const FractionalLayoutUnit& value) { m_value = value.rawValue(); } 62 76 63 77 inline int toInt() const { return m_value / kFixedPointDenominator; } 64 inline unsigned toUnsigned() const { ASSERT(m_value >= 0); return toInt(); }78 inline unsigned toUnsigned() const { REPORT_OVERFLOW(m_value >= 0); return toInt(); } 65 79 inline float toFloat() const { return static_cast<float>(m_value) / kFixedPointDenominator; } 66 80 inline double toDouble() const { return static_cast<double>(m_value) / kFixedPointDenominator; } … … 82 96 inline void setRawValue(long long value) 83 97 { 84 ASSERT(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max());98 REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max()); 85 99 m_value = static_cast<int>(value); 86 100 }
Note: See TracChangeset
for help on using the changeset viewer.