Title: [109642] trunk/Source/WebCore
Revision
109642
Author
[email protected]
Date
2012-03-02 17:47:46 -0800 (Fri, 02 Mar 2012)

Log Message

Revert borders to integers for subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=80175

Reviewed by Eric Seidel.

Change border representation and calculation back to integers to ensure
that borders given the same width are rendered with the same actual width.

This will also avoid unnecessary type conversions when we switch over
to subpixel precision.

No new tests.

* rendering/LayoutTypes.h:
(WebCore::pixelSnappedIntRect):
(WebCore):
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::borderTop):
(WebCore::RenderBoxModelObject::borderBottom):
(WebCore::RenderBoxModelObject::borderLeft):
(WebCore::RenderBoxModelObject::borderRight):
(WebCore::RenderBoxModelObject::borderBefore):
(WebCore::RenderBoxModelObject::borderAfter):
(WebCore::RenderBoxModelObject::borderStart):
(WebCore::RenderBoxModelObject::borderEnd):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
(WebCore::RenderTable::calcBorderStart):
(WebCore::RenderTable::calcBorderEnd):
(WebCore::RenderTable::borderBefore):
(WebCore::RenderTable::borderAfter):
(WebCore::RenderTable::outerBorderBefore):
(WebCore::RenderTable::outerBorderAfter):
(WebCore::RenderTable::outerBorderStart):
(WebCore::RenderTable::outerBorderEnd):
* rendering/RenderTable.h:
(WebCore::RenderTable::borderStart):
(WebCore::RenderTable::borderEnd):
(RenderTable):
(WebCore::RenderTable::borderLeft):
(WebCore::RenderTable::borderRight):
(WebCore::RenderTable::borderTop):
(WebCore::RenderTable::borderBottom):
(WebCore::RenderTable::outerBorderLeft):
(WebCore::RenderTable::outerBorderRight):
(WebCore::RenderTable::outerBorderTop):
(WebCore::RenderTable::outerBorderBottom):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::clippedOverflowRectForRepaint):
(WebCore::RenderTableCell::borderLeft):
(WebCore::RenderTableCell::borderRight):
(WebCore::RenderTableCell::borderTop):
(WebCore::RenderTableCell::borderBottom):
(WebCore::RenderTableCell::borderStart):
(WebCore::RenderTableCell::borderEnd):
(WebCore::RenderTableCell::borderBefore):
(WebCore::RenderTableCell::borderAfter):
(WebCore::RenderTableCell::borderHalfLeft):
(WebCore::RenderTableCell::borderHalfRight):
(WebCore::RenderTableCell::borderHalfTop):
(WebCore::RenderTableCell::borderHalfBottom):
(WebCore::RenderTableCell::borderHalfStart):
(WebCore::RenderTableCell::borderHalfEnd):
(WebCore::RenderTableCell::borderHalfBefore):
(WebCore::RenderTableCell::borderHalfAfter):
(WebCore::RenderTableCell::paintCollapsedBorders):
* rendering/RenderTableCell.h:
(RenderTableCell):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109641 => 109642)


