Diff
Modified: trunk/Source/WebCore/ChangeLog (163943 => 163944)
--- trunk/Source/WebCore/ChangeLog 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/ChangeLog 2014-02-12 04:50:55 UTC (rev 163944)
@@ -1,3 +1,34 @@
+2014-02-11 Zalan Bujtas <za...@apple.com>
+
+ Subpixel rendering: Switch repaint rect from IntRect to LayoutRect to be able to
+ repaint on device pixel boundaries.
+ https://bugs.webkit.org/show_bug.cgi?id=128477
+
+ Reviewed by Simon Fraser.
+
+ RenderLayer needs to be able to repaint on device pixel boundaries. RenderView still
+ repaints on integral position.
+
+ No change in functionality.
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::layoutRunsAndFloats):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::repaintAfterLayoutIfNeeded):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPositions):
+ (WebCore::RenderLayer::clearRepaintRects):
+ (WebCore::RenderLayer::scrollTo):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::repaintUsingContainer):
+ (WebCore::RenderObject::repaint):
+ (WebCore::RenderObject::repaintRectangle):
+ * rendering/RenderObject.h:
+
2014-02-11 Dan Bernstein <m...@apple.com>
iOS build fix fix.
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-02-12 04:50:55 UTC (rev 163944)
@@ -1054,7 +1054,7 @@
// that the block really needed a full layout, we missed our chance to repaint the layer
// before layout started. Luckily the layer has cached the repaint rect for its original
// position and size, and so we can use that to make a repaint happen now.
- repaintUsingContainer(containerForRepaint(), pixelSnappedIntRect(layer()->repaintRect()));
+ repaintUsingContainer(containerForRepaint(), layer()->repaintRect());
}
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2014-02-12 04:50:55 UTC (rev 163944)
@@ -1187,9 +1187,9 @@
repaintContainer = &view();
if (fullRepaint) {
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds));
+ repaintUsingContainer(repaintContainer, oldBounds);
if (newBounds != oldBounds)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds));
+ repaintUsingContainer(repaintContainer, newBounds);
return true;
}
@@ -1198,27 +1198,27 @@
LayoutUnit deltaLeft = newBounds.x() - oldBounds.x();
if (deltaLeft > 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
+ repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));
else if (deltaLeft < 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
+ repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));
LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
if (deltaRight > 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
+ repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));
else if (deltaRight < 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
+ repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));
LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
if (deltaTop > 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
+ repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));
else if (deltaTop < 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
+ repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));
LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
if (deltaBottom > 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
+ repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));
else if (deltaBottom < 0)
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
+ repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));
if (newOutlineBox == oldOutlineBox)
return false;
@@ -1245,7 +1245,7 @@
LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX());
if (rightRect.x() < right) {
rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()));
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRect));
+ repaintUsingContainer(repaintContainer, rightRect);
}
}
LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.height());
@@ -1265,7 +1265,7 @@
LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY());
if (bottomRect.y() < bottom) {
bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRect.y()));
- repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRect));
+ repaintUsingContainer(repaintContainer, bottomRect);
}
}
return false;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-12 04:50:55 UTC (rev 163944)
@@ -421,9 +421,9 @@
if (!renderer().view().printing()) {
bool didRepaint = false;
if (m_repaintStatus & NeedsFullRepaint) {
- renderer().repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldRepaintRect));
+ renderer().repaintUsingContainer(repaintContainer, oldRepaintRect);
if (m_repaintRect != oldRepaintRect) {
- renderer().repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect));
+ renderer().repaintUsingContainer(repaintContainer, m_repaintRect);
didRepaint = true;
}
} else if (shouldRepaintAfterLayout()) {
@@ -707,8 +707,8 @@
ASSERT(!m_hasVisibleContent);
ASSERT(!m_visibleContentStatusDirty);
- m_repaintRect = IntRect();
- m_outlineBox = IntRect();
+ m_repaintRect = LayoutRect();
+ m_outlineBox = LayoutRect();
}
void RenderLayer::updateLayerPositionsAfterDocumentScroll()
@@ -2289,7 +2289,7 @@
#else
if (requiresRepaint)
#endif
- renderer().repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect));
+ renderer().repaintUsingContainer(repaintContainer, m_repaintRect);
// Schedule the scroll DOM event.
if (Element* element = renderer().element())
@@ -6203,13 +6203,13 @@
renderer().view().repaintViewRectangle(absRect);
} else
- backing()->setContentsNeedDisplayInRect(pixelSnappedIntRect(r), shouldClip);
+ backing()->setContentsNeedDisplayInRect(r, shouldClip);
}
// Since we're only painting non-composited layers, we know that they all share the same repaintContainer.
void RenderLayer::repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer)
{
- renderer().repaintUsingContainer(repaintContainer, pixelSnappedIntRect(renderer().clippedOverflowRectForRepaint(repaintContainer)));
+ renderer().repaintUsingContainer(repaintContainer, renderer().clippedOverflowRectForRepaint(repaintContainer));
for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) {
if (!curr->isComposited())
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-12 04:50:55 UTC (rev 163944)
@@ -2082,41 +2082,42 @@
}
// r is in the coordinate space of the layer's render object
-void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r, GraphicsLayer::ShouldClipToLayer shouldClip)
+void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r, GraphicsLayer::ShouldClipToLayer shouldClip)
{
ASSERT(!paintsIntoCompositedAncestor());
+ FloatRect pixelSnappedRectForPainting = pixelSnappedForPainting(r, deviceScaleFactor());
FrameView& frameView = owningLayer().renderer().view().frameView();
if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
frameView.addTrackedRepaintRect(pixelSnappedIntRect(r));
if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
- IntRect layerDirtyRect = r;
+ FloatRect layerDirtyRect = pixelSnappedRectForPainting;
layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
- IntRect layerDirtyRect = r;
+ FloatRect layerDirtyRect = pixelSnappedRectForPainting;
layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
// FIXME: need to split out repaints for the background.
if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
- IntRect layerDirtyRect = r;
+ FloatRect layerDirtyRect = pixelSnappedRectForPainting;
layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer());
m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
if (m_maskLayer && m_maskLayer->drawsContent()) {
- IntRect layerDirtyRect = r;
+ FloatRect layerDirtyRect = pixelSnappedRectForPainting;
layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
m_maskLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
- IntRect layerDirtyRect = r;
+ FloatRect layerDirtyRect = pixelSnappedRectForPainting;
layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer());
#if PLATFORM(IOS)
// Account for the fact that RenderLayerBacking::updateGraphicsLayerGeometry() bakes scrollOffset into offsetFromRenderer on iOS.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-12 04:50:55 UTC (rev 163944)
@@ -126,7 +126,7 @@
void setContentsNeedDisplay(GraphicsLayer::ShouldClipToLayer = GraphicsLayer::ClipToLayer);
// r is in the coordinate space of the layer's render object
- void setContentsNeedDisplayInRect(const IntRect&, GraphicsLayer::ShouldClipToLayer = GraphicsLayer::ClipToLayer);
+ void setContentsNeedDisplayInRect(const LayoutRect&, GraphicsLayer::ShouldClipToLayer = GraphicsLayer::ClipToLayer);
// Notification from the renderer that its content changed.
void contentChanged(ContentChangeType);
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2014-02-12 04:50:55 UTC (rev 163944)
@@ -1225,7 +1225,7 @@
return repaintContainer;
}
-void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const IntRect& r, bool immediate, bool shouldClipToLayer) const
+void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const LayoutRect& r, bool immediate, bool shouldClipToLayer) const
{
if (!repaintContainer) {
view().repaintViewRectangle(r, immediate);
@@ -1271,7 +1271,7 @@
return; // Don't repaint if we're printing.
RenderLayerModelObject* repaintContainer = containerForRepaint();
- repaintUsingContainer(repaintContainer ? repaintContainer : view, pixelSnappedIntRect(clippedOverflowRectForRepaint(repaintContainer)), immediate);
+ repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOverflowRectForRepaint(repaintContainer), immediate);
}
void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate, bool shouldClipToLayer) const
@@ -1292,7 +1292,7 @@
RenderLayerModelObject* repaintContainer = containerForRepaint();
computeRectForRepaint(repaintContainer, dirtyRect);
- repaintUsingContainer(repaintContainer ? repaintContainer : view, pixelSnappedIntRect(dirtyRect), immediate, shouldClipToLayer);
+ repaintUsingContainer(repaintContainer ? repaintContainer : view, dirtyRect, immediate, shouldClipToLayer);
}
void RenderObject::repaintSlowRepaintObject() const
Modified: trunk/Source/WebCore/rendering/RenderObject.h (163943 => 163944)
--- trunk/Source/WebCore/rendering/RenderObject.h 2014-02-12 04:45:13 UTC (rev 163943)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2014-02-12 04:50:55 UTC (rev 163944)
@@ -723,7 +723,7 @@
RenderLayerModelObject* containerForRepaint() const;
// Actually do the repaint of rect r for this object which has been computed in the coordinate space
// of repaintContainer. If repaintContainer is 0, repaint via the view.
- void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const IntRect&, bool immediate = false, bool shouldClipToLayer = true) const;
+ void repaintUsingContainer(const RenderLayerModelObject* repaintContainer, const LayoutRect&, bool immediate = false, bool shouldClipToLayer = true) const;
// Repaint the entire object. Called when, e.g., the color of a border changes, or when a border
// style changes.