Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/LayerPainter.h" | 6 #include "core/paint/LayerPainter.h" |
| 7 | 7 |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 #include "core/paint/FilterPainter.h" | |
| 10 #include "core/rendering/ClipPathOperation.h" | 11 #include "core/rendering/ClipPathOperation.h" |
| 11 #include "core/rendering/FilterEffectRenderer.h" | 12 #include "core/rendering/FilterEffectRenderer.h" |
| 12 #include "core/rendering/PaintInfo.h" | 13 #include "core/rendering/PaintInfo.h" |
| 13 #include "core/rendering/RenderBlock.h" | 14 #include "core/rendering/RenderBlock.h" |
| 14 #include "core/rendering/RenderLayer.h" | 15 #include "core/rendering/RenderLayer.h" |
| 15 #include "core/rendering/RenderView.h" | 16 #include "core/rendering/RenderView.h" |
| 16 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 17 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which | 270 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which |
| 270 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). | 271 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). |
| 271 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along | 272 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along |
| 272 // so it will be tested against as we descend through the renderers. | 273 // so it will be tested against as we descend through the renderers. |
| 273 RenderObject* paintingRootForRenderer = 0; | 274 RenderObject* paintingRootForRenderer = 0; |
| 274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) | 275 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) |
| 275 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 276 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
| 276 | 277 |
| 277 { // Begin block for the lifetime of any filter clip. | 278 { // Begin block for the lifetime of any filter clip. |
| 278 OwnPtr<ClipRecorder> clipRecorder; | 279 OwnPtr<ClipRecorder> clipRecorder; |
| 280 FilterPainter filterPainter(m_renderLayer); | |
| 279 if (haveFilterEffect) { | 281 if (haveFilterEffect) { |
| 280 ASSERT(m_renderLayer.filterInfo()); | 282 ASSERT(m_renderLayer.filterInfo()); |
| 281 | 283 |
| 282 if (!rootRelativeBoundsComputed) | 284 if (!rootRelativeBoundsComputed) |
| 283 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingR eflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 285 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingR eflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 284 | 286 |
| 285 // Do transparency and clipping before starting filter processing. | 287 // Do transparency and clipping before starting filter processing. |
| 286 if (haveTransparency) { | 288 if (haveTransparency) { |
| 287 // If we have a filter and transparency, we have to eagerly star t a transparency layer here, rather than risk a child layer lazily starts one af ter filter processing. | 289 // If we have a filter and transparency, we have to eagerly star t a transparency layer here, rather than risk a child layer lazily starts one af ter filter processing. |
| 288 beginTransparencyLayers(context, localPaintingInfo.rootLayer, pa intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); | 290 beginTransparencyLayers(context, localPaintingInfo.rootLayer, pa intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); |
| 289 } | 291 } |
| 290 | 292 |
| 291 // We'll handle clipping to the dirty rect before filter rasterizati on. | 293 // We'll handle clipping to the dirty rect before filter rasterizati on. |
| 292 // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. | 294 // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. |
| 293 // FIXME: It is incorrect to just clip to the damageRect here once m ultiple fragments are involved. | 295 // FIXME: It is incorrect to just clip to the damageRect here once m ultiple fragments are involved. |
| 294 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : la yerFragments[0].backgroundRect; | 296 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : la yerFragments[0].backgroundRect; |
| 295 | 297 |
| 296 if (needsToClip(localPaintingInfo, backgroundRect)) { | 298 if (needsToClip(localPaintingInfo, backgroundRect)) { |
| 297 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context , DisplayItem::ClipLayerFilter, backgroundRect)); | 299 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context , DisplayItem::ClipLayerFilter, backgroundRect)); |
| 298 applyRoundedRectClips(localPaintingInfo, context, backgroundRect , paintFlags, *clipRecorder); | 300 applyRoundedRectClips(localPaintingInfo, context, backgroundRect , paintFlags, *clipRecorder); |
| 299 } | 301 } |
| 300 | 302 |
| 301 // Subsequent code should not clip to the dirty rect, since we've al ready | 303 // Subsequent code should not clip to the dirty rect, since we've al ready |
| 302 // done it above, and doing it later will defeat the outsets. | 304 // done it above, and doing it later will defeat the outsets. |
| 303 localPaintingInfo.clipToDirtyRect = false; | 305 localPaintingInfo.clipToDirtyRect = false; |
| 304 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect (context, rootRelativeBounds); | 306 haveFilterEffect = filterPainter.beginFilterEffect(context, rootRela tiveBounds); |
| 305 if (!haveFilterEffect) { | 307 if (!haveFilterEffect) { |
| 306 // If the the filter failed to start, undo the clip immediately | 308 // If the the filter failed to start, undo the clip immediately |
| 307 clipRecorder.clear(); | 309 clipRecorder.clear(); |
| 308 } | 310 } |
| 309 } | 311 } |
| 310 | 312 |
| 311 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)) ; | 313 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)) ; |
| 312 | 314 |
| 313 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; | 315 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; |
| 314 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); | 316 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 340 | 342 |
| 341 if (shouldPaintNormalFlowAndPosZOrderLists) | 343 if (shouldPaintNormalFlowAndPosZOrderLists) |
| 342 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); | 344 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); |
| 343 | 345 |
| 344 if (shouldPaintOverlayScrollbars) | 346 if (shouldPaintOverlayScrollbars) |
| 345 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); | 347 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); |
| 346 | 348 |
| 347 if (haveFilterEffect) { | 349 if (haveFilterEffect) { |
| 348 // Apply the correct clipping (ie. overflow: hidden). | 350 // Apply the correct clipping (ie. overflow: hidden). |
| 349 // FIXME: It is incorrect to just clip to the damageRect here once m ultiple fragments are involved. | 351 // FIXME: It is incorrect to just clip to the damageRect here once m ultiple fragments are involved. |
| 350 m_renderLayer.filterRenderer()->endFilterEffect(context); | 352 filterPainter.endFilterEffect(context); |
|
mstensho (USE GERRIT)
2014/11/11 08:15:29
Can't you just have ~FilterPainter() do this job,
| |
| 351 } | 353 } |
| 352 } // Filter clip block | 354 } // Filter clip block |
| 353 | 355 |
| 354 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; | 356 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; |
| 355 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; | 357 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; |
| 356 | 358 |
| 357 if (shouldPaintMask) | 359 if (shouldPaintMask) |
| 358 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); | 360 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); |
| 359 | 361 |
| 360 if (shouldPaintClippingMask) { | 362 if (shouldPaintClippingMask) { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, DisplayItem::ClipLayerFragmentParent, clipRect)); | 848 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, DisplayItem::ClipLayerFragmentParent, clipRect)); |
| 847 // FIXME: why should we have to deal with rounded rect clips here at all? | 849 // FIXME: why should we have to deal with rounded rect clips here at all? |
| 848 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder); | 850 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder); |
| 849 } | 851 } |
| 850 | 852 |
| 851 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 853 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
| 852 } | 854 } |
| 853 } | 855 } |
| 854 | 856 |
| 855 } // namespace blink | 857 } // namespace blink |
| OLD | NEW |