| Index: sky/engine/core/rendering/RenderLayer.cpp
|
| diff --git a/sky/engine/core/rendering/RenderLayer.cpp b/sky/engine/core/rendering/RenderLayer.cpp
|
| index 2d8f89dd7b1f115563b6afd961843534682b7414..7ff87f2d4095716142753a5a4a348f8db3108143 100644
|
| --- a/sky/engine/core/rendering/RenderLayer.cpp
|
| +++ b/sky/engine/core/rendering/RenderLayer.cpp
|
| @@ -741,13 +741,6 @@ void RenderLayer::updateStackingNode()
|
| m_stackingNode = nullptr;
|
| }
|
|
|
| -void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect)
|
| -{
|
| - TRACE_EVENT0("blink", "RenderLayer::paint");
|
| - LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), LayoutSize());
|
| - paintLayer(context, paintingInfo, PaintContent);
|
| -}
|
| -
|
| static bool inContainingBlockChain(RenderLayer* startLayer, RenderLayer* endLayer)
|
| {
|
| if (startLayer == endLayer)
|
| @@ -795,231 +788,6 @@ void RenderLayer::restoreClip(GraphicsContext* context, const LayoutRect& paintD
|
| context->restore();
|
| }
|
|
|
| -void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
|
| -{
|
| - // Non self-painting leaf layers don't need to be painted as their renderer() should properly paint itself.
|
| - if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
|
| - return;
|
| -
|
| - // If this layer is totally invisible then there is nothing to paint.
|
| - if (!renderer()->opacity())
|
| - return;
|
| -
|
| - if (paintsWithTransform()) {
|
| - TransformationMatrix layerTransform = renderableTransform();
|
| - // If the transform can't be inverted, then don't paint anything.
|
| - if (!layerTransform.isInvertible())
|
| - return;
|
| -
|
| - // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency
|
| - // layer from the parent now, assuming there is a parent
|
| - if (isTransparent()) {
|
| - if (parent())
|
| - parent()->beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
|
| - else
|
| - beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
|
| - }
|
| -
|
| - // Make sure the parent's clip rects have been calculated.
|
| - ClipRect clipRect = paintingInfo.paintDirtyRect;
|
| - if (parent()) {
|
| - ClipRectsContext clipRectsContext(paintingInfo.rootLayer, PaintingClipRects);
|
| - clipRect = clipper().backgroundClipRect(clipRectsContext);
|
| - clipRect.intersect(paintingInfo.paintDirtyRect);
|
| -
|
| - // Push the parent coordinate space's clip.
|
| - parent()->clipToRect(paintingInfo, context, clipRect);
|
| - }
|
| -
|
| - paintLayerByApplyingTransform(context, paintingInfo, paintFlags);
|
| -
|
| - // Restore the clip.
|
| - if (parent())
|
| - parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRect);
|
| -
|
| - return;
|
| - }
|
| -
|
| - paintLayerContents(context, paintingInfo, paintFlags);
|
| -}
|
| -
|
| -void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
|
| -{
|
| - ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
|
| -
|
| - float deviceScaleFactor = blink::deviceScaleFactor(renderer()->frame());
|
| - context->setDeviceScaleFactor(deviceScaleFactor);
|
| -
|
| - GraphicsContext* transparencyLayerContext = context;
|
| -
|
| - m_stackingNode->updateLayerListsIfNeeded();
|
| -
|
| - LayoutPoint offsetFromRoot;
|
| - convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
|
| -
|
| - LayoutRect rootRelativeBounds;
|
| - bool rootRelativeBoundsComputed = false;
|
| -
|
| - // Apply clip-path to context.
|
| - GraphicsContextStateSaver clipStateSaver(*context, false);
|
| - RenderStyle* style = renderer()->style();
|
| -
|
| - // Clip-path, like border radius, must not be applied to the contents of a composited-scrolling container.
|
| - // It must, however, still be applied to the mask layer, so that the compositor can properly mask the
|
| - // scrolling contents and scrollbars.
|
| - if (renderer()->hasClipPath() && style) {
|
| - ASSERT(style->clipPath());
|
| - if (style->clipPath()->type() == ClipPathOperation::SHAPE) {
|
| - ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style->clipPath());
|
| - if (clipPath->isValid()) {
|
| - clipStateSaver.save();
|
| -
|
| - if (!rootRelativeBoundsComputed) {
|
| - rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot);
|
| - rootRelativeBoundsComputed = true;
|
| - }
|
| -
|
| - context->clipPath(clipPath->path(rootRelativeBounds), clipPath->windRule());
|
| - }
|
| - }
|
| - }
|
| -
|
| - LayerPaintingInfo localPaintingInfo(paintingInfo);
|
| - FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilters());
|
| -
|
| - LayoutRect layerBounds;
|
| - // FIXME(sky): Remove foregroundRect. It's unused.
|
| - ClipRect backgroundRect, foregroundRect;
|
| - ClipRectsContext clipRectsContext(localPaintingInfo.rootLayer, PaintingClipRects, localPaintingInfo.subPixelAccumulation);
|
| - clipper().calculateRects(clipRectsContext, localPaintingInfo.paintDirtyRect,
|
| - layerBounds, backgroundRect, foregroundRect,
|
| - &offsetFromRoot);
|
| -
|
| - bool shouldPaintContent = isSelfPaintingLayer() && intersectsDamageRect(layerBounds, backgroundRect.rect(), localPaintingInfo.rootLayer, &offsetFromRoot);
|
| -
|
| - bool haveTransparency = isTransparent();
|
| -
|
| - if (filterPainter.haveFilterEffect()) {
|
| - ASSERT(this->filterInfo());
|
| -
|
| - if (!rootRelativeBoundsComputed)
|
| - rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot);
|
| -
|
| - if (filterPainter.prepareFilterEffect(this, rootRelativeBounds, paintingInfo.paintDirtyRect)) {
|
| - // Rewire the old context to a memory buffer, so that we can capture the contents of the layer.
|
| - // NOTE: We saved the old context in the "transparencyLayerContext" local variable, to be able to start a transparency layer
|
| - // on the original context and avoid duplicating "beginFilterEffect" after each transparency layer call. Also, note that
|
| - // beginTransparencyLayers will only create a single lazy transparency layer, even though it is called twice in this method.
|
| - // With deferred filters, we don't need a separate context, but we do need to do transparency and clipping before starting
|
| - // filter processing.
|
| - // FIXME: when the legacy path is removed, remove the transparencyLayerContext as well.
|
| - if (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 after filter processing.
|
| - beginTransparencyLayers(context, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation);
|
| - }
|
| - // We'll handle clipping to the dirty rect before filter rasterization.
|
| - // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets.
|
| - // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved.
|
| - clipToRect(localPaintingInfo, context, backgroundRect);
|
| - // Subsequent code should not clip to the dirty rect, since we've already
|
| - // done it above, and doing it later will defeat the outsets.
|
| - localPaintingInfo.clipToDirtyRect = false;
|
| -
|
| - context = filterPainter.beginFilterEffect(context);
|
| - }
|
| - }
|
| -
|
| - LayoutPoint layerLocation = toPoint(layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation);
|
| -
|
| - if (shouldPaintContent) {
|
| - paintForeground(context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency,
|
| - localPaintingInfo, layerLocation, backgroundRect);
|
| - }
|
| -
|
| - paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags);
|
| -
|
| - if (filterPainter.hasStartedFilterEffect()) {
|
| - context = filterPainter.applyFilterEffect();
|
| - restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect);
|
| - }
|
| -
|
| - // Make sure that we now use the original transparency context.
|
| - ASSERT(transparencyLayerContext == context);
|
| -
|
| - // End our transparency layer
|
| - if (haveTransparency && m_usedTransparency) {
|
| - context->endLayer();
|
| - context->restore();
|
| - m_usedTransparency = false;
|
| - }
|
| -}
|
| -
|
| -void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset)
|
| -{
|
| - // 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;
|
| - convertToLayerCoords(paintingInfo.rootLayer, delta);
|
| - delta.moveBy(translationOffset);
|
| - TransformationMatrix transform(renderableTransform());
|
| - IntPoint roundedDelta = roundedIntPoint(delta);
|
| - transform.translateRight(roundedDelta.x(), roundedDelta.y());
|
| - LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
|
| -
|
| - // Apply the transform.
|
| - GraphicsContextStateSaver stateSaver(*context, false);
|
| - if (!transform.isIdentity()) {
|
| - stateSaver.save();
|
| - context->concatCTM(transform.toAffineTransform());
|
| - }
|
| -
|
| - // Now do a paint with the root layer shifted to be us.
|
| - LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect)),
|
| - adjustedSubPixelAccumulation);
|
| - paintLayerContents(context, transformedPaintingInfo, paintFlags);
|
| -}
|
| -
|
| -void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
|
| -{
|
| - if (!hasSelfPaintingLayerDescendant())
|
| - return;
|
| -
|
| -#if ENABLE(ASSERT)
|
| - LayerListMutationDetector mutationChecker(m_stackingNode.get());
|
| -#endif
|
| -
|
| - RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
|
| - while (RenderLayerStackingNode* child = iterator.next()) {
|
| - child->layer()->paintLayer(context, paintingInfo, paintFlags);
|
| - }
|
| -}
|
| -
|
| -void RenderLayer::paintForeground(GraphicsContext* context, GraphicsContext* transparencyLayerContext,
|
| - const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo,
|
| - LayoutPoint& layerLocation, ClipRect& layerForegroundRect)
|
| -{
|
| - bool foregroundRectIsEmpty = layerForegroundRect.isEmpty();
|
| -
|
| - // Begin transparency if we have something to paint.
|
| - if (haveTransparency && !foregroundRectIsEmpty)
|
| - beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation);
|
| -
|
| - // Optimize clipping for the single fragment case.
|
| - bool shouldClip = localPaintingInfo.clipToDirtyRect && !foregroundRectIsEmpty;
|
| - if (shouldClip)
|
| - clipToRect(localPaintingInfo, context, layerForegroundRect);
|
| -
|
| - // TODO(ojan): We probably should early return at the beginning of this function
|
| - // if the rect is empty.
|
| - if (!foregroundRectIsEmpty) {
|
| - PaintInfo paintInfo(context, pixelSnappedIntRect(layerForegroundRect.rect()), localPaintingInfo.rootLayer->renderer());
|
| - renderer()->paint(paintInfo, layerLocation);
|
| - }
|
| -
|
| - if (shouldClip)
|
| - restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRect);
|
| -}
|
| -
|
| static inline LayoutRect frameVisibleRect(RenderObject* renderer)
|
| {
|
| FrameView* frameView = renderer->document().view();
|
|
|