| Index: Source/core/rendering/RenderLayer.cpp
|
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
|
| index 512b4828f3961fc5612afcd8233161d04854eaad..d6840131c9283d1446108880432c09c108d989f7 100644
|
| --- a/Source/core/rendering/RenderLayer.cpp
|
| +++ b/Source/core/rendering/RenderLayer.cpp
|
| @@ -1216,10 +1216,10 @@ enum TransparencyClipBoxMode {
|
| RootOfTransparencyClipBox
|
| };
|
|
|
| -static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* rootLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, PaintBehavior = 0);
|
| +static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* rootLayer, TransparencyClipBoxBehavior, TransparencyClipBoxMode, const LayoutSize& subPixelAccumulation, PaintBehavior = 0);
|
|
|
| static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, const RenderLayer* layer, const RenderLayer* rootLayer,
|
| - TransparencyClipBoxBehavior transparencyBehavior, PaintBehavior paintBehavior)
|
| + TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior)
|
| {
|
| // If we have a mask, then the clip is limited to the border box area (and there is
|
| // no need to examine child layers).
|
| @@ -1228,7 +1228,7 @@ static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
|
| // a stacking container. This means we can just walk the layer tree directly.
|
| for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSibling()) {
|
| if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionLayer() != curr)
|
| - clipRect.unite(transparencyClipBox(curr, rootLayer, transparencyBehavior, DescendantsOfTransparencyClipBox, paintBehavior));
|
| + clipRect.unite(transparencyClipBox(curr, rootLayer, transparencyBehavior, DescendantsOfTransparencyClipBox, subPixelAccumulation, paintBehavior));
|
| }
|
| }
|
|
|
| @@ -1246,7 +1246,7 @@ static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
|
| }
|
|
|
| static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
|
| - TransparencyClipBoxMode transparencyMode, PaintBehavior paintBehavior)
|
| + TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior)
|
| {
|
| // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
|
| // paintDirtyRect, and that should cut down on the amount we have to paint. Still it
|
| @@ -1261,14 +1261,16 @@ static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye
|
| LayoutPoint delta;
|
| layer->convertToLayerCoords(rootLayerForTransform, delta);
|
|
|
| + delta.move(subPixelAccumulation);
|
| + IntPoint pixelSnappedDelta = roundedIntPoint(delta);
|
| TransformationMatrix transform;
|
| - transform.translate(delta.x(), delta.y());
|
| + transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y());
|
| transform = transform * *layer->transform();
|
|
|
| // We don't use fragment boxes when collecting a transformed layer's bounding box, since it always
|
| // paints unfragmented.
|
| LayoutRect clipRect = layer->boundingBox(layer);
|
| - expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, paintBehavior);
|
| + expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, subPixelAccumulation, paintBehavior);
|
| layer->renderer()->style()->filterOutsets().expandRect(clipRect);
|
| LayoutRect result = transform.mapRect(clipRect);
|
| if (!paginationLayer)
|
| @@ -1287,17 +1289,18 @@ static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLaye
|
| }
|
|
|
| LayoutRect clipRect = layer->boundingBox(rootLayer, RenderLayer::UseFragmentBoxes);
|
| - expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, paintBehavior);
|
| + expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, subPixelAccumulation, paintBehavior);
|
| layer->renderer()->style()->filterOutsets().expandRect(clipRect);
|
| + clipRect.move(subPixelAccumulation);
|
| return clipRect;
|
| }
|
|
|
| -LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior)
|
| +LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior)
|
| {
|
| - return intersection(transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect);
|
| + return intersection(transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, RootOfTransparencyClipBox, subPixelAccumulation, paintBehavior), paintDirtyRect);
|
| }
|
|
|
| -void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior)
|
| +void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior)
|
| {
|
| bool createTransparencyLayerForBlendMode = m_stackingNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode();
|
| if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) || paintsWithBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency))
|
| @@ -1305,12 +1308,12 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render
|
|
|
| RenderLayer* ancestor = transparentPaintingAncestor();
|
| if (ancestor)
|
| - ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, paintBehavior);
|
| + ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior);
|
|
|
| if (paintsWithTransparency(paintBehavior) || paintsWithBlendMode() || createTransparencyLayerForBlendMode) {
|
| m_usedTransparency = true;
|
| context->save();
|
| - LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBehavior);
|
| + LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior);
|
| context->clip(clipRect);
|
|
|
| if (paintsWithBlendMode())
|
| @@ -1897,9 +1900,9 @@ void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
|
| // layer from the parent now, assuming there is a parent
|
| if (paintFlags & PaintLayerHaveTransparency) {
|
| if (parent())
|
| - parent()->beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.paintBehavior);
|
| + parent()->beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior);
|
| else
|
| - beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.paintBehavior);
|
| + beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior);
|
| }
|
|
|
| if (enclosingPaginationLayer()) {
|
| @@ -2032,7 +2035,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
|
| bool createTransparencyLayerForBlendMode = !renderer()->isRoot() && m_stackingNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode();
|
|
|
| if (createTransparencyLayerForBlendMode)
|
| - beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.paintBehavior);
|
| + beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior);
|
|
|
| LayerPaintingInfo localPaintingInfo(paintingInfo);
|
| FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilters());
|
| @@ -2068,7 +2071,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
|
|
|
| if (filterPainter.hasStartedFilterEffect() && haveTransparency) {
|
| // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one with the wrong context.
|
| - beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, localPaintingInfo.paintBehavior);
|
| + beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo.paintBehavior);
|
| }
|
|
|
| // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which
|
| @@ -2302,7 +2305,7 @@ void RenderLayer::paintTransformedLayerIntoFragments(GraphicsContext* context, c
|
| {
|
| LayerFragments enclosingPaginationFragments;
|
| LayoutPoint offsetOfPaginationLayerFromRoot;
|
| - LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.paintBehavior);
|
| + LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), PaintingTransparencyClipBox, RootOfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior);
|
| enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect,
|
| (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize,
|
| (paintFlags & PaintLayerPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, &offsetOfPaginationLayerFromRoot, paintingInfo.subPixelAccumulation, &transformedExtent);
|
| @@ -2351,7 +2354,7 @@ void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen
|
|
|
| // Begin transparency layers lazily now that we know we have to paint something.
|
| if (haveTransparency || paintsWithBlendMode())
|
| - beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
|
| + beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo.paintBehavior);
|
|
|
| if (localPaintingInfo.clipToDirtyRect) {
|
| // Paint our background first, before painting any child layers.
|
| @@ -2378,7 +2381,7 @@ void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
|
| for (size_t i = 0; i < layerFragments.size(); ++i) {
|
| const LayerFragment& fragment = layerFragments.at(i);
|
| if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty()) {
|
| - beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
|
| + beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo.paintBehavior);
|
| break;
|
| }
|
| }
|
| @@ -2951,7 +2954,8 @@ RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa
|
| {
|
| LayerFragments enclosingPaginationFragments;
|
| LayoutPoint offsetOfPaginationLayerFromRoot;
|
| - LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox);
|
| + // FIXME: We're missing a sub-pixel offset here crbug.com/348728
|
| + LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, RootOfTransparencyClipBox, LayoutSize());
|
| enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect,
|
| RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
|
|
|
|
|