Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
| index 84b8d17f8c95530eb96a21adf94511862f8e8103..52430c138b5d84062b3c1e83950f987cf12db6b0 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
| @@ -93,8 +93,9 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayer(GraphicsContext& co |
| LayerFixedPositionRecorder fixedPositionRecorder(context, *m_paintLayer.layoutObject()); |
| + // Transforms will be applied by property nodes directly for SPv2. |
| // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying the transform twice. |
| - if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(paintFlags & PaintLayerAppliedTransform)) |
| + if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(paintFlags & PaintLayerAppliedTransform)) |
| return paintLayerWithTransform(context, paintingInfo, paintFlags); |
| return paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
| @@ -326,7 +327,9 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon |
| if (shouldPaintContent || shouldPaintSelfOutline || isPaintingOverlayScrollbars) { |
| // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment. |
| ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects; |
| - if (fragmentPolicy == ForceSingleFragment) |
| + // TODO(trchen): We haven't decided how to handle visual fragmentation with SPv2. |
| + // Related thread https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/81XuWFf-mxM |
|
chrishtr
2016/02/02 19:41:10
Following up on this now in the google group, we n
trchen
2016/02/02 21:54:51
This CL will unblock many other things, and I don'
chrishtr
2016/02/02 23:31:59
Sure, of course.
|
| + if (fragmentPolicy == ForceSingleFragment || RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| else |
| m_paintLayer.collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| @@ -345,16 +348,8 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsCon |
| rootRelativeBounds, rootRelativeBoundsComputed); |
| Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties; |
| - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| - if (const auto* objectProperties = m_paintLayer.layoutObject()->objectPaintProperties()) { |
| - PaintChunkProperties properties(context.paintController().currentPaintChunkProperties()); |
| - if (TransformPaintPropertyNode* transform = objectProperties->transformForLayerContents()) |
| - properties.transform = transform; |
| - if (EffectPaintPropertyNode* effect = objectProperties->effect()) |
| - properties.effect = effect; |
| - scopedPaintChunkProperties.emplace(context.paintController(), properties); |
| - } |
| - } |
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| + scopedPaintChunkProperties.emplace(context.paintController(), m_paintLayer.cachedSPv2PaintParameters().properties); |
|
chrishtr
2016/02/02 19:43:31
Is it true that this is a pure cache? i.e. the old
trchen
2016/02/02 21:54:51
Nope, the old code won't work for non-trivial case
chrishtr
2016/02/02 23:31:59
It's still not clear what you are trying to achiev
trchen
2016/02/02 23:48:26
ObjectPaintProperties hold references to the prope
|
| bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintContent && !selectionOnly; |
| bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground); |
| @@ -432,6 +427,9 @@ bool PaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(PaintLayerFragmen |
| PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| { |
| + // Transforms will be applied by property nodes directly for SPv2. |
| + ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| + |
| TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags()); |
| // If the transform can't be inverted, then don't paint anything. |
| if (!layerTransform.isInvertible()) |
| @@ -500,6 +498,9 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(Graphi |
| PaintLayerPainter::PaintResult PaintLayerPainter::paintFragmentByApplyingTransform(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTranslation) |
| { |
| + // Transforms will be applied by property nodes directly for SPv2. |
| + ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| + |
| // This involves subtracting out the position of the layer in our current coordinate space, but preserving |
| // the accumulated error for sub-pixel layout. |
| LayoutPoint delta; |
| @@ -622,16 +623,21 @@ void PaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const PaintLaye |
| LayoutRect newCullRect(clipRect.rect()); |
| Optional<ScrollRecorder> scrollRecorder; |
| - LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation()); |
| - if (!paintingInfo.scrollOffsetAccumulation.isZero()) { |
| - // As a descendant of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorders |
| - // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder |
| - // for this layer seperately, with the scroll offset accumulated from the root layer to the parent of this |
| - // layer, to get the same result as ScrollRecorder in BlockPainter. |
| - paintOffset += paintingInfo.scrollOffsetAccumulation; |
| - |
| - newCullRect.move(paintingInfo.scrollOffsetAccumulation); |
| - scrollRecorder.emplace(context, *m_paintLayer.layoutObject(), phase, paintingInfo.scrollOffsetAccumulation); |
| + LayoutPoint paintOffset; |
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + paintOffset = toPoint(m_paintLayer.cachedSPv2PaintParameters().paintOffset - m_paintLayer.layoutBoxLocation()); |
| + } else { |
| + paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation()); |
| + if (!paintingInfo.scrollOffsetAccumulation.isZero()) { |
| + // As a descendant of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorders |
| + // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder |
| + // for this layer seperately, with the scroll offset accumulated from the root layer to the parent of this |
| + // layer, to get the same result as ScrollRecorder in BlockPainter. |
| + paintOffset += paintingInfo.scrollOffsetAccumulation; |
| + |
| + newCullRect.move(paintingInfo.scrollOffsetAccumulation); |
| + scrollRecorder.emplace(context, *m_paintLayer.layoutObject(), phase, paintingInfo.scrollOffsetAccumulation); |
| + } |
| } |
| PaintInfo paintInfo(context, pixelSnappedIntRect(newCullRect), phase, |
| paintingInfo.globalPaintFlags(), paintFlags, paintingInfo.rootLayer->layoutObject()); |