Changeset 175955 in webkit
- Timestamp:
- Nov 11, 2014, 10:15:46 AM (12 years ago)
- Location:
- releases/WebKitGTK/webkit-2.6/Source
- Files:
-
- 5 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/MathExtras.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/DOMTimer.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/FloatQuad.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.6/Source/WTF/ChangeLog
r175933 r175955 1 2014-11-05 Chris Dumez <cdumez@apple.com> 2 3 Assertion hit DOMTimer::updateTimerIntervalIfNecessary() 4 https://bugs.webkit.org/show_bug.cgi?id=138440 5 6 Reviewed by Geoffrey Garen. 7 8 Move the withinEpsilon() function to WTF to avoid code duplication. 9 10 * wtf/MathExtras.h: 11 (WTF::withinEpsilon): 12 1 13 2014-10-30 Jeffrey Pfau <jpfau@apple.com> 2 14 -
releases/WebKitGTK/webkit-2.6/Source/WTF/wtf/MathExtras.h
r165676 r175955 385 385 } 386 386 387 template <typename T> 388 inline bool withinEpsilon(T a, T b) 389 { 390 return std::abs(a - b) <= std::numeric_limits<T>::epsilon(); 391 } 392 387 393 } // namespace WTF 388 394 -
releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog
r175952 r175955 1 2014-11-05 Chris Dumez <cdumez@apple.com> 2 3 Assertion hit DOMTimer::updateTimerIntervalIfNecessary() 4 https://bugs.webkit.org/show_bug.cgi?id=138440 5 6 Reviewed by Geoffrey Garen. 7 8 We sometimes hit the ASSERT(repeatInterval() == previousInterval) 9 assertion in DOMTimer::updateTimerIntervalIfNecessary() when visiting 10 the following pages: 11 http://lifehacker.com/the-healthiest-foods-for-one-handed-snacking-while-gami-1654728164 12 http://longform.org/posts/like-something-the-lord-made 13 14 After debugging, the issue turned out to be that we are comparing 15 floating point numbers using ==, and the check sometimes fails even 16 though the values really close to each other. This patch updates the 17 DOMTimer code to use WTF::withinEpsilon() instead of operator==() 18 to compare the floating point intervals. 19 20 I confirmed manually that the assertion is no longer hit. 21 22 * page/DOMTimer.cpp: 23 (WebCore::DOMTimer::updateTimerIntervalIfNecessary): 24 * platform/graphics/FloatQuad.cpp: 25 (WebCore::FloatQuad::isRectilinear): 26 (WebCore::withinEpsilon): Deleted. 27 1 28 2014-11-05 Chris Dumez <cdumez@apple.com> 2 29 -
releases/WebKitGTK/webkit-2.6/Source/WebCore/page/DOMTimer.cpp
r173694 r175955 36 36 #include <wtf/CurrentTime.h> 37 37 #include <wtf/HashSet.h> 38 #include <wtf/MathExtras.h> 38 39 #include <wtf/StdLibExtras.h> 39 40 … … 262 263 m_currentTimerInterval = intervalClampedToMinimum(); 263 264 264 if ( previousInterval == m_currentTimerInterval)265 if (WTF::withinEpsilon(previousInterval, m_currentTimerInterval)) 265 266 return; 266 267 267 268 if (repeatInterval()) { 268 ASSERT( repeatInterval() == previousInterval);269 ASSERT(WTF::withinEpsilon(repeatInterval(), previousInterval)); 269 270 augmentRepeatInterval(m_currentTimerInterval - previousInterval); 270 271 } else -
releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/FloatQuad.cpp
r165676 r175955 34 34 #include <algorithm> 35 35 #include <limits> 36 #include <wtf/MathExtras.h> 36 37 37 38 namespace WebCore { … … 91 92 } 92 93 93 static inline bool withinEpsilon(float a, float b)94 {95 return fabs(a - b) < std::numeric_limits<float>::epsilon();96 }97 98 94 bool FloatQuad::isRectilinear() const 99 95 { 100 return ( withinEpsilon(m_p1.x(), m_p2.x()) && withinEpsilon(m_p2.y(), m_p3.y()) && withinEpsilon(m_p3.x(), m_p4.x()) &&withinEpsilon(m_p4.y(), m_p1.y()))101 || ( withinEpsilon(m_p1.y(), m_p2.y()) && withinEpsilon(m_p2.x(), m_p3.x()) && withinEpsilon(m_p3.y(), m_p4.y()) &&withinEpsilon(m_p4.x(), m_p1.x()));96 return (WTF::withinEpsilon(m_p1.x(), m_p2.x()) && WTF::withinEpsilon(m_p2.y(), m_p3.y()) && WTF::withinEpsilon(m_p3.x(), m_p4.x()) && WTF::withinEpsilon(m_p4.y(), m_p1.y())) 97 || (WTF::withinEpsilon(m_p1.y(), m_p2.y()) && WTF::withinEpsilon(m_p2.x(), m_p3.x()) && WTF::withinEpsilon(m_p3.y(), m_p4.y()) && WTF::withinEpsilon(m_p4.x(), m_p1.x())); 102 98 } 103 99
Note:
See TracChangeset
for help on using the changeset viewer.