Correct usage of LayoutUnits in RenderImage and SVGImage
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2011 18:27:35 +0000 (18:27 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Nov 2011 18:27:35 +0000 (18:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71525

Reviewed by Darin Adler.

Correcting incorrect usage of LayoutUnits for image sizes that should be integers and fixing overloaded functions that
should be using LayoutUnits.

No new tests -- no change in behavior.

* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageDimensionsChanged):
(WebCore::RenderImage::paintIntoRect):
(WebCore::RenderImage::nodeAtPoint):
(WebCore::RenderImage::computeReplacedLogicalWidth):
* rendering/RenderImage.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImageChromeClient::invalidateContentsAndWindow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99303 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderImage.h
Source/WebCore/svg/graphics/SVGImage.cpp

index f8e60e1..f6ef993 100644 (file)
@@ -1,3 +1,24 @@
+2011-11-04  Levi Weintraub  <leviw@chromium.org>
+
+        Correct usage of LayoutUnits in RenderImage and SVGImage
+        https://bugs.webkit.org/show_bug.cgi?id=71525
+
+        Reviewed by Darin Adler.
+
+        Correcting incorrect usage of LayoutUnits for image sizes that should be integers and fixing overloaded functions that
+        should be using LayoutUnits.
+
+        No new tests -- no change in behavior.
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::imageDimensionsChanged):
+        (WebCore::RenderImage::paintIntoRect):
+        (WebCore::RenderImage::nodeAtPoint):
+        (WebCore::RenderImage::computeReplacedLogicalWidth):
+        * rendering/RenderImage.h:
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImageChromeClient::invalidateContentsAndWindow):
+
 2011-11-04  Adam Barth  <abarth@webkit.org>
 
         Implement allow-popups for iframe@sandbox
index 62c6aa4..3319787 100644 (file)
@@ -212,7 +212,7 @@ void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* r
     }
 
     if (shouldRepaint) {
-        IntRect repaintRect;
+        LayoutRect repaintRect;
         if (rect) {
             // The image changed rect is in source image coordinates (pre-zooming),
             // so map from the bounds of the image to the contentsBox.
@@ -394,7 +394,7 @@ void RenderImage::areaElementFocusChanged(HTMLAreaElement* element)
     repaint();
 }
 
-void RenderImage::paintIntoRect(GraphicsContext* context, const IntRect& rect)
+void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect)
 {
     if (!m_imageResource->hasImage() || m_imageResource->errorOccurred() || rect.width() <= 0 || rect.height() <= 0)
         return;
@@ -454,7 +454,7 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
 
     if (tempResult.innerNode() && node()) {
         if (HTMLMapElement* map = imageMap()) {
-            IntRect contentBox = contentBoxRect();
+            LayoutRect contentBox = contentBoxRect();
             float scaleFactor = 1 / style()->effectiveZoom();
             LayoutPoint mapLocation(pointInContainer.x() - accumulatedOffset.x() - this->x() - contentBox.x(), pointInContainer.y() - accumulatedOffset.y() - this->y() - contentBox.y());
             mapLocation.scale(scaleFactor, scaleFactor);
@@ -495,13 +495,13 @@ LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
     bool hasRelativeWidth = contentRenderer ? contentRenderer->style()->width().isPercent() : m_imageResource->imageHasRelativeWidth();
     bool hasRelativeHeight = contentRenderer ? contentRenderer->style()->height().isPercent() : m_imageResource->imageHasRelativeHeight();
 
-    LayoutSize containerSize;
+    IntSize containerSize;
     if (hasRelativeWidth || hasRelativeHeight) {
         // Propagate the containing block size to the image resource, otherwhise we can't compute our own intrinsic size, if it's relative.
         RenderObject* containingBlock = isPositioned() ? container() : this->containingBlock();
         if (containingBlock->isBox()) {
             RenderBox* box = toRenderBox(containingBlock);
-            containerSize = LayoutSize(box->availableWidth(), box->availableHeight()); // Already contains zooming information.
+            containerSize = IntSize(box->availableWidth(), box->availableHeight()); // Already contains zooming information.
         }
     } else {
         // Propagate the current zoomed image size to the image resource, otherwhise the image size will remain the same on-screen.
index bcd34d1..2c4ac54 100644 (file)
@@ -62,7 +62,7 @@ protected:
 
     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
 
-    virtual void paintIntoRect(GraphicsContext*, const IntRect&);
+    virtual void paintIntoRect(GraphicsContext*, const LayoutRect&);
     virtual void paint(PaintInfo&, const LayoutPoint&);
 
     virtual void intrinsicSizeChanged()
@@ -77,7 +77,7 @@ private:
     virtual bool isImage() const { return true; }
     virtual bool isRenderImage() const { return true; }
 
-    virtual void paintReplaced(PaintInfo&, const IntPoint&);
+    virtual void paintReplaced(PaintInfo&, const LayoutPoint&);
 
     virtual bool backgroundIsObscured() const;
 
index 3f14ccd..0a333af 100644 (file)
@@ -73,7 +73,7 @@ private:
         m_image = 0;
     }
 
-    virtual void invalidateContentsAndWindow(const LayoutRect& r, bool)
+    virtual void invalidateContentsAndWindow(const IntRect& r, bool)
     {
         if (m_image && m_image->imageObserver())
             m_image->imageObserver()->changedInRect(m_image, r);