--- trunk/Source/WebCore/ChangeLog	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/ChangeLog	2012-03-03 01:47:46 UTC (rev 109642)
@@ -1,3 +1,74 @@
+2012-03-02  Emil A Eklund  <[email protected]>
+
+        Revert borders to integers for subpixel layout
+        https://bugs.webkit.org/show_bug.cgi?id=80175
+
+        Reviewed by Eric Seidel.
+
+        Change border representation and calculation back to integers to ensure
+        that borders given the same width are rendered with the same actual width.
+
+        This will also avoid unnecessary type conversions when we switch over
+        to subpixel precision.
+
+        No new tests.
+
+        * rendering/LayoutTypes.h:
+        (WebCore::pixelSnappedIntRect):
+        (WebCore):
+        * rendering/RenderBoxModelObject.h:
+        (WebCore::RenderBoxModelObject::borderTop):
+        (WebCore::RenderBoxModelObject::borderBottom):
+        (WebCore::RenderBoxModelObject::borderLeft):
+        (WebCore::RenderBoxModelObject::borderRight):
+        (WebCore::RenderBoxModelObject::borderBefore):
+        (WebCore::RenderBoxModelObject::borderAfter):
+        (WebCore::RenderBoxModelObject::borderStart):
+        (WebCore::RenderBoxModelObject::borderEnd):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
+        (WebCore::RenderTable::calcBorderStart):
+        (WebCore::RenderTable::calcBorderEnd):
+        (WebCore::RenderTable::borderBefore):
+        (WebCore::RenderTable::borderAfter):
+        (WebCore::RenderTable::outerBorderBefore):
+        (WebCore::RenderTable::outerBorderAfter):
+        (WebCore::RenderTable::outerBorderStart):
+        (WebCore::RenderTable::outerBorderEnd):
+        * rendering/RenderTable.h:
+        (WebCore::RenderTable::borderStart):
+        (WebCore::RenderTable::borderEnd):
+        (RenderTable):
+        (WebCore::RenderTable::borderLeft):
+        (WebCore::RenderTable::borderRight):
+        (WebCore::RenderTable::borderTop):
+        (WebCore::RenderTable::borderBottom):
+        (WebCore::RenderTable::outerBorderLeft):
+        (WebCore::RenderTable::outerBorderRight):
+        (WebCore::RenderTable::outerBorderTop):
+        (WebCore::RenderTable::outerBorderBottom):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::clippedOverflowRectForRepaint):
+        (WebCore::RenderTableCell::borderLeft):
+        (WebCore::RenderTableCell::borderRight):
+        (WebCore::RenderTableCell::borderTop):
+        (WebCore::RenderTableCell::borderBottom):
+        (WebCore::RenderTableCell::borderStart):
+        (WebCore::RenderTableCell::borderEnd):
+        (WebCore::RenderTableCell::borderBefore):
+        (WebCore::RenderTableCell::borderAfter):
+        (WebCore::RenderTableCell::borderHalfLeft):
+        (WebCore::RenderTableCell::borderHalfRight):
+        (WebCore::RenderTableCell::borderHalfTop):
+        (WebCore::RenderTableCell::borderHalfBottom):
+        (WebCore::RenderTableCell::borderHalfStart):
+        (WebCore::RenderTableCell::borderHalfEnd):
+        (WebCore::RenderTableCell::borderHalfBefore):
+        (WebCore::RenderTableCell::borderHalfAfter):
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        * rendering/RenderTableCell.h:
+        (RenderTableCell):
+
 2012-03-01  Eric Seidel  <[email protected]>
 
         Chrome 18 fails html5test.com XHR Blob response test

Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (109641 => 109642)


--- trunk/Source/WebCore/rendering/LayoutTypes.h	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h	2012-03-03 01:47:46 UTC (rev 109642)
@@ -58,6 +58,11 @@
     return rect;
 }
 
+inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit width, LayoutUnit height)
+{
+    return IntRect(left, top, width, height);
+}
+
 inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom)
 {
     return IntRect(left, top, right - left, bottom - top);

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (109641 => 109642)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2012-03-03 01:47:46 UTC (rev 109642)
@@ -87,14 +87,14 @@
     virtual LayoutUnit paddingStart(bool includeIntrinsicPadding = true) const;
     virtual LayoutUnit paddingEnd(bool includeIntrinsicPadding = true) const;
 
-    virtual LayoutUnit borderTop() const { return style()->borderTopWidth(); }
-    virtual LayoutUnit borderBottom() const { return style()->borderBottomWidth(); }
-    virtual LayoutUnit borderLeft() const { return style()->borderLeftWidth(); }
-    virtual LayoutUnit borderRight() const { return style()->borderRightWidth(); }
-    virtual LayoutUnit borderBefore() const { return style()->borderBeforeWidth(); }
-    virtual LayoutUnit borderAfter() const { return style()->borderAfterWidth(); }
-    virtual LayoutUnit borderStart() const { return style()->borderStartWidth(); }
-    virtual LayoutUnit borderEnd() const { return style()->borderEndWidth(); }
+    virtual int borderTop() const { return style()->borderTopWidth(); }
+    virtual int borderBottom() const { return style()->borderBottomWidth(); }
+    virtual int borderLeft() const { return style()->borderLeftWidth(); }
+    virtual int borderRight() const { return style()->borderRightWidth(); }
+    virtual int borderBefore() const { return style()->borderBeforeWidth(); }
+    virtual int borderAfter() const { return style()->borderAfterWidth(); }
+    virtual int borderStart() const { return style()->borderStartWidth(); }
+    virtual int borderEnd() const { return style()->borderEndWidth(); }
 
     LayoutUnit borderAndPaddingHeight() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); }
     LayoutUnit borderAndPaddingWidth() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); }

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (109641 => 109642)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-03-03 01:47:46 UTC (rev 109642)
@@ -270,11 +270,11 @@
 LayoutUnit RenderTable::convertStyleLogicalWidthToComputedWidth(const Length& styleLogicalWidth, LayoutUnit availableWidth)
 {
     // HTML tables' width styles already include borders and paddings, but CSS tables' width styles do not.
-    LayoutUnit borders = 0;
+    int borders = 0;
     bool isCSSTable = !node() || !node()->hasTagName(tableTag);
     if (isCSSTable && styleLogicalWidth.isFixed() && styleLogicalWidth.isPositive()) {
         recalcBordersInRowDirection();
-        borders = borderStart() + borderEnd() + (collapseBorders() ? zeroLayoutUnit : paddingStart() + paddingEnd());
+        borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
     }
     return styleLogicalWidth.calcMinValue(availableWidth) + borders;
 }
@@ -840,14 +840,14 @@
     m_needsSectionRecalc = false;
 }
 
-LayoutUnit RenderTable::calcBorderStart() const
+int RenderTable::calcBorderStart() const
 {
     if (collapseBorders()) {
         // Determined by the first cell of the first row. See the CSS 2.1 spec, section 17.6.2.
         if (!numEffCols())
             return 0;
 
-        LayoutUnit borderWidth = 0;
+        unsigned borderWidth = 0;
 
         const BorderValue& tb = style()->borderStart();
         if (tb.style() == BHIDDEN)
@@ -860,7 +860,7 @@
             if (gb.style() == BHIDDEN)
                 return 0;
             if (gb.style() > BHIDDEN)
-                borderWidth = max<LayoutUnit>(borderWidth, gb.width());
+                borderWidth = max(borderWidth, gb.width());
         }
         
         if (const RenderTableSection* topNonEmptySection = this->topNonEmptySection()) {
@@ -869,7 +869,7 @@
                 return 0;
 
             if (sb.style() > BHIDDEN)
-                borderWidth = max<LayoutUnit>(borderWidth, sb.width());
+                borderWidth = max(borderWidth, sb.width());
 
             const RenderTableSection::CellStruct& cs = topNonEmptySection->cellAt(0, 0);
             
@@ -883,9 +883,9 @@
                     return 0;
 
                 if (cb.style() > BHIDDEN)
-                    borderWidth = max<LayoutUnit>(borderWidth, cb.width());
+                    borderWidth = max(borderWidth, cb.width());
                 if (rb.style() > BHIDDEN)
-                    borderWidth = max<LayoutUnit>(borderWidth, rb.width());
+                    borderWidth = max(borderWidth, rb.width());
             }
         }
         return (borderWidth + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
@@ -893,14 +893,14 @@
     return RenderBlock::borderStart();
 }
 
