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