Title: [114408] branches/subpixellayout/Source/WebCore/rendering
Revision
114408
Author
e...@chromium.org
Date
2012-04-17 12:10:42 -0700 (Tue, 17 Apr 2012)

Log Message

Fix pixel snapping in RenderThemeChromiumSkia on branch.

Modified Paths


Diff

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp (114407 => 114408)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp	2012-04-17 19:09:35 UTC (rev 114407)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp	2012-04-17 19:10:42 UTC (rev 114408)
@@ -261,16 +261,16 @@
     style->setHeight(Length(cancelButtonSize, Fixed));
 }
 
-IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const
+IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const
 {
     // Compute an offset between the part renderer and the input renderer.
-    IntSize offsetFromInputRenderer = -expandedIntSize(partRenderer->offsetFromAncestorContainer(inputRenderer));
+    LayoutSize offsetFromInputRenderer = -partRenderer->offsetFromAncestorContainer(inputRenderer);
     // Move the rect into partRenderer's coords.
     partRect.move(offsetFromInputRenderer);
     // Account for the local drawing offset.
     partRect.move(localOffset.x(), localOffset.y());
 
-    return partRect;
+    return pixelSnappedIntRect(partRect);
 }
 
 bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelButtonObject, const PaintInfo& paintInfo, const IntRect& r)
@@ -280,16 +280,16 @@
     if (!input->renderer()->isBox())
         return false;
     RenderBox* inputRenderBox = toRenderBox(input->renderer());
-    IntRect inputContentBox = pixelSnappedIntRect(inputRenderBox->contentBoxRect());
+    LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled button stays square and will fit in its parent's box.
-    int cancelButtonSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
+    LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height()));
     // Calculate cancel button's coordinates relative to the input element.
     // Center the button vertically.  Round up though, so if it has to be one pixel off-center, it will
     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
-    IntRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
-                             inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
-                             cancelButtonSize, cancelButtonSize);
+    LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(),
+                                inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
+                                cancelButtonSize, cancelButtonSize);
     IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r);
 
     static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef();
@@ -323,16 +323,16 @@
     if (!input->renderer()->isBox())
         return false;
     RenderBox* inputRenderBox = toRenderBox(input->renderer());
-    IntRect inputContentBox = pixelSnappedIntRect(inputRenderBox->contentBoxRect());
+    LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled decoration stays square and will fit in its parent's box.
-    int magnifierSize = std::min(inputContentBox.width(), std::min<int>(inputContentBox.height(), r.height()));
+    LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height()));
     // Calculate decoration's coordinates relative to the input element.
     // Center the decoration vertically.  Round up though, so if it has to be one pixel off-center, it will
     // be one pixel closer to the bottom of the field.  This tends to look better with the text.
-    IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
-                          inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
-                          magnifierSize, magnifierSize);
+    LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
+                             inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2,
+                             magnifierSize, magnifierSize);
     IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
 
     static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef();
@@ -358,14 +358,14 @@
     if (!input->renderer()->isBox())
         return false;
     RenderBox* inputRenderBox = toRenderBox(input->renderer());
-    IntRect inputContentBox = pixelSnappedIntRect(inputRenderBox->contentBoxRect());
+    LayoutRect inputContentBox = inputRenderBox->contentBoxRect();
 
     // Make sure the scaled decoration will fit in its parent's box.
-    int magnifierHeight = std::min<int>(inputContentBox.height(), r.height());
-    int magnifierWidth = std::min<int>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
-    IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
-                          inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
-                          magnifierWidth, magnifierHeight);
+    LayoutUnit magnifierHeight = std::min(inputContentBox.height(), r.height());
+    LayoutUnit magnifierWidth = std::min(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);
+    LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(),
+                             inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2,
+                             magnifierWidth, magnifierHeight);
     IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r);
 
     static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef();

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.h (114407 => 114408)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.h	2012-04-17 19:09:35 UTC (rev 114407)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeChromiumSkia.h	2012-04-17 19:10:42 UTC (rev 114408)
@@ -157,7 +157,7 @@
 
     int menuListInternalPadding(RenderStyle*, int paddingType) const;
     bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
-    IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const;
+    IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to