-LayoutUnit RenderTable::calcBorderEnd() const
+int RenderTable::calcBorderEnd() const
 {
     if (collapseBorders()) {
         // Determined by the last cell of the first row. See the CSS 2.1 spec, section 17.6.2.
         if (!numEffCols())
             return 0;
 
-        LayoutUnit borderWidth = 0;
+        unsigned borderWidth = 0;
 
         const BorderValue& tb = style()->borderEnd();
         if (tb.style() == BHIDDEN)
@@ -914,7 +914,7 @@
             if (gb.style() == BHIDDEN)
                 return 0;
             if (gb.style() > BHIDDEN)
-                borderWidth = max<LayoutUnit>(borderWidth, gb.width());
+                borderWidth = max(borderWidth, gb.width());
         }
 
         if (const RenderTableSection* topNonEmptySection = this->topNonEmptySection()) {
@@ -923,7 +923,7 @@
                 return 0;
 
             if (sb.style() > BHIDDEN)
-                borderWidth = max<LayoutUnit>(borderWidth, sb.width());
+                borderWidth = max(borderWidth, sb.width());
 
             const RenderTableSection::CellStruct& cs = topNonEmptySection->cellAt(0, endColumn);
             
@@ -937,9 +937,9 @@
                     return 0;
 
                 if (cb.style() > BHIDDEN)
-                    borderWidth = max<LayoutUnit>(borderWidth, cb.width());
+                    borderWidth = max(borderWidth, cb.width());
                 if (rb.style() > BHIDDEN)
-                    borderWidth = max<LayoutUnit>(borderWidth, rb.width());
+                    borderWidth = max(borderWidth, rb.width());
             }
         }
         return (borderWidth + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
@@ -953,7 +953,7 @@
     m_borderEnd = calcBorderEnd();
 }
 
-LayoutUnit RenderTable::borderBefore() const
+int RenderTable::borderBefore() const
 {
     if (collapseBorders()) {
         recalcSectionsIfNeeded();
@@ -962,7 +962,7 @@
     return RenderBlock::borderBefore();
 }
 
-LayoutUnit RenderTable::borderAfter() const
+int RenderTable::borderAfter() const
 {
     if (collapseBorders()) {
         recalcSectionsIfNeeded();
@@ -971,11 +971,11 @@
     return RenderBlock::borderAfter();
 }
 
-LayoutUnit RenderTable::outerBorderBefore() const
+int RenderTable::outerBorderBefore() const
 {
     if (!collapseBorders())
         return 0;
-    LayoutUnit borderWidth = 0;
+    int borderWidth = 0;
     if (RenderTableSection* topSection = this->topSection()) {
         borderWidth = topSection->outerBorderBefore();
         if (borderWidth < 0)
@@ -985,15 +985,15 @@
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = max<LayoutUnit>(borderWidth, tb.width() / 2);
+        borderWidth = max<int>(borderWidth, tb.width() / 2);
     return borderWidth;
 }
 
-LayoutUnit RenderTable::outerBorderAfter() const
+int RenderTable::outerBorderAfter() const
 {
     if (!collapseBorders())
         return 0;
-    LayoutUnit borderWidth = 0;
+    int borderWidth = 0;
     RenderTableSection* bottomSection;
     if (m_foot)
         bottomSection = m_foot;
@@ -1011,16 +1011,16 @@
     if (tb.style() == BHIDDEN)
         return 0;
     if (tb.style() > BHIDDEN)
-        borderWidth = max<LayoutUnit>(borderWidth, (tb.width() + 1) / 2);
+        borderWidth = max<int>(borderWidth, (tb.width() + 1) / 2);
     return borderWidth;
 }
 
-LayoutUnit RenderTable::outerBorderStart() const
+int RenderTable::outerBorderStart() const
 {
     if (!collapseBorders())
         return 0;
 
-    LayoutUnit borderWidth = 0;
+    int borderWidth = 0;
 
     const BorderValue& tb = style()->borderStart();
     if (tb.style() == BHIDDEN)
@@ -1032,7 +1032,7 @@
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (!child->isTableSection())
             continue;
-        LayoutUnit sw = toRenderTableSection(child)->outerBorderStart();
+        int sw = toRenderTableSection(child)->outerBorderStart();
         if (sw < 0)
             continue;
         allHidden = false;
@@ -1044,12 +1044,12 @@
     return borderWidth;
 }
 
-LayoutUnit RenderTable::outerBorderEnd() const
+int RenderTable::outerBorderEnd() const
 {
     if (!collapseBorders())
         return 0;
 
-    LayoutUnit borderWidth = 0;
+    int borderWidth = 0;
 
     const BorderValue& tb = style()->borderEnd();
     if (tb.style() == BHIDDEN)
@@ -1061,7 +1061,7 @@
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (!child->isTableSection())
             continue;
-        LayoutUnit sw = toRenderTableSection(child)->outerBorderEnd();
+        int sw = toRenderTableSection(child)->outerBorderEnd();
         if (sw < 0)
             continue;
         allHidden = false;

Modified: trunk/Source/WebCore/rendering/RenderTable.h (109641 => 109642)


--- trunk/Source/WebCore/rendering/RenderTable.h	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/RenderTable.h	2012-03-03 01:47:46 UTC (rev 109642)
@@ -52,33 +52,33 @@
     
     bool collapseBorders() const { return style()->borderCollapse(); }
 
-    LayoutUnit borderStart() const { return m_borderStart; }
-    LayoutUnit borderEnd() const { return m_borderEnd; }
-    LayoutUnit borderBefore() const;
-    LayoutUnit borderAfter() const;
+    int borderStart() const { return m_borderStart; }
+    int borderEnd() const { return m_borderEnd; }
+    int borderBefore() const;
+    int borderAfter() const;
 
-    LayoutUnit borderLeft() const
+    int borderLeft() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
         return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
     }
 
-    LayoutUnit borderRight() const
+    int borderRight() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isLeftToRightDirection() ? borderEnd() : borderStart();
         return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
     }
 
-    LayoutUnit borderTop() const
+    int borderTop() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBefore();
         return style()->isLeftToRightDirection() ? borderStart() : borderEnd();
     }
 
-    LayoutUnit borderBottom() const
+    int borderBottom() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAfter();
@@ -87,41 +87,41 @@
 
     Color bgColor() const { return style()->visitedDependentColor(CSSPropertyBackgroundColor); }
 
-    LayoutUnit outerBorderBefore() const;
-    LayoutUnit outerBorderAfter() const;
-    LayoutUnit outerBorderStart() const;
-    LayoutUnit outerBorderEnd() const;
+    int outerBorderBefore() const;
+    int outerBorderAfter() const;
+    int outerBorderStart() const;
+    int outerBorderEnd() const;
 
-    LayoutUnit outerBorderLeft() const
+    int outerBorderLeft() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
         return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
     }
 
