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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 if (m_renderLayer.parent()) { | 96 if (m_renderLayer.parent()) { |
| 96 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore OverlayScrollbarSize); | 97 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore OverlayScrollbarSize); |
| 97 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) | 98 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) |
| 98 clipRectsContext.setIgnoreOverflowClip(); | 99 clipRectsContext.setIgnoreOverflowClip(); |
| 99 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte xt); | 100 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte xt); |
| 100 clipRect.intersect(paintingInfo.paintDirtyRect); | 101 clipRect.intersect(paintingInfo.paintDirtyRect); |
| 101 | 102 |
| 102 if (needsToClip(paintingInfo, clipRect)) { | 103 if (needsToClip(paintingInfo, clipRect)) { |
| 103 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), context, DisplayItem::ClipLayerParent, clipRect)); | 104 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), context, DisplayItem::ClipLayerParent, clipRect)); |
| 104 if (clipRect.hasRadius()) | 105 if (clipRect.hasRadius()) |
| 105 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips( paintingInfo, context, paintFlags, *clipRecorder); | 106 applyRoundedRectClips(*m_renderLayer.parent(), paintingInfo, context, paintFlags, *clipRecorder); |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 110 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
| 110 | 111 |
| 111 return; | 112 return; |
| 112 } | 113 } |
| 113 | 114 |
| 114 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 115 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
| 115 } | 116 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 } | 247 } |
| 247 | 248 |
| 248 // Blending operations must be performed only with the nearest ancestor stac king context. | 249 // Blending operations must be performed only with the nearest ancestor stac king context. |
| 249 // Note that there is no need to create a transparency layer if we're painti ng the root. | 250 // Note that there is no need to create a transparency layer if we're painti ng the root. |
| 250 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa yer.hasNonIsolatedDescendantWithBlendMode(); | 251 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa yer.hasNonIsolatedDescendantWithBlendMode(); |
| 251 | 252 |
| 252 if (createTransparencyLayerForBlendMode) | 253 if (createTransparencyLayerForBlendMode) |
| 253 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); | 254 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
| 254 | 255 |
| 255 LayerPaintingInfo localPaintingInfo(paintingInfo); | 256 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 256 bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.pain tsWithFilters(); | |
| 257 | 257 |
| 258 LayerFragments layerFragments; | 258 LayerFragments layerFragments; |
| 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
| 260 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. | 260 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. |
| 261 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, | 261 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, |
| 262 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, | 262 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, |
| 263 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); | 263 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 264 if (shouldPaintContent) | 264 if (shouldPaintContent) |
| 265 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); | 265 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); |
| 266 } | 266 } |
| 267 | 267 |
| 268 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; | 268 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; |
| 269 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which | 269 // 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). | 270 // 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 | 271 // 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. | 272 // so it will be tested against as we descend through the renderers. |
| 273 RenderObject* paintingRootForRenderer = 0; | 273 RenderObject* paintingRootForRenderer = 0; |
| 274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) | 274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) |
| 275 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 275 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
| 276 | 276 |
| 277 { // Begin block for the lifetime of any filter clip. | 277 { // Begin block for the lifetime of any filter. |
| 278 OwnPtr<ClipRecorder> clipRecorder; | 278 OwnPtr<FilterPainter> filterPainter; |
| 279 if (haveFilterEffect) { | 279 if (m_renderLayer.filterRenderer() && m_renderLayer.paintsWithFilters()) { |
| 280 ASSERT(m_renderLayer.filterInfo()); | 280 ASSERT(m_renderLayer.filterInfo()); |
| 281 | 281 |
| 282 if (!rootRelativeBoundsComputed) | 282 if (!rootRelativeBoundsComputed) |
| 283 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingR eflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 283 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingR eflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 284 | 284 |
| 285 // Do transparency and clipping before starting filter processing. | 285 // Do transparency and clipping before starting filter processing. |
| 286 if (haveTransparency) { | 286 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. | 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. |
| 288 beginTransparencyLayers(context, localPaintingInfo.rootLayer, pa intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); | 288 beginTransparencyLayers(context, localPaintingInfo.rootLayer, pa intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // We'll handle clipping to the dirty rect before filter rasterizati on. | 291 // 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. | 292 // 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. | 293 // 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; | 294 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : la yerFragments[0].backgroundRect; |
| 295 | 295 |
| 296 if (needsToClip(localPaintingInfo, backgroundRect)) { | |
| 297 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context , DisplayItem::ClipLayerFilter, backgroundRect)); | |
| 298 if (backgroundRect.hasRadius()) | |
| 299 applyRoundedRectClips(localPaintingInfo, context, paintFlags , *clipRecorder); | |
| 300 } | |
| 301 | |
| 302 // Subsequent code should not clip to the dirty rect, since we've al ready | 296 // Subsequent code should not clip to the dirty rect, since we've al ready |
| 303 // done it above, and doing it later will defeat the outsets. | 297 // done it above, and doing it later will defeat the outsets. |
| 304 localPaintingInfo.clipToDirtyRect = false; | 298 localPaintingInfo.clipToDirtyRect = false; |
| 305 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect (context, rootRelativeBounds); | 299 filterPainter = adoptPtr(new FilterPainter(m_renderLayer, context, r ootRelativeBounds, backgroundRect, localPaintingInfo, paintFlags)); |
| 306 if (!haveFilterEffect) { | |
| 307 // If the the filter failed to start, undo the clip immediately | |
| 308 clipRecorder.clear(); | |
| 309 } | |
| 310 } | 300 } |
| 311 | 301 |
| 312 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)) ; | 302 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)) ; |
| 313 | 303 |
| 314 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; | 304 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; |
| 315 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); | 305 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); |
| 316 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; | 306 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; |
| 317 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; | 307 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; |
| 318 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 308 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
| 319 | 309 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 337 } | 327 } |
| 338 | 328 |
| 339 if (shouldPaintOutline) | 329 if (shouldPaintOutline) |
| 340 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); | 330 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); |
| 341 | 331 |
| 342 if (shouldPaintNormalFlowAndPosZOrderLists) | 332 if (shouldPaintNormalFlowAndPosZOrderLists) |
| 343 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); | 333 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); |
| 344 | 334 |
| 345 if (shouldPaintOverlayScrollbars) | 335 if (shouldPaintOverlayScrollbars) |
| 346 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); | 336 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); |
| 347 | |
| 348 if (haveFilterEffect) { | |
| 349 // Apply the correct clipping (ie. overflow: hidden). | |
| 350 // FIXME: It is incorrect to just clip to the damageRect here once m ultiple fragments are involved. | |
| 351 m_renderLayer.filterRenderer()->endFilterEffect(context); | |
| 352 } | |
| 353 } // Filter clip block | 337 } // Filter clip block |
|
Stephen White
2014/11/11 22:20:55
Nit: maybe we should change this to FilterPainter
chrishtr
2014/11/11 22:22:42
Done.
| |
| 354 | 338 |
| 355 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; | 339 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; |
| 356 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; | 340 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; |
| 357 | 341 |
| 358 if (shouldPaintMask) | 342 if (shouldPaintMask) |
| 359 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); | 343 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); |
| 360 | 344 |
| 361 if (shouldPaintClippingMask) { | 345 if (shouldPaintClippingMask) { |
| 362 // Paint the border radius mask for the fragments. | 346 // Paint the border radius mask for the fragments. |
| 363 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer, paintFlags); | 347 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer, paintFlags); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 387 } | 371 } |
| 388 | 372 |
| 389 return false; | 373 return false; |
| 390 } | 374 } |
| 391 | 375 |
| 392 bool LayerPainter::needsToClip(const LayerPaintingInfo& localPaintingInfo, const ClipRect& clipRect) | 376 bool LayerPainter::needsToClip(const LayerPaintingInfo& localPaintingInfo, const ClipRect& clipRect) |
| 393 { | 377 { |
| 394 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); | 378 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); |
| 395 } | 379 } |
| 396 | 380 |
| 397 void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingI nfo, GraphicsContext* context, PaintLayerFlags paintFlags, ClipRecorder& clipRec order, BorderRadiusClippingRule rule) | 381 void LayerPainter::applyRoundedRectClips(RenderLayer& renderLayer, const LayerPa intingInfo& localPaintingInfo, GraphicsContext* context, |
| 382 PaintLayerFlags paintFlags, ClipRecorder& clipRecorder, BorderRadiusClipping Rule rule) | |
| 398 { | 383 { |
| 399 // If the clip rect has been tainted by a border radius, then we have to wal k up our layer chain applying the clips from | 384 // If the clip rect has been tainted by a border radius, then we have to wal k up our layer chain applying the clips from |
| 400 // any layers with overflow. The condition for being able to apply these cli ps is that the overflow object be in our | 385 // any layers with overflow. The condition for being able to apply these cli ps is that the overflow object be in our |
| 401 // containing block chain so we check that also. | 386 // containing block chain so we check that also. |
| 402 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_renderLaye r : m_renderLayer.parent(); layer; layer = layer->parent()) { | 387 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &renderLayer : renderLayer.parent(); layer; layer = layer->parent()) { |
| 403 // Composited scrolling layers handle border-radius clip in the composit or via a mask layer. We do not | 388 // Composited scrolling layers handle border-radius clip in the composit or via a mask layer. We do not |
| 404 // want to apply a border-radius clip to the layer contents itself, beca use that would require re-rastering | 389 // want to apply a border-radius clip to the layer contents itself, beca use that would require re-rastering |
| 405 // every frame to update the clip. We only want to make sure that the ma sk layer is properly clipped so | 390 // every frame to update the clip. We only want to make sure that the ma sk layer is properly clipped so |
| 406 // that it can in turn clip the scrolled contents in the compositor. | 391 // that it can in turn clip the scrolled contents in the compositor. |
| 407 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti ngChildClippingMaskPhase)) | 392 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti ngChildClippingMaskPhase)) |
| 408 break; | 393 break; |
| 409 | 394 |
| 410 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()-> hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) { | 395 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()-> hasBorderRadius() && inContainingBlockChain(&renderLayer, layer)) { |
| 411 LayoutPoint delta; | 396 LayoutPoint delta; |
| 412 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); | 397 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); |
| 413 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size()))); | 398 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size()))); |
| 414 } | 399 } |
| 415 | 400 |
| 416 if (layer == localPaintingInfo.rootLayer) | 401 if (layer == localPaintingInfo.rootLayer) |
| 417 break; | 402 break; |
| 418 } | 403 } |
| 419 } | 404 } |
| 420 | 405 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) | 501 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) |
| 517 { | 502 { |
| 518 for (size_t i = 0; i < layerFragments.size(); ++i) { | 503 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 519 const LayerFragment& fragment = layerFragments.at(i); | 504 const LayerFragment& fragment = layerFragments.at(i); |
| 520 | 505 |
| 521 OwnPtr<ClipRecorder> clipRecorder; | 506 OwnPtr<ClipRecorder> clipRecorder; |
| 522 | 507 |
| 523 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 508 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| 524 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Di splayItem::ClipLayerOverflowControls, fragment.backgroundRect)); | 509 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Di splayItem::ClipLayerOverflowControls, fragment.backgroundRect)); |
| 525 if (fragment.backgroundRect.hasRadius()) | 510 if (fragment.backgroundRect.hasRadius()) |
| 526 applyRoundedRectClips(localPaintingInfo, context, paintFlags, *c lipRecorder); | 511 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, paintFlags, *clipRecorder); |
| 527 } | 512 } |
| 528 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) | 513 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) |
| 529 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - m_renderLayer.renderBoxLocation() + subPixe lAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, m_renderLayer.comp ositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); | 514 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - m_renderLayer.renderBoxLocation() + subPixe lAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, m_renderLayer.comp ositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); |
| 530 } | 515 } |
| 531 } | 516 } |
| 532 | 517 |
| 533 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) | 518 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) |
| 534 { | 519 { |
| 535 RenderView* view = renderer->view(); | 520 RenderView* view = renderer->view(); |
| 536 RenderLayerModelObject* prevBlock = renderer; | 521 RenderLayerModelObject* prevBlock = renderer; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 break; | 690 break; |
| 706 case PaintPhaseClippingMask: | 691 case PaintPhaseClippingMask: |
| 707 clipType = DisplayItem::ClipLayerFragmentClippingMask; | 692 clipType = DisplayItem::ClipLayerFragmentClippingMask; |
| 708 break; | 693 break; |
| 709 default: | 694 default: |
| 710 ASSERT_NOT_REACHED(); | 695 ASSERT_NOT_REACHED(); |
| 711 } | 696 } |
| 712 | 697 |
| 713 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, clipTy pe, clipRect)); | 698 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, clipTy pe, clipRect)); |
| 714 if (clipRect.hasRadius()) | 699 if (clipRect.hasRadius()) |
| 715 applyRoundedRectClips(paintingInfo, context, paintFlags, *clipRecord er, clippingRule); | 700 applyRoundedRectClips(m_renderLayer, paintingInfo, context, paintFla gs, *clipRecorder, clippingRule); |
| 716 } | 701 } |
| 717 | 702 |
| 718 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); | 703 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); |
| 719 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 704 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 720 } | 705 } |
| 721 | 706 |
| 722 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 707 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
| 723 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 708 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| 724 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 709 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 725 { | 710 { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 747 } | 732 } |
| 748 } | 733 } |
| 749 | 734 |
| 750 // Optimize clipping for the single fragment case. | 735 // Optimize clipping for the single fragment case. |
| 751 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); | 736 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); |
| 752 ClipState clipState = HasNotClipped; | 737 ClipState clipState = HasNotClipped; |
| 753 OwnPtr<ClipRecorder> clipRecorder; | 738 OwnPtr<ClipRecorder> clipRecorder; |
| 754 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { | 739 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { |
| 755 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Displa yItem::ClipLayerForeground, layerFragments[0].foregroundRect)); | 740 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Displa yItem::ClipLayerForeground, layerFragments[0].foregroundRect)); |
| 756 if (layerFragments[0].foregroundRect.hasRadius()) | 741 if (layerFragments[0].foregroundRect.hasRadius()) |
| 757 applyRoundedRectClips(localPaintingInfo, context, paintFlags, *clipR ecorder); | 742 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, pai ntFlags, *clipRecorder); |
| 758 clipState = HasClipped; | 743 clipState = HasClipped; |
| 759 } | 744 } |
| 760 | 745 |
| 761 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for | 746 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for |
| 762 // interleaving of the fragments to work properly. | 747 // interleaving of the fragments to work properly. |
| 763 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, | 748 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, |
| 764 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState); | 749 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState); |
| 765 | 750 |
| 766 if (!selectionOnly) { | 751 if (!selectionOnly) { |
| 767 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl ipState); | 752 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl ipState); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 | 828 |
| 844 OwnPtr<ClipRecorder> clipRecorder; | 829 OwnPtr<ClipRecorder> clipRecorder; |
| 845 if (needsToClip(paintingInfo, clipRect)) | 830 if (needsToClip(paintingInfo, clipRect)) |
| 846 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, DisplayItem::ClipLayerFragmentParent, clipRect)); | 831 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, DisplayItem::ClipLayerFragmentParent, clipRect)); |
| 847 | 832 |
| 848 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 833 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
| 849 } | 834 } |
| 850 } | 835 } |
| 851 | 836 |
| 852 } // namespace blink | 837 } // namespace blink |
| OLD | NEW |