- Revision
- 169161
- Author
- [email protected]
- Date
- 2014-05-21 09:06:55 -0700 (Wed, 21 May 2014)
Log Message
Garbage when rubber-banding at the right edge of a page zoomed to non-integral scale.
https://bugs.webkit.org/show_bug.cgi?id=133139
<rdar://problem/16503353>
Reviewed by Simon Fraser.
Do not pixel align the root content layer. The alignment code expands the graphics's layer size
which makes the right and bottom tiles bigger than the content.
Painting the body's background color produces pixel cracks, because the content can not
fill the expanded tiles completely.
Not testable.
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::needsPixelAligment):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateGeometry):
(WebCore::GraphicsLayerCA::computePixelAlignment):
* platform/graphics/ca/mac/TileGrid.mm:
(WebCore::TileGrid::rectForTileIndex):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::needsPixelAligment):
* rendering/RenderLayerBacking.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (169160 => 169161)
--- trunk/Source/WebCore/ChangeLog 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/ChangeLog 2014-05-21 16:06:55 UTC (rev 169161)
@@ -1,3 +1,29 @@
+2014-05-21 Zalan Bujtas <[email protected]>
+
+ Garbage when rubber-banding at the right edge of a page zoomed to non-integral scale.
+ https://bugs.webkit.org/show_bug.cgi?id=133139
+ <rdar://problem/16503353>
+
+ Reviewed by Simon Fraser.
+
+ Do not pixel align the root content layer. The alignment code expands the graphics's layer size
+ which makes the right and bottom tiles bigger than the content.
+ Painting the body's background color produces pixel cracks, because the content can not
+ fill the expanded tiles completely.
+
+ Not testable.
+
+ * platform/graphics/GraphicsLayerClient.h:
+ (WebCore::GraphicsLayerClient::needsPixelAligment):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateGeometry):
+ (WebCore::GraphicsLayerCA::computePixelAlignment):
+ * platform/graphics/ca/mac/TileGrid.mm:
+ (WebCore::TileGrid::rectForTileIndex):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::needsPixelAligment):
+ * rendering/RenderLayerBacking.h:
+
2014-05-21 Radu Stavila <[email protected]>
REGRESSION (r168046): Invalid layout in WebCore::RenderBox::containingBlockLogicalWidthForPositioned
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (169160 => 169161)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2014-05-21 16:06:55 UTC (rev 169161)
@@ -99,6 +99,8 @@
virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const { return false; }
virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const { return true; }
+ virtual bool needsPixelAligment() const { return false; }
+
#ifndef NDEBUG
// RenderLayerBacking overrides this to verify that it is not
// currently painting contents. An ASSERT fails, if it is.
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (169160 => 169161)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-05-21 16:06:55 UTC (rev 169161)
@@ -1529,12 +1529,15 @@
void GraphicsLayerCA::updateGeometry(float pageScaleFactor, const FloatPoint& positionRelativeToBase)
{
- FloatPoint scaledPosition;
- FloatPoint3D scaledAnchorPoint;
- FloatSize scaledSize;
+ FloatPoint scaledPosition = m_position;
+ FloatPoint3D scaledAnchorPoint = m_anchorPoint;
+ FloatSize scaledSize = m_size;
FloatSize pixelAlignmentOffset;
- computePixelAlignment(pageScaleFactor * deviceScaleFactor(), positionRelativeToBase, scaledPosition, scaledSize, scaledAnchorPoint, pixelAlignmentOffset);
+ // FIXME: figure out if we really need to pixel align the graphics layer here.
+ if (m_client.needsPixelAligment() && !isIntegral(pageScaleFactor) && m_drawsContent && !m_masksToBounds)
+ computePixelAlignment(pageScaleFactor, positionRelativeToBase, scaledPosition, scaledSize, scaledAnchorPoint, pixelAlignmentOffset);
+
FloatRect adjustedBounds(m_boundsOrigin - pixelAlignmentOffset, scaledSize);
// Update position.
@@ -3433,14 +3436,6 @@
void GraphicsLayerCA::computePixelAlignment(float contentsScale, const FloatPoint& positionRelativeToBase,
FloatPoint& position, FloatSize& size, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const
{
- if (isIntegral(contentsScale) || !m_drawsContent || m_masksToBounds) {
- position = m_position;
- size = m_size;
- anchorPoint = m_anchorPoint;
- alignmentOffset = FloatSize();
- return;
- }
-
FloatRect baseRelativeBounds(positionRelativeToBase, m_size);
FloatRect scaledBounds = baseRelativeBounds;
// Scale by the page scale factor to compute the screen-relative bounds.
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm (169160 => 169161)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm 2014-05-21 16:06:55 UTC (rev 169161)
@@ -215,6 +215,9 @@
IntRect TileGrid::rectForTileIndex(const TileIndex& tileIndex) const
{
+ // FIXME: calculating the scaled size here should match with the rest of calculated sizes where we use the combination of
+ // enclosingIntRect, expandedIntSize (floor vs ceil).
+ // However enclosing this size could reveal gap on root layer's background. see RenderView::backgroundRect()
IntSize tileSize = m_controller.tileSize();
IntRect rect(tileIndex.x() * tileSize.width(), tileIndex.y() * tileSize.height(), tileSize.width(), tileSize.height());
IntRect scaledBounds(m_controller.bounds());
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (169160 => 169161)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-05-21 16:06:55 UTC (rev 169161)
@@ -120,9 +120,7 @@
Page* page = renderer().frame().page();
if (layer.isRootLayer() && page) {
- if (renderer().frame().isMainFrame())
- m_isMainFrameRenderViewLayer = true;
-
+ m_isMainFrameRenderViewLayer = renderer().frame().isMainFrame();
m_usingTiledCacheLayer = page->chrome().client().shouldUseTiledBackingForFrameView(renderer().frame().view());
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (169160 => 169161)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-05-21 15:31:20 UTC (rev 169160)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-05-21 16:06:55 UTC (rev 169161)
@@ -53,7 +53,7 @@
//
// There is one RenderLayerBacking for each RenderLayer that is composited.
-class RenderLayerBacking : public GraphicsLayerClient {
+class RenderLayerBacking final : public GraphicsLayerClient {
WTF_MAKE_NONCOPYABLE(RenderLayerBacking); WTF_MAKE_FAST_ALLOCATED;
public:
explicit RenderLayerBacking(RenderLayer&);
@@ -195,6 +195,7 @@
virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const override;
virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const override;
+ virtual bool needsPixelAligment() const override { return !m_isMainFrameRenderViewLayer; }
#ifndef NDEBUG
virtual void verifyNotPainting();