Pixel turds when bordered div is resized on SMF forum software.
https://bugs.webkit.org/show_bug.cgi?id=155957
<rdar://problem/25010646>

Reviewed by Simon Fraser.

Use unmodified, non-snapped bounding box rect when computing dirty rects.

Source/WebCore:

Test: fast/repaint/hidpi-box-with-subpixel-height-inflates.html

* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::getTrailingCorner):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::borderBoundingBox): Deleted.
* rendering/RenderLineBreak.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::setBestTruncatedAt):

LayoutTests:

* fast/repaint/hidpi-box-with-subpixel-height-inflates-expected.txt: Added.
* fast/repaint/hidpi-box-with-subpixel-height-inflates.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@198771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 29d91a57..b341a57 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2016-03-28  Zalan Bujtas  <zalan@apple.com>
+
+        Pixel turds when bordered div is resized on SMF forum software.
+        https://bugs.webkit.org/show_bug.cgi?id=155957
+        <rdar://problem/25010646>
+
+        Reviewed by Simon Fraser.
+
+        Use unmodified, non-snapped bounding box rect when computing dirty rects.
+
+        Test: fast/repaint/hidpi-box-with-subpixel-height-inflates.html
+
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::getTrailingCorner):
+        * rendering/RenderInline.h:
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::borderBoundingBox): Deleted.
+        * rendering/RenderLineBreak.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::setBestTruncatedAt):
+
 2016-03-28  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Crash when AX trying to create element for an old auto fill element
diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h
index 07e330c..61b6e7f 100644
--- a/Source/WebCore/rendering/RenderBox.h
+++ b/Source/WebCore/rendering/RenderBox.h
@@ -153,7 +153,7 @@
     }
     LayoutRect borderBoxRect() const { return LayoutRect(LayoutPoint(), size()); }
     LayoutRect paddingBoxRect() const { return LayoutRect(borderLeft(), borderTop(), contentWidth() + paddingLeft() + paddingRight(), contentHeight() + paddingTop() + paddingBottom()); }
-    IntRect borderBoundingBox() const final { return enclosingIntRect(borderBoxRect()); }
+    LayoutRect borderBoundingBox() const final { return borderBoxRect(); }
 
     WEBCORE_EXPORT RoundedRect::Radii borderRadii() const;
 
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h
index 5baccb9..25a4f41 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.h
+++ b/Source/WebCore/rendering/RenderBoxModelObject.h
@@ -130,7 +130,7 @@
     bool requiresLayer() const override { return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection(); }
 
     // This will work on inlines to return the bounding box of all of the lines' border boxes.
-    virtual IntRect borderBoundingBox() const = 0;
+    virtual LayoutRect borderBoundingBox() const = 0;
 
     // These return the CSS computed padding values.
     LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style().paddingTop()); }
diff --git a/Source/WebCore/rendering/RenderElement.cpp b/Source/WebCore/rendering/RenderElement.cpp
index 9c19f5c..3220ddb 100644
--- a/Source/WebCore/rendering/RenderElement.cpp
+++ b/Source/WebCore/rendering/RenderElement.cpp
@@ -1730,7 +1730,7 @@
         if (is<RenderText>(*o) || o->isReplaced()) {
             point = FloatPoint();
             if (is<RenderText>(*o)) {
-                IntRect linesBox = downcast<RenderText>(*o).linesBoundingBox();
+                LayoutRect linesBox = downcast<RenderText>(*o).linesBoundingBox();
                 if (!linesBox.maxX() && !linesBox.maxY())
                     continue;
                 point.moveBy(linesBox.maxXMaxYCorner());
diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h
index b1f09cd..8ebcaec 100644
--- a/Source/WebCore/rendering/RenderInline.h
+++ b/Source/WebCore/rendering/RenderInline.h
@@ -53,10 +53,9 @@
 
     LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = nullptr) const final;
 
-    IntRect borderBoundingBox() const final
+    LayoutRect borderBoundingBox() const final
     {
-        IntRect boundingBox = linesBoundingBox();
-        return IntRect(0, 0, boundingBox.width(), boundingBox.height());
+        return LayoutRect(LayoutPoint(), linesBoundingBox().size());
     }
 
     WEBCORE_EXPORT IntRect linesBoundingBox() const;
diff --git a/Source/WebCore/rendering/RenderLineBreak.cpp b/Source/WebCore/rendering/RenderLineBreak.cpp
index 9006831..977c811 100644
--- a/Source/WebCore/rendering/RenderLineBreak.cpp
+++ b/Source/WebCore/rendering/RenderLineBreak.cpp
@@ -225,11 +225,6 @@
     m_cachedLineHeight = invalidLineHeight;
 }
 
-IntRect RenderLineBreak::borderBoundingBox() const
-{
-    return IntRect(IntPoint(), linesBoundingBox().size());
-}
-
 #if PLATFORM(IOS)
 void RenderLineBreak::collectSelectionRects(Vector<SelectionRect>& rects, unsigned, unsigned)
 {
diff --git a/Source/WebCore/rendering/RenderLineBreak.h b/Source/WebCore/rendering/RenderLineBreak.h
index 81c41e6..9bcd4f1 100644
--- a/Source/WebCore/rendering/RenderLineBreak.h
+++ b/Source/WebCore/rendering/RenderLineBreak.h
@@ -82,7 +82,7 @@
     LayoutUnit marginEnd(const RenderStyle*) const override { return 0; }
     LayoutUnit offsetWidth() const override { return linesBoundingBox().width(); }
     LayoutUnit offsetHeight() const override { return linesBoundingBox().height(); }
-    IntRect borderBoundingBox() const override;
+    LayoutRect borderBoundingBox() const override { return LayoutRect(LayoutPoint(), linesBoundingBox().size()); }
     LayoutRect frameRectForStickyPositioning() const override { ASSERT_NOT_REACHED(); return LayoutRect(); }
     LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject*) const override { return LayoutRect(); }
 
diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp
index 565450c..0f484a0 100644
--- a/Source/WebCore/rendering/RenderView.cpp
+++ b/Source/WebCore/rendering/RenderView.cpp
@@ -1251,7 +1251,7 @@
     }
 
     // Prefer the widest object that tries to move the pagination point
-    IntRect boundingBox = forRenderer->borderBoundingBox();
+    LayoutRect boundingBox = forRenderer->borderBoundingBox();
     if (boundingBox.width() > m_legacyPrinting.m_truncatorWidth) {
         m_legacyPrinting.m_truncatorWidth = boundingBox.width();
         m_legacyPrinting.m_bestTruncatedAt = y;
diff --git a/Source/WebKit2/Shared/WebRenderObject.cpp b/Source/WebKit2/Shared/WebRenderObject.cpp
index e54c6ab..c3cdee6 100644
--- a/Source/WebKit2/Shared/WebRenderObject.cpp
+++ b/Source/WebKit2/Shared/WebRenderObject.cpp
@@ -106,7 +106,7 @@
         m_frameRect = downcast<RenderText>(*renderer).linesBoundingBox();
         m_frameRect.setLocation(downcast<RenderText>(*renderer).firstRunLocation());
     } else if (is<RenderInline>(*renderer))
-        m_frameRect = downcast<RenderInline>(*renderer).borderBoundingBox();
+        m_frameRect = IntRect(downcast<RenderInline>(*renderer).borderBoundingBox());
 
     if (!shouldIncludeDescendants)
         return;