Diff
Modified: branches/subpixellayout/Source/WebCore/rendering/LayoutTypes.h (108688 => 108689)
--- branches/subpixellayout/Source/WebCore/rendering/LayoutTypes.h 2012-02-23 23:52:15 UTC (rev 108688)
+++ branches/subpixellayout/Source/WebCore/rendering/LayoutTypes.h 2012-02-23 23:54:01 UTC (rev 108689)
@@ -62,6 +62,11 @@
return FractionalLayoutSize(s);
}
+inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit width, LayoutUnit height)
+{
+ return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snapSizeToPixel(height, top));
+}
+
inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom)
{
return IntRect(left.round(), top.round(), snapSizeToPixel(right - left, left), snapSizeToPixel(bottom - top, top));
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp (108688 => 108689)
--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp 2012-02-23 23:52:15 UTC (rev 108688)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp 2012-02-23 23:54:01 UTC (rev 108689)
@@ -982,7 +982,7 @@
// this matters for rects in transformed contexts.
bool wasAntialiased = graphicsContext->shouldAntialias();
graphicsContext->setShouldAntialias(antialias);
- graphicsContext->drawRect(pixelSnappedIntRect(LayoutRect(x1, y1, x2 - x1, y2 - y1)));
+ graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
graphicsContext->setShouldAntialias(wasAntialiased);
graphicsContext->setStrokeStyle(oldStrokeStyle);
return;
@@ -1223,7 +1223,7 @@
LayoutRect result = rects[0];
for (size_t i = 1; i < n; ++i)
result.unite(rects[i]);
- return enclosingIntRect(result);
+ return pixelSnappedIntRect(result);
}
void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
@@ -1374,7 +1374,7 @@
// This ASSERT fails due to animations. See https://bugs.webkit.org/show_bug.cgi?id=37048
// ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(repaintContainer));
- LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : pixelSnappedIntRect(clippedOverflowRectForRepaint(repaintContainer));
+ LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);
LayoutRect newOutlineBox;
bool fullRepaint = selfNeedsLayout();
@@ -1384,7 +1384,7 @@
if (!fullRepaint) {
// This ASSERT fails due to animations. See https://bugs.webkit.org/show_bug.cgi?id=37048
// ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBoundsForRepaint(repaintContainer));
- newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : pixelSnappedIntRect(outlineBoundsForRepaint(repaintContainer));
+ newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBoundsForRepaint(repaintContainer);
if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaintBackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBox)))
fullRepaint = true;
}
@@ -1408,19 +1408,19 @@
else if (deltaLeft < 0)
repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
- int deltaRight = newBounds.maxX() - oldBounds.maxX();
+ LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
if (deltaRight > 0)
repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
else if (deltaRight < 0)
repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
- int deltaTop = newBounds.y() - oldBounds.y();
+ LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
if (deltaTop > 0)
repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
else if (deltaTop < 0)
repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
- int deltaBottom = newBounds.maxY() - oldBounds.maxY();
+ LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
if (deltaBottom > 0)
repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
else if (deltaBottom < 0)
Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTableCell.cpp (108688 => 108689)
--- branches/subpixellayout/Source/WebCore/rendering/RenderTableCell.cpp 2012-02-23 23:52:15 UTC (rev 108688)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTableCell.cpp 2012-02-23 23:54:01 UTC (rev 108689)
@@ -965,10 +965,10 @@
LayoutUnit leftWidth = leftVal.width();
LayoutUnit rightWidth = rightVal.width();
- LayoutUnit x = paintRect.x() - leftWidth / 2;
- LayoutUnit y = paintRect.y() - topWidth / 2;
- LayoutUnit w = paintRect.width() + leftWidth / 2 + (rightWidth + 1) / 2;
- LayoutUnit h = paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2;
+ IntRect borderRect = pixelSnappedIntRect(paintRect.x() - leftWidth / 2,
+ paintRect.y() - topWidth / 2,
+ paintRect.width() + leftWidth / 2 + (rightWidth + 1) / 2,
+ paintRect.height() + topWidth / 2 + (bottomWidth + 1) / 2);
EBorderStyle topStyle = collapsedBorderStyle(topVal.style());
EBorderStyle bottomStyle = collapsedBorderStyle(bottomVal.style());
@@ -983,10 +983,10 @@
// We never paint diagonals at the joins. We simply let the border with the highest
// precedence paint on top of borders with lower precedence.
CollapsedBorders borders;
- borders.addBorder(topVal, BSTop, renderTop, x, y, x + w, y + topWidth, topStyle);
- borders.addBorder(bottomVal, BSBottom, renderBottom, x, y + h - bottomWidth, x + w, y + h, bottomStyle);
- borders.addBorder(leftVal, BSLeft, renderLeft, x, y, x + leftWidth, y + h, leftStyle);
- borders.addBorder(rightVal, BSRight, renderRight, x + w - rightWidth, y, x + w, y + h, rightStyle);
+ borders.addBorder(topVal, BSTop, renderTop, borderRect.x(), borderRect.y(), borderRect.maxX(), borderRect.y() + topWidth, topStyle);
+ borders.addBorder(bottomVal, BSBottom, renderBottom, borderRect.x(), borderRect.maxY() - bottomWidth, borderRect.maxX(), borderRect.maxY(), bottomStyle);
+ borders.addBorder(leftVal, BSLeft, renderLeft, borderRect.x(), borderRect.y(), borderRect.x() + leftWidth, borderRect.maxY(), leftStyle);
+ borders.addBorder(rightVal, BSRight, renderRight, borderRect.maxX() - rightWidth, borderRect.y(), borderRect.maxX(), borderRect.maxY(), rightStyle);
bool antialias = shouldAntialiasLines(graphicsContext);