-    LayoutUnit outerBorderRight() const
+    int outerBorderRight() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
         return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
     }
 
-    LayoutUnit outerBorderTop() const
+    int outerBorderTop() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isFlippedBlocksWritingMode() ? outerBorderAfter() : outerBorderBefore();
         return style()->isLeftToRightDirection() ? outerBorderStart() : outerBorderEnd();
     }
 
-    LayoutUnit outerBorderBottom() const
+    int outerBorderBottom() const
     {
         if (style()->isHorizontalWritingMode())
             return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() : outerBorderAfter();
         return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorderStart();
     }
 
-    LayoutUnit calcBorderStart() const;
-    LayoutUnit calcBorderEnd() const;
+    int calcBorderStart() const;
+    int calcBorderEnd() const;
     void recalcBordersInRowDirection();
 
     virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
@@ -271,8 +271,8 @@
     
     short m_hSpacing;
     short m_vSpacing;
-    LayoutUnit m_borderStart;
-    LayoutUnit m_borderEnd;
+    int m_borderStart;
+    int m_borderEnd;
 };
 
 inline RenderTableSection* RenderTable::topSection() const

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (109641 => 109642)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-03-03 01:47:46 UTC (rev 109642)
@@ -267,11 +267,11 @@
         return RenderBlock::clippedOverflowRectForRepaint(repaintContainer);
 
     bool rtl = !table()->style()->isLeftToRightDirection();
