Diff
Modified: trunk/Source/WebCore/ChangeLog (164414 => 164415)
--- trunk/Source/WebCore/ChangeLog 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/ChangeLog 2014-02-20 05:02:37 UTC (rev 164415)
@@ -1,5 +1,39 @@
2014-02-19 Zalan Bujtas <[email protected]>
+ Subpixel rendering: Make GraphicsLayer's offsetFromRenderer subpixel position based.
+ https://bugs.webkit.org/show_bug.cgi?id=128694
+
+ Reviewed by Simon Fraser.
+
+ Changing layers from using integral types to using Float/LayoutUnits so that
+ we can position them on subpixels. They are still integral positioned though.
+
+ Covered by existing tests.
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::setOffsetFromRenderer):
+ (WebCore::GraphicsLayer::paintGraphicsLayerContents):
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::offsetFromRenderer): removed incorrect comment.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread):
+ (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
+ (WebCore::RenderLayerBacking::computeTransformOrigin):
+ (WebCore::RenderLayerBacking::computePerspectiveOrigin):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::requiresOwnBackingStore):
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::adjustRegionBoundsFromFlowThreadPortionRect):
+ * rendering/RenderMultiColumnSet.h:
+ * rendering/RenderRegion.cpp:
+ (WebCore::RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect):
+ * rendering/RenderRegion.h:
+
+2014-02-19 Zalan Bujtas <[email protected]>
+
Subpixel rendering: Make GraphicsLayer::paintGraphicsLayerContents()'s cliprect FloatRect based.
https://bugs.webkit.org/show_bug.cgi?id=128911
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (164414 => 164415)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2014-02-20 05:02:37 UTC (rev 164415)
@@ -296,7 +296,7 @@
m_replicaLayer = layer;
}
-void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset, ShouldSetNeedsDisplay shouldSetNeedsDisplay)
+void GraphicsLayer::setOffsetFromRenderer(const FloatSize& offset, ShouldSetNeedsDisplay shouldSetNeedsDisplay)
{
if (offset == m_offsetFromRenderer)
return;
@@ -327,7 +327,7 @@
void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const FloatRect& clip)
{
if (m_client) {
- IntSize offset = offsetFromRenderer();
+ FloatSize offset = offsetFromRenderer();
context.translate(-offset);
FloatRect clipRect(clip);
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (164414 => 164415)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2014-02-20 05:02:37 UTC (rev 164415)
@@ -279,9 +279,9 @@
SetNeedsDisplay
};
- // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative).
- IntSize offsetFromRenderer() const { return m_offsetFromRenderer; }
- void setOffsetFromRenderer(const IntSize&, ShouldSetNeedsDisplay = SetNeedsDisplay);
+ // Offset is origin of the renderer minus origin of the graphics layer.
+ FloatSize offsetFromRenderer() const { return m_offsetFromRenderer; }
+ void setOffsetFromRenderer(const FloatSize&, ShouldSetNeedsDisplay = SetNeedsDisplay);
// The position of the layer (the location of its top-left corner in its parent)
const FloatPoint& position() const { return m_position; }
@@ -555,7 +555,7 @@
String m_name;
// Offset from the owning renderer
- IntSize m_offsetFromRenderer;
+ FloatSize m_offsetFromRenderer;
// Position is relative to the parent GraphicsLayer
FloatPoint m_position;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-02-20 05:02:37 UTC (rev 164415)
@@ -74,7 +74,7 @@
using namespace HTMLNames;
static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
-static IntRect clipBox(RenderBox& renderer);
+static LayoutRect clipBox(RenderBox& renderer);
CanvasCompositingStrategy canvasCompositingStrategy(const RenderObject& renderer)
{
@@ -633,7 +633,7 @@
return layerConfigChanged;
}
-static IntRect clipBox(RenderBox& renderer)
+static LayoutRect clipBox(RenderBox& renderer)
{
LayoutRect result = LayoutRect::infiniteRect();
if (renderer.hasOverflowClip())
@@ -686,7 +686,7 @@
RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer();
// We compute everything relative to the enclosing compositing layer.
- IntRect ancestorCompositingBounds;
+ LayoutRect ancestorCompositingBounds;
if (compAncestor) {
ASSERT(compAncestor->backing());
ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()->compositedBounds());
@@ -700,17 +700,17 @@
// Move the bounds by the subpixel accumulation so that it pixel-snaps relative to absolute pixels instead of local coordinates.
localRawCompositingBounds.move(m_subpixelAccumulation);
- IntRect localCompositingBounds = pixelSnappedIntRect(localRawCompositingBounds);
- IntRect relativeCompositingBounds(localCompositingBounds);
+ LayoutRect localCompositingBounds = pixelSnappedIntRect(localRawCompositingBounds);
+ LayoutRect relativeCompositingBounds(localCompositingBounds);
relativeCompositingBounds.moveBy(delta);
adjustAncestorCompositingBoundsForFlowThread(ancestorCompositingBounds, compAncestor);
- IntPoint graphicsLayerParentLocation;
+ LayoutPoint graphicsLayerParentLocation;
if (compAncestor && compAncestor->backing()->hasClippingLayer()) {
// If the compositing ancestor has a layer to clip children, we parent in that, and therefore
// position relative to it.
- IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
+ LayoutRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
graphicsLayerParentLocation = clippingBox.location();
} else if (compAncestor)
graphicsLayerParentLocation = ancestorCompositingBounds.location();
@@ -720,19 +720,19 @@
#if PLATFORM(IOS)
if (compAncestor && compAncestor->hasAcceleratedTouchScrolling()) {
RenderBox* renderBox = toRenderBox(&compAncestor->renderer());
- IntRect paddingBox(renderBox->borderLeft(), renderBox->borderTop(),
+ LayoutRect paddingBox(renderBox->borderLeft(), renderBox->borderTop(),
renderBox->width() - renderBox->borderLeft() - renderBox->borderRight(),
renderBox->height() - renderBox->borderTop() - renderBox->borderBottom());
- IntSize scrollOffset = compAncestor->scrolledContentOffset();
+ LayoutSize scrollOffset = compAncestor->scrolledContentOffset();
graphicsLayerParentLocation = paddingBox.location() - scrollOffset;
}
#endif
if (compAncestor && compAncestor->needsCompositedScrolling()) {
RenderBox& renderBox = toRenderBox(compAncestor->renderer());
- IntSize scrollOffset = compAncestor->scrolledContentOffset();
- IntPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop());
+ LayoutSize scrollOffset = compAncestor->scrolledContentOffset();
+ LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop());
graphicsLayerParentLocation = scrollOrigin - scrollOffset;
}
@@ -741,8 +741,8 @@
// layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
// for a compositing layer, rootLayer is the layer itself.
RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
- IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.backgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions.
- ASSERT(parentClipRect != IntRect::infiniteRect());
+ LayoutRect parentClipRect = pixelSnappedIntRect(m_owningLayer.backgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions.
+ ASSERT(parentClipRect != LayoutRect::infiniteRect());
m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
m_ancestorClippingLayer->setSize(parentClipRect.size());
@@ -753,7 +753,7 @@
graphicsLayerParentLocation = parentClipRect.location();
}
- FloatSize contentsSize = relativeCompositingBounds.size();
+ LayoutSize contentsSize = relativeCompositingBounds.size();
if (m_contentsContainmentLayer) {
m_contentsContainmentLayer->setPreserves3D(preserves3D);
@@ -765,26 +765,26 @@
m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
m_graphicsLayer->setSize(contentsSize);
- IntSize offsetFromRenderer = toIntSize(localCompositingBounds.location());
+ FloatSize offsetFromRenderer = toLayoutSize(localCompositingBounds.location());
if (offsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) {
- m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
+ m_graphicsLayer->setOffsetFromRenderer(offsetFromRenderer);
positionOverflowControlsLayers();
}
if (!m_isMainFrameRenderViewLayer) {
// For non-root layers, background is always painted by the primary graphics layer.
ASSERT(!m_backgroundLayer);
- bool hadSubpixelRounding = LayoutSize(relativeCompositingBounds.size()) != localRawCompositingBounds.size();
+ bool hadSubpixelRounding = relativeCompositingBounds.size() != localRawCompositingBounds.size();
m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds));
}
// If we have a layer that clips children, position it.
- IntRect clippingBox;
+ LayoutRect clippingBox;
if (GraphicsLayer* clipLayer = clippingLayer()) {
clippingBox = clipBox(toRenderBox(renderer()));
clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
clipLayer->setSize(clippingBox.size());
- clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location()));
+ clipLayer->setOffsetFromRenderer(toFloatSize(clippingBox.location()));
}
if (m_maskLayer) {
@@ -794,10 +794,10 @@
}
if (m_owningLayer.hasTransform()) {
- const IntRect borderBox = toRenderBox(renderer()).pixelSnappedBorderBoxRect();
+ const LayoutRect borderBox = toRenderBox(renderer()).pixelSnappedBorderBoxRect();
// Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- IntRect layerBounds(delta, borderBox.size());
+ LayoutRect layerBounds(delta, borderBox.size());
// Update properties that depend on layer dimensions
FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
@@ -836,12 +836,12 @@
if (m_foregroundLayer) {
FloatPoint foregroundPosition;
FloatSize foregroundSize = contentsSize;
- IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
+ FloatSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
if (hasClippingLayer()) {
// If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
// so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
foregroundSize = FloatSize(clippingBox.size());
- foregroundOffset = toIntSize(clippingBox.location());
+ foregroundOffset = toFloatSize(clippingBox.location());
}
m_foregroundLayer->setPosition(foregroundPosition);
@@ -883,7 +883,7 @@
m_scrollingLayer->setSize(paddingBox.size());
#if PLATFORM(IOS)
- IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
+ FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location());
bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
@@ -907,13 +907,13 @@
m_scrollingContentsLayer->setSize(scrollSize);
// Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting.
// FIXME: The paint offset and the scroll offset should really be separate concepts.
- m_scrollingContentsLayer->setOffsetFromRenderer(paddingBox.location() - IntPoint() - scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
+ m_scrollingContentsLayer->setOffsetFromRenderer(paddingBox.location() - FloatPoint() - scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
compositor().scrollingLayerAddedOrUpdated(&m_owningLayer);
#else
m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));
- IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
+ FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
m_scrollingLayer->setOffsetFromRenderer(-toIntSize(paddingBox.location()));
bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
@@ -951,7 +951,7 @@
compositor().updateViewportConstraintStatus(m_owningLayer);
}
-void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(IntRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
+void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const
{
if (!m_owningLayer.isInsideFlowThread())
return;
@@ -1225,7 +1225,7 @@
const IntRect borderBox = toRenderBox(renderer()).pixelSnappedBorderBoxRect();
- IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
+ FloatSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
IntRect hBarRect = m_owningLayer.rectForHorizontalScrollbar(borderBox);
layer->setPosition(hBarRect.location() - offsetFromRenderer);
@@ -1905,7 +1905,7 @@
image->startAnimation();
}
-FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox) const
+FloatPoint3D RenderLayerBacking::computeTransformOrigin(const LayoutRect& borderBox) const
{
const RenderStyle& style = renderer().style();
@@ -1917,7 +1917,7 @@
return origin;
}
-FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox) const
+FloatPoint RenderLayerBacking::computePerspectiveOrigin(const LayoutRect& borderBox) const
{
const RenderStyle& style = renderer().style();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-02-20 05:02:37 UTC (rev 164415)
@@ -241,9 +241,9 @@
LayoutSize contentOffsetInCompostingLayer() const;
// Result is transform origin in pixels.
- FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
+ FloatPoint3D computeTransformOrigin(const LayoutRect& borderBox) const;
// Result is perspective origin in pixels.
- FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
+ FloatPoint computePerspectiveOrigin(const LayoutRect& borderBox) const;
void updateOpacity(const RenderStyle*);
void updateTransform(const RenderStyle*);
@@ -286,7 +286,7 @@
void paintIntoLayer(const GraphicsLayer*, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
// Helper function for updateGraphicsLayerGeometry.
- void adjustAncestorCompositingBoundsForFlowThread(IntRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const;
+ void adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const;
static CSSPropertyID graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(CSSPropertyID);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-02-20 05:02:37 UTC (rev 164415)
@@ -2009,7 +2009,7 @@
return false;
}
-bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer& layer, const RenderLayer* compositingAncestorLayer, const IntRect& layerCompositedBoundsInAncestor, const IntRect& ancestorCompositedBounds) const
+bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer& layer, const RenderLayer* compositingAncestorLayer, const LayoutRect& layerCompositedBoundsInAncestor, const LayoutRect& ancestorCompositedBounds) const
{
auto& renderer = layer.renderer();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-02-20 05:02:37 UTC (rev 164415)
@@ -182,7 +182,7 @@
void repaintCompositedLayers(const IntRect* = 0);
// Returns true if the given layer needs it own backing store.
- bool requiresOwnBackingStore(const RenderLayer&, const RenderLayer* compositingAncestorLayer, const IntRect& layerCompositedBoundsInAncestor, const IntRect& ancestorCompositedBounds) const;
+ bool requiresOwnBackingStore(const RenderLayer&, const RenderLayer* compositingAncestorLayer, const LayoutRect& layerCompositedBoundsInAncestor, const LayoutRect& ancestorCompositedBounds) const;
RenderLayer& rootRenderLayer() const;
GraphicsLayer* rootGraphicsLayer() const;
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2014-02-20 05:02:37 UTC (rev 164415)
@@ -655,7 +655,7 @@
}
}
-void RenderMultiColumnSet::adjustRegionBoundsFromFlowThreadPortionRect(const IntPoint& layerOffset, IntRect& regionBounds)
+void RenderMultiColumnSet::adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds)
{
LayoutUnit layerLogicalTop = isHorizontalWritingMode() ? layerOffset.y() : layerOffset.x();
unsigned startColumn = columnIndexAtOffset(layerLogicalTop);
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-02-20 05:02:37 UTC (rev 164415)
@@ -102,7 +102,7 @@
virtual void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) override;
- virtual void adjustRegionBoundsFromFlowThreadPortionRect(const IntPoint& layerOffset, IntRect& regionBounds) override;
+ virtual void adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds) override;
virtual const char* renderName() const;
Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderRegion.cpp 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp 2014-02-20 05:02:37 UTC (rev 164415)
@@ -444,11 +444,11 @@
namedFlow.getRanges(rangeObjects, this);
}
-void RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect(const IntPoint& layerOffset, IntRect& regionBounds)
+void RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds)
{
LayoutRect flippedFlowThreadPortionRect = flowThreadPortionRect();
flowThread()->flipForWritingMode(flippedFlowThreadPortionRect);
- regionBounds.moveBy(roundedIntPoint(flippedFlowThreadPortionRect.location()));
+ regionBounds.moveBy(flippedFlowThreadPortionRect.location());
UNUSED_PARAM(layerOffset);
}
Modified: trunk/Source/WebCore/rendering/RenderRegion.h (164414 => 164415)
--- trunk/Source/WebCore/rendering/RenderRegion.h 2014-02-20 04:18:23 UTC (rev 164414)
+++ trunk/Source/WebCore/rendering/RenderRegion.h 2014-02-20 05:02:37 UTC (rev 164415)
@@ -113,7 +113,7 @@
virtual void collectLayerFragments(LayerFragments&, const LayoutRect&, const LayoutRect&) { }
- virtual void adjustRegionBoundsFromFlowThreadPortionRect(const IntPoint& layerOffset, IntRect& regionBounds); // layerOffset is needed for multi-column.
+ virtual void adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds); // layerOffset is needed for multi-column.
void addLayoutOverflowForBox(const RenderBox*, const LayoutRect&);
void addVisualOverflowForBox(const RenderBox*, const LayoutRect&);