Changeset 171210 in webkit
- Timestamp:
- Jul 17, 2014 6:56:12 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r171198 r171210 1 2014-07-17 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Embedded non-compositing rotate transform paints to wrong position. 4 https://bugs.webkit.org/show_bug.cgi?id=135028 5 6 Reviewed by Simon Fraser. 7 8 CTM always translates to where the layer's renderer() is going to paint. 9 It ensures that the pixel snapped renderer() always end up painting to (0, 0) which is 10 required to be able to position properly on transformed context. 11 12 * fast/layers/hidpi-transform-on-child-content-is-mispositioned-expected.html: Added. 13 * fast/layers/hidpi-transform-on-child-content-is-mispositioned.html: Added. 14 1 15 2014-07-17 Alexey Proskuryakov <ap@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r171207 r171210 1 2014-07-17 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Embedded non-compositing rotate transform paints to wrong position. 4 https://bugs.webkit.org/show_bug.cgi?id=135028 5 6 Reviewed by Simon Fraser. 7 8 CTM always translates to where the layer's renderer() is going to paint. 9 It ensures that the pixel snapped renderer() always end up painting to (0, 0) which is 10 required to be able to position properly on transformed context. 11 12 Test: fast/layers/hidpi-transform-on-child-content-is-mispositioned.html 13 14 * rendering/RenderLayer.cpp: 15 (WebCore::RenderLayer::beginTransparencyLayers): 16 (WebCore::RenderLayer::clipToRect): 17 (WebCore::RenderLayer::paintLayerByApplyingTransform): 18 (WebCore::RenderLayer::paintBackgroundForFragments): 19 (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): 20 (WebCore::RenderLayer::paintOutlineForFragments): 21 (WebCore::RenderLayer::paintMaskForFragments): 22 (WebCore::RenderLayer::paintOverflowControlsForFragments): 23 (WebCore::RenderLayer::calculateClipRects): 24 * rendering/RenderLayer.h: 25 1 26 2014-07-17 Beth Dakin <bdakin@apple.com> 2 27 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r171074 r171210 1695 1695 context->save(); 1696 1696 LayoutRect adjustedClipRect = paintingExtent(*this, paintingInfo.rootLayer, dirtyRect, paintingInfo.paintBehavior); 1697 adjustedClipRect.move(paintingInfo.sub PixelAccumulation);1697 adjustedClipRect.move(paintingInfo.subpixelAccumulation); 1698 1698 FloatRect pixelSnappedClipRect = pixelSnappedForPainting(adjustedClipRect, renderer().document().deviceScaleFactor()); 1699 1699 context->clip(pixelSnappedClipRect); … … 3590 3590 context->save(); 3591 3591 LayoutRect adjustedClipRect = clipRect.rect(); 3592 adjustedClipRect.move(paintingInfo.sub PixelAccumulation);3592 adjustedClipRect.move(paintingInfo.subpixelAccumulation); 3593 3593 context->clip(pixelSnappedForPainting(adjustedClipRect, deviceScaleFactor)); 3594 3594 } … … 3603 3603 if (layer->renderer().hasOverflowClip() && layer->renderer().style().hasBorderRadius() && inContainingBlockChain(this, layer)) { 3604 3604 LayoutRect adjustedClipRect = LayoutRect(toLayoutPoint(layer->offsetFromAncestor(paintingInfo.rootLayer)), layer->size()); 3605 adjustedClipRect.move(paintingInfo.sub PixelAccumulation);3605 adjustedClipRect.move(paintingInfo.subpixelAccumulation); 3606 3606 context->clipRoundedRect(layer->renderer().style().getRoundedInnerBorderFor(adjustedClipRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor)); 3607 3607 } … … 4150 4150 offsetFromParent += translationOffset; 4151 4151 TransformationMatrix transform(renderableTransform(paintingInfo.paintBehavior)); 4152 FloatSize devicePixelSnappedOffsetFromParent = toFloatSize(roundedForPainting(toLayoutPoint(offsetFromParent), deviceScaleFactor)); 4152 // 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. 4153 LayoutSize offsetForThisLayer = offsetFromParent + paintingInfo.subpixelAccumulation; 4154 FloatSize devicePixelSnappedOffsetForThisLayer = toFloatSize(roundedForPainting(toLayoutPoint(offsetForThisLayer), deviceScaleFactor)); 4155 // We handle accumulated subpixels through nested layers here. Since the context gets translated to device pixels, 4156 // all we need to do is add the delta to the accumulated pixels coming from ancestor layers. 4153 4157 // Translate the graphics context to the snapping position to avoid off-device-pixel positing. 4154 transform.translateRight(devicePixelSnappedOffsetFromParent.width(), devicePixelSnappedOffsetFromParent.height()); 4155 // We handle accumulated subpixels through nested layers here. Since the context gets translated to device pixels, 4156 // all we need to do is add the delta to the accumulated pixels coming from ancestor layers. With deep nesting of subpixel positioned 4157 // boxes, this could grow to a relatively large number, but the translateRight() balances it. 4158 FloatSize delta = offsetFromParent - devicePixelSnappedOffsetFromParent; 4159 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + LayoutSize(delta); 4158 transform.translateRight(devicePixelSnappedOffsetForThisLayer.width(), devicePixelSnappedOffsetForThisLayer.height()); 4160 4159 // Apply the transform. 4161 4160 GraphicsContextStateSaver stateSaver(*context); … … 4163 4162 4164 4163 // Now do a paint with the root layer shifted to be us. 4165 LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(enclosingRectForPainting(transform.inverse().mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)), paintingInfo.paintBehavior, 4166 adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests); 4164 LayoutSize adjustedSubpixelAccumulation = offsetForThisLayer - LayoutSize(devicePixelSnappedOffsetForThisLayer); 4165 LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(enclosingRectForPainting(transform.inverse().mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)), 4166 paintingInfo.paintBehavior, adjustedSubpixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests); 4167 4167 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags); 4168 4168 } … … 4420 4420 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4421 4421 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4422 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation));4422 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)); 4423 4423 4424 4424 if (localPaintingInfo.clipToDirtyRect) … … 4495 4495 if (phase == PaintPhaseForeground) 4496 4496 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests; 4497 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation));4497 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)); 4498 4498 4499 4499 if (shouldClip) … … 4513 4513 PaintInfo paintInfo(context, fragment.outlineRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4514 4514 clipToRect(localPaintingInfo, context, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); 4515 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation));4515 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)); 4516 4516 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineRect); 4517 4517 } … … 4532 4532 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4533 4533 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4534 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation));4534 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)); 4535 4535 4536 4536 if (localPaintingInfo.clipToDirtyRect) … … 4544 4544 const LayerFragment& fragment = layerFragments.at(i); 4545 4545 clipToRect(localPaintingInfo, context, fragment.backgroundRect); 4546 paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.sub PixelAccumulation)),4546 paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)), 4547 4547 pixelSnappedIntRect(fragment.backgroundRect.rect()), true); 4548 4548 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect); … … 6732 6732 clipToRect(paintingInfo, context, clipRect); 6733 6733 6734 flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior, paintFlags); 6734 flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelAccumulation, 6735 paintingInfo.paintBehavior, paintFlags); 6735 6736 6736 6737 if (shouldClip) -
trunk/Source/WebCore/rendering/RenderLayer.h
r171074 r171210 888 888 889 889 struct LayerPaintingInfo { 890 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSub PixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr)890 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubpixelAccumulation, RenderObject* inSubtreePaintRoot = nullptr, OverlapTestRequestMap* inOverlapTestRequests = nullptr) 891 891 : rootLayer(inRootLayer) 892 892 , subtreePaintRoot(inSubtreePaintRoot) 893 893 , paintDirtyRect(inDirtyRect) 894 , sub PixelAccumulation(inSubPixelAccumulation)894 , subpixelAccumulation(inSubpixelAccumulation) 895 895 , overlapTestRequests(inOverlapTestRequests) 896 896 , paintBehavior(inPaintBehavior) … … 900 900 RenderObject* subtreePaintRoot; // only paint descendants of this object 901 901 LayoutRect paintDirtyRect; // relative to rootLayer; 902 LayoutSize sub PixelAccumulation;902 LayoutSize subpixelAccumulation; 903 903 OverlapTestRequestMap* overlapTestRequests; // May be null. 904 904 PaintBehavior paintBehavior;
Note: See TracChangeset
for help on using the changeset viewer.