Title: [109822] branches/subpixellayout/Source/WebCore
Revision
109822
Author
le...@chromium.org
Date
2012-03-05 17:03:26 -0800 (Mon, 05 Mar 2012)

Log Message

Fixing an improper overloaded method in RenderThemeMac, cleaning up RenderBlock.cpp, and adding a size_t flavor of operator* in FractionalLayoutUnit for RenderBlock.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/platform/FractionalLayoutUnit.h (109821 => 109822)


--- branches/subpixellayout/Source/WebCore/platform/FractionalLayoutUnit.h	2012-03-06 01:01:51 UTC (rev 109821)
+++ branches/subpixellayout/Source/WebCore/platform/FractionalLayoutUnit.h	2012-03-06 01:03:26 UTC (rev 109822)
@@ -47,6 +47,7 @@
     FractionalLayoutUnit(int value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
     FractionalLayoutUnit(unsigned short value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
     FractionalLayoutUnit(unsigned int value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
+    FractionalLayoutUnit(size_t value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
     FractionalLayoutUnit(float value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
     FractionalLayoutUnit(double value) { ASSERT(isInBounds(value)); m_value = value * kFixedPointDenominator; }
     FractionalLayoutUnit(const FractionalLayoutUnit& value) { m_value = value.rawValue(); }
@@ -77,23 +78,23 @@
         return returnValue;
     }
 #if OS(DARWIN)
-    inline int wtf_ceil()
+    inline int wtf_ceil() const
 #else
-    inline int ceil()
+    inline int ceil() const
 #endif
     {
         if (m_value > 0)
             return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominator;
         return (m_value - kFixedPointDenominator + 1) / kFixedPointDenominator;
     }
-    inline int round()
+    inline int round() const
     {
         if (m_value > 0)
             return (m_value + (kFixedPointDenominator / 2)) / kFixedPointDenominator;
         return (m_value - (kFixedPointDenominator / 2)) / kFixedPointDenominator;
     }
 
-    inline int floor()
+    inline int floor() const
     {
         return toInt();
     }
@@ -121,6 +122,10 @@
     {
         return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
     }
+    inline bool isInBounds(size_t value)
+    {
+        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
+    }
     inline bool isInBounds(double value)
     {
         return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
@@ -330,6 +335,11 @@
     return FractionalLayoutUnit(a) * b;
 }
 
+inline FractionalLayoutUnit operator*(size_t a, const FractionalLayoutUnit& b)
+{
+    return FractionalLayoutUnit(a) * b;
+}
+
 inline FractionalLayoutUnit operator*(const int a, const FractionalLayoutUnit& b)
 {
     return FractionalLayoutUnit(a) * b;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp (109821 => 109822)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2012-03-06 01:01:51 UTC (rev 109821)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2012-03-06 01:03:26 UTC (rev 109822)
@@ -2680,12 +2680,8 @@
                 LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth();
                 LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
                 LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness;
-
-                int pixelSnappedRuleLeft = roundToInt(ruleLeft);
-                int pixelSnappedRuleRight = snapSizeToPixel(ruleRight - ruleLeft, ruleLeft) + pixelSnappedRuleLeft;
-                int pixelSnappedRuleTop = roundToInt(ruleTop);
-                int pixelSnappedRuleBottom = snapSizeToPixel(ruleBottom - ruleTop, ruleTop) + pixelSnappedRuleTop;
-                drawLineForBoxSide(paintInfo.context, pixelSnappedRuleLeft, pixelSnappedRuleTop, pixelSnappedRuleRight, pixelSnappedRuleBottom, boxSide, ruleColor, ruleStyle, 0, 0, antialias);
+                IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom);
+                drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
             }
             
             ruleLogicalLeft = currLogicalLeftOffset;
@@ -5008,7 +5004,7 @@
             }
         } else if (contentLogicalHeight() > boundedMultiply(pageLogicalHeight, desiredColumnCount)) {
             // Now that we know the intrinsic height of the columns, we have to rebalance them.
-            columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), (contentLogicalHeight() / desiredColumnCount).ceil());
+            columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf(contentLogicalHeight() / desiredColumnCount));
         }
         
         if (columnHeight && columnHeight != pageLogicalHeight) {
@@ -5206,11 +5202,11 @@
 
     for (size_t i = 0; i < colCount; ++i) {
         // Compute the edges for a given column in the block progression direction.
-        LayoutRect sliceRect(logicalLeft, borderBefore() + paddingBefore() + static_cast<int>(i) * colLogicalHeight, colLogicalWidth, colLogicalHeight);
+        LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight);
         if (!isHorizontalWritingMode())
             sliceRect = sliceRect.transposedRect();
         
-        LayoutUnit logicalOffset = static_cast<int>(i) * colLogicalHeight;
+        LayoutUnit logicalOffset = i * colLogicalHeight;
 
         // Now we're in the same coordinate space as the point.  See if it is inside the rectangle.
         if (isHorizontalWritingMode()) {

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h (109821 => 109822)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h	2012-03-06 01:01:51 UTC (rev 109821)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.h	2012-03-06 01:03:26 UTC (rev 109822)
@@ -79,7 +79,7 @@
     virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; }
 
 #if ENABLE(METER_TAG)
-    virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const;
+    virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const;
     virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&);
     virtual bool supportsMeter(ControlPart) const;
 #endif

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm (109821 => 109822)


--- branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm	2012-03-06 01:01:51 UTC (rev 109821)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderThemeMac.mm	2012-03-06 01:03:26 UTC (rev 109822)
@@ -817,16 +817,16 @@
 
 #if ENABLE(METER_TAG)
 
-IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const
+LayoutSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const LayoutRect& bounds) const
 {
     if (NoControlPart == renderMeter->style()->appearance())
         return bounds.size();
 
     NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter);
     // Makes enough room for cell's intrinsic size.
-    NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())];
-    return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(),
-                   bounds.height() < cellSize.height ? cellSize.height : bounds.height());
+    NSSize cellSize = [cell cellSizeForBounds:pixelSnappedIntRect(LayoutPoint(), bounds.size())];
+    return LayoutSize(bounds.width() < static_cast<LayoutUnit>(cellSize.width) ? static_cast<LayoutUnit>(cellSize.width) : bounds.width(),
+                   bounds.height() < static_cast<LayoutUnit>(cellSize.height) ? static_cast<LayoutUnit>(cellSize.height) : bounds.height());
 }
 
 bool RenderThemeMac::paintMeter(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to