Changeset 165341 in webkit
- Timestamp:
- Mar 8, 2014, 4:14:00 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r165340 r165341 1 2014-03-08 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Simple compositing container layer (isSimpleContainerCompositingLayer) paints to wrong position. 4 https://bugs.webkit.org/show_bug.cgi?id=129861 5 6 Reviewed by Simon Fraser. 7 8 This patch ensures that both the simple and non-simple cases paint to the same position. 9 Simple compositing container layer codepath needs to take the fractional device pixel offset 10 into account when painting. Without the fractional value, the final paint rounding could push the 11 paint offset to a different position. 12 retina example: 13 compositing top-left: 0px 0px. 14 fractional offset: 0.3px 0.3px 15 painting coords without offseting: 0px 0px 16 with offseting: 0.5px 0.5px 17 18 * compositing/hidpi-simple-container-layer-on-device-pixel-expected.html: Added. 19 * compositing/hidpi-simple-container-layer-on-device-pixel.html: Added. 20 1 21 2014-03-08 Martin Robinson <mrobinson@igalia.com> 2 22 -
trunk/Source/WebCore/ChangeLog
r165339 r165341 1 2014-03-08 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Simple compositing container layer (isSimpleContainerCompositingLayer) paints to wrong position. 4 https://bugs.webkit.org/show_bug.cgi?id=129861 5 6 Reviewed by Simon Fraser. 7 8 This patch ensures that both the simple and non-simple cases paint to the same position. 9 Simple compositing container layer codepath needs to take the fractional device pixel offset 10 into account when painting. Without the fractional value, the final paint rounding could push the 11 paint offset to a different position. 12 retina example: 13 compositing top-left: 0px 0px. 14 fractional offset: 0.3px 0.3px 15 painting coords without offseting: 0px 0px 16 with offseting: 0.5px 0.5px 17 18 Tests: compositing/hidpi-simple-container-layer-on-device-pixel.html 19 20 * WebCore.exp.in: 21 * platform/graphics/GraphicsLayer.h: 22 (WebCore::GraphicsLayer::contentsRect): 23 (WebCore::GraphicsLayer::setContentsRect): 24 (WebCore::GraphicsLayer::contentsClippingRect): 25 (WebCore::GraphicsLayer::setContentsClippingRect): 26 * platform/graphics/ca/GraphicsLayerCA.cpp: 27 (WebCore::GraphicsLayerCA::setContentsRect): 28 (WebCore::GraphicsLayerCA::setContentsClippingRect): 29 (WebCore::GraphicsLayerCA::updateContentsRects): 30 * platform/graphics/ca/GraphicsLayerCA.h: 31 * rendering/RenderLayerBacking.cpp: 32 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): 33 (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor): 34 (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): 35 (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer): 36 (WebCore::RenderLayerBacking::backgroundBoxForPainting): 37 * rendering/RenderLayerBacking.h: 38 1 39 2014-03-08 Oliver Hunt <oliver@apple.com> 2 40 -
trunk/Source/WebCore/WebCore.exp.in
r165327 r165341 537 537 __ZN7WebCore15GraphicsLayerCA15removeAnimationERKN3WTF6StringE 538 538 __ZN7WebCore15GraphicsLayerCA15setBoundsOriginERKNS_10FloatPointE 539 __ZN7WebCore15GraphicsLayerCA15setContentsRectERKNS_ 7IntRectE539 __ZN7WebCore15GraphicsLayerCA15setContentsRectERKNS_9FloatRectE 540 540 __ZN7WebCore15GraphicsLayerCA15setDrawsContentEb 541 541 __ZN7WebCore15GraphicsLayerCA15setNeedsDisplayEv … … 563 563 __ZN7WebCore15GraphicsLayerCA21setNeedsDisplayInRectERKNS_9FloatRectENS_13GraphicsLayer17ShouldClipToLayerE 564 564 __ZN7WebCore15GraphicsLayerCA21setShowRepaintCounterEb 565 __ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_ 7IntRectE565 __ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_9FloatRectE 566 566 __ZN7WebCore15GraphicsLayerCA23setContentsNeedsDisplayEv 567 567 __ZN7WebCore15GraphicsLayerCA23setContentsToSolidColorERKNS_5ColorE -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r164415 r165341 31 31 #include "FloatPoint.h" 32 32 #include "FloatPoint3D.h" 33 #include "FloatRect.h" 33 34 #include "FloatSize.h" 34 35 #include "GraphicsLayerClient.h" … … 60 61 namespace WebCore { 61 62 62 class FloatRect;63 63 class GraphicsContext; 64 64 class GraphicsLayerFactory; … … 377 377 378 378 // Set that the position/size of the contents (image or video). 379 IntRect contentsRect() const { return m_contentsRect; }380 virtual void setContentsRect(const IntRect& r) { m_contentsRect = r; }381 382 IntRect contentsClippingRect() const { return m_contentsClippingRect; }383 virtual void setContentsClippingRect(const IntRect& r) { m_contentsClippingRect = r; }379 FloatRect contentsRect() const { return m_contentsRect; } 380 virtual void setContentsRect(const FloatRect& r) { m_contentsRect = r; } 381 382 FloatRect contentsClippingRect() const { return m_contentsClippingRect; } 383 virtual void setContentsClippingRect(const FloatRect& r) { m_contentsClippingRect = r; } 384 384 385 385 // Transitions are identified by a special animation name that cannot clash with a keyframe identifier. … … 605 605 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position of the replica. 606 606 607 IntRect m_contentsRect;608 IntRect m_contentsClippingRect;607 FloatRect m_contentsRect; 608 FloatRect m_contentsClippingRect; 609 609 IntPoint m_contentsTilePhase; 610 610 IntSize m_contentsTileSize; -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r164412 r165341 765 765 } 766 766 767 void GraphicsLayerCA::setContentsRect(const IntRect& rect)767 void GraphicsLayerCA::setContentsRect(const FloatRect& rect) 768 768 { 769 769 if (rect == m_contentsRect) … … 774 774 } 775 775 776 void GraphicsLayerCA::setContentsClippingRect(const IntRect& rect)776 void GraphicsLayerCA::setContentsClippingRect(const FloatRect& rect) 777 777 { 778 778 if (rect == m_contentsClippingRect) … … 2039 2039 clippingBounds.setSize(m_contentsClippingRect.size()); 2040 2040 2041 contentOrigin = toLayoutPoint(m_contentsRect.location() - m_contentsClippingRect.location());2041 contentOrigin = FloatPoint(m_contentsRect.location() - m_contentsClippingRect.location()); 2042 2042 2043 2043 m_contentsClippingLayer->setPosition(clippingOrigin); -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r164412 r165341 112 112 virtual void setContentsNeedsDisplay(); 113 113 114 virtual void setContentsRect(const IntRect&);115 virtual void setContentsClippingRect(const IntRect&) override;114 virtual void setContentsRect(const FloatRect&) override; 115 virtual void setContentsClippingRect(const FloatRect&) override; 116 116 117 117 virtual void suspendAnimations(double time); -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
r161570 r165341 329 329 /* \reimp (GraphicsLayer.h) 330 330 */ 331 void GraphicsLayerTextureMapper::setContentsRect(const IntRect& value)331 void GraphicsLayerTextureMapper::setContentsRect(const FloatRect& value) 332 332 { 333 333 if (value == contentsRect()) -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
r162139 r165341 64 64 virtual void setBackfaceVisibility(bool b); 65 65 virtual void setOpacity(float opacity); 66 virtual void setContentsRect(const IntRect& r);66 virtual void setContentsRect(const FloatRect&); 67 67 virtual void setReplicatedByLayer(GraphicsLayer*); 68 68 virtual void setContentsToImage(Image*); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
r163079 r165341 566 566 } 567 567 568 void TextureMapperLayer::setContentsRect(const IntRect& contentsRect)568 void TextureMapperLayer::setContentsRect(const FloatRect& contentsRect) 569 569 { 570 570 if (contentsRect == m_state.contentsRect) -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
r163079 r165341 87 87 void setTransform(const TransformationMatrix&); 88 88 void setChildrenTransform(const TransformationMatrix&); 89 void setContentsRect(const IntRect&);89 void setContentsRect(const FloatRect&); 90 90 void setMasksToBounds(bool); 91 91 void setDrawsContent(bool); -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
r161570 r165341 335 335 } 336 336 337 void CoordinatedGraphicsLayer::setContentsRect(const IntRect& r)337 void CoordinatedGraphicsLayer::setContentsRect(const FloatRect& r) 338 338 { 339 339 if (contentsRect() == r) … … 823 823 { 824 824 ASSERT(m_coordinatedImageBacking); 825 return tiledBackingStoreVisibleRect().intersects( contentsRect());825 return tiledBackingStoreVisibleRect().intersects(IntRect(contentsRect())); 826 826 } 827 827 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
r162139 r165341 85 85 virtual void setBackfaceVisibility(bool) override; 86 86 virtual void setOpacity(float) override; 87 virtual void setContentsRect(const IntRect&) override;87 virtual void setContentsRect(const FloatRect&) override; 88 88 virtual void setContentsTilePhase(const IntPoint&) override; 89 89 virtual void setContentsTileSize(const IntSize&) override; -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h
r162644 r165341 142 142 TransformationMatrix transform; 143 143 TransformationMatrix childrenTransform; 144 IntRect contentsRect;144 FloatRect contentsRect; 145 145 IntPoint contentsTilePhase; 146 146 IntSize contentsTileSize; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r165190 r165341 1557 1557 // An unset (invalid) color will remove the solid color. 1558 1558 m_graphicsLayer->setContentsToSolidColor(backgroundColor); 1559 IntRect contentsRect = backgroundBox();1559 FloatRect contentsRect = backgroundBoxForPainting(); 1560 1560 m_graphicsLayer->setContentsRect(contentsRect); 1561 1561 m_graphicsLayer->setContentsClippingRect(contentsRect); … … 1610 1610 } 1611 1611 1612 IntRect destRect = backgroundBox();1612 IntRect destRect = pixelSnappedIntRect(LayoutRect(backgroundBoxForPainting())); 1613 1613 IntPoint phase; 1614 1614 IntSize tileSize; … … 1946 1946 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const 1947 1947 { 1948 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()) ;1948 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()) + m_devicePixelFractionFromRenderer; 1949 1949 } 1950 1950 … … 1988 1988 } 1989 1989 1990 IntRect RenderLayerBacking::backgroundBox() const1990 FloatRect RenderLayerBacking::backgroundBoxForPainting() const 1991 1991 { 1992 1992 if (!renderer().isBox()) 1993 return IntRect();1993 return FloatRect(); 1994 1994 1995 1995 LayoutRect backgroundBox = backgroundRectForBox(toRenderBox(renderer())); 1996 1996 backgroundBox.move(contentOffsetInCompostingLayer()); 1997 return pixelSnapped IntRect(backgroundBox);1997 return pixelSnappedForPainting(backgroundBox, deviceScaleFactor()); 1998 1998 } 1999 1999 -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r164759 r165341 195 195 196 196 LayoutRect contentsBox() const; 197 IntRect backgroundBox() const;198 197 199 198 // For informative purposes only. … … 216 215 217 216 private: 217 FloatRect backgroundBoxForPainting() const; 218 218 219 void createPrimaryGraphicsLayer(); 219 220 void destroyGraphicsLayers();
Note:
See TracChangeset
for help on using the changeset viewer.