Changeset 204552 in webkit
- Timestamp:
- Aug 16, 2016 8:18:21 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r204551 r204552 1 2016-08-16 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Cleanup RenderLayerBacking::updateGeometry. 4 https://bugs.webkit.org/show_bug.cgi?id=156860 5 <rdar://problem/25432352> 6 7 Reviewed by Simon Fraser. 8 9 * compositing/hidpi-ancestor-subpixel-clipping-expected.html: Added. 10 * compositing/hidpi-ancestor-subpixel-clipping.html: Added. 11 * compositing/hidpi-sibling-composited-content-offset-expected.html: Added. 12 * compositing/hidpi-sibling-composited-content-offset.html: Added. 13 * compositing/hidpi-subpixel-transform-origin-expected.html: Added. 14 * compositing/hidpi-subpixel-transform-origin.html: Added. 15 * fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt: Added. 16 * fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html: Added. 17 1 18 2016-08-16 Commit Queue <commit-queue@webkit.org> 2 19 -
trunk/Source/WebCore/ChangeLog
r204551 r204552 1 2016-08-16 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Cleanup RenderLayerBacking::updateGeometry. 4 https://bugs.webkit.org/show_bug.cgi?id=156860 5 <rdar://problem/25432352> 6 7 Reviewed by Simon Fraser. 8 9 This patch cleans up the subpixel adjustment computation for the graphics layers 10 in RenderLayerBacking::updateGeometry. 11 It also fixes subpixel jiggling with clipping layers (both ancestor and child containment layers). 12 13 Tests: compositing/hidpi-ancestor-subpixel-clipping.html 14 compositing/hidpi-sibling-composited-content-offset.html 15 compositing/hidpi-subpixel-transform-origin.html 16 fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html 17 18 * rendering/RenderLayer.cpp: 19 (WebCore::RenderLayer::beginTransparencyLayers): 20 (WebCore::RenderLayer::paint): 21 (WebCore::RenderLayer::clipToRect): 22 (WebCore::RenderLayer::setupClipPath): 23 (WebCore::RenderLayer::paintLayerByApplyingTransform): 24 (WebCore::RenderLayer::paintBackgroundForFragments): 25 (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): 26 (WebCore::RenderLayer::paintOutlineForFragments): 27 (WebCore::RenderLayer::paintMaskForFragments): 28 (WebCore::RenderLayer::paintChildClippingMaskForFragments): 29 (WebCore::RenderLayer::paintOverflowControlsForFragments): 30 (WebCore::RenderLayer::calculateClipRects): 31 * rendering/RenderLayer.h: 32 * rendering/RenderLayerBacking.cpp: 33 (WebCore::subpixelOffsetFromRendererChanged): 34 (WebCore::subpixelForLayerPainting): 35 (WebCore::computeOffsetFromRenderer): 36 (WebCore::snappedGraphicsLayerRect): 37 (WebCore::computeOffsetFromAncestorGraphicsLayer): 38 (WebCore::ComputedOffsets::ComputedOffsets): This is a helper class to hold offset values. 39 (WebCore::ComputedOffsets::fromAncestorGraphicsLayer): 40 (WebCore::ComputedOffsets::fromParentGraphicsLayer): 41 (WebCore::ComputedOffsets::fromPrimaryGraphicsLayer): 42 (WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect): 43 (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect): 44 (WebCore::RenderLayerBacking::updateGeometry): 45 (WebCore::RenderLayerBacking::updateMaskingLayerGeometry): 46 (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer): 47 (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): 48 (WebCore::RenderLayerBacking::paintIntoLayer): 49 (WebCore::RenderLayerBacking::paintContents): 50 (WebCore::devicePixelFractionGapFromRendererChanged): Deleted. 51 (WebCore::pixelFractionForLayerPainting): Deleted. 52 (WebCore::calculateDevicePixelOffsetFromRenderer): Deleted. 53 (WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread): Deleted. 54 * rendering/RenderLayerBacking.h: 55 1 56 2016-08-16 Commit Queue <commit-queue@webkit.org> 2 57 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r204543 r204552 1812 1812 context.save(); 1813 1813 LayoutRect adjustedClipRect = paintingExtent(*this, paintingInfo.rootLayer, dirtyRect, paintingInfo.paintBehavior); 1814 adjustedClipRect.move(paintingInfo.subpixel Accumulation);1814 adjustedClipRect.move(paintingInfo.subpixelOffset); 1815 1815 FloatRect pixelSnappedClipRect = snapRectToDevicePixels(adjustedClipRect, renderer().document().deviceScaleFactor()); 1816 1816 context.clip(pixelSnappedClipRect); … … 3809 3809 } 3810 3810 3811 void RenderLayer::paint(GraphicsContext& context, const LayoutRect& damageRect, const LayoutSize& subpixel Accumulation, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags)3811 void RenderLayer::paint(GraphicsContext& context, const LayoutRect& damageRect, const LayoutSize& subpixelOffset, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, PaintLayerFlags paintFlags) 3812 3812 { 3813 3813 OverlapTestRequestMap overlapTestRequests; 3814 3814 3815 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, subpixel Accumulation, subtreePaintRoot, &overlapTestRequests);3815 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, subpixelOffset, subtreePaintRoot, &overlapTestRequests); 3816 3816 paintLayer(context, paintingInfo, paintFlags); 3817 3817 … … 3852 3852 if (needsClipping) { 3853 3853 LayoutRect adjustedClipRect = clipRect.rect(); 3854 adjustedClipRect.move(paintingInfo.subpixel Accumulation);3854 adjustedClipRect.move(paintingInfo.subpixelOffset); 3855 3855 context.clip(snapRectToDevicePixels(adjustedClipRect, deviceScaleFactor)); 3856 3856 } … … 3863 3863 if (layer->renderer().hasOverflowClip() && layer->renderer().style().hasBorderRadius() && inContainingBlockChain(this, layer)) { 3864 3864 LayoutRect adjustedClipRect = LayoutRect(toLayoutPoint(layer->offsetFromAncestor(paintingInfo.rootLayer, AdjustForColumns)), layer->size()); 3865 adjustedClipRect.move(paintingInfo.subpixel Accumulation);3865 adjustedClipRect.move(paintingInfo.subpixelOffset); 3866 3866 FloatRoundedRect roundedRect = layer->renderer().style().getRoundedInnerBorderFor(adjustedClipRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor); 3867 3867 if (roundedRect.intersectionIsRectangular(paintingInfo.paintDirtyRect)) … … 4135 4135 if (is<ShapeClipPathOperation>(*style.clipPath()) || (is<BoxClipPathOperation>(*style.clipPath()) && is<RenderBox>(renderer()))) { 4136 4136 WindRule windRule; 4137 LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixel Accumulation, LayoutPoint(), renderer().document().deviceScaleFactor()));4137 LayoutSize paintingOffsetFromRoot = LayoutSize(snapSizeToDevicePixel(offsetFromRoot + paintingInfo.subpixelOffset, LayoutPoint(), renderer().document().deviceScaleFactor())); 4138 4138 Path path = computeClipPath(paintingOffsetFromRoot, rootRelativeBounds, windRule); 4139 4139 context.save(); … … 4451 4451 TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavior)); 4452 4452 // Add the subpixel accumulation to the current layer's offset so that we can always snap the translateRight value to where the renderer() is supposed to be painting. 4453 LayoutSize offsetForThisLayer = offsetFromParent + paintingInfo.subpixel Accumulation;4453 LayoutSize offsetForThisLayer = offsetFromParent + paintingInfo.subpixelOffset; 4454 4454 FloatSize devicePixelSnappedOffsetForThisLayer = toFloatSize(roundPointToDevicePixels(toLayoutPoint(offsetForThisLayer), deviceScaleFactor)); 4455 4455 // We handle accumulated subpixels through nested layers here. Since the context gets translated to device pixels, … … 4462 4462 4463 4463 // Now do a paint with the root layer shifted to be us. 4464 LayoutSize adjustedSubpixel Accumulation= offsetForThisLayer - LayoutSize(devicePixelSnappedOffsetForThisLayer);4464 LayoutSize adjustedSubpixelOffset = offsetForThisLayer - LayoutSize(devicePixelSnappedOffsetForThisLayer); 4465 4465 LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(encloseRectToDevicePixels(transform.inverse().valueOr(AffineTransform()).mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)), 4466 paintingInfo.paintBehavior, adjustedSubpixel Accumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);4466 paintingInfo.paintBehavior, adjustedSubpixelOffset, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests); 4467 4467 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags); 4468 4468 context.setCTM(oldTransfrom); … … 4706 4706 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4707 4707 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4708 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation));4708 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)); 4709 4709 4710 4710 if (localPaintingInfo.clipToDirtyRect) … … 4773 4773 if (phase == PaintPhaseForeground) 4774 4774 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests; 4775 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation));4775 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)); 4776 4776 4777 4777 if (shouldClip) … … 4790 4790 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4791 4791 clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); 4792 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation));4792 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)); 4793 4793 restoreClip(context, localPaintingInfo, fragment.backgroundRect); 4794 4794 } … … 4808 4808 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4809 4809 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4810 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation));4810 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)); 4811 4811 4812 4812 if (localPaintingInfo.clipToDirtyRect) … … 4827 4827 // Paint the clipped mask. 4828 4828 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseClippingMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4829 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation));4829 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)); 4830 4830 4831 4831 if (localPaintingInfo.clipToDirtyRect) … … 4840 4840 continue; 4841 4841 clipToRect(context, localPaintingInfo, fragment.backgroundRect); 4842 paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixel Accumulation)),4842 paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset)), 4843 4843 snappedIntRect(fragment.backgroundRect.rect()), true); 4844 4844 restoreClip(context, localPaintingInfo, fragment.backgroundRect); … … 6982 6982 context.translate(-adjustedPaintOffset.x(), -adjustedPaintOffset.y()); 6983 6983 6984 LayoutSize subpixel Accumulation= moveOffset - toLayoutSize(LayoutPoint(adjustedPaintOffset));6984 LayoutSize subpixelOffset = moveOffset - toLayoutSize(LayoutPoint(adjustedPaintOffset)); 6985 6985 paintDirtyRect.move(moveOffset); 6986 paint(context, paintDirtyRect, LayoutSize(-subpixel Accumulation.width(), -subpixelAccumulation.height()), paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects);6986 paint(context, paintDirtyRect, LayoutSize(-subpixelOffset.width(), -subpixelOffset.height()), paintBehavior, nullptr, paintFlags | PaintLayerTemporaryClipRects); 6987 6987 region->restoreRegionObjectsOriginalStyle(); 6988 6988 context.restore(); … … 7025 7025 clipToRect(context, paintingInfo, clipRect); 7026 7026 7027 flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixel Accumulation,7027 flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelOffset, 7028 7028 paintingInfo.paintBehavior, paintFlags); 7029 7029 -
trunk/Source/WebCore/rendering/RenderLayer.h
r204047 r204552 467 467 // front. The hitTest method looks for mouse events by walking 468 468 // layers that intersect the point from front to back. 469 void paint(GraphicsContext&, const LayoutRect& damageRect, const LayoutSize& subpixel Accumulation= LayoutSize(), PaintBehavior = PaintBehaviorNormal,469 void paint(GraphicsContext&, const LayoutRect& damageRect, const LayoutSize& subpixelOffset = LayoutSize(), PaintBehavior = PaintBehaviorNormal, 470 470 RenderObject* subtreePaintRoot = nullptr, PaintLayerFlags = 0); 471 471 bool hitTest(const HitTestRequest&, HitTestResult&); … … 679 679 680 680 struct LayerPaintingInfo { 681 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSu bpixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)681 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSupixelOffset, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr) 682 682 : rootLayer(inRootLayer) 683 683 , subtreePaintRoot(inSubtreePaintRoot) 684 684 , paintDirtyRect(inDirtyRect) 685 , subpixel Accumulation(inSubpixelAccumulation)685 , subpixelOffset(inSupixelOffset) 686 686 , overlapTestRequests(inOverlapTestRequests) 687 687 , paintBehavior(inPaintBehavior) … … 691 691 RenderObject* subtreePaintRoot; // only paint descendants of this object 692 692 LayoutRect paintDirtyRect; // relative to rootLayer; 693 LayoutSize subpixel Accumulation;693 LayoutSize subpixelOffset; 694 694 OverlapTestRequestMap* overlapTestRequests; // May be null. 695 695 PaintBehavior paintBehavior; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r204466 r204552 697 697 } 698 698 699 static bool devicePixelFractionGapFromRendererChanged(const LayoutSize& previousDevicePixelFractionFromRenderer, const LayoutSize& currentDevicePixelFractionFromRenderer, float deviceScaleFactor)700 { 701 FloatSize previous = snapSizeToDevicePixel( previousDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);702 FloatSize current = snapSizeToDevicePixel( currentDevicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor);699 static bool subpixelOffsetFromRendererChanged(const LayoutSize& oldSubpixelOffsetFromRenderer, const LayoutSize& newSubpixelOffsetFromRenderer, float deviceScaleFactor) 700 { 701 FloatSize previous = snapSizeToDevicePixel(oldSubpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor); 702 FloatSize current = snapSizeToDevicePixel(newSubpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor); 703 703 return previous != current; 704 704 } 705 706 static FloatSize pixelFractionForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor)705 706 static FloatSize subpixelForLayerPainting(const LayoutPoint& point, float pixelSnappingFactor) 707 707 { 708 708 LayoutUnit x = point.x(); … … 713 713 } 714 714 715 static void calculateDevicePixelOffsetFromRenderer(const LayoutSize& rendererOffsetFromGraphicsLayer, FloatSize& devicePixelOffsetFromRenderer, 716 LayoutSize& devicePixelFractionFromRenderer, float deviceScaleFactor) 717 { 718 devicePixelFractionFromRenderer = LayoutSize(pixelFractionForLayerPainting(toLayoutPoint(rendererOffsetFromGraphicsLayer), deviceScaleFactor)); 719 devicePixelOffsetFromRenderer = rendererOffsetFromGraphicsLayer - devicePixelFractionFromRenderer; 715 struct OffsetFromRenderer { 716 // 1.2px - > { m_devicePixelOffset = 1px m_subpixelOffset = 0.2px } 717 LayoutSize m_devicePixelOffset; 718 LayoutSize m_subpixelOffset; 719 }; 720 721 static OffsetFromRenderer computeOffsetFromRenderer(const LayoutSize& offset, float deviceScaleFactor) 722 { 723 OffsetFromRenderer offsetFromRenderer; 724 offsetFromRenderer.m_subpixelOffset = LayoutSize(subpixelForLayerPainting(toLayoutPoint(offset), deviceScaleFactor)); 725 offsetFromRenderer.m_devicePixelOffset = offset - offsetFromRenderer.m_subpixelOffset; 726 return offsetFromRenderer; 727 } 728 729 struct SnappedRectInfo { 730 LayoutRect m_snappedRect; 731 LayoutSize m_snapDelta; 732 }; 733 734 static SnappedRectInfo snappedGraphicsLayer(const LayoutSize& offset, const LayoutSize& size, float deviceScaleFactor) 735 { 736 SnappedRectInfo snappedGraphicsLayer; 737 LayoutRect graphicsLayerRect = LayoutRect(toLayoutPoint(offset), size); 738 snappedGraphicsLayer.m_snappedRect = LayoutRect(snapRectToDevicePixels(graphicsLayerRect, deviceScaleFactor)); 739 snappedGraphicsLayer.m_snapDelta = snappedGraphicsLayer.m_snappedRect.location() - toLayoutPoint(offset); 740 return snappedGraphicsLayer; 741 } 742 743 static LayoutSize computeOffsetFromAncestorGraphicsLayer(RenderLayer* compositedAncestor, const LayoutPoint& location) 744 { 745 if (!compositedAncestor) 746 return toLayoutSize(location); 747 748 LayoutSize ancestorRenderLayerOffsetFromAncestorGraphicsLayer = -(LayoutSize(compositedAncestor->backing()->graphicsLayer()->offsetFromRenderer()) 749 + compositedAncestor->backing()->subpixelOffsetFromRenderer()); 750 return ancestorRenderLayerOffsetFromAncestorGraphicsLayer + toLayoutSize(location); 751 } 752 753 class ComputedOffsets { 754 public: 755 ComputedOffsets(const RenderLayer& renderLayer, const LayoutRect& localRect, const LayoutRect& parentGraphicsLayerRect, const LayoutRect& primaryGraphicsLayerRect) 756 : m_renderLayer(renderLayer) 757 , m_location(localRect.location()) 758 , m_parentGraphicsLayerOffset(toLayoutSize(parentGraphicsLayerRect.location())) 759 , m_primaryGraphicsLayerOffset(toLayoutSize(primaryGraphicsLayerRect.location())) 760 { 761 } 762 763 LayoutSize fromParentGraphicsLayer() 764 { 765 if (!m_fromParentGraphicsLayer) 766 m_fromParentGraphicsLayer = fromAncestorGraphicsLayer() - m_parentGraphicsLayerOffset; 767 return m_fromParentGraphicsLayer.value(); 768 } 769 770 LayoutSize fromPrimaryGraphicsLayer() 771 { 772 if (!m_fromPrimaryGraphicsLayer) 773 m_fromPrimaryGraphicsLayer = fromAncestorGraphicsLayer() - m_parentGraphicsLayerOffset - m_primaryGraphicsLayerOffset; 774 return m_fromPrimaryGraphicsLayer.value(); 775 } 776 777 private: 778 LayoutSize fromAncestorGraphicsLayer() 779 { 780 if (!m_fromAncestorGraphicsLayer) { 781 RenderLayer* compositedAncestor = m_renderLayer.ancestorCompositingLayer(); 782 LayoutPoint localPointInAncestorRenderLayerCoords = m_renderLayer.convertToLayerCoords(compositedAncestor, m_location, RenderLayer::AdjustForColumns); 783 m_fromAncestorGraphicsLayer = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, localPointInAncestorRenderLayerCoords); 784 } 785 return m_fromAncestorGraphicsLayer.value(); 786 } 787 788 Optional<LayoutSize> m_fromAncestorGraphicsLayer; 789 Optional<LayoutSize> m_fromParentGraphicsLayer; 790 Optional<LayoutSize> m_fromPrimaryGraphicsLayer; 791 792 const RenderLayer& m_renderLayer; 793 // Location is relative to the renderer. 794 const LayoutPoint m_location; 795 const LayoutSize m_parentGraphicsLayerOffset; 796 const LayoutSize m_primaryGraphicsLayerOffset; 797 }; 798 799 LayoutRect RenderLayerBacking::computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const 800 { 801 ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, LayoutRect()); 802 return LayoutRect(encloseRectToDevicePixels(LayoutRect(toLayoutPoint(compositedBoundsOffset.fromParentGraphicsLayer()), compositedBounds().size()), 803 deviceScaleFactor())); 804 } 805 806 LayoutRect RenderLayerBacking::computeParentGraphicsLayerRect(RenderLayer* compositedAncestor, LayoutSize& ancestorClippingLayerOffset) const 807 { 808 if (!compositedAncestor || !compositedAncestor->backing()) 809 return renderer().view().documentRect(); 810 811 auto* ancestorBackingLayer = compositedAncestor->backing(); 812 LayoutRect parentGraphicsLayerRect; 813 if (m_owningLayer.isInsideFlowThread()) { 814 /// FIXME: flows/columns need work. 815 LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds(); 816 ancestorCompositedBounds.setLocation(LayoutPoint()); 817 adjustAncestorCompositingBoundsForFlowThread(ancestorCompositedBounds, compositedAncestor); 818 parentGraphicsLayerRect = ancestorCompositedBounds; 819 } 820 821 if (ancestorBackingLayer->hasClippingLayer()) { 822 // If the compositing ancestor has a layer to clip children, we parent in that, and therefore position relative to it. 823 LayoutRect clippingBox = clipBox(downcast<RenderBox>(compositedAncestor->renderer())); 824 LayoutSize clippingBoxOffset = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, clippingBox.location()); 825 parentGraphicsLayerRect = snappedGraphicsLayer(clippingBoxOffset, clippingBox.size(), deviceScaleFactor()).m_snappedRect; 826 } 827 828 #if PLATFORM(IOS) 829 if (compositedAncestor->hasTouchScrollableOverflow()) { 830 auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer()); 831 LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), 832 renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), 833 renderBox.height() - renderBox.borderTop() - renderBox.borderBottom()); 834 ScrollOffset scrollOffset = compositedAncestor->scrollOffset(); 835 parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(scrollOffset)), paddingBox.size()); 836 } 837 #else 838 if (compositedAncestor->needsCompositedScrolling()) { 839 auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer()); 840 LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop()); 841 parentGraphicsLayerRect = LayoutRect(scrollOrigin - toLayoutSize(compositedAncestor->scrollOffset()), renderBox.borderBoxRect().size()); 842 } 843 #endif 844 845 if (m_ancestorClippingLayer) { 846 // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this 847 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects 848 // for a compositing layer, rootLayer is the layer itself. 849 ShouldRespectOverflowClip shouldRespectOverflowClip = compositedAncestor->isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip; 850 RenderLayer::ClipRectsContext clipRectsContext(compositedAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip); 851 LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions. 852 ASSERT(!parentClipRect.isInfinite()); 853 LayoutSize clippingOffset = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, parentClipRect.location()); 854 LayoutRect snappedClippingLayerRect = snappedGraphicsLayer(clippingOffset, parentClipRect.size(), deviceScaleFactor()).m_snappedRect; 855 // The primary layer is then parented in, and positioned relative to this clipping layer. 856 ancestorClippingLayerOffset = snappedClippingLayerRect.location() - parentGraphicsLayerRect.location(); 857 parentGraphicsLayerRect = snappedClippingLayerRect; 858 } 859 return parentGraphicsLayerRect; 720 860 } 721 861 … … 727 867 728 868 const RenderStyle& style = renderer().style(); 729 730 869 // Set transform property, if it is not animating. We have to do this here because the transform 731 870 // is affected by the layer dimensions. … … 744 883 updateBlendMode(style); 745 884 #endif 746 747 885 m_owningLayer.updateDescendantDependentFlags(); 748 886 … … 751 889 m_graphicsLayer->setPreserves3D(preserves3D); 752 890 m_graphicsLayer->setBackfaceVisibility(style.backfaceVisibility() == BackfaceVisibilityVisible); 753 /* 754 * GraphicsLayer: device pixel positioned, enclosing rect. 755 * RenderLayer: subpixel positioned. 756 * Offset from renderer (GraphicsLayer <-> RenderLayer::renderer()): subpixel based offset. 757 * 758 * relativeCompositingBounds 759 * _______________________________________ 760 * |\ GraphicsLayer | 761 * | \ | 762 * | \ offset from renderer: (device pixel + subpixel) 763 * | \ | 764 * | \______________________________ | 765 * | | localCompositingBounds | | 766 * | | | | 767 * | | RenderLayer::renderer() | | 768 * | | | | 769 * 770 * localCompositingBounds: this RenderLayer relative to its renderer(). 771 * relativeCompositingBounds: this RenderLayer relative to its parent compositing layer. 772 * enclosingRelativeCompositingBounds: this RenderLayer relative to its parent, device pixel enclosing. 773 * rendererOffsetFromGraphicsLayer: RenderLayer::renderer()'s offset from its enclosing GraphicsLayer. 774 * devicePixelOffsetFromRenderer: rendererOffsetFromGraphicsLayer's device pixel part. (6.9px -> 6.5px in case of 2x display) 775 * devicePixelFractionFromRenderer: rendererOffsetFromGraphicsLayer's fractional part (6.9px -> 0.4px in case of 2x display) 776 */ 777 float deviceScaleFactor = this->deviceScaleFactor(); 778 RenderLayer* compAncestor = m_owningLayer.ancestorCompositingLayer(); 779 // We compute everything relative to the enclosing compositing layer. 780 LayoutRect ancestorCompositingBounds; 781 if (compAncestor) { 782 ASSERT(compAncestor->backing()); 783 ancestorCompositingBounds = compAncestor->backing()->compositedBounds(); 784 } 785 LayoutRect localCompositingBounds = compositedBounds(); 786 LayoutRect relativeCompositingBounds(localCompositingBounds); 787 788 LayoutPoint offsetFromParent = m_owningLayer.convertToLayerCoords(compAncestor, LayoutPoint(), RenderLayer::AdjustForColumns); 789 // Device pixel fractions get accumulated through ancestor layers. Our painting offset is layout offset + parent's painting offset. 790 offsetFromParent = offsetFromParent + (compAncestor ? compAncestor->backing()->devicePixelFractionFromRenderer() : LayoutSize()); 791 relativeCompositingBounds.moveBy(offsetFromParent); 792 793 LayoutRect enclosingRelativeCompositingBounds = LayoutRect(encloseRectToDevicePixels(relativeCompositingBounds, deviceScaleFactor)); 794 m_compositedBoundsDeltaFromGraphicsLayer = enclosingRelativeCompositingBounds.location() - relativeCompositingBounds.location(); 795 LayoutSize rendererOffsetFromGraphicsLayer = toLayoutSize(localCompositingBounds.location()) + m_compositedBoundsDeltaFromGraphicsLayer; 796 797 FloatSize devicePixelOffsetFromRenderer; 798 LayoutSize devicePixelFractionFromRenderer; 799 calculateDevicePixelOffsetFromRenderer(rendererOffsetFromGraphicsLayer, devicePixelOffsetFromRenderer, devicePixelFractionFromRenderer, deviceScaleFactor); 800 LayoutSize oldDevicePixelFractionFromRenderer = m_devicePixelFractionFromRenderer; 801 m_devicePixelFractionFromRenderer = LayoutSize(-devicePixelFractionFromRenderer.width(), -devicePixelFractionFromRenderer.height()); 802 803 adjustAncestorCompositingBoundsForFlowThread(ancestorCompositingBounds, compAncestor); 804 805 LayoutPoint graphicsLayerParentLocation; 806 if (compAncestor && compAncestor->backing()->hasClippingLayer()) { 807 // If the compositing ancestor has a layer to clip children, we parent in that, and therefore 808 // position relative to it. 809 // FIXME: need to do some pixel snapping here. 810 LayoutRect clippingBox = clipBox(downcast<RenderBox>(compAncestor->renderer())); 811 graphicsLayerParentLocation = clippingBox.location(); 812 } else if (compAncestor) 813 graphicsLayerParentLocation = ancestorCompositingBounds.location(); 814 else 815 graphicsLayerParentLocation = renderer().view().documentRect().location(); 816 817 #if PLATFORM(IOS) 818 if (compAncestor && compAncestor->hasTouchScrollableOverflow()) { 819 auto& renderBox = downcast<RenderBox>(compAncestor->renderer()); 820 LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), 821 renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), 822 renderBox.height() - renderBox.borderTop() - renderBox.borderBottom()); 823 824 ScrollOffset scrollOffset = compAncestor->scrollOffset(); 825 // FIXME: pixel snap the padding box. 826 graphicsLayerParentLocation = paddingBox.location() - toLayoutSize(scrollOffset); 827 } 828 #else 829 if (compAncestor && compAncestor->needsCompositedScrolling()) { 830 auto& renderBox = downcast<RenderBox>(compAncestor->renderer()); 831 LayoutPoint scrollOrigin(renderBox.borderLeft(), renderBox.borderTop()); 832 graphicsLayerParentLocation = scrollOrigin - toLayoutSize(compAncestor->scrollOffset()); 833 } 834 #endif 835 836 if (compAncestor && m_ancestorClippingLayer) { 837 // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this 838 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects 839 // for a compositing layer, rootLayer is the layer itself. 840 ShouldRespectOverflowClip shouldRespectOverflowClip = compAncestor->isolatesCompositedBlending() ? RespectOverflowClip : IgnoreOverflowClip; 841 RenderLayer::ClipRectsContext clipRectsContext(compAncestor, TemporaryClipRects, IgnoreOverlayScrollbarSize, shouldRespectOverflowClip); 842 LayoutRect parentClipRect = m_owningLayer.backgroundClipRect(clipRectsContext).rect(); // FIXME: Incorrect for CSS regions. 843 ASSERT(!parentClipRect.isInfinite()); 844 FloatPoint enclosingClippingLayerPosition = floorPointToDevicePixels(LayoutPoint(parentClipRect.location() - graphicsLayerParentLocation), deviceScaleFactor); 845 m_ancestorClippingLayer->setPosition(enclosingClippingLayerPosition); 846 m_ancestorClippingLayer->setSize(parentClipRect.size()); 847 848 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords. 849 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - offsetFromParent); 850 851 // The primary layer is then parented in, and positioned relative to this clipping layer. 852 graphicsLayerParentLocation = parentClipRect.location(); 853 } 854 855 LayoutSize contentsSize = enclosingRelativeCompositingBounds.size(); 891 892 RenderLayer* compositedAncestor = m_owningLayer.ancestorCompositingLayer(); 893 LayoutSize ancestorClippingLayerOffset; 894 LayoutRect parentGraphicsLayerRect = computeParentGraphicsLayerRect(compositedAncestor, ancestorClippingLayerOffset); 895 LayoutRect primaryGraphicsLayerRect = computePrimaryGraphicsLayerRect(parentGraphicsLayerRect); 896 897 ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, primaryGraphicsLayerRect); 898 m_compositedBoundsOffsetFromGraphicsLayer = compositedBoundsOffset.fromPrimaryGraphicsLayer(); 899 m_graphicsLayer->setPosition(primaryGraphicsLayerRect.location()); 900 m_graphicsLayer->setSize(primaryGraphicsLayerRect.size()); 901 902 ComputedOffsets rendererOffset(m_owningLayer, LayoutRect(), parentGraphicsLayerRect, primaryGraphicsLayerRect); 903 if (m_ancestorClippingLayer) { 904 // Clipping layer is parented in the ancestor layer. 905 m_ancestorClippingLayer->setPosition(toLayoutPoint(ancestorClippingLayerOffset)); 906 m_ancestorClippingLayer->setSize(parentGraphicsLayerRect.size()); 907 m_ancestorClippingLayer->setOffsetFromRenderer(-rendererOffset.fromParentGraphicsLayer()); 908 } 909 856 910 if (m_contentsContainmentLayer) { 857 911 m_contentsContainmentLayer->setPreserves3D(preserves3D); 858 FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor);859 m_ contentsContainmentLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation));912 m_contentsContainmentLayer->setPosition(primaryGraphicsLayerRect.location()); 913 m_graphicsLayer->setPosition(FloatPoint()); 860 914 // Use the same size as m_graphicsLayer so transforms behave correctly. 861 m_contentsContainmentLayer->setSize(contentsSize); 862 graphicsLayerParentLocation = enclosingRelativeCompositingBounds.location(); 863 } 864 865 FloatPoint enclosingGraphicsParentLocation = floorPointToDevicePixels(graphicsLayerParentLocation, deviceScaleFactor); 866 m_graphicsLayer->setPosition(FloatPoint(enclosingRelativeCompositingBounds.location() - enclosingGraphicsParentLocation)); 867 m_graphicsLayer->setSize(contentsSize); 868 if (devicePixelOffsetFromRenderer != m_graphicsLayer->offsetFromRenderer()) { 869 m_graphicsLayer->setOffsetFromRenderer(devicePixelOffsetFromRenderer); 915 m_contentsContainmentLayer->setSize(primaryGraphicsLayerRect.size()); 916 } 917 918 // Compute renderer offset from primary graphics layer. Note that primaryGraphicsLayerRect is in parentGraphicsLayer's coordidate system which is not necessarily 919 // the same as the ancestor graphics layer. 920 OffsetFromRenderer primaryGraphicsLayerOffsetFromRenderer; 921 LayoutSize oldSubpixelOffsetFromRenderer = m_subpixelOffsetFromRenderer; 922 primaryGraphicsLayerOffsetFromRenderer = computeOffsetFromRenderer(-rendererOffset.fromPrimaryGraphicsLayer(), deviceScaleFactor()); 923 m_subpixelOffsetFromRenderer = primaryGraphicsLayerOffsetFromRenderer.m_subpixelOffset; 924 925 if (primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset != m_graphicsLayer->offsetFromRenderer()) { 926 m_graphicsLayer->setOffsetFromRenderer(primaryGraphicsLayerOffsetFromRenderer.m_devicePixelOffset); 870 927 positionOverflowControlsLayers(); 871 928 } … … 874 931 // For non-root layers, background is always painted by the primary graphics layer. 875 932 ASSERT(!m_backgroundLayer); 876 bool hadSubpixelRounding = enclosingRelativeCompositingBounds != relativeCompositingBounds; 877 m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds)); 933 // Subpixel offset from graphics layer or size changed. 934 bool hadSubpixelRounding = !m_subpixelOffsetFromRenderer.isZero() || compositedBounds().size() != primaryGraphicsLayerRect.size(); 935 m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); 878 936 } 879 937 … … 881 939 LayoutRect clippingBox; 882 940 if (GraphicsLayer* clipLayer = clippingLayer()) { 883 // FIXME: need to do some pixel snapping here.884 941 clippingBox = clipBox(downcast<RenderBox>(renderer())); 885 clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location())); 886 clipLayer->setSize(clippingBox.size()); 887 clipLayer->setOffsetFromRenderer(toFloatSize(clippingBox.location())); 942 // Clipping layer is parented in the primary graphics layer. 943 LayoutSize clipBoxOffsetFromGraphicsLayer = toLayoutSize(clippingBox.location()) + rendererOffset.fromPrimaryGraphicsLayer(); 944 SnappedRectInfo snappedClippingGraphicsLayer = snappedGraphicsLayer(clipBoxOffsetFromGraphicsLayer, clippingBox.size(), deviceScaleFactor()); 945 clipLayer->setPosition(snappedClippingGraphicsLayer.m_snappedRect.location()); 946 clipLayer->setSize(snappedClippingGraphicsLayer.m_snappedRect.size()); 947 clipLayer->setOffsetFromRenderer(toLayoutSize(clippingBox.location() - snappedClippingGraphicsLayer.m_snapDelta)); 888 948 889 949 if (m_childClippingMaskLayer && !m_scrollingLayer) { … … 900 960 // Update properties that depend on layer dimensions. 901 961 FloatPoint3D transformOrigin = computeTransformOriginForPainting(downcast<RenderBox>(renderer()).borderBoxRect()); 902 // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds. 903 FloatPoint layerOffset = roundPointToDevicePixels(offsetFromParent, deviceScaleFactor); 962 FloatPoint layerOffset = roundPointToDevicePixels(toLayoutPoint(rendererOffset.fromParentGraphicsLayer()), deviceScaleFactor()); 904 963 // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set. 905 FloatPoint3D anchor(enclosingRelativeCompositingBounds.width() ? ((layerOffset.x() - enclosingRelativeCompositingBounds.x()) + transformOrigin.x()) 906 / enclosingRelativeCompositingBounds.width() : 0.5, enclosingRelativeCompositingBounds.height() ? ((layerOffset.y() - enclosingRelativeCompositingBounds.y()) 907 + transformOrigin.y()) / enclosingRelativeCompositingBounds.height() : 0.5, transformOrigin.z()); 964 FloatPoint3D anchor( 965 primaryGraphicsLayerRect.width() ? ((layerOffset.x() - primaryGraphicsLayerRect.x()) + transformOrigin.x()) / primaryGraphicsLayerRect.width() : 0.5, 966 primaryGraphicsLayerRect.height() ? ((layerOffset.y() - primaryGraphicsLayerRect.y())+ transformOrigin.y()) / primaryGraphicsLayerRect.height() : 0.5, 967 transformOrigin.z()); 908 968 909 969 if (m_contentsContainmentLayer) … … 936 996 if (m_foregroundLayer) { 937 997 FloatPoint foregroundPosition; 938 FloatSize foregroundSize = contentsSize;998 FloatSize foregroundSize = primaryGraphicsLayerRect.size(); 939 999 FloatSize foregroundOffset = m_graphicsLayer->offsetFromRenderer(); 940 1000 if (hasClippingLayer()) { … … 952 1012 if (m_backgroundLayer) { 953 1013 FloatPoint backgroundPosition; 954 FloatSize backgroundSize = contentsSize;1014 FloatSize backgroundSize = primaryGraphicsLayerRect.size(); 955 1015 if (backgroundLayerPaintsFixedRootBackground()) { 956 1016 const FrameView& frameView = renderer().view().frameView(); … … 969 1029 // The reflection layer has the bounds of m_owningLayer.reflectionLayer(), 970 1030 // but the reflected layer is the bounds of this layer, so we need to position it appropriately. 971 FloatRect layerBounds = compositedBounds();1031 FloatRect layerBounds = this->compositedBounds(); 972 1032 FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds(); 973 1033 reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())); … … 981 1041 982 1042 // FIXME: need to do some pixel snapping here. 983 m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - localCompositingBounds.location()));1043 m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - compositedBounds().location())); 984 1044 985 1045 m_scrollingLayer->setSize(roundedIntSize(LayoutSize(renderBox.clientWidth(), renderBox.clientHeight()))); … … 1045 1105 1046 1106 // If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store. 1047 setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compAncestor, enclosingRelativeCompositingBounds, ancestorCompositingBounds)); 1107 LayoutRect ancestorCompositedBounds = compositedAncestor ? compositedAncestor->backing()->compositedBounds() : LayoutRect(); 1108 setRequiresOwnBackingStore(compositor().requiresOwnBackingStore(m_owningLayer, compositedAncestor, 1109 LayoutRect(toLayoutPoint(compositedBoundsOffset.fromParentGraphicsLayer()), compositedBounds().size()), ancestorCompositedBounds)); 1048 1110 #if ENABLE(FILTERS_LEVEL_2) 1049 1111 updateBackdropFiltersGeometry(); … … 1051 1113 updateAfterWidgetResize(); 1052 1114 1053 if ( devicePixelFractionGapFromRendererChanged(oldDevicePixelFractionFromRenderer, m_devicePixelFractionFromRenderer, deviceScaleFactor) && canIssueSetNeedsDisplay())1115 if (subpixelOffsetFromRendererChanged(oldSubpixelOffsetFromRenderer, m_subpixelOffsetFromRenderer, deviceScaleFactor()) && canIssueSetNeedsDisplay()) 1054 1116 setContentsNeedDisplay(); 1055 1117 … … 1093 1155 LayoutRect boundingBox = m_owningLayer.boundingBox(&m_owningLayer); 1094 1156 LayoutRect referenceBoxForClippedInline = LayoutRect(snapRectToDevicePixels(boundingBox, deviceScaleFactor())); 1095 LayoutSize offset = LayoutSize(snapSizeToDevicePixel( m_devicePixelFractionFromRenderer, LayoutPoint(), deviceScaleFactor()));1157 LayoutSize offset = LayoutSize(snapSizeToDevicePixel(-m_subpixelOffsetFromRenderer, LayoutPoint(), deviceScaleFactor())); 1096 1158 Path clipPath = m_owningLayer.computeClipPath(offset, referenceBoxForClippedInline, windRule); 1097 1159 … … 1108 1170 void RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread(LayoutRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const 1109 1171 { 1110 if (!m_owningLayer.isInsideFlowThread())1111 return;1112 1113 1172 RenderLayer* flowThreadLayer = m_owningLayer.isInsideOutOfFlowThread() ? m_owningLayer.stackingContainer() : nullptr; 1114 1173 if (flowThreadLayer && flowThreadLayer->isRenderFlowThread()) { … … 2103 2162 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const 2104 2163 { 2105 return LayoutSize(-m_compositedBounds.x() - m_compositedBoundsDeltaFromGraphicsLayer.width(), -m_compositedBounds.y() - m_compositedBoundsDeltaFromGraphicsLayer.height());2164 return LayoutSize(-m_compositedBounds.x() + m_compositedBoundsOffsetFromGraphicsLayer.width(), -m_compositedBounds.y() + m_compositedBoundsOffsetFromGraphicsLayer.height()); 2106 2165 } 2107 2166 … … 2251 2310 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { 2252 2311 FloatRect layerDirtyRect = pixelSnappedRectForPainting; 2253 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);2312 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); 2254 2313 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip); 2255 2314 } … … 2257 2316 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { 2258 2317 FloatRect layerDirtyRect = pixelSnappedRectForPainting; 2259 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);2318 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); 2260 2319 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip); 2261 2320 } … … 2264 2323 if (m_backgroundLayer && m_backgroundLayer->drawsContent()) { 2265 2324 FloatRect layerDirtyRect = pixelSnappedRectForPainting; 2266 layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);2325 layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); 2267 2326 m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip); 2268 2327 } … … 2270 2329 if (m_maskLayer && m_maskLayer->drawsContent()) { 2271 2330 FloatRect layerDirtyRect = pixelSnappedRectForPainting; 2272 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);2331 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); 2273 2332 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip); 2274 2333 } … … 2282 2341 if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) { 2283 2342 FloatRect layerDirtyRect = pixelSnappedRectForPainting; 2284 layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + m_devicePixelFractionFromRenderer);2343 layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); 2285 2344 #if PLATFORM(IOS) 2286 2345 // Account for the fact that RenderLayerBacking::updateGeometry() bakes scrollOffset into offsetFromRenderer on iOS, … … 2336 2395 2337 2396 // FIXME: GraphicsLayers need a way to split for RenderRegions. 2338 RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, m_devicePixelFractionFromRenderer);2397 RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, paintDirtyRect, paintBehavior, -m_subpixelOffsetFromRenderer); 2339 2398 m_owningLayer.paintLayerContents(context, paintingInfo, paintFlags); 2340 2399 … … 2360 2419 // The dirtyRect is in the coords of the painting root. 2361 2420 FloatRect adjustedClipRect = clip; 2362 adjustedClipRect.move( -m_devicePixelFractionFromRenderer);2421 adjustedClipRect.move(m_subpixelOffsetFromRenderer); 2363 2422 IntRect dirtyRect = enclosingIntRect(adjustedClipRect); 2364 2423 -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r198374 r204552 217 217 bool needsPixelAligment() const override { return !m_isMainFrameRenderViewLayer; } 218 218 219 LayoutSize subpixelOffsetFromRenderer() const { return m_subpixelOffsetFromRenderer; } 220 219 221 #if PLATFORM(IOS) 220 222 bool needsIOSDumpRenderTreeMainFrameRenderViewLayerIsAlwaysOpaqueHack(const GraphicsLayer&) const override; … … 248 250 WEBCORE_EXPORT void setIsTrackingDisplayListReplay(bool); 249 251 WEBCORE_EXPORT String replayDisplayListAsText(DisplayList::AsTextFlags) const; 250 251 LayoutSize devicePixelFractionFromRenderer() const { return m_devicePixelFractionFromRenderer; }252 252 253 253 private: … … 344 344 345 345 bool canIssueSetNeedsDisplay() const { return !paintsIntoWindow() && !paintsIntoCompositedAncestor(); } 346 LayoutRect computeParentGraphicsLayerRect(RenderLayer* compositedAncestor, LayoutSize& ancestorClippingLayerOffset) const; 347 LayoutRect computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const; 346 348 347 349 RenderLayer& m_owningLayer; … … 367 369 368 370 LayoutRect m_compositedBounds; 369 LayoutSize m_ devicePixelFractionFromRenderer;370 LayoutSize m_compositedBounds DeltaFromGraphicsLayer; // This is the (subpixel) distance between the edge of the graphics layer and thelayer bounds.371 LayoutSize m_subpixelOffsetFromRenderer; // This is the subpixel distance between the primary graphics layer and the associated renderer's bounds. 372 LayoutSize m_compositedBoundsOffsetFromGraphicsLayer; // This is the subpixel distance between the primary graphics layer and the render layer bounds. 371 373 372 374 bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
Note: See TracChangeset
for help on using the changeset viewer.