| Index: Source/core/rendering/RenderLayer.cpp
|
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
|
| index 98bf30d208bf6becc7c7d9562163e6b029b027c6..a4734f263ce08b5cf5741025b3d01c35c0e5b564 100644
|
| --- a/Source/core/rendering/RenderLayer.cpp
|
| +++ b/Source/core/rendering/RenderLayer.cpp
|
| @@ -2010,7 +2010,10 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
|
| LayoutPoint offsetFromRoot;
|
| convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
|
|
|
| - IntRect rootRelativeBounds;
|
| + if (compositingState() == PaintsIntoOwnBacking)
|
| + offsetFromRoot.move(m_compositedLayerMapping->subpixelAccumulation());
|
| +
|
| + LayoutRect rootRelativeBounds;
|
| bool rootRelativeBoundsComputed = false;
|
|
|
| // Apply clip-path to context.
|
| @@ -2132,7 +2135,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
|
| // fragment should paint.
|
| collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.region, localPaintingInfo.paintDirtyRect,
|
| (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
|
| - (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot);
|
| + (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
|
| updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintFlags, shouldPaintContent, &offsetFromRoot);
|
| }
|
|
|
| @@ -2237,12 +2240,12 @@ void RenderLayer::paintList(Vector<RenderLayerStackingNode*>* list, GraphicsCont
|
|
|
| void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& dirtyRect,
|
| ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
|
| - const LayoutRect* layerBoundingBox)
|
| + const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
|
| {
|
| if (!enclosingPaginationLayer() || hasTransform()) {
|
| // For unpaginated layers, there is only one fragment.
|
| LayerFragment fragment;
|
| - ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip);
|
| + ClipRectsContext clipRectsContext(rootLayer, region, clipRectsType, inOverlayScrollbarSizeRelevancy, respectOverflowClip, subPixelAccumulation);
|
| calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFromRoot);
|
| fragments.append(fragment);
|
| return;
|
| @@ -2328,7 +2331,7 @@ void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
|
| LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.paintBehavior);
|
| enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.region, paintingInfo.paintDirtyRect,
|
| (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
|
| - (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
|
| + (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAccumulation, &transformedExtent);
|
|
|
| for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
|
| const LayerFragment& fragment = enclosingPaginationFragments.at(i);
|
| @@ -2354,6 +2357,15 @@ void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
|
| }
|
| }
|
|
|
| +static inline LayoutSize subPixelAccumulationIfNeeded(const LayoutSize& subPixelAccumulation, CompositingState compositingState)
|
| +{
|
| + // Only apply the sub-pixel accumulation if we don't paint into our own backing layer, otherwise the position
|
| + // of the renderer already includes any sub-pixel offset.
|
| + if (compositingState == PaintsIntoOwnBacking)
|
| + return LayoutSize();
|
| + return subPixelAccumulation;
|
| +}
|
| +
|
| void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragments, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
|
| const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
|
| RenderObject* paintingRootForRenderer)
|
| @@ -2376,7 +2388,7 @@ void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen
|
| // Paint the background.
|
| // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
|
| - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
|
| + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState())));
|
|
|
| if (localPaintingInfo.clipToDirtyRect)
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
|
| @@ -2436,7 +2448,7 @@ void RenderLayer::paintForegroundForFragmentsWithPhase(PaintPhase phase, const L
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect.rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
|
| if (phase == PaintPhaseForeground)
|
| paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
|
| - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
|
| + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState())));
|
|
|
| if (shouldClip)
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
|
| @@ -2454,7 +2466,7 @@ void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments,
|
| // Paint our own outline
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.rect()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
|
| clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
|
| - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
|
| + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState())));
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineRect);
|
| }
|
| }
|
| @@ -2473,7 +2485,7 @@ void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr
|
| // Paint the mask.
|
| // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
|
| - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
|
| + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState())));
|
|
|
| if (localPaintingInfo.clipToDirtyRect)
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
|
| @@ -2493,7 +2505,7 @@ void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer
|
|
|
| // Paint the the clipped mask.
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
|
| - renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
|
| + renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState())));
|
|
|
| if (localPaintingInfo.clipToDirtyRect)
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
|
| @@ -2506,7 +2518,7 @@ void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF
|
| const LayerFragment& fragment = layerFragments.at(i);
|
| clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
|
| if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea())
|
| - scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
|
| + scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, compositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
|
| restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
|
| }
|
| }
|
| @@ -2967,7 +2979,7 @@ RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
|
| LayoutPoint offsetOfPaginationLayerFromRoot;
|
| LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
|
| enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestLocation.region(), hitTestRect,
|
| - RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, &transformedExtent);
|
| + RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
|
|
|
| for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
|
| const LayerFragment& fragment = enclosingPaginationFragments.at(i);
|
| @@ -3287,7 +3299,7 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const
|
| if (renderer()->hasOverflowClip()) {
|
| // This layer establishes a clip of some kind.
|
| if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip) {
|
| - foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy));
|
| + foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset + clipRectsContext.subPixelAccumulation, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy));
|
| if (renderer()->style()->hasBorderRadius())
|
| foregroundRect.setHasRadius(true);
|
| }
|
| @@ -3302,13 +3314,13 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const
|
| // individual region boxes as overflow.
|
| LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverflowRect();
|
| renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // Layers are in physical coordinates, so the overflow has to be flipped.
|
| - layerBoundsWithVisualOverflow.moveBy(offset);
|
| + layerBoundsWithVisualOverflow.moveBy(offset + clipRectsContext.subPixelAccumulation);
|
| if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
|
| backgroundRect.intersect(layerBoundsWithVisualOverflow);
|
| } else {
|
| // Shift the bounds to be for our region only.
|
| LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsContext.region);
|
| - bounds.moveBy(offset);
|
| + bounds.moveBy(offset + clipRectsContext.subPixelAccumulation);
|
| if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)
|
| backgroundRect.intersect(bounds);
|
| }
|
| @@ -3317,7 +3329,7 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const
|
| // CSS clip (different than clipping due to overflow) can clip to any box, even if it falls outside of the border box.
|
| if (renderer()->hasClip()) {
|
| // Clip applies to *us* as well, so go ahead and update the damageRect.
|
| - LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRectsContext.region);
|
| + LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset + clipRectsContext.subPixelAccumulation, clipRectsContext.region);
|
| backgroundRect.intersect(newPosClip);
|
| foregroundRect.intersect(newPosClip);
|
| outlineRect.intersect(newPosClip);
|
| @@ -3524,14 +3536,14 @@ IntRect RenderLayer::absoluteBoundingBox() const
|
| 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();
|
|
|
| @@ -3572,7 +3584,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| LayoutPoint ancestorRelOffset;
|
| convertToLayerCoords(ancestorLayer, ancestorRelOffset);
|
| localClipRect.moveBy(ancestorRelOffset);
|
| - return pixelSnappedIntRect(localClipRect);
|
| + return localClipRect;
|
| }
|
| }
|
|
|
| @@ -3584,7 +3596,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| if (m_reflectionInfo) {
|
| RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer();
|
| if (!reflectionLayer->compositedLayerMapping()) {
|
| - IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| + LayoutRect childUnionBounds = reflectionLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| }
|
| @@ -3601,7 +3613,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren);
|
| while (RenderLayerStackingNode* node = iterator.next()) {
|
| if (flags & IncludeCompositedDescendants || !node->layer()->compositedLayerMapping()) {
|
| - IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags);
|
| + LayoutRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| }
|
| @@ -3625,7 +3637,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| convertToLayerCoords(ancestorLayer, ancestorRelOffset);
|
| unionBounds.moveBy(ancestorRelOffset);
|
|
|
| - return pixelSnappedIntRect(unionBounds);
|
| + return unionBounds;
|
| }
|
|
|
| CompositingState RenderLayer::compositingState() const
|
|
|