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/rendering/ClipPathOperation.h" | 10 #include "core/rendering/ClipPathOperation.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 LayerPainter(*m_renderLayer.parent()).beginTransparencyLayers(co ntext, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixe lAccumulation, paintingInfo.paintBehavior); | 81 LayerPainter(*m_renderLayer.parent()).beginTransparencyLayers(co ntext, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixe lAccumulation, paintingInfo.paintBehavior); |
82 else | 82 else |
83 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav ior); | 83 beginTransparencyLayers(context, paintingInfo.rootLayer, paintin gInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehav ior); |
84 } | 84 } |
85 | 85 |
86 if (m_renderLayer.enclosingPaginationLayer()) { | 86 if (m_renderLayer.enclosingPaginationLayer()) { |
87 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags ); | 87 paintTransformedLayerIntoFragments(context, paintingInfo, paintFlags ); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erParent); | |
92 PaintClipRecorder* paintClipRecorderPtr = 0; | |
93 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
94 paintClipRecorderPtr = &paintClipRecorder; | |
95 | |
91 // Make sure the parent's clip rects have been calculated. | 96 // Make sure the parent's clip rects have been calculated. |
92 ClipRect clipRect = paintingInfo.paintDirtyRect; | 97 ClipRect clipRect = paintingInfo.paintDirtyRect; |
93 if (m_renderLayer.parent()) { | 98 if (m_renderLayer.parent()) { |
94 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore OverlayScrollbarSize); | 99 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore OverlayScrollbarSize); |
95 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) | 100 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) |
96 clipRectsContext.setIgnoreOverflowClip(); | 101 clipRectsContext.setIgnoreOverflowClip(); |
97 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte xt); | 102 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte xt); |
98 clipRect.intersect(paintingInfo.paintDirtyRect); | 103 clipRect.intersect(paintingInfo.paintDirtyRect); |
99 | 104 |
100 // Push the parent coordinate space's clip. | 105 // Push the parent coordinate space's clip. |
101 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, conte xt, clipRect, paintFlags); | 106 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, conte xt, clipRect, paintFlags, paintClipRecorderPtr); |
102 } | 107 } |
103 | 108 |
104 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 109 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
105 | 110 |
106 // Restore the clip. | 111 // Restore the clip. |
107 if (m_renderLayer.parent()) | 112 if (m_renderLayer.parent()) |
108 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingI nfo.paintDirtyRect, clipRect); | 113 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingI nfo.paintDirtyRect, clipRect, paintClipRecorderPtr); |
109 | 114 |
110 return; | 115 return; |
111 } | 116 } |
112 | 117 |
113 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 118 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
114 } | 119 } |
115 | 120 |
116 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA ccumulation, PaintBehavior paintBehavior) | 121 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA ccumulation, PaintBehavior paintBehavior) |
117 { | 122 { |
118 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS tackingContext() && m_renderLayer.hasDescendantWithBlendMode(); | 123 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS tackingContext() && m_renderLayer.hasDescendantWithBlendMode(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 LayerFragments layerFragments; | 263 LayerFragments layerFragments; |
259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 264 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
260 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each | 265 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each |
261 // fragment should paint. | 266 // fragment should paint. |
262 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, | 267 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, |
263 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, | 268 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, |
264 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); | 269 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); |
265 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); | 270 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); |
266 } | 271 } |
267 | 272 |
273 PaintClipRecorder filterPaintClipRecorder(&m_renderLayer, ClipDisplayItem::L ayerFilter); | |
274 PaintClipRecorder* filterPaintClipRecorderPtr = 0; | |
275 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
276 filterPaintClipRecorderPtr = &filterPaintClipRecorder; | |
277 | |
268 if (haveFilterEffect) { | 278 if (haveFilterEffect) { |
269 ASSERT(m_renderLayer.filterInfo()); | 279 ASSERT(m_renderLayer.filterInfo()); |
270 | 280 |
271 if (!rootRelativeBoundsComputed) | 281 if (!rootRelativeBoundsComputed) |
272 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingRefle ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 282 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingRefle ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
273 | 283 |
274 // Do transparency and clipping before starting filter processing. | 284 // Do transparency and clipping before starting filter processing. |
275 if (haveTransparency) { | 285 if (haveTransparency) { |
276 // 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. | 286 // 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. |
277 beginTransparencyLayers(context, localPaintingInfo.rootLayer, painti ngInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo.pain tBehavior); | 287 beginTransparencyLayers(context, localPaintingInfo.rootLayer, painti ngInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo.pain tBehavior); |
278 } | 288 } |
289 | |
279 // We'll handle clipping to the dirty rect before filter rasterization. | 290 // We'll handle clipping to the dirty rect before filter rasterization. |
280 // Filter processing will automatically expand the clip rect and the off screen to accommodate any filter outsets. | 291 // Filter processing will automatically expand the clip rect and the off screen to accommodate any filter outsets. |
281 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved. | 292 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved. |
282 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect; | 293 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect; |
283 clipToRect(localPaintingInfo, context, backgroundRect, paintFlags); | 294 clipToRect(localPaintingInfo, context, backgroundRect, paintFlags, filte rPaintClipRecorderPtr); |
284 // Subsequent code should not clip to the dirty rect, since we've alread y | 295 // Subsequent code should not clip to the dirty rect, since we've alread y |
285 // done it above, and doing it later will defeat the outsets. | 296 // done it above, and doing it later will defeat the outsets. |
286 localPaintingInfo.clipToDirtyRect = false; | 297 localPaintingInfo.clipToDirtyRect = false; |
287 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect(con text, rootRelativeBounds); | 298 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect(con text, rootRelativeBounds); |
288 if (!haveFilterEffect) { | 299 if (!haveFilterEffect) { |
289 // If the the filter failed to start, undo the clip immediately | 300 // If the the filter failed to start, undo the clip immediately |
290 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRec t); | 301 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRec t, filterPaintClipRecorderPtr); |
291 } | 302 } |
292 } | 303 } |
293 | 304 |
294 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which | 305 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which |
295 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). | 306 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). |
296 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along | 307 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along |
297 // so it will be tested against as we descend through the renderers. | 308 // so it will be tested against as we descend through the renderers. |
298 RenderObject* paintingRootForRenderer = 0; | 309 RenderObject* paintingRootForRenderer = 0; |
299 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) | 310 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) |
300 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 311 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, pain tingInfo, paintFlags); | 347 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, pain tingInfo, paintFlags); |
337 | 348 |
338 if (shouldPaintOverlayScrollbars) | 349 if (shouldPaintOverlayScrollbars) |
339 paintOverflowControlsForFragments(layerFragments, context, localPainting Info, paintFlags); | 350 paintOverflowControlsForFragments(layerFragments, context, localPainting Info, paintFlags); |
340 | 351 |
341 if (haveFilterEffect) { | 352 if (haveFilterEffect) { |
342 // Apply the correct clipping (ie. overflow: hidden). | 353 // Apply the correct clipping (ie. overflow: hidden). |
343 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved. | 354 // FIXME: It is incorrect to just clip to the damageRect here once multi ple fragments are involved. |
344 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect; | 355 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF ragments[0].backgroundRect; |
345 m_renderLayer.filterRenderer()->endFilterEffect(context); | 356 m_renderLayer.filterRenderer()->endFilterEffect(context); |
346 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRect); | 357 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRect, f ilterPaintClipRecorderPtr); |
347 } | 358 } |
348 | 359 |
349 if (shouldPaintMask) | 360 if (shouldPaintMask) |
350 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); | 361 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer, paintFlags); |
351 | 362 |
352 if (shouldPaintClippingMask) { | 363 if (shouldPaintClippingMask) { |
353 // Paint the border radius mask for the fragments. | 364 // Paint the border radius mask for the fragments. |
354 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer, paintFlags); | 365 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer, paintFlags); |
355 } | 366 } |
356 | 367 |
(...skipping 17 matching lines...) Expand all Loading... | |
374 RenderView* view = startLayer->renderer()->view(); | 385 RenderView* view = startLayer->renderer()->view(); |
375 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock(); currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo ck()) { | 386 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock(); currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo ck()) { |
376 if (currentBlock->layer() == endLayer) | 387 if (currentBlock->layer() == endLayer) |
377 return true; | 388 return true; |
378 } | 389 } |
379 | 390 |
380 return false; | 391 return false; |
381 } | 392 } |
382 | 393 |
383 void LayerPainter::clipToRect(const LayerPaintingInfo& localPaintingInfo, Graphi csContext* context, const ClipRect& clipRect, | 394 void LayerPainter::clipToRect(const LayerPaintingInfo& localPaintingInfo, Graphi csContext* context, const ClipRect& clipRect, |
384 PaintLayerFlags paintFlags, BorderRadiusClippingRule rule) | 395 PaintLayerFlags paintFlags, PaintClipRecorder* paintClipRecorder, BorderRadi usClippingRule rule) |
385 { | 396 { |
386 if (clipRect.rect() == localPaintingInfo.paintDirtyRect && !clipRect.hasRadi us()) | 397 if (clipRect.rect() == localPaintingInfo.paintDirtyRect && !clipRect.hasRadi us()) |
387 return; | 398 return; |
388 context->save(); | |
389 context->clip(pixelSnappedIntRect(clipRect.rect())); | |
390 | 399 |
391 if (!clipRect.hasRadius()) | 400 IntRect pixelSnappedRect = pixelSnappedIntRect(clipRect.rect()); |
392 return; | |
393 | 401 |
394 // 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 | 402 if (paintClipRecorder) { |
leviw_travelin_and_unemployed
2014/10/15 18:51:39
Putting this if everywhere that calls clip seems u
| |
395 // any layers with overflow. The condition for being able to apply these cli ps is that the overflow object be in our | 403 paintClipRecorder->setClipRect(pixelSnappedRect); |
396 // containing block chain so we check that also. | 404 } else { |
397 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_renderLaye r : m_renderLayer.parent(); layer; layer = layer->parent()) { | 405 context->save(); |
398 // Composited scrolling layers handle border-radius clip in the composit or via a mask layer. We do not | 406 context->clip(pixelSnappedIntRect(clipRect.rect())); |
399 // want to apply a border-radius clip to the layer contents itself, beca use that would require re-rastering | 407 } |
400 // every frame to update the clip. We only want to make sure that the ma sk layer is properly clipped so | |
401 // that it can in turn clip the scrolled contents in the compositor. | |
402 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti ngChildClippingMaskPhase)) | |
403 break; | |
404 | 408 |
405 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()-> hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) { | 409 if (clipRect.hasRadius()) { |
406 LayoutPoint delta; | 410 // If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from |
407 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); | 411 // any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our |
408 context->clipRoundedRect(layer->renderer()->style()->getRoundedInner BorderFor(LayoutRect(delta, layer->size()))); | 412 // containing block chain so we check that also. |
413 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_render Layer : m_renderLayer.parent(); layer; layer = layer->parent()) { | |
414 // Composited scrolling layers handle border-radius clip in the comp ositor via a mask layer. We do not | |
415 // want to apply a border-radius clip to the layer contents itself, because that would require re-rastering | |
416 // every frame to update the clip. We only want to make sure that th e mask layer is properly clipped so | |
417 // that it can in turn clip the scrolled contents in the compositor. | |
418 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPa intingChildClippingMaskPhase)) | |
419 break; | |
420 | |
421 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style ()->hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) { | |
422 LayoutPoint delta; | |
423 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); | |
424 RoundedRect roundedRect = layer->renderer()->style()->getRounded InnerBorderFor(LayoutRect(delta, layer->size())); | |
425 if (paintClipRecorder) | |
426 paintClipRecorder->addRoundedRectClip(roundedRect); | |
427 else | |
428 context->clipRoundedRect(roundedRect); | |
429 } | |
430 | |
431 if (layer == localPaintingInfo.rootLayer) | |
432 break; | |
409 } | 433 } |
434 } | |
410 | 435 |
411 if (layer == localPaintingInfo.rootLayer) | 436 if (paintClipRecorder) |
leviw_travelin_and_unemployed
2014/10/15 18:51:39
Why is it okay to unbalance this with the calls to
| |
412 break; | 437 paintClipRecorder->endClip(); |
413 } | |
414 } | 438 } |
415 | 439 |
416 void LayerPainter::restoreClip(GraphicsContext* context, const LayoutRect& paint DirtyRect, const ClipRect& clipRect) | 440 void LayerPainter::restoreClip(GraphicsContext* context, const LayoutRect& paint DirtyRect, const ClipRect& clipRect, PaintClipRecorder* paintClipRecorder = 0) |
417 { | 441 { |
418 if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius()) | 442 if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius()) |
419 return; | 443 return; |
420 context->restore(); | 444 if (paintClipRecorder) |
445 paintClipRecorder->endClip(); | |
446 else | |
447 context->restore(); | |
421 } | 448 } |
422 | 449 |
423 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, | 450 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, |
424 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) | 451 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) |
425 { | 452 { |
426 ASSERT(offsetFromRoot); | 453 ASSERT(offsetFromRoot); |
427 for (size_t i = 0; i < fragments.size(); ++i) { | 454 for (size_t i = 0; i < fragments.size(); ++i) { |
428 LayerFragment& fragment = fragments.at(i); | 455 LayerFragment& fragment = fragments.at(i); |
429 fragment.shouldPaintContent = shouldPaintContent; | 456 fragment.shouldPaintContent = shouldPaintContent; |
430 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) { | 457 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 // Only apply the sub-pixel accumulation if we don't paint into our own back ing layer, otherwise the position | 532 // Only apply the sub-pixel accumulation if we don't paint into our own back ing layer, otherwise the position |
506 // of the renderer already includes any sub-pixel offset. | 533 // of the renderer already includes any sub-pixel offset. |
507 if (compositingState == PaintsIntoOwnBacking) | 534 if (compositingState == PaintsIntoOwnBacking) |
508 return LayoutSize(); | 535 return LayoutSize(); |
509 return subPixelAccumulation; | 536 return subPixelAccumulation; |
510 } | 537 } |
511 | 538 |
512 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) | 539 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) |
513 { | 540 { |
514 for (size_t i = 0; i < layerFragments.size(); ++i) { | 541 for (size_t i = 0; i < layerFragments.size(); ++i) { |
542 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erOverflowControls); | |
543 PaintClipRecorder* paintClipRecorderPtr = 0; | |
544 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
545 paintClipRecorderPtr = &paintClipRecorder; | |
546 | |
515 const LayerFragment& fragment = layerFragments.at(i); | 547 const LayerFragment& fragment = layerFragments.at(i); |
516 clipToRect(localPaintingInfo, context, fragment.backgroundRect, paintFla gs); | 548 |
549 clipToRect(localPaintingInfo, context, fragment.backgroundRect, paintFla gs, paintClipRecorderPtr); | |
517 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) | 550 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) |
518 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); | 551 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); |
519 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect); | 552 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect, paintClipRecorderPtr); |
520 } | 553 } |
521 } | 554 } |
522 | 555 |
523 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) | 556 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) |
524 { | 557 { |
525 RenderView* view = renderer->view(); | 558 RenderView* view = renderer->view(); |
526 RenderLayerModelObject* prevBlock = renderer; | 559 RenderLayerModelObject* prevBlock = renderer; |
527 RenderBlock* containingBlock; | 560 RenderBlock* containingBlock; |
528 for (containingBlock = renderer->containingBlock(); | 561 for (containingBlock = renderer->containingBlock(); |
529 containingBlock && containingBlock != view && containingBlock != ancesto rColumnsRenderer; | 562 containingBlock && containingBlock != view && containingBlock != ancesto rColumnsRenderer; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 else | 691 else |
659 currLogicalTopOffset -= blockDelta; | 692 currLogicalTopOffset -= blockDelta; |
660 } | 693 } |
661 } | 694 } |
662 | 695 |
663 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 696 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
664 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 697 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
665 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 698 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
666 { | 699 { |
667 for (size_t i = 0; i < layerFragments.size(); ++i) { | 700 for (size_t i = 0; i < layerFragments.size(); ++i) { |
701 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erBackground); | |
702 PaintClipRecorder* paintClipRecorderPtr = 0; | |
703 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
704 paintClipRecorderPtr = &paintClipRecorder; | |
705 | |
668 const LayerFragment& fragment = layerFragments.at(i); | 706 const LayerFragment& fragment = layerFragments.at(i); |
669 if (!fragment.shouldPaintContent) | 707 if (!fragment.shouldPaintContent) |
670 continue; | 708 continue; |
671 | 709 |
672 // Begin transparency layers lazily now that we know we have to paint so mething. | 710 // Begin transparency layers lazily now that we know we have to paint so mething. |
673 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) | 711 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) |
674 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); | 712 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); |
675 | 713 |
676 if (localPaintingInfo.clipToDirtyRect) { | 714 if (localPaintingInfo.clipToDirtyRect) { |
677 // Paint our background first, before painting any child layers. | 715 // Paint our background first, before painting any child layers. |
678 // Establish the clip used to paint our background. | 716 // Establish the clip used to paint our background. |
679 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Background painting will handle cli pping to self. | 717 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, paintClipRecorderPtr, DoNotIncludeSelfForBorderRadius); // Background pa inting will handle clipping to self. |
680 } | 718 } |
681 | 719 |
682 // Paint the background. | 720 // Paint the background. |
683 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. | 721 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. |
684 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); | 722 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); |
685 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 723 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
686 | 724 |
687 if (localPaintingInfo.clipToDirtyRect) | 725 if (localPaintingInfo.clipToDirtyRect) |
688 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); | 726 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect, paintClipRecorderPtr); |
689 } | 727 } |
690 } | 728 } |
691 | 729 |
692 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 730 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
693 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 731 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
694 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) | 732 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) |
695 { | 733 { |
696 // Begin transparency if we have something to paint. | 734 // Begin transparency if we have something to paint. |
697 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { | 735 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { |
698 for (size_t i = 0; i < layerFragments.size(); ++i) { | 736 for (size_t i = 0; i < layerFragments.size(); ++i) { |
699 const LayerFragment& fragment = layerFragments.at(i); | 737 const LayerFragment& fragment = layerFragments.at(i); |
700 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { | 738 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { |
701 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); | 739 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); |
702 break; | 740 break; |
703 } | 741 } |
704 } | 742 } |
705 } | 743 } |
706 | 744 |
745 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::LayerFo reground); | |
746 PaintClipRecorder* paintClipRecorderPtr = 0; | |
747 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
748 paintClipRecorderPtr = &paintClipRecorder; | |
749 | |
707 // Optimize clipping for the single fragment case. | 750 // Optimize clipping for the single fragment case. |
708 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); | 751 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); |
709 if (shouldClip) | 752 if (shouldClip) |
710 clipToRect(localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags); | 753 clipToRect(localPaintingInfo, context, layerFragments[0].foregroundRect, paintFlags, paintClipRecorderPtr); |
711 | 754 |
712 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for | 755 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for |
713 // interleaving of the fragments to work properly. | 756 // interleaving of the fragments to work properly. |
714 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, | 757 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, |
715 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); | 758 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); |
716 | 759 |
717 if (!selectionOnly) { | 760 if (!selectionOnly) { |
718 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); | 761 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); |
719 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); | 762 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); |
720 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); | 763 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); |
721 } | 764 } |
722 | 765 |
723 if (shouldClip) | 766 if (shouldClip) |
724 restoreClip(context, localPaintingInfo.paintDirtyRect, layerFragments[0] .foregroundRect); | 767 restoreClip(context, localPaintingInfo.paintDirtyRect, layerFragments[0] .foregroundRect, paintClipRecorderPtr); |
725 } | 768 } |
726 | 769 |
727 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, | 770 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, |
728 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 771 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
729 { | 772 { |
730 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; | 773 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; |
731 | 774 |
732 for (size_t i = 0; i < layerFragments.size(); ++i) { | 775 for (size_t i = 0; i < layerFragments.size(); ++i) { |
733 const LayerFragment& fragment = layerFragments.at(i); | 776 const LayerFragment& fragment = layerFragments.at(i); |
734 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) | 777 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) |
735 continue; | 778 continue; |
736 | 779 |
780 // Note: this method only clips when there is more than one fragment. | |
781 ClipDisplayItem::ClipType clipType = (ClipDisplayItem::ClipType)0; | |
782 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | |
783 switch (phase) { | |
784 case PaintPhaseFloat: | |
785 clipType = ClipDisplayItem::LayerFragmentFloat; | |
786 break; | |
787 case PaintPhaseForeground: | |
788 clipType = ClipDisplayItem::LayerFragmentForeground; | |
789 break; | |
790 case PaintPhaseChildOutlines: | |
791 clipType = ClipDisplayItem::LayerFragmentChildOutline; | |
792 break; | |
793 default: | |
794 ASSERT_NOT_REACHED(); | |
795 } | |
796 } | |
797 PaintClipRecorder paintClipRecorder(&m_renderLayer, clipType); | |
798 PaintClipRecorder* paintClipRecorderPtr = 0; | |
799 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
800 paintClipRecorderPtr = &paintClipRecorder; | |
801 | |
737 if (shouldClip) | 802 if (shouldClip) |
738 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags); | 803 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags, paintClipRecorderPtr); |
739 | 804 |
740 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.ro otLayer->renderer()); | 805 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect .rect()), phase, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.ro otLayer->renderer()); |
741 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 806 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
742 | 807 |
743 if (shouldClip) | 808 if (shouldClip) |
744 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); | 809 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect, paintClipRecorderPtr); |
745 } | 810 } |
746 } | 811 } |
747 | 812 |
748 void LayerPainter::paintOutlineForFragments(const LayerFragments& layerFragments , GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 813 void LayerPainter::paintOutlineForFragments(const LayerFragments& layerFragments , GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
749 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLay erFlags paintFlags) | 814 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLay erFlags paintFlags) |
750 { | 815 { |
751 for (size_t i = 0; i < layerFragments.size(); ++i) { | 816 for (size_t i = 0; i < layerFragments.size(); ++i) { |
752 const LayerFragment& fragment = layerFragments.at(i); | 817 const LayerFragment& fragment = layerFragments.at(i); |
753 if (fragment.outlineRect.isEmpty()) | 818 if (fragment.outlineRect.isEmpty()) |
754 continue; | 819 continue; |
755 | 820 |
821 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erFragmentOutline); | |
822 PaintClipRecorder* paintClipRecorderPtr = 0; | |
823 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
824 paintClipRecorderPtr = &paintClipRecorder; | |
825 | |
756 // Paint our own outline | 826 // Paint our own outline |
757 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); | 827 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); |
758 clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags, DoNotIncludeSelfForBorderRadius); | 828 clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags, paintClipRecorderPtr, DoNotIncludeSelfForBorderRadius); |
759 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 829 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
760 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect); | 830 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineR ect, paintClipRecorderPtr); |
761 } | 831 } |
762 } | 832 } |
763 | 833 |
764 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 834 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
765 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 835 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
766 { | 836 { |
767 for (size_t i = 0; i < layerFragments.size(); ++i) { | 837 for (size_t i = 0; i < layerFragments.size(); ++i) { |
768 const LayerFragment& fragment = layerFragments.at(i); | 838 const LayerFragment& fragment = layerFragments.at(i); |
769 if (!fragment.shouldPaintContent) | 839 if (!fragment.shouldPaintContent) |
770 continue; | 840 continue; |
771 | 841 |
842 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erFragmentMask); | |
843 PaintClipRecorder* paintClipRecorderPtr = 0; | |
844 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
845 paintClipRecorderPtr = &paintClipRecorder; | |
846 | |
772 if (localPaintingInfo.clipToDirtyRect) | 847 if (localPaintingInfo.clipToDirtyRect) |
773 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self. | 848 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain tFlags, paintClipRecorderPtr, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self. |
774 | 849 |
775 // Paint the mask. | 850 // Paint the mask. |
776 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. | 851 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. |
777 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, local PaintingInfo.rootLayer->renderer()); | 852 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, local PaintingInfo.rootLayer->renderer()); |
778 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 853 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
779 | 854 |
780 if (localPaintingInfo.clipToDirtyRect) | 855 if (localPaintingInfo.clipToDirtyRect) |
781 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); | 856 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect, paintClipRecorderPtr); |
782 } | 857 } |
783 } | 858 } |
784 | 859 |
785 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , | 860 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , |
786 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 861 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
787 { | 862 { |
788 for (size_t i = 0; i < layerFragments.size(); ++i) { | 863 for (size_t i = 0; i < layerFragments.size(); ++i) { |
789 const LayerFragment& fragment = layerFragments.at(i); | 864 const LayerFragment& fragment = layerFragments.at(i); |
790 if (!fragment.shouldPaintContent) | 865 if (!fragment.shouldPaintContent) |
791 continue; | 866 continue; |
792 | 867 |
868 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erFragmentClippingMask); | |
869 PaintClipRecorder* paintClipRecorderPtr = 0; | |
870 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
871 paintClipRecorderPtr = &paintClipRecorder; | |
872 | |
793 if (localPaintingInfo.clipToDirtyRect) | 873 if (localPaintingInfo.clipToDirtyRect) |
794 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self. | 874 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain tFlags, paintClipRecorderPtr, IncludeSelfForBorderRadius); // Child clipping mas k painting will handle clipping to self. |
795 | 875 |
796 // Paint the the clipped mask. | 876 // Paint the the clipped mask. |
797 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); | 877 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); |
798 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 878 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
799 | 879 |
800 if (localPaintingInfo.clipToDirtyRect) | 880 if (localPaintingInfo.clipToDirtyRect) |
801 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect); | 881 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect, paintClipRecorderPtr); |
802 } | 882 } |
803 } | 883 } |
804 | 884 |
805 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) | 885 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) |
806 { | 886 { |
807 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 887 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
808 return; | 888 return; |
809 | 889 |
810 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot); | 890 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot); |
811 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 891 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
(...skipping 22 matching lines...) Expand all Loading... | |
834 m_renderLayer.enclosingPaginationLayer()->convertToLayerCoords(paint ingInfo.rootLayer, offsetOfPaginationLayerFromRoot); | 914 m_renderLayer.enclosingPaginationLayer()->convertToLayerCoords(paint ingInfo.rootLayer, offsetOfPaginationLayerFromRoot); |
835 | 915 |
836 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize); | 916 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize); |
837 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) | 917 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) |
838 clipRectsContext.setIgnoreOverflowClip(); | 918 clipRectsContext.setIgnoreOverflowClip(); |
839 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe ct(clipRectsContext).rect(); | 919 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe ct(clipRectsContext).rect(); |
840 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); | 920 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); |
841 clipRect.intersect(parentClipRect); | 921 clipRect.intersect(parentClipRect); |
842 } | 922 } |
843 | 923 |
844 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context, clipRect, paintFlags); | 924 PaintClipRecorder paintClipRecorder(&m_renderLayer, ClipDisplayItem::Lay erFragmentParent); |
925 PaintClipRecorder* paintClipRecorderPtr = 0; | |
926 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
927 paintClipRecorderPtr = &paintClipRecorder; | |
928 | |
929 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context, clipRect, paintFlags, paintClipRecorderPtr); | |
845 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 930 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
846 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo. paintDirtyRect, clipRect); | 931 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo. paintDirtyRect, clipRect, paintClipRecorderPtr); |
847 } | 932 } |
848 } | 933 } |
849 | 934 |
850 } // namespace blink | 935 } // namespace blink |
OLD | NEW |