-    LayoutUnit outlineSize = style()->outlineSize();
-    LayoutUnit left = max(borderHalfLeft(true), outlineSize);
-    LayoutUnit right = max(borderHalfRight(true), outlineSize);
-    LayoutUnit top = max(borderHalfTop(true), outlineSize);
-    LayoutUnit bottom = max(borderHalfBottom(true), outlineSize);
+    int outlineSize = style()->outlineSize();
+    int left = max(borderHalfLeft(true), outlineSize);
+    int right = max(borderHalfRight(true), outlineSize);
+    int top = max(borderHalfTop(true), outlineSize);
+    int bottom = max(borderHalfBottom(true), outlineSize);
     if ((left && !rtl) || (right && rtl)) {
         if (RenderTableCell* before = table()->cellBefore(this)) {
             top = max(top, before->borderHalfTop(true));
@@ -747,49 +747,49 @@
     return tableStyle->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
 }
 
-LayoutUnit RenderTableCell::borderLeft() const
+int RenderTableCell::borderLeft() const
 {
     return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderLeft();
 }
 
-LayoutUnit RenderTableCell::borderRight() const
+int RenderTableCell::borderRight() const
 {
     return table()->collapseBorders() ? borderHalfRight(false) : RenderBlock::borderRight();
 }
 
-LayoutUnit RenderTableCell::borderTop() const
+int RenderTableCell::borderTop() const
 {
     return table()->collapseBorders() ? borderHalfTop(false) : RenderBlock::borderTop();
 }
 
-LayoutUnit RenderTableCell::borderBottom() const
+int RenderTableCell::borderBottom() const
 {
     return table()->collapseBorders() ? borderHalfBottom(false) : RenderBlock::borderBottom();
 }
 
 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=46191, make the collapsed border drawing
 // work with different block flow values instead of being hard-coded to top-to-bottom.
-LayoutUnit RenderTableCell::borderStart() const
+int RenderTableCell::borderStart() const
 {
     return table()->collapseBorders() ? borderHalfStart(false) : RenderBlock::borderStart();
 }
 
-LayoutUnit RenderTableCell::borderEnd() const
+int RenderTableCell::borderEnd() const
 {
     return table()->collapseBorders() ? borderHalfEnd(false) : RenderBlock::borderEnd();
 }
 
-LayoutUnit RenderTableCell::borderBefore() const
+int RenderTableCell::borderBefore() const
 {
     return table()->collapseBorders() ? borderHalfBefore(false) : RenderBlock::borderBefore();
 }
 
-LayoutUnit RenderTableCell::borderAfter() const
+int RenderTableCell::borderAfter() const
 {
     return table()->collapseBorders() ? borderHalfAfter(false) : RenderBlock::borderAfter();
 }
 
-LayoutUnit RenderTableCell::borderHalfLeft(bool outer) const
+int RenderTableCell::borderHalfLeft(bool outer) const
 {
     RenderStyle* tableStyle = table()->style();
     if (tableStyle->isHorizontalWritingMode())
@@ -797,7 +797,7 @@
     return tableStyle->isFlippedBlocksWritingMode() ? borderHalfAfter(outer) : borderHalfBefore(outer);
 }
 
-LayoutUnit RenderTableCell::borderHalfRight(bool outer) const
+int RenderTableCell::borderHalfRight(bool outer) const
 {
     RenderStyle* tableStyle = table()->style();
     if (tableStyle->isHorizontalWritingMode())
@@ -805,7 +805,7 @@
     return tableStyle->isFlippedBlocksWritingMode() ? borderHalfBefore(outer) : borderHalfAfter(outer);
 }
 
-LayoutUnit RenderTableCell::borderHalfTop(bool outer) const
+int RenderTableCell::borderHalfTop(bool outer) const
 {
     RenderStyle* tableStyle = table()->style();
     if (tableStyle->isHorizontalWritingMode())
@@ -813,7 +813,7 @@
     return tableStyle->isLeftToRightDirection() ? borderHalfStart(outer) : borderHalfEnd(outer);
 }
 
-LayoutUnit RenderTableCell::borderHalfBottom(bool outer) const
+int RenderTableCell::borderHalfBottom(bool outer) const
 {
     RenderStyle* tableStyle = table()->style();
     if (tableStyle->isHorizontalWritingMode())
@@ -821,7 +821,7 @@
     return tableStyle->isLeftToRightDirection() ? borderHalfEnd(outer) : borderHalfStart(outer);
 }
 
-LayoutUnit RenderTableCell::borderHalfStart(bool outer) const
+int RenderTableCell::borderHalfStart(bool outer) const
 {
     CollapsedBorderValue border = collapsedStartBorder(DoNotIncludeBorderColor);
     if (border.exists())
@@ -829,7 +829,7 @@
     return 0;
 }
     
-LayoutUnit RenderTableCell::borderHalfEnd(bool outer) const
+int RenderTableCell::borderHalfEnd(bool outer) const
 {
     CollapsedBorderValue border = collapsedEndBorder(DoNotIncludeBorderColor);
     if (border.exists())
@@ -837,7 +837,7 @@
     return 0;
 }
 
-LayoutUnit RenderTableCell::borderHalfBefore(bool outer) const
+int RenderTableCell::borderHalfBefore(bool outer) const
 {
     CollapsedBorderValue border = collapsedBeforeBorder(DoNotIncludeBorderColor);
     if (border.exists())
@@ -845,7 +845,7 @@
     return 0;
 }
 
-LayoutUnit RenderTableCell::borderHalfAfter(bool outer) const
+int RenderTableCell::borderHalfAfter(bool outer) const
 {
     CollapsedBorderValue border = collapsedAfterBorder(DoNotIncludeBorderColor);
     if (border.exists())
@@ -981,16 +981,16 @@
     CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(tableStyle);
      
     // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
-    LayoutUnit topWidth = topVal.width();
-    LayoutUnit bottomWidth = bottomVal.width();
-    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;
-    
+    int topWidth = topVal.width();
+    int bottomWidth = bottomVal.width();
+    int leftWidth = leftVal.width();
+    int rightWidth = rightVal.width();
+
+    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());
     EBorderStyle leftStyle = collapsedBorderStyle(leftVal.style());
@@ -1004,10 +1004,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);
     

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (109641 => 109642)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2012-03-03 01:32:05 UTC (rev 109641)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2012-03-03 01:47:46 UTC (rev 109642)
@@ -91,14 +91,14 @@
 
     void updateLogicalWidth(LayoutUnit);
 
-    virtual LayoutUnit borderLeft() const;
-    virtual LayoutUnit borderRight() const;
-    virtual LayoutUnit borderTop() const;
-    virtual LayoutUnit borderBottom() const;
-    virtual LayoutUnit borderStart() const;
-    virtual LayoutUnit borderEnd() const;
-    virtual LayoutUnit borderBefore() const;
-    virtual LayoutUnit borderAfter() const;
+    virtual int borderLeft() const;
+    virtual int borderRight() const;
+    virtual int borderTop() const;
+    virtual int borderBottom() const;
+    virtual int borderStart() const;
+    virtual int borderEnd() const;
+    virtual int borderBefore() const;
+    virtual int borderAfter() const;
 
     void collectBorderValues(RenderTable::CollapsedBorderValues&) const;
     static void sortBorderValues(RenderTable::CollapsedBorderValues&);
@@ -159,15 +159,15 @@
     virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
 
-    LayoutUnit borderHalfLeft(bool outer) const;
-    LayoutUnit borderHalfRight(bool outer) const;
-    LayoutUnit borderHalfTop(bool outer) const;
-    LayoutUnit borderHalfBottom(bool outer) const;
+    int borderHalfLeft(bool outer) const;
+    int borderHalfRight(bool outer) const;
+    int borderHalfTop(bool outer) const;
+    int borderHalfBottom(bool outer) const;
 
-    LayoutUnit borderHalfStart(bool outer) const;
-    LayoutUnit borderHalfEnd(bool outer) const;
-    LayoutUnit borderHalfBefore(bool outer) const;
-    LayoutUnit borderHalfAfter(bool outer) const;
+    int borderHalfStart(bool outer) const;
+    int borderHalfEnd(bool outer) const;
+    int borderHalfBefore(bool outer) const;
+    int borderHalfAfter(bool outer) const;
 
     CollapsedBorderValue collapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
     CollapsedBorderValue collapsedEndBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to