| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Make sure the parent's clip rects have been calculated. | 91 // Make sure the parent's clip rects have been calculated. |
| 92 ClipRect clipRect = paintingInfo.paintDirtyRect; | 92 ClipRect clipRect = paintingInfo.paintDirtyRect; |
| 93 |
| 94 OwnPtr<ClipRecorder> clipRecorder; |
| 93 if (m_renderLayer.parent()) { | 95 if (m_renderLayer.parent()) { |
| 94 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore
OverlayScrollbarSize); | 96 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore
OverlayScrollbarSize); |
| 95 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) | 97 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) |
| 96 clipRectsContext.setIgnoreOverflowClip(); | 98 clipRectsContext.setIgnoreOverflowClip(); |
| 97 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte
xt); | 99 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte
xt); |
| 98 clipRect.intersect(paintingInfo.paintDirtyRect); | 100 clipRect.intersect(paintingInfo.paintDirtyRect); |
| 99 | 101 |
| 100 // Push the parent coordinate space's clip. | 102 if (needsToClip(paintingInfo, clipRect)) { |
| 101 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, conte
xt, clipRect, paintFlags); | 103 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(),
context, ClipDisplayItem::LayerParent, clipRect)); |
| 104 |
| 105 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(pain
tingInfo, context, clipRect, paintFlags, *clipRecorder); |
| 106 } |
| 102 } | 107 } |
| 103 | 108 |
| 104 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 109 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
| 105 | 110 |
| 106 // Restore the clip. | |
| 107 if (m_renderLayer.parent()) | |
| 108 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingI
nfo.paintDirtyRect, clipRect); | |
| 109 | |
| 110 return; | 111 return; |
| 111 } | 112 } |
| 112 | 113 |
| 113 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 114 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende
rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA
ccumulation, PaintBehavior paintBehavior) | 117 void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende
rLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelA
ccumulation, PaintBehavior paintBehavior) |
| 117 { | 118 { |
| 118 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS
tackingContext() && m_renderLayer.hasDescendantWithBlendMode(); | 119 bool createTransparencyLayerForBlendMode = m_renderLayer.stackingNode()->isS
tackingContext() && m_renderLayer.hasDescendantWithBlendMode(); |
| 119 if ((m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pa
intsWithBlendMode() || createTransparencyLayerForBlendMode) && m_renderLayer.use
dTransparency()) | 120 if ((m_renderLayer.paintsWithTransparency(paintBehavior) || m_renderLayer.pa
intsWithBlendMode() || createTransparencyLayerForBlendMode) && m_renderLayer.use
dTransparency()) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 LayerFragments layerFragments; | 259 LayerFragments layerFragments; |
| 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars)
{ | 260 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 | 261 // 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. | 262 // fragment should paint. |
| 262 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay
er, localPaintingInfo.paintDirtyRect, | 263 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay
er, localPaintingInfo.paintDirtyRect, |
| 263 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, IgnoreOverlayScrollbarSize, | 264 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai
ntingClipRects, IgnoreOverlayScrollbarSize, |
| 264 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of
fsetFromRoot, localPaintingInfo.subPixelAccumulation); | 265 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of
fsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 265 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); | 266 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF
lags, shouldPaintContent, &offsetFromRoot); |
| 266 } | 267 } |
| 267 | 268 |
| 268 if (haveFilterEffect) { | 269 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti
onOnly; |
| 269 ASSERT(m_renderLayer.filterInfo()); | |
| 270 | |
| 271 if (!rootRelativeBoundsComputed) | |
| 272 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingRefle
ctionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | |
| 273 | |
| 274 // Do transparency and clipping before starting filter processing. | |
| 275 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. | |
| 277 beginTransparencyLayers(context, localPaintingInfo.rootLayer, painti
ngInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo.pain
tBehavior); | |
| 278 } | |
| 279 // 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. | |
| 281 // 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; | |
| 283 clipToRect(localPaintingInfo, context, backgroundRect, paintFlags); | |
| 284 // 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. | |
| 286 localPaintingInfo.clipToDirtyRect = false; | |
| 287 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect(con
text, rootRelativeBounds); | |
| 288 if (!haveFilterEffect) { | |
| 289 // If the the filter failed to start, undo the clip immediately | |
| 290 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRec
t); | |
| 291 } | |
| 292 } | |
| 293 | |
| 294 // 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 |
| 295 // 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). |
| 296 // 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 |
| 297 // 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. |
| 298 RenderObject* paintingRootForRenderer = 0; | 274 RenderObject* paintingRootForRenderer = 0; |
| 299 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan
tOf(localPaintingInfo.paintingRoot)) | 275 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan
tOf(localPaintingInfo.paintingRoot)) |
| 300 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 276 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
| 301 | 277 |
| 302 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText)); | 278 { // Begin block for the lifetime of any filter clip. |
| 303 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti
onOnly; | 279 OwnPtr<ClipRecorder> clipRecorder; |
| 280 if (haveFilterEffect) { |
| 281 ASSERT(m_renderLayer.filterInfo()); |
| 304 | 282 |
| 305 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintCo
ntent && !selectionOnly; | 283 if (!rootRelativeBoundsComputed) |
| 306 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOve
rflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground
); | 284 rootRelativeBounds = m_renderLayer.physicalBoundingBoxIncludingR
eflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 307 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintC
ontent; | 285 |
| 308 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground
; | 286 // Do transparency and clipping before starting filter processing. |
| 309 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 287 if (haveTransparency) { |
| 288 // 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 beginTransparencyLayers(context, localPaintingInfo.rootLayer, pa
intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, localPaintingInfo.
paintBehavior); |
| 290 } |
| 291 |
| 292 // We'll handle clipping to the dirty rect before filter rasterizati
on. |
| 293 // Filter processing will automatically expand the clip rect and the
offscreen to accommodate any filter outsets. |
| 294 // FIXME: It is incorrect to just clip to the damageRect here once m
ultiple fragments are involved. |
| 295 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : la
yerFragments[0].backgroundRect; |
| 296 |
| 297 if (needsToClip(localPaintingInfo, backgroundRect)) { |
| 298 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context
, ClipDisplayItem::LayerFilter, backgroundRect)); |
| 299 applyRoundedRectClips(localPaintingInfo, context, backgroundRect
, paintFlags, *clipRecorder); |
| 300 } |
| 301 |
| 302 // 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. |
| 304 localPaintingInfo.clipToDirtyRect = false; |
| 305 haveFilterEffect = m_renderLayer.filterRenderer()->beginFilterEffect
(context, rootRelativeBounds); |
| 306 if (!haveFilterEffect) { |
| 307 // If the the filter failed to start, undo the clip immediately |
| 308 clipRecorder.clear(); |
| 309 } |
| 310 } |
| 311 |
| 312 ASSERT(!(localPaintingInfo.paintBehavior & PaintBehaviorForceBlackText))
; |
| 313 |
| 314 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai
ntContent && !selectionOnly; |
| 315 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin
gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr
ound); |
| 316 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa
intContent; |
| 317 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr
ound; |
| 318 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
| 319 |
| 320 PaintBehavior paintBehavior = PaintBehaviorNormal; |
| 321 if (paintFlags & PaintLayerPaintingSkipRootBackground) |
| 322 paintBehavior |= PaintBehaviorSkipRootBackground; |
| 323 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) |
| 324 paintBehavior |= PaintBehaviorRootBackgroundOnly; |
| 325 |
| 326 if (shouldPaintBackground) { |
| 327 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa
intDirtyRect, haveTransparency, |
| 328 localPaintingInfo, paintBehavior, paintingRootForRenderer, paint
Flags); |
| 329 } |
| 330 |
| 331 if (shouldPaintNegZOrderList) |
| 332 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFl
ags); |
| 333 |
| 334 if (shouldPaintOwnContents) { |
| 335 paintForegroundForFragments(layerFragments, context, paintingInfo.pa
intDirtyRect, haveTransparency, |
| 336 localPaintingInfo, paintBehavior, paintingRootForRenderer, selec
tionOnly, paintFlags); |
| 337 } |
| 338 |
| 339 if (shouldPaintOutline) |
| 340 paintOutlineForFragments(layerFragments, context, localPaintingInfo,
paintBehavior, paintingRootForRenderer, paintFlags); |
| 341 |
| 342 if (shouldPaintNormalFlowAndPosZOrderLists) |
| 343 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context,
paintingInfo, paintFlags); |
| 344 |
| 345 if (shouldPaintOverlayScrollbars) |
| 346 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 |
| 354 |
| 310 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase)
&& shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; | 355 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase)
&& shouldPaintContent && m_renderLayer.renderer()->hasMask() && !selectionOnly; |
| 311 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping
MaskPhase) && shouldPaintContent && !selectionOnly; | 356 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping
MaskPhase) && shouldPaintContent && !selectionOnly; |
| 312 | 357 |
| 313 PaintBehavior paintBehavior = PaintBehaviorNormal; | |
| 314 if (paintFlags & PaintLayerPaintingSkipRootBackground) | |
| 315 paintBehavior |= PaintBehaviorSkipRootBackground; | |
| 316 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) | |
| 317 paintBehavior |= PaintBehaviorRootBackgroundOnly; | |
| 318 | |
| 319 if (shouldPaintBackground) { | |
| 320 paintBackgroundForFragments(layerFragments, context, paintingInfo.paintD
irtyRect, haveTransparency, | |
| 321 localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag
s); | |
| 322 } | |
| 323 | |
| 324 if (shouldPaintNegZOrderList) | |
| 325 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags)
; | |
| 326 | |
| 327 if (shouldPaintOwnContents) { | |
| 328 paintForegroundForFragments(layerFragments, context, paintingInfo.paintD
irtyRect, haveTransparency, | |
| 329 localPaintingInfo, paintBehavior, paintingRootForRenderer, selection
Only, paintFlags); | |
| 330 } | |
| 331 | |
| 332 if (shouldPaintOutline) | |
| 333 paintOutlineForFragments(layerFragments, context, localPaintingInfo, pai
ntBehavior, paintingRootForRenderer, paintFlags); | |
| 334 | |
| 335 if (shouldPaintNormalFlowAndPosZOrderLists) | |
| 336 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, pain
tingInfo, paintFlags); | |
| 337 | |
| 338 if (shouldPaintOverlayScrollbars) | |
| 339 paintOverflowControlsForFragments(layerFragments, context, localPainting
Info, paintFlags); | |
| 340 | |
| 341 if (haveFilterEffect) { | |
| 342 // 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. | |
| 344 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerF
ragments[0].backgroundRect; | |
| 345 m_renderLayer.filterRenderer()->endFilterEffect(context); | |
| 346 restoreClip(context, localPaintingInfo.paintDirtyRect, backgroundRect); | |
| 347 } | |
| 348 | |
| 349 if (shouldPaintMask) | 358 if (shouldPaintMask) |
| 350 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti
ngRootForRenderer, paintFlags); | 359 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti
ngRootForRenderer, paintFlags); |
| 351 | 360 |
| 352 if (shouldPaintClippingMask) { | 361 if (shouldPaintClippingMask) { |
| 353 // Paint the border radius mask for the fragments. | 362 // Paint the border radius mask for the fragments. |
| 354 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintingRootForRenderer, paintFlags); | 363 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintingRootForRenderer, paintFlags); |
| 355 } | 364 } |
| 356 | 365 |
| 357 // End our transparency layer | 366 // End our transparency layer |
| 358 if ((haveTransparency || m_renderLayer.paintsWithBlendMode() || createTransp
arencyLayerForBlendMode) && m_renderLayer.usedTransparency() | 367 if ((haveTransparency || m_renderLayer.paintsWithBlendMode() || createTransp
arencyLayerForBlendMode) && m_renderLayer.usedTransparency() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 373 | 382 |
| 374 RenderView* view = startLayer->renderer()->view(); | 383 RenderView* view = startLayer->renderer()->view(); |
| 375 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock();
currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo
ck()) { | 384 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock();
currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo
ck()) { |
| 376 if (currentBlock->layer() == endLayer) | 385 if (currentBlock->layer() == endLayer) |
| 377 return true; | 386 return true; |
| 378 } | 387 } |
| 379 | 388 |
| 380 return false; | 389 return false; |
| 381 } | 390 } |
| 382 | 391 |
| 383 void LayerPainter::clipToRect(const LayerPaintingInfo& localPaintingInfo, Graphi
csContext* context, const ClipRect& clipRect, | 392 bool LayerPainter::needsToClip(const LayerPaintingInfo& localPaintingInfo, const
ClipRect& clipRect) |
| 384 PaintLayerFlags paintFlags, BorderRadiusClippingRule rule) | |
| 385 { | 393 { |
| 386 if (clipRect.rect() == localPaintingInfo.paintDirtyRect && !clipRect.hasRadi
us()) | 394 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa
dius(); |
| 387 return; | 395 } |
| 388 context->save(); | |
| 389 context->clip(pixelSnappedIntRect(clipRect.rect())); | |
| 390 | 396 |
| 397 void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingI
nfo, GraphicsContext* context, const ClipRect& clipRect, |
| 398 PaintLayerFlags paintFlags, ClipRecorder& clipRecorder, BorderRadiusClipping
Rule rule) |
| 399 { |
| 391 if (!clipRect.hasRadius()) | 400 if (!clipRect.hasRadius()) |
| 392 return; | 401 return; |
| 393 | 402 |
| 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 | 403 // 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 |
| 395 // any layers with overflow. The condition for being able to apply these cli
ps is that the overflow object be in our | 404 // any layers with overflow. The condition for being able to apply these cli
ps is that the overflow object be in our |
| 396 // containing block chain so we check that also. | 405 // containing block chain so we check that also. |
| 397 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_renderLaye
r : m_renderLayer.parent(); layer; layer = layer->parent()) { | 406 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &m_renderLaye
r : m_renderLayer.parent(); layer; layer = layer->parent()) { |
| 398 // Composited scrolling layers handle border-radius clip in the composit
or via a mask layer. We do not | 407 // Composited scrolling layers handle border-radius clip in the composit
or via a mask layer. We do not |
| 399 // want to apply a border-radius clip to the layer contents itself, beca
use that would require re-rastering | 408 // want to apply a border-radius clip to the layer contents itself, beca
use that would require re-rastering |
| 400 // every frame to update the clip. We only want to make sure that the ma
sk layer is properly clipped so | 409 // 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. | 410 // that it can in turn clip the scrolled contents in the compositor. |
| 402 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti
ngChildClippingMaskPhase)) | 411 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti
ngChildClippingMaskPhase)) |
| 403 break; | 412 break; |
| 404 | 413 |
| 405 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->
hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) { | 414 if (layer->renderer()->hasOverflowClip() && layer->renderer()->style()->
hasBorderRadius() && inContainingBlockChain(&m_renderLayer, layer)) { |
| 406 LayoutPoint delta; | 415 LayoutPoint delta; |
| 407 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); | 416 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); |
| 408 context->clipRoundedRect(layer->renderer()->style()->getRoundedInner
BorderFor(LayoutRect(delta, layer->size()))); | 417 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound
edInnerBorderFor(LayoutRect(delta, layer->size()))); |
| 409 } | 418 } |
| 410 | 419 |
| 411 if (layer == localPaintingInfo.rootLayer) | 420 if (layer == localPaintingInfo.rootLayer) |
| 412 break; | 421 break; |
| 413 } | 422 } |
| 414 } | 423 } |
| 415 | 424 |
| 416 void LayerPainter::restoreClip(GraphicsContext* context, const LayoutRect& paint
DirtyRect, const ClipRect& clipRect) | |
| 417 { | |
| 418 if (clipRect.rect() == paintDirtyRect && !clipRect.hasRadius()) | |
| 419 return; | |
| 420 context->restore(); | |
| 421 } | |
| 422 | |
| 423 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con
st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, | 425 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con
st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, |
| 424 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) | 426 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) |
| 425 { | 427 { |
| 426 ASSERT(offsetFromRoot); | 428 ASSERT(offsetFromRoot); |
| 427 for (size_t i = 0; i < fragments.size(); ++i) { | 429 for (size_t i = 0; i < fragments.size(); ++i) { |
| 428 LayerFragment& fragment = fragments.at(i); | 430 LayerFragment& fragment = fragments.at(i); |
| 429 fragment.shouldPaintContent = shouldPaintContent; | 431 fragment.shouldPaintContent = shouldPaintContent; |
| 430 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags &
PaintLayerPaintingOverflowContents)) { | 432 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags &
PaintLayerPaintingOverflowContents)) { |
| 431 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio
nOffset; | 433 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio
nOffset; |
| 432 fragment.shouldPaintContent &= m_renderLayer.intersectsDamageRect(fr
agment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer,
&newOffsetFromRoot); | 434 fragment.shouldPaintContent &= m_renderLayer.intersectsDamageRect(fr
agment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer,
&newOffsetFromRoot); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // of the renderer already includes any sub-pixel offset. | 508 // of the renderer already includes any sub-pixel offset. |
| 507 if (compositingState == PaintsIntoOwnBacking) | 509 if (compositingState == PaintsIntoOwnBacking) |
| 508 return LayoutSize(); | 510 return LayoutSize(); |
| 509 return subPixelAccumulation; | 511 return subPixelAccumulation; |
| 510 } | 512 } |
| 511 | 513 |
| 512 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) | 514 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) |
| 513 { | 515 { |
| 514 for (size_t i = 0; i < layerFragments.size(); ++i) { | 516 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 515 const LayerFragment& fragment = layerFragments.at(i); | 517 const LayerFragment& fragment = layerFragments.at(i); |
| 516 clipToRect(localPaintingInfo, context, fragment.backgroundRect, paintFla
gs); | 518 |
| 519 OwnPtr<ClipRecorder> clipRecorder; |
| 520 |
| 521 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| 522 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl
ipDisplayItem::LayerOverflowControls, fragment.backgroundRect)); |
| 523 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun
dRect, paintFlags, *clipRecorder); |
| 524 } |
| 517 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) | 525 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); | 526 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); | |
| 520 } | 527 } |
| 521 } | 528 } |
| 522 | 529 |
| 523 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) | 530 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) |
| 524 { | 531 { |
| 525 RenderView* view = renderer->view(); | 532 RenderView* view = renderer->view(); |
| 526 RenderLayerModelObject* prevBlock = renderer; | 533 RenderLayerModelObject* prevBlock = renderer; |
| 527 RenderBlock* containingBlock; | 534 RenderBlock* containingBlock; |
| 528 for (containingBlock = renderer->containingBlock(); | 535 for (containingBlock = renderer->containingBlock(); |
| 529 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; | 536 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 { | 673 { |
| 667 for (size_t i = 0; i < layerFragments.size(); ++i) { | 674 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 668 const LayerFragment& fragment = layerFragments.at(i); | 675 const LayerFragment& fragment = layerFragments.at(i); |
| 669 if (!fragment.shouldPaintContent) | 676 if (!fragment.shouldPaintContent) |
| 670 continue; | 677 continue; |
| 671 | 678 |
| 672 // Begin transparency layers lazily now that we know we have to paint so
mething. | 679 // Begin transparency layers lazily now that we know we have to paint so
mething. |
| 673 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) | 680 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) |
| 674 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp
arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo.
paintBehavior); | 681 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp
arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo.
paintBehavior); |
| 675 | 682 |
| 676 if (localPaintingInfo.clipToDirtyRect) { | 683 OwnPtr<ClipRecorder> clipRecorder; |
| 677 // Paint our background first, before painting any child layers. | 684 |
| 678 // Establish the clip used to paint our background. | 685 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo,
fragment.backgroundRect)) { |
| 679 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain
tFlags, DoNotIncludeSelfForBorderRadius); // Background painting will handle cli
pping to self. | 686 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl
ipDisplayItem::LayerBackground, fragment.backgroundRect)); |
| 687 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun
dRect, paintFlags, *clipRecorder); |
| 680 } | 688 } |
| 681 | 689 |
| 682 // Paint the background. | 690 // Paint the background. |
| 683 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 691 // 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()); | 692 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()))); | 693 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo
calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 686 | |
| 687 if (localPaintingInfo.clipToDirtyRect) | |
| 688 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | |
| 689 } | 694 } |
| 690 } | 695 } |
| 691 | 696 |
| 692 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, | 697 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, |
| 693 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 698 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| 694 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p
aintFlags) | 699 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p
aintFlags) |
| 695 { | 700 { |
| 696 // Begin transparency if we have something to paint. | 701 // Begin transparency if we have something to paint. |
| 697 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { | 702 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { |
| 698 for (size_t i = 0; i < layerFragments.size(); ++i) { | 703 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 699 const LayerFragment& fragment = layerFragments.at(i); | 704 const LayerFragment& fragment = layerFragments.at(i); |
| 700 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { | 705 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { |
| 701 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr
ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI
nfo.paintBehavior); | 706 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr
ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI
nfo.paintBehavior); |
| 702 break; | 707 break; |
| 703 } | 708 } |
| 704 } | 709 } |
| 705 } | 710 } |
| 706 | 711 |
| 707 // Optimize clipping for the single fragment case. | 712 // Optimize clipping for the single fragment case. |
| 708 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe
ct.isEmpty(); | 713 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe
ct.isEmpty(); |
| 709 if (shouldClip) | 714 |
| 710 clipToRect(localPaintingInfo, context, layerFragments[0].foregroundRect,
paintFlags); | 715 OwnPtr<ClipRecorder> clipRecorder; |
| 716 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { |
| 717 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi
splayItem::LayerForeground, layerFragments[0].foregroundRect)); |
| 718 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore
groundRect, paintFlags, *clipRecorder); |
| 719 } |
| 711 | 720 |
| 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 | 721 // 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. | 722 // interleaving of the fragments to work properly. |
| 714 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, | 723 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, |
| 715 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags); | 724 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags); |
| 716 | 725 |
| 717 if (!selectionOnly) { | 726 if (!selectionOnly) { |
| 718 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co
ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); | 727 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co
ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); |
| 719 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag
s); | 728 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment
s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag
s); |
| 720 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm
ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF
lags); | 729 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm
ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF
lags); |
| 721 } | 730 } |
| 722 | |
| 723 if (shouldClip) | |
| 724 restoreClip(context, localPaintingInfo.paintDirtyRect, layerFragments[0]
.foregroundRect); | |
| 725 } | 731 } |
| 726 | 732 |
| 727 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const
LayerFragments& layerFragments, GraphicsContext* context, | 733 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const
LayerFragments& layerFragments, GraphicsContext* context, |
| 728 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren
derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 734 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren
derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 729 { | 735 { |
| 730 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
> 1; | 736 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
> 1; |
| 731 | 737 |
| 732 for (size_t i = 0; i < layerFragments.size(); ++i) { | 738 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 733 const LayerFragment& fragment = layerFragments.at(i); | 739 const LayerFragment& fragment = layerFragments.at(i); |
| 734 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) | 740 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) |
| 735 continue; | 741 continue; |
| 736 | 742 |
| 737 if (shouldClip) | 743 OwnPtr<ClipRecorder> clipRecorder; |
| 738 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain
tFlags); | 744 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect
)) { |
| 745 // Note: this method only clips when there is more than one fragment
. |
| 746 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF
loat; |
| 747 switch (phase) { |
| 748 case PaintPhaseFloat: |
| 749 break; |
| 750 case PaintPhaseForeground: |
| 751 clipType = ClipDisplayItem::LayerFragmentForeground; |
| 752 break; |
| 753 case PaintPhaseChildOutlines: |
| 754 clipType = ClipDisplayItem::LayerFragmentChildOutline; |
| 755 break; |
| 756 case PaintPhaseSelection: |
| 757 clipType = ClipDisplayItem::LayerFragmentSelection; |
| 758 break; |
| 759 case PaintPhaseChildBlockBackgrounds: |
| 760 clipType = ClipDisplayItem::LayerFragmentChildBlockBackgrounds; |
| 761 break; |
| 762 default: |
| 763 ASSERT_NOT_REACHED(); |
| 764 } |
| 765 |
| 766 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, cl
ipType, fragment.foregroundRect)); |
| 767 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun
dRect, paintFlags, *clipRecorder); |
| 768 } |
| 739 | 769 |
| 740 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect
.rect()), phase, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.ro
otLayer->renderer()); | 770 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()))); | 771 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo
calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 742 | |
| 743 if (shouldClip) | |
| 744 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); | |
| 745 } | 772 } |
| 746 } | 773 } |
| 747 | 774 |
| 748 void LayerPainter::paintOutlineForFragments(const LayerFragments& layerFragments
, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 775 void LayerPainter::paintOutlineForFragments(const LayerFragments& layerFragments
, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 749 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLay
erFlags paintFlags) | 776 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer, PaintLay
erFlags paintFlags) |
| 750 { | 777 { |
| 751 for (size_t i = 0; i < layerFragments.size(); ++i) { | 778 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 752 const LayerFragment& fragment = layerFragments.at(i); | 779 const LayerFragment& fragment = layerFragments.at(i); |
| 753 if (fragment.outlineRect.isEmpty()) | 780 if (fragment.outlineRect.isEmpty()) |
| 754 continue; | 781 continue; |
| 755 | 782 |
| 783 OwnPtr<ClipRecorder> clipRecorder; |
| 784 if (needsToClip(localPaintingInfo, fragment.outlineRect)) { |
| 785 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl
ipDisplayItem::LayerFragmentOutline, fragment.outlineRect)); |
| 786 applyRoundedRectClips(localPaintingInfo, context, fragment.outlineRe
ct, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); |
| 787 } |
| 788 |
| 756 // Paint our own outline | 789 // Paint our own outline |
| 757 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re
ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa
intingInfo.rootLayer->renderer()); | 790 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re
ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa
intingInfo.rootLayer->renderer()); |
| 758 clipToRect(localPaintingInfo, context, fragment.outlineRect, paintFlags,
DoNotIncludeSelfForBorderRadius); | |
| 759 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo
calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 791 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); | |
| 761 } | 792 } |
| 762 } | 793 } |
| 763 | 794 |
| 764 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G
raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 795 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G
raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 765 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 796 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 766 { | 797 { |
| 767 for (size_t i = 0; i < layerFragments.size(); ++i) { | 798 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 768 const LayerFragment& fragment = layerFragments.at(i); | 799 const LayerFragment& fragment = layerFragments.at(i); |
| 769 if (!fragment.shouldPaintContent) | 800 if (!fragment.shouldPaintContent) |
| 770 continue; | 801 continue; |
| 771 | 802 |
| 772 if (localPaintingInfo.clipToDirtyRect) | 803 OwnPtr<ClipRecorder> clipRecorder; |
| 773 clipToRect(localPaintingInfo, context, fragment.backgroundRect, pain
tFlags, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping
to self. | 804 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo,
fragment.backgroundRect)) { |
| 805 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl
ipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); |
| 806 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun
dRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); // Mask pain
ting will handle clipping to self. |
| 807 } |
| 774 | 808 |
| 775 // Paint the mask. | 809 // Paint the mask. |
| 776 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 810 // 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()); | 811 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()))); | 812 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo
calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 779 | |
| 780 if (localPaintingInfo.clipToDirtyRect) | |
| 781 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | |
| 782 } | 813 } |
| 783 } | 814 } |
| 784 | 815 |
| 785 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye
rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo
, | 816 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye
rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo
, |
| 786 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 817 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 787 { | 818 { |
| 788 for (size_t i = 0; i < layerFragments.size(); ++i) { | 819 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 789 const LayerFragment& fragment = layerFragments.at(i); | 820 const LayerFragment& fragment = layerFragments.at(i); |
| 790 if (!fragment.shouldPaintContent) | 821 if (!fragment.shouldPaintContent) |
| 791 continue; | 822 continue; |
| 792 | 823 |
| 793 if (localPaintingInfo.clipToDirtyRect) | 824 OwnPtr<ClipRecorder> clipRecorder; |
| 794 clipToRect(localPaintingInfo, context, fragment.foregroundRect, pain
tFlags, IncludeSelfForBorderRadius); // Child clipping mask painting will handle
clipping to self. | 825 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo,
fragment.foregroundRect)) { |
| 826 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl
ipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); |
| 827 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun
dRect, paintFlags, *clipRecorder, IncludeSelfForBorderRadius); // Child clipping
mask painting will handle clipping to self. |
| 828 } |
| 795 | 829 |
| 796 // Paint the the clipped mask. | 830 // Paint the the clipped mask. |
| 797 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect
.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer,
0, localPaintingInfo.rootLayer->renderer()); | 831 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()))); | 832 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.
location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo
calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 799 | |
| 800 if (localPaintingInfo.clipToDirtyRect) | |
| 801 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore
groundRect); | |
| 802 } | 833 } |
| 803 } | 834 } |
| 804 | 835 |
| 805 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout
Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) | 836 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout
Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) |
| 806 { | 837 { |
| 807 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 838 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
| 808 return; | 839 return; |
| 809 | 840 |
| 810 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 841 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); |
| 811 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 842 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 834 m_renderLayer.enclosingPaginationLayer()->convertToLayerCoords(paint
ingInfo.rootLayer, offsetOfPaginationLayerFromRoot); | 865 m_renderLayer.enclosingPaginationLayer()->convertToLayerCoords(paint
ingInfo.rootLayer, offsetOfPaginationLayerFromRoot); |
| 835 | 866 |
| 836 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL
ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin
gClipRects, IgnoreOverlayScrollbarSize); | 867 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL
ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin
gClipRects, IgnoreOverlayScrollbarSize); |
| 837 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) | 868 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) |
| 838 clipRectsContext.setIgnoreOverflowClip(); | 869 clipRectsContext.setIgnoreOverflowClip(); |
| 839 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe
ct(clipRectsContext).rect(); | 870 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe
ct(clipRectsContext).rect(); |
| 840 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); | 871 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); |
| 841 clipRect.intersect(parentClipRect); | 872 clipRect.intersect(parentClipRect); |
| 842 } | 873 } |
| 843 | 874 |
| 844 LayerPainter(*m_renderLayer.parent()).clipToRect(paintingInfo, context,
clipRect, paintFlags); | 875 OwnPtr<ClipRecorder> clipRecorder; |
| 876 if (needsToClip(paintingInfo, clipRect)) { |
| 877 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con
text, ClipDisplayItem::LayerFragmentParent, clipRect)); |
| 878 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting
Info, context, clipRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRad
ius); // Child clipping mask painting will handle clipping to self. |
| 879 } |
| 880 |
| 845 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); | 881 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); |
| 846 LayerPainter(*m_renderLayer.parent()).restoreClip(context, paintingInfo.
paintDirtyRect, clipRect); | |
| 847 } | 882 } |
| 848 } | 883 } |
| 849 | 884 |
| 850 } // namespace blink | 885 } // namespace blink |
| OLD | NEW |