Diff
Modified: trunk/LayoutTests/ChangeLog (154008 => 154009)
--- trunk/LayoutTests/ChangeLog 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/LayoutTests/ChangeLog 2013-08-13 17:08:19 UTC (rev 154009)
@@ -1,3 +1,13 @@
+2013-08-13 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION(SUBPIXEL_LAYOUT) Composited layers can cause one pixel shifts
+ https://bugs.webkit.org/show_bug.cgi?id=115304
+
+ Reviewed by David Hyatt.
+
+ * fast/sub-pixel/sub-pixel-composited-layers-expected.html: Added.
+ * fast/sub-pixel/sub-pixel-composited-layers.html: Added.
+
2013-08-13 Christophe Dumez <[email protected]>
HTMLSelectElement.item() does not behave according to specification
Added: trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers-expected.html (0 => 154009)
--- trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers-expected.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers-expected.html 2013-08-13 17:08:19 UTC (rev 154009)
@@ -0,0 +1,92 @@
+<html>
+<head>
+<style>
+ #test {
+ margin: 5px;
+ }
+ .container {
+ position: absolute;
+ opacity: 0.95;
+ }
+ .shifter {
+ position: absolute;
+ background-color: black;
+ width: 12.5px;
+ height: 12.5px;
+ }
+ .shifter8x8 {
+ position: absolute;
+ background-color: black;
+ width: 16.5px;
+ height: 16.5px;
+ }
+</style>
+</head>
+<body>
+<div id=test>
+</div>
+<script>
+ function setupGrid10x10(leftOffset, topOffset, leftFraction, topFraction)
+ {
+ var test = document.getElementById('test');
+ for (var i = 0; i < 10; i++) {
+ if (i == 5)
+ topOffset += 5;
+ var leftOffsetj = leftOffset;
+ for (var j = 0; j < 10; j++) {
+ if (j == 5)
+ leftOffsetj += 5;
+ var container = document.createElement("div");
+ var shifter = document.createElement("div");
+ container.setAttribute('class', 'container');
+ shifter.setAttribute('class', 'shifter');
+ container.style.left = (leftOffsetj + j * 16 + i * leftFraction) + "px"
+ container.style.top = (topOffset + i * 16 + i * topFraction) + "px"
+ shifter.style.left = (5 + j * leftFraction) + "px"
+ shifter.style.top = (5 + j * topFraction) + "px"
+ container.appendChild(shifter);
+ test.appendChild(container);
+ }
+ }
+ }
+
+ function setupGrid8x8(leftOffset, topOffset, leftFraction, topFraction)
+ {
+ var test = document.getElementById('test');
+ for (var i = 0; i < 8; i++) {
+ if (i == 4)
+ topOffset += 5;
+ var leftOffsetj = leftOffset;
+ for (var j = 0; j < 8; j++) {
+ if (j == 4)
+ leftOffsetj += 5;
+ var container = document.createElement("div");
+ var shifter = document.createElement("div");
+ container.setAttribute('class', 'container');
+ shifter.setAttribute('class', 'shifter8x8');
+ container.style.left = (leftOffsetj + j * 20 + i * leftFraction) + "px"
+ container.style.top = (topOffset + i * 20 + i * topFraction) + "px"
+ shifter.style.left = (5 + j * leftFraction) + "px"
+ shifter.style.top = (5 + j * topFraction) + "px"
+ container.appendChild(shifter);
+ test.appendChild(container);
+ }
+ }
+ }
+
+ function setupTest()
+ {
+ // Vertical shifts:
+ setupGrid10x10(10, 10, 0, 0.1)
+ // Horizontal shifts:
+ setupGrid10x10(200, 10, 0.1, 0);
+
+ // And in 8x8 (where exactly 0.5 is more common)
+ setupGrid8x8(10, 200, 0, 0.125);
+ setupGrid8x8(200, 200, 0.125, 0);
+ }
+
+ setupTest();
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers.html (0 => 154009)
--- trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers.html (rev 0)
+++ trunk/LayoutTests/fast/sub-pixel/sub-pixel-composited-layers.html 2013-08-13 17:08:19 UTC (rev 154009)
@@ -0,0 +1,95 @@
+<html>
+<head>
+<style>
+ #test {
+ margin: 5px;
+ }
+ #test.composite > .container {
+ -webkit-transform: translateZ(0);
+ opacity: 0.95;
+ }
+ .container {
+ position: absolute;
+ }
+ .shifter {
+ position: absolute;
+ background-color: black;
+ width: 12.5px;
+ height: 12.5px;
+ }
+ .shifter8x8 {
+ position: absolute;
+ background-color: black;
+ width: 16.5px;
+ height: 16.5px;
+ }
+</style>
+</head>
+<body>
+<div id=test class=composite>
+</div>
+<script>
+ function setupGrid10x10(leftOffset, topOffset, leftFraction, topFraction)
+ {
+ var test = document.getElementById('test');
+ for (var i = 0; i < 10; i++) {
+ if (i == 5)
+ topOffset += 5;
+ var leftOffsetj = leftOffset;
+ for (var j = 0; j < 10; j++) {
+ if (j == 5)
+ leftOffsetj += 5;
+ var container = document.createElement("div");
+ var shifter = document.createElement("div");
+ container.setAttribute('class', 'container');
+ shifter.setAttribute('class', 'shifter');
+ container.style.left = (leftOffsetj + j * 16 + i * leftFraction) + "px"
+ container.style.top = (topOffset + i * 16 + i * topFraction) + "px"
+ shifter.style.left = (5 + j * leftFraction) + "px"
+ shifter.style.top = (5 + j * topFraction) + "px"
+ container.appendChild(shifter);
+ test.appendChild(container);
+ }
+ }
+ }
+
+ function setupGrid8x8(leftOffset, topOffset, leftFraction, topFraction)
+ {
+ var test = document.getElementById('test');
+ for (var i = 0; i < 8; i++) {
+ if (i == 4)
+ topOffset += 5;
+ var leftOffsetj = leftOffset;
+ for (var j = 0; j < 8; j++) {
+ if (j == 4)
+ leftOffsetj += 5;
+ var container = document.createElement("div");
+ var shifter = document.createElement("div");
+ container.setAttribute('class', 'container');
+ shifter.setAttribute('class', 'shifter8x8');
+ container.style.left = (leftOffsetj + j * 20 + i * leftFraction) + "px"
+ container.style.top = (topOffset + i * 20 + i * topFraction) + "px"
+ shifter.style.left = (5 + j * leftFraction) + "px"
+ shifter.style.top = (5 + j * topFraction) + "px"
+ container.appendChild(shifter);
+ test.appendChild(container);
+ }
+ }
+ }
+
+ function setupTest()
+ {
+ // Vertical shifts:
+ setupGrid10x10(10, 10, 0, 0.1)
+ // Horizontal shifts:
+ setupGrid10x10(200, 10, 0.1, 0);
+
+ // And in 8x8 (where exactly 0.5 is more common)
+ setupGrid8x8(10, 200, 0, 0.125);
+ setupGrid8x8(200, 200, 0.125, 0);
+ }
+
+ setupTest();
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (154008 => 154009)
--- trunk/Source/WebCore/ChangeLog 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/ChangeLog 2013-08-13 17:08:19 UTC (rev 154009)
@@ -1,3 +1,51 @@
+2013-08-13 Allan Sandfeld Jensen <[email protected]>
+
+ REGRESSION(SUBPIXEL_LAYOUT) Composited layers can cause one pixel shifts
+ https://bugs.webkit.org/show_bug.cgi?id=115304
+
+ Reviewed by David Hyatt.
+
+ Accelerated layers can cause blocks at subpixel offsets to shift because
+ accumulated subpixel offsets are lost between each layers.
+
+ To solve this layer bounds are now calculated in LayoutUnits, and their
+ subpixel offset saved so it can be used to ensure correct pixel-snapping
+ during painting.
+
+ Test: fast/sub-pixel/sub-pixel-composited-layers.html
+
+ * WebCore.exp.in:
+ * inspector/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::buildObjectForLayer):
+ * platform/graphics/LayoutPoint.h:
+ (WebCore::LayoutPoint::fraction):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setupClipPath):
+ (WebCore::RenderLayer::setupFilters):
+ (WebCore::RenderLayer::paintLayerContents):
+ (WebCore::RenderLayer::calculateLayerBounds):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateCompositedBounds):
+ (WebCore::RenderLayerBacking::updateAfterWidgetResize):
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::resetContentsRect):
+ (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer):
+ (WebCore::RenderLayerBacking::contentsBox):
+ (WebCore::RenderLayerBacking::backgroundBox):
+ (WebCore::RenderLayerBacking::paintIntoLayer):
+ (WebCore::RenderLayerBacking::paintContents):
+ (WebCore::RenderLayerBacking::compositedBounds):
+ (WebCore::RenderLayerBacking::setCompositedBounds):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::logLayerInfo):
+ (WebCore::RenderLayerCompositor::calculateCompositedBounds):
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::operator<<):
+ * rendering/RenderTreeAsText.h:
+
2013-08-13 [email protected] <[email protected]>
[Curl] Possible infinite loop while downloading.
Modified: trunk/Source/WebCore/WebCore.exp.in (154008 => 154009)
--- trunk/Source/WebCore/WebCore.exp.in 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-08-13 17:08:19 UTC (rev 154009)
@@ -1136,6 +1136,7 @@
__ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
__ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
__ZN7WebCore9FloatRectC1ERK6CGRect
+__ZN7WebCore9FloatRectC1ERKNS_10LayoutRectE
__ZN7WebCore9FloatRectC1ERKNS_7IntRectE
__ZN7WebCore9FloatSizeC1ERK6CGSize
__ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE
Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp (154008 => 154009)
--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-08-13 17:08:19 UTC (rev 154009)
@@ -180,7 +180,7 @@
.setNodeId(idForNode(errorString, node))
.setBounds(buildObjectForIntRect(renderer->absoluteBoundingBoxRect()))
.setMemory(backing->backingStoreMemoryEstimate())
- .setCompositedBounds(buildObjectForIntRect(backing->compositedBounds()))
+ .setCompositedBounds(buildObjectForIntRect(enclosingIntRect(backing->compositedBounds())))
.setPaintCount(backing->graphicsLayer()->repaintCount());
if (node && node->shadowHost())
Modified: trunk/Source/WebCore/platform/graphics/LayoutPoint.h (154008 => 154009)
--- trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2013-08-13 17:08:19 UTC (rev 154009)
@@ -81,7 +81,12 @@
{
return LayoutPoint(m_y, m_x);
}
-
+
+ LayoutPoint fraction() const
+ {
+ return LayoutPoint(m_x.fraction(), m_y.fraction());
+ }
+
operator FloatPoint() const { return FloatPoint(m_x, m_y); }
private:
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-08-13 17:08:19 UTC (rev 154009)
@@ -3730,7 +3730,7 @@
return false;
}
-bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, const LayoutPoint& offsetFromRoot, IntRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+bool RenderLayer::setupClipPath(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, const LayoutPoint& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
{
if (!renderer()->hasClipPath() || context->paintingDisabled())
return false;
@@ -3773,7 +3773,7 @@
}
#if ENABLE(CSS_FILTERS)
-PassOwnPtr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext* context, LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& offsetFromRoot, IntRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
+PassOwnPtr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext* context, LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
{
if (context->paintingDisabled())
return nullptr;
@@ -3864,7 +3864,7 @@
LayoutPoint offsetFromRoot;
convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
- IntRect rootRelativeBounds;
+ LayoutRect rootRelativeBounds;
bool rootRelativeBoundsComputed = false;
// FIXME: We shouldn't have to disable subpixel quantization for overflow clips or subframes once we scroll those
@@ -5381,14 +5381,14 @@
return pixelSnappedIntRect(boundingBox(root()));
}
-IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
+LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
{
if (!isSelfPaintingLayer())
- return IntRect();
+ return LayoutRect();
// FIXME: This could be improved to do a check like hasVisibleNonCompositingDescendantLayers() (bug 92580).
if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant())
- return IntRect();
+ return LayoutRect();
RenderLayerModelObject* renderer = this->renderer();
@@ -5428,7 +5428,7 @@
LayoutPoint ancestorRelOffset;
convertToLayerCoords(ancestorLayer, ancestorRelOffset);
localClipRect.moveBy(ancestorRelOffset);
- return pixelSnappedIntRect(localClipRect);
+ return localClipRect;
}
}
@@ -5439,7 +5439,7 @@
if (RenderLayer* reflection = reflectionLayer()) {
if (!reflection->isComposited()) {
- IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
+ LayoutRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
unionBounds.unite(childUnionBounds);
}
}
@@ -5455,7 +5455,7 @@
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = negZOrderList->at(i);
if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
- IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
+ LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
unionBounds.unite(childUnionBounds);
}
}
@@ -5466,7 +5466,7 @@
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = posZOrderList->at(i);
if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
- IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
+ LayoutRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
unionBounds.unite(childUnionBounds);
}
}
@@ -5480,7 +5480,7 @@
// so there's no way we could hit a RenderNamedFlowThread here.
ASSERT(!curLayer->isOutOfFlowRenderFlowThread());
if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) {
- IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
+ LayoutRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
unionBounds.unite(curAbsBounds);
}
}
@@ -5507,7 +5507,7 @@
convertToLayerCoords(ancestorLayer, ancestorRelOffset);
unionBounds.moveBy(ancestorRelOffset);
- return pixelSnappedIntRect(unionBounds);
+ return unionBounds;
}
void RenderLayer::clearClipRectsIncludingDescendants(ClipRectsType typeToClear)
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2013-08-13 17:08:19 UTC (rev 154009)
@@ -705,7 +705,7 @@
#endif
// Can pass offsetFromRoot if known.
- IntRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
+ LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
// WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects.
LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const;
@@ -940,9 +940,9 @@
};
bool setupFontSubpixelQuantization(GraphicsContext*, bool& didQuantizeFonts);
- bool setupClipPath(GraphicsContext*, const LayerPaintingInfo&, const LayoutPoint& offsetFromRoot, IntRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
+ bool setupClipPath(GraphicsContext*, const LayerPaintingInfo&, const LayoutPoint& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
#if ENABLE(CSS_FILTERS)
- PassOwnPtr<FilterEffectRendererHelper> setupFilters(GraphicsContext*, LayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot, IntRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
+ PassOwnPtr<FilterEffectRendererHelper> setupFilters(GraphicsContext*, LayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
GraphicsContext* applyFilters(FilterEffectRendererHelper*, GraphicsContext* originalContext, LayerPaintingInfo&, LayerFragments&);
#endif
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-08-13 17:08:19 UTC (rev 154009)
@@ -425,7 +425,7 @@
void RenderLayerBacking::updateCompositedBounds()
{
- IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
+ LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
// Clip to the size of the document or enclosing overflow-scroll layer.
// If this or an ancestor is transformed, we can't currently compute the correct rect to intersect with.
@@ -447,7 +447,7 @@
m_owningLayer->convertToLayerCoords(rootLayer, delta);
clippingBounds.move(-delta.x(), -delta.y());
- layerBounds.intersect(pixelSnappedIntRect(clippingBounds));
+ layerBounds.intersect(clippingBounds);
m_boundsConstrainedByClipping = true;
} else
m_boundsConstrainedByClipping = false;
@@ -470,7 +470,7 @@
if (renderer()->isRenderPart()) {
if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::frameContentsCompositor(toRenderPart(renderer()))) {
innerCompositor->frameViewDidChangeSize();
- innerCompositor->frameViewDidChangeLocation(contentsBox().location());
+ innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contentsBox().location()));
}
}
}
@@ -647,11 +647,16 @@
ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()->compositedBounds());
}
- IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
+ LayoutRect localRawCompositingBounds = compositedBounds();
+ LayoutPoint rawDelta;
+ m_owningLayer->convertToLayerCoords(compAncestor, rawDelta);
+ IntPoint delta = flooredIntPoint(rawDelta);
+ m_subpixelAccumulation = toLayoutSize(rawDelta.fraction());
+ // 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);
- IntPoint delta;
- m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
relativeCompositingBounds.moveBy(delta);
IntPoint graphicsLayerParentLocation;
@@ -701,7 +706,7 @@
m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
-
+
FloatSize oldSize = m_graphicsLayer->size();
if (oldSize != contentsSize) {
m_graphicsLayer->setSize(contentsSize);
@@ -739,7 +744,7 @@
const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
// Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- IntRect layerBounds = IntRect(delta, borderBox.size());
+ IntRect layerBounds(delta, borderBox.size());
// Update properties that depend on layer dimensions
FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
@@ -953,7 +958,7 @@
void RenderLayerBacking::resetContentsRect()
{
- IntRect rect = contentsBox();
+ IntRect rect = pixelSnappedIntRect(contentsBox());
m_graphicsLayer->setContentsRect(rect);
m_graphicsLayer->setContentsTileSize(IntSize());
m_graphicsLayer->setContentsTilePhase(IntPoint());
@@ -1757,7 +1762,7 @@
return;
// This is a no-op if the layer doesn't have an inner layer for the image.
- m_graphicsLayer->setContentsRect(contentsBox());
+ m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
m_graphicsLayer->setContentsToImage(image);
bool isSimpleContainer = false;
updateDrawsContent(isSimpleContainer);
@@ -1795,24 +1800,24 @@
}
// Return the offset from the top-left of this compositing layer at which the renderer's contents are painted.
-IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const
+LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const
{
- return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y());
+ return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y());
}
-IntRect RenderLayerBacking::contentsBox() const
+LayoutRect RenderLayerBacking::contentsBox() const
{
if (!renderer()->isBox())
- return IntRect();
+ return LayoutRect();
- IntRect contentsRect;
+ LayoutRect contentsRect;
#if ENABLE(VIDEO)
if (renderer()->isVideo()) {
RenderVideo* videoRenderer = toRenderVideo(renderer());
contentsRect = videoRenderer->videoBox();
} else
#endif
- contentsRect = pixelSnappedIntRect(toRenderBox(renderer())->contentBoxRect());
+ contentsRect = toRenderBox(renderer())->contentBoxRect();
contentsRect.move(contentOffsetInCompostingLayer());
return contentsRect;
@@ -1840,9 +1845,9 @@
if (!renderer()->isBox())
return IntRect();
- IntRect pixelSnappedBackgroundBox = pixelSnappedIntRect(backgroundRectForBox(toRenderBox(renderer())));
- pixelSnappedBackgroundBox.move(contentOffsetInCompostingLayer());
- return pixelSnappedBackgroundBox;
+ LayoutRect backgroundBox = backgroundRectForBox(toRenderBox(renderer()));
+ backgroundBox.move(contentOffsetInCompostingLayer());
+ return pixelSnappedIntRect(backgroundBox);
}
GraphicsLayer* RenderLayerBacking::parentForSublayers() const
@@ -1988,7 +1993,7 @@
paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
// FIXME: GraphicsLayers need a way to split for RenderRegions.
- RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, paintBehavior, LayoutSize());
+ RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, paintBehavior, m_subpixelAccumulation);
m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags);
if (m_owningLayer->containsDirtyOverlayScrollbars())
@@ -2031,7 +2036,7 @@
// The dirtyRect is in the coords of the painting root.
IntRect dirtyRect = clip;
if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
- dirtyRect.intersect(compositedBounds());
+ dirtyRect.intersect(enclosingIntRect(compositedBounds()));
// We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase);
@@ -2264,12 +2269,12 @@
m_graphicsLayer->resumeAnimations();
}
-IntRect RenderLayerBacking::compositedBounds() const
+LayoutRect RenderLayerBacking::compositedBounds() const
{
return m_compositedBounds;
}
-void RenderLayerBacking::setCompositedBounds(const IntRect& bounds)
+void RenderLayerBacking::setCompositedBounds(const LayoutRect& bounds)
{
m_compositedBounds = bounds;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2013-08-13 17:08:19 UTC (rev 154009)
@@ -141,8 +141,8 @@
void suspendAnimations(double time = 0);
void resumeAnimations();
- IntRect compositedBounds() const;
- void setCompositedBounds(const IntRect&);
+ LayoutRect compositedBounds() const;
+ void setCompositedBounds(const LayoutRect&);
void updateCompositedBounds();
void updateAfterWidgetResize();
@@ -175,7 +175,7 @@
virtual void verifyNotPainting();
#endif
- IntRect contentsBox() const;
+ LayoutRect contentsBox() const;
IntRect backgroundBox() const;
// For informative purposes only.
@@ -229,7 +229,7 @@
GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
- IntSize contentOffsetInCompostingLayer() const;
+ LayoutSize contentOffsetInCompostingLayer() const;
// Result is transform origin in pixels.
FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
// Result is perspective origin in pixels.
@@ -297,7 +297,8 @@
uint64_t m_scrollLayerID;
- IntRect m_compositedBounds;
+ LayoutRect m_compositedBounds;
+ LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of the compositedBounds compared to absolute coordinates.
bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
bool m_boundsConstrainedByClipping;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-08-13 17:08:19 UTC (rev 154009)
@@ -654,7 +654,7 @@
StringBuilder logString;
logString.append(String::format("%*p %dx%d %.2fKB", 12 + depth * 2, layer,
- backing->compositedBounds().width(), backing->compositedBounds().height(),
+ backing->compositedBounds().width().round(), backing->compositedBounds().height().round(),
backing->backingStoreMemoryEstimate() / 1024));
logString.append(" (");
@@ -830,10 +830,10 @@
// The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant
// RenderLayers that are rendered by the composited RenderLayer.
-IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) const
+LayoutRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) const
{
if (!canBeComposited(layer))
- return IntRect();
+ return LayoutRect();
return layer->calculateLayerBounds(ancestorLayer, 0, RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask);
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2013-08-13 17:08:19 UTC (rev 154009)
@@ -163,7 +163,7 @@
// Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
// If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
- IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer) const;
+ LayoutRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer) const;
// Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
void repaintOnCompositingChange(RenderLayer*);
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2013-08-13 17:08:19 UTC (rev 154009)
@@ -88,9 +88,15 @@
return ts << "(" << p.x() << "," << p.y() << ")";
}
+TextStream& operator<<(TextStream& ts, const LayoutRect& r)
+{
+ // FIXME: These should be printed as floats. Keeping them ints for consistency with previous test expectations.
+ return ts << pixelSnappedIntRect(r);
+}
+
TextStream& operator<<(TextStream& ts, const LayoutPoint& p)
{
- // FIXME: These should be printed as floats. Keeping them ints for consistency with pervious test expectations.
+ // FIXME: These should be printed as floats. Keeping them ints for consistency with previous test expectations.
return ts << "(" << p.x().toInt() << "," << p.y().toInt() << ")";
}
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.h (154008 => 154009)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.h 2013-08-13 16:58:17 UTC (rev 154008)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.h 2013-08-13 17:08:19 UTC (rev 154009)
@@ -38,6 +38,7 @@
class IntPoint;
class IntRect;
class LayoutPoint;
+class LayoutRect;
class RenderObject;
class TextStream;
@@ -71,6 +72,7 @@
TextStream& operator<<(TextStream&, const IntPoint&);
TextStream& operator<<(TextStream&, const IntRect&);
TextStream& operator<<(TextStream&, const LayoutPoint&);
+TextStream& operator<<(TextStream&, const LayoutRect&);
TextStream& operator<<(TextStream&, const FloatPoint&);
TextStream& operator<<(TextStream&, const FloatSize&);