Title: [112158] trunk/Source/WebCore
Revision
112158
Author
[email protected]
Date
2012-03-26 15:41:28 -0700 (Mon, 26 Mar 2012)

Log Message

Correct LayoutUnit usage in RenderFieldSet and RenderMenuItem
https://bugs.webkit.org/show_bug.cgi?id=82179

Reviewed by Julien Chaffraix.

Correcting small misuses of ints vs LayoutUnits in RenderFieldSet and RenderMenuItem. Also
adding zeroLayoutUnit where necessary to fix the sub-pixel build. See below for details.

No new tests. No change in behavior.

* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::paintBoxDecorations): Clip rects need to be pixel snapped to mirror
the actual coordinates we paint.
(WebCore::RenderFieldset::paintMask): Using zeroLayoutUnit for ternary operation to fix the
sub-pixel build.
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::showPopup): Correctly using an IntRect for absoluteBoundingBoxRect.
(WebCore::RenderMenuList::clientPaddingLeft): Correcting mismatched return type with header.
(WebCore::RenderMenuList::clientPaddingRight): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112157 => 112158)


--- trunk/Source/WebCore/ChangeLog	2012-03-26 22:39:33 UTC (rev 112157)
+++ trunk/Source/WebCore/ChangeLog	2012-03-26 22:41:28 UTC (rev 112158)
@@ -1,3 +1,25 @@
+2012-03-26  Levi Weintraub  <[email protected]>
+
+        Correct LayoutUnit usage in RenderFieldSet and RenderMenuItem
+        https://bugs.webkit.org/show_bug.cgi?id=82179
+
+        Reviewed by Julien Chaffraix.
+
+        Correcting small misuses of ints vs LayoutUnits in RenderFieldSet and RenderMenuItem. Also
+        adding zeroLayoutUnit where necessary to fix the sub-pixel build. See below for details.
+
+        No new tests. No change in behavior.
+
+        * rendering/RenderFieldset.cpp:
+        (WebCore::RenderFieldset::paintBoxDecorations): Clip rects need to be pixel snapped to mirror
+        the actual coordinates we paint.
+        (WebCore::RenderFieldset::paintMask): Using zeroLayoutUnit for ternary operation to fix the
+        sub-pixel build.
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::showPopup): Correctly using an IntRect for absoluteBoundingBoxRect.
+        (WebCore::RenderMenuList::clientPaddingLeft): Correcting mismatched return type with header.
+        (WebCore::RenderMenuList::clientPaddingRight): Ditto.
+
 2012-03-26  Dan Bernstein  <[email protected]>
 
         Tried to fix an unused parameter warning after r112154.

Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (112157 => 112158)


--- trunk/Source/WebCore/rendering/RenderFieldset.cpp	2012-03-26 22:39:33 UTC (rev 112157)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp	2012-03-26 22:41:28 UTC (rev 112158)
@@ -159,11 +159,11 @@
     if (style()->isHorizontalWritingMode()) {
         LayoutUnit clipTop = paintRect.y();
         LayoutUnit clipHeight = max(static_cast<LayoutUnit>(style()->borderTopWidth()), legend->height() - ((legend->height() - borderTop()) / 2));
-        graphicsContext->clipOut(LayoutRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
+        graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
     } else {
         LayoutUnit clipLeft = paintRect.x();
         LayoutUnit clipWidth = max(static_cast<LayoutUnit>(style()->borderLeftWidth()), legend->width());
-        graphicsContext->clipOut(LayoutRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
+        graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
     }
 
     paintBorder(paintInfo, paintRect, style());
@@ -183,11 +183,11 @@
     // cases the legend is embedded in the right and bottom borders respectively.
     // https://bugs.webkit.org/show_bug.cgi?id=47236
     if (style()->isHorizontalWritingMode()) {
-        LayoutUnit yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
+        LayoutUnit yOff = (legend->y() > 0) ? zeroLayoutUnit : (legend->height() - borderTop()) / 2;
         paintRect.expand(0, -yOff);
         paintRect.move(0, yOff);
     } else {
-        LayoutUnit xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
+        LayoutUnit xOff = (legend->x() > 0) ? zeroLayoutUnit : (legend->width() - borderLeft()) / 2;
         paintRect.expand(-xOff, 0);
         paintRect.move(xOff, 0);
     }

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (112157 => 112158)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2012-03-26 22:39:33 UTC (rev 112157)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2012-03-26 22:41:28 UTC (rev 112158)
@@ -308,11 +308,11 @@
     // Compute the top left taking transforms into account, but use
     // the actual width of the element to size the popup.
     FloatPoint absTopLeft = localToAbsolute(FloatPoint(), false, true);
-    LayoutRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
+    IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
     int scale = document()->page()->settings()->defaultDeviceScaleFactor();
     if (scale && scale != 1)
         absBounds.scale(scale);
-    absBounds.setLocation(roundedLayoutPoint(absTopLeft));
+    absBounds.setLocation(roundedIntPoint(absTopLeft));
     HTMLSelectElement* select = toHTMLSelectElement(node());
     m_popup->show(absBounds, document()->view(), select->optionToListIndex(select->selectedIndex()));
 }
@@ -511,13 +511,13 @@
     return 0;
 }
 
-int RenderMenuList::clientPaddingLeft() const
+LayoutUnit RenderMenuList::clientPaddingLeft() const
 {
     return paddingLeft() + m_innerBlock->paddingLeft();
 }
 
 const int endOfLinePadding = 2;
-int RenderMenuList::clientPaddingRight() const
+LayoutUnit RenderMenuList::clientPaddingRight() const
 {
     if (style()->appearance() == MenulistPart || style()->appearance() == MenulistButtonPart) {
         // For these appearance values, the theme applies padding to leave room for the
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to