Title: [98528] branches/subpixellayout/Source/WebCore
Revision
98528
Author
le...@chromium.org
Date
2011-10-26 17:26:21 -0700 (Wed, 26 Oct 2011)

Log Message

Fixing FixedPoint's flooredIntSize, adding an adjustedBorderBoxRectForCellRounding method to get Table border painting correct, and fixing float and linebox layout since my last checkin.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/platform/graphics/FixedSize.h (98527 => 98528)


--- branches/subpixellayout/Source/WebCore/platform/graphics/FixedSize.h	2011-10-27 00:21:34 UTC (rev 98527)
+++ branches/subpixellayout/Source/WebCore/platform/graphics/FixedSize.h	2011-10-27 00:26:21 UTC (rev 98528)
@@ -196,7 +196,7 @@
 
 inline IntSize flooredIntSize(const FixedSize& p)
 {
-    return IntSize(p.height().toInt(), p.width().toInt());
+    return IntSize(p.width().toInt(), p.height().toInt());
 }
 
 inline IntSize roundedIntSize(const FixedSize& p)

Modified: branches/subpixellayout/Source/WebCore/rendering/AutoTableLayout.cpp (98527 => 98528)


--- branches/subpixellayout/Source/WebCore/rendering/AutoTableLayout.cpp	2011-10-27 00:21:34 UTC (rev 98527)
+++ branches/subpixellayout/Source/WebCore/rendering/AutoTableLayout.cpp	2011-10-27 00:26:21 UTC (rev 98528)
@@ -251,7 +251,6 @@
 
     if (scaleColumns) {
         maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
-        // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
         maxWidth = max<int>(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
         maxWidth = max<int>(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
     }

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp (98527 => 98528)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2011-10-27 00:21:34 UTC (rev 98527)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2011-10-27 00:26:21 UTC (rev 98528)
@@ -3580,7 +3580,7 @@
         }
 
         if (FloatTypeValue == FloatingObject::FloatRight
-            && m_renderer->pixelSnappedLogicalRightForFloat(r) < m_offset) {
+            && m_renderer->pixelSnappedLogicalLeftForFloat(r) < m_offset) {
             m_offset = m_renderer->pixelSnappedLogicalLeftForFloat(r);
             if (m_heightRemaining)
                 *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_value;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTable.cpp (98527 => 98528)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTable.cpp	2011-10-27 00:21:34 UTC (rev 98527)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTable.cpp	2011-10-27 00:26:21 UTC (rev 98528)
@@ -514,6 +514,12 @@
         popContentsClip(paintInfo, paintPhase, adjustedPaintOffset);
 }
 
+// We have to floor our size because table cell layout is still done with integers
+static inline IntRect adjustedBorderBoxRectForCellRounding(const LayoutRect& outlineRect)
+{
+    return IntRect(roundedIntPoint(outlineRect.location()), flooredIntSize(outlineRect.size()));
+}
+
 void RenderTable::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     PaintPhase paintPhase = paintInfo.phase;
@@ -563,7 +569,7 @@
 
     // Paint outline.
     if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && hasOutline() && style()->visibility() == VISIBLE)
-        paintOutline(paintInfo.context, LayoutRect(paintOffset, size()));
+        paintOutline(paintInfo.context, adjustedBorderBoxRectForCellRounding(LayoutRect(paintOffset, size())));
 }
 
 void RenderTable::subtractCaptionRect(LayoutRect& rect) const
@@ -589,7 +595,7 @@
     if (!paintInfo.shouldPaintWithinRoot(this))
         return;
 
-    LayoutRect rect(paintOffset, size());
+    LayoutRect rect = adjustedBorderBoxRectForCellRounding(LayoutRect(paintOffset, size()));
     subtractCaptionRect(rect);
 
     paintBoxShadow(paintInfo, rect, style(), Normal);
@@ -597,7 +603,7 @@
     paintBoxShadow(paintInfo, rect, style(), Inset);
 
     if (style()->hasBorder() && !collapseBorders())
-        paintBorder(paintInfo, rect, style());
+        paintBorder(paintInfo, adjustedBorderBoxRectForCellRounding(rect), style());
 }
 
 void RenderTable::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -605,7 +611,7 @@
     if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
         return;
 
-    LayoutRect rect(paintOffset, size());
+    LayoutRect rect = adjustedBorderBoxRectForCellRounding(LayoutRect(paintOffset, size()));
     subtractCaptionRect(rect);
 
     paintMaskImages(paintInfo, rect);

Modified: branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp (98527 => 98528)


--- branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2011-10-27 00:21:34 UTC (rev 98527)
+++ branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2011-10-27 00:26:21 UTC (rev 98528)
@@ -840,9 +840,15 @@
     return factor;
 }
 
+static inline IntRect pixelSnappedIntRect(const LayoutRect& borderRect)
+{
+    return IntRect(roundedIntPoint(borderRect.location()), IntSize((borderRect.x() + borderRect.width()).round() - borderRect.x().round(),
+        (borderRect.y() + borderRect.height()).round() - borderRect.y().round()));
+}
+
 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
 {
-    RoundedRect roundedRect(enclosingIntRect(borderRect));
+    RoundedRect roundedRect(pixelSnappedIntRect(borderRect));
     if (hasBorderRadius()) {
         RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size());
         radii.scale(calcConstraintScaleFor(borderRect, radii));
@@ -871,7 +877,7 @@
                borderRect.width() - leftWidth - rightWidth, 
                borderRect.height() - topWidth - bottomWidth);
 
-    RoundedRect roundedRect(enclosingIntRect(innerRect));
+    RoundedRect roundedRect(pixelSnappedIntRect(innerRect));
 
     if (hasBorderRadius()) {
         RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to