Title: [97188] trunk/Source
Revision
97188
Author
wjmacl...@chromium.org
Date
2011-10-11 15:43:53 -0700 (Tue, 11 Oct 2011)

Log Message

Loss of precision when converting from double to int and double to float in FrameView::zoomAnimatorTransformChanged()
https://bugs.webkit.org/show_bug.cgi?id=69739

Source/WebCore:

Reviewed by Simon Fraser.

Change 'double' parameters in FrameView:: & ScrollableArea::zoomAnimatorTransformChanged()
to 'float' to avoid loss of precision warnings when invoking setPageScalefactor.

Test coverage provided by existing zoom-animator tests.

* page/FrameView.cpp:
(WebCore::FrameView::zoomAnimatorTransformChanged):
* page/FrameView.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::zoomAnimatorTransformChanged):
* platform/ScrollableArea.h:

Source/WebKit2:

Change 'double' parameters to 'float' to match changes in FrameView.

Reviewed by Simon Fraser.

* WebProcess/Plugins/PDF/BuiltInPDFView.h:
(WebKit::BuiltInPDFView::zoomAnimatorTransformChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97187 => 97188)


--- trunk/Source/WebCore/ChangeLog	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebCore/ChangeLog	2011-10-11 22:43:53 UTC (rev 97188)
@@ -1,3 +1,22 @@
+2011-10-11  W. James MacLean  <wjmacl...@chromium.org>
+
+        Loss of precision when converting from double to int and double to float in FrameView::zoomAnimatorTransformChanged()
+        https://bugs.webkit.org/show_bug.cgi?id=69739
+
+        Reviewed by Simon Fraser.
+
+        Change 'double' parameters in FrameView:: & ScrollableArea::zoomAnimatorTransformChanged()
+        to 'float' to avoid loss of precision warnings when invoking setPageScalefactor.
+
+        Test coverage provided by existing zoom-animator tests.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::zoomAnimatorTransformChanged):
+        * page/FrameView.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::zoomAnimatorTransformChanged):
+        * platform/ScrollableArea.h:
+
 2011-10-11  No'am Rosenthal  <noam.rosent...@nokia.com>
 
         Unreviewed build fix, unbreaking the Qt minimal bot.

Modified: trunk/Source/WebCore/page/FrameView.cpp (97187 => 97188)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-10-11 22:43:53 UTC (rev 97188)
@@ -1223,13 +1223,11 @@
     m_widgetUpdateSet->remove(object);
 }
 
-void FrameView::zoomAnimatorTransformChanged(double scale, double x, double y, ZoomAnimationState state)
+void FrameView::zoomAnimatorTransformChanged(float scale, float x, float y, ZoomAnimationState state)
 {
     if (state == ZoomAnimationFinishing) {
-        // FIXME: We lose precision when converting from a double to an int and an double to a float.
-        // Is this acceptable? See <https://bugs.webkit.org/show_bug.cgi?id=69739>.
-        m_page->setPageScaleFactor(static_cast<float>(m_page->pageScaleFactor() * scale),
-                                   LayoutPoint(static_cast<int>(scale * scrollX() - x), static_cast<int>(scale * scrollY() - y)));
+        m_page->setPageScaleFactor(m_page->pageScaleFactor() * scale,
+                                   LayoutPoint(scale * scrollX() - x, scale * scrollY() - y));
         scrollAnimator()->resetZoom();
     }
 

Modified: trunk/Source/WebCore/page/FrameView.h (97187 => 97188)


--- trunk/Source/WebCore/page/FrameView.h	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebCore/page/FrameView.h	2011-10-11 22:43:53 UTC (rev 97188)
@@ -170,7 +170,7 @@
     virtual void repaintFixedElementsAfterScrolling();
     virtual bool shouldRubberBandInDirection(ScrollDirection) const;
 
-    virtual void zoomAnimatorTransformChanged(double, double, double, ZoomAnimationState);
+    virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState);
 
     String mediaType() const;
     void setMediaType(const String&);

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (97187 => 97188)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-10-11 22:43:53 UTC (rev 97188)
@@ -123,7 +123,7 @@
     scrollToOffsetWithoutAnimation(FloatPoint(scrollAnimator()->currentPosition().x(), y));
 }
 
-void ScrollableArea::zoomAnimatorTransformChanged(double, double, double, ZoomAnimationState)
+void ScrollableArea::zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState)
 {
     // Requires FrameView to override this.
 }

Modified: trunk/Source/WebCore/platform/ScrollableArea.h (97187 => 97188)


--- trunk/Source/WebCore/platform/ScrollableArea.h	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebCore/platform/ScrollableArea.h	2011-10-11 22:43:53 UTC (rev 97188)
@@ -54,7 +54,7 @@
     void scrollToXOffsetWithoutAnimation(float x);
     void scrollToYOffsetWithoutAnimation(float x);
 
-    virtual void zoomAnimatorTransformChanged(double, double, double, ZoomAnimationState);
+    virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState);
 
     bool handleWheelEvent(const PlatformWheelEvent&);
 #if ENABLE(GESTURE_EVENTS)

Modified: trunk/Source/WebKit2/ChangeLog (97187 => 97188)


--- trunk/Source/WebKit2/ChangeLog	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-11 22:43:53 UTC (rev 97188)
@@ -1,3 +1,15 @@
+2011-10-11  W. James MacLean  <wjmacl...@chromium.org>
+
+        Loss of precision when converting from double to int and double to float in FrameView::zoomAnimatorTransformChanged()
+        https://bugs.webkit.org/show_bug.cgi?id=69739
+
+        Change 'double' parameters to 'float' to match changes in FrameView.
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+        (WebKit::BuiltInPDFView::zoomAnimatorTransformChanged):
+
 2011-10-11  Alexey Proskuryakov  <a...@apple.com>
 
         [Mac] Small embedded PDFs are not fully repainted when scrolling

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (97187 => 97188)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-11 21:56:09 UTC (rev 97187)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-11 22:43:53 UTC (rev 97188)
@@ -87,9 +87,9 @@
     virtual void manualStreamDidReceiveData(const char* bytes, int length);
     virtual void manualStreamDidFinishLoading();
     virtual void manualStreamDidFail(bool wasCancelled);
-    
-    virtual void zoomAnimatorTransformChanged(double, double, double, ZoomAnimationState) { }
 
+    virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState) { }
+
     virtual bool handleMouseEvent(const WebMouseEvent&);
     virtual bool handleWheelEvent(const WebWheelEvent&);
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to