| Index: Source/core/paint/LayerPainter.cpp
|
| diff --git a/Source/core/paint/LayerPainter.cpp b/Source/core/paint/LayerPainter.cpp
|
| index 1ca2e32ed7f073085436266a76309bb76974c354..60315947c3deb9f7f5ca1b85e77ce6309af1f8da 100644
|
| --- a/Source/core/paint/LayerPainter.cpp
|
| +++ b/Source/core/paint/LayerPainter.cpp
|
| @@ -7,6 +7,7 @@
|
|
|
| #include "core/frame/Settings.h"
|
| #include "core/page/Page.h"
|
| +#include "core/paint/FilterPainter.h"
|
| #include "core/rendering/ClipPathOperation.h"
|
| #include "core/rendering/FilterEffectRenderer.h"
|
| #include "core/rendering/PaintInfo.h"
|
| @@ -102,7 +103,7 @@ void LayerPainter::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
|
| if (needsToClip(paintingInfo, clipRect)) {
|
| clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), context, DisplayItem::ClipLayerParent, clipRect));
|
|
|
| - LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(paintingInfo, context, clipRect, paintFlags, *clipRecorder);
|
| + applyRoundedRectClips(*m_renderLayer.parent(), paintingInfo, context, clipRect, paintFlags, *clipRecorder);
|
| }
|
| }
|
|
|
| @@ -253,7 +254,6 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
|
| beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior);
|
|
|
| LayerPaintingInfo localPaintingInfo(paintingInfo);
|
| - bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.paintsWithFilters();
|
|
|
| LayerFragments layerFragments;
|
| if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
|
| @@ -274,9 +274,9 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
|
| if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendantOf(localPaintingInfo.paintingRoot))
|
| paintingRootForRenderer = localPaintingInfo.paintingRoot;
|
|
|
| - { // Begin block for the lifetime of any filter clip.
|
| - OwnPtr<ClipRecorder> clipRecorder;
|
| - if (haveFilterEffect) {
|
| + { // Begin block for the lifetime of any filter.
|
| + OwnPtr<FilterPainter> filterPainter;
|
| + if (m_renderLayer.filterRenderer() && m_renderLayer.paintsWithFilters()) {
|
| ASSERT(m_renderLayer.filterInfo());
|
|
|
| if (!rootRelativeBoundsComputed)
|
| @@ -293,19 +293,10 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
|
| // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved.
|
| ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect;
|
|
|
| - if (needsToClip(localPaintingInfo, backgroundRect)) {
|
| - clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, DisplayItem::ClipLayerFilter, backgroundRect));
|
| - applyRoundedRectClips(localPaintingInfo, context, backgroundRect, paintFlags, *clipRecorder);
|
| - }
|
| -
|
| // 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;
|
| - haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect(context, rootRelativeBounds);
|
| - if (!haveFilterEffect) {
|
| - // If the the filter failed to start, undo the clip immediately
|
| - clipRecorder.clear();
|
| - }
|
| + filterPainter = adoptPtr(new FilterPainter(m_renderLayer, context, rootRelativeBounds, backgroundRect, localPaintingInfo, paintFlags));
|
| }
|
|
|
| ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText));
|
| @@ -343,12 +334,6 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
|
|
|
| if (shouldPaintOverlayScrollbars)
|
| paintOverflowControlsForFragments(layerFragments, context, localPaintingInfo, paintFlags);
|
| -
|
| - if (haveFilterEffect) {
|
| - // Apply the correct clipping (ie. overflow: hidden).
|
| - // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved.
|
| - m_renderLayer.filterRenderer()->endFilterEffect(context);
|
| - }
|
| } // Filter clip block
|
|
|
| bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly;
|
| @@ -393,7 +378,7 @@ bool LayerPainter::needsToClip(const LayerPaintingInfo& localPaintingInfo, const
|
| return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRadius();
|
| }
|
|
|
| -void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingInfo, GraphicsContext* context, const ClipRect& clipRect,
|
| +void LayerPainter::applyRoundedRectClips(RenderLayer& renderLayer, const LayerPaintingInfo& localPaintingInfo, GraphicsContext* context, const ClipRect& clipRect,
|
| PaintLayerFlags paintFlags, ClipRecorder& clipRecorder, BorderRadiusClippingRule rule)
|
| {
|
| if (!clipRect.hasRadius())
|
| @@ -402,7 +387,7 @@ void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingI
|
| // If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from
|
| // any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our
|
| // containing block chain so we check that also.
|
| - for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_renderLayer : m_renderLayer.parent(); layer; layer = layer->parent()) {
|
| + for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &renderLayer : renderLayer.parent(); layer; layer = layer->parent()) {
|
| // Composited scrolling layers handle border-radius clip in the compositor via a mask layer. We do not
|
| // want to apply a border-radius clip to the layer contents itself, because that would require re-rastering
|
| // every frame to update the clip. We only want to make sure that the mask layer is properly clipped so
|
| @@ -410,7 +395,7 @@ void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingI
|
| if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))
|
| break;
|
|
|
| - if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) {
|
| + if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->hasBorderRadius() && inContainingBlockChain(&renderLayer, layer)) {
|
| LayoutPoint delta;
|
| layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta);
|
| clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRoundedInnerBorderFor(LayoutRect(delta, layer->size())));
|
| @@ -525,7 +510,7 @@ void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
|
|
|
| if (needsToClip(localPaintingInfo, fragment.backgroundRect)) {
|
| clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect));
|
| - applyRoundedRectClips(localPaintingInfo, context, fragment.backgroundRect, paintFlags, *clipRecorder);
|
| + applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, fragment.backgroundRect, paintFlags, *clipRecorder);
|
| }
|
| if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollableArea())
|
| scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
|
| @@ -713,7 +698,7 @@ void LayerPainter::paintFragmentWithPhase(PaintPhase phase, const LayerFragment&
|
| }
|
|
|
| clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, clipType, clipRect));
|
| - applyRoundedRectClips(paintingInfo, context, clipRect, paintFlags, *clipRecorder, clippingRule);
|
| + applyRoundedRectClips(m_renderLayer, paintingInfo, context, clipRect, paintFlags, *clipRecorder, clippingRule);
|
| }
|
|
|
| PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, paintBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer());
|
| @@ -754,7 +739,7 @@ void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme
|
| OwnPtr<ClipRecorder> clipRecorder;
|
| if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroundRect)) {
|
| clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect));
|
| - applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags, *clipRecorder);
|
| + applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags, *clipRecorder);
|
| clipState = HasClipped;
|
| }
|
|
|
| @@ -845,7 +830,7 @@ void LayerPainter::paintTransformedLayerIntoFragments(GraphicsContext* context,
|
| if (needsToClip(paintingInfo, clipRect)) {
|
| clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), context, DisplayItem::ClipLayerFragmentParent, clipRect));
|
| // FIXME: why should we have to deal with rounded rect clips here at all?
|
| - LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(paintingInfo, context, clipRect, paintFlags, *clipRecorder);
|
| + applyRoundedRectClips(*m_renderLayer.parent(), paintingInfo, context, clipRect, paintFlags, *clipRecorder);
|
| }
|
|
|
| paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset);
|
|
|