Title: [171078] trunk/Source/WebKit2
Revision
171078
Author
[email protected]
Date
2014-07-14 14:02:19 -0700 (Mon, 14 Jul 2014)

Log Message

[iOS][WK2] Fix withinEpsilon()
https://bugs.webkit.org/show_bug.cgi?id=134798

Patch by Benjamin Poulain <[email protected]> on 2014-07-14
Reviewed by Darin Adler.

Move the function back to WKWebView, it is no longer needed in WKContentView.

Use the real types as input to properly verify that the two inputs are within
a small value of the 32bit floating point.

The epsilon we use is always on 32 bits float because we want to avoid doing work for changes
that would not make any difference on float.

The source of those small changes comes from the fact UIProcess does a lot of processing
on CGFloat, which are double on 64bits architecture, while the WebProcess use 32bits floating point
for scale. When we are getting updates from the WebProcess, we should ignore any small differences
caused by the computations done with less precision.

* UIProcess/API/Cocoa/WKWebView.mm:
(withinEpsilon):
* UIProcess/ios/WKContentViewInteraction.h:
(withinEpsilon): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (171077 => 171078)


--- trunk/Source/WebKit2/ChangeLog	2014-07-14 21:01:21 UTC (rev 171077)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-14 21:02:19 UTC (rev 171078)
@@ -1,3 +1,28 @@
+2014-07-14  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] Fix withinEpsilon()
+        https://bugs.webkit.org/show_bug.cgi?id=134798
+
+        Reviewed by Darin Adler.
+
+        Move the function back to WKWebView, it is no longer needed in WKContentView.
+
+        Use the real types as input to properly verify that the two inputs are within
+        a small value of the 32bit floating point.
+
+        The epsilon we use is always on 32 bits float because we want to avoid doing work for changes
+        that would not make any difference on float.
+
+        The source of those small changes comes from the fact UIProcess does a lot of processing
+        on CGFloat, which are double on 64bits architecture, while the WebProcess use 32bits floating point
+        for scale. When we are getting updates from the WebProcess, we should ignore any small differences
+        caused by the computations done with less precision.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (withinEpsilon):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        (withinEpsilon): Deleted.
+
 2014-07-14  Bear Travis  <[email protected]>
 
         [Feature Queries] Enable Feature Queries on Mac

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (171077 => 171078)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-07-14 21:01:21 UTC (rev 171077)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-07-14 21:02:19 UTC (rev 171078)
@@ -789,6 +789,14 @@
     scrollView.contentOffset = contentOffset;
 }
 
+// WebCore stores the page scale factor as float instead of double. When we get a scale from WebCore,
+// we need to ignore differences that are within a small rounding error on floats.
+template <typename TypeA, typename TypeB>
+static inline bool withinEpsilon(TypeA a, TypeB b)
+{
+    return std::abs(a - b) < std::numeric_limits<float>::epsilon();
+}
+
 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction
 {
     if (_customContentView)

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (171077 => 171078)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-07-14 21:01:21 UTC (rev 171077)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2014-07-14 21:02:19 UTC (rev 171078)
@@ -184,9 +184,4 @@
 - (void)_disableInspectorNodeSearch;
 @end
 
-static inline bool withinEpsilon(float a, float b)
-{
-    return fabs(a - b) < std::numeric_limits<float>::epsilon();
-}
-
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to