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/layout/Layer.h" |
9 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
10 #include "core/paint/CompositingRecorder.h" | 11 #include "core/paint/CompositingRecorder.h" |
11 #include "core/paint/FilterPainter.h" | 12 #include "core/paint/FilterPainter.h" |
12 #include "core/paint/LayerClipRecorder.h" | 13 #include "core/paint/LayerClipRecorder.h" |
13 #include "core/paint/ScrollableAreaPainter.h" | 14 #include "core/paint/ScrollableAreaPainter.h" |
14 #include "core/paint/Transform3DRecorder.h" | 15 #include "core/paint/Transform3DRecorder.h" |
15 #include "core/rendering/ClipPathOperation.h" | 16 #include "core/rendering/ClipPathOperation.h" |
16 #include "core/rendering/FilterEffectRenderer.h" | 17 #include "core/rendering/FilterEffectRenderer.h" |
17 #include "core/rendering/PaintInfo.h" | 18 #include "core/rendering/PaintInfo.h" |
18 #include "core/rendering/RenderBlock.h" | 19 #include "core/rendering/RenderBlock.h" |
19 #include "core/rendering/RenderLayer.h" | |
20 #include "core/rendering/RenderView.h" | 20 #include "core/rendering/RenderView.h" |
21 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 21 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
22 #include "platform/graphics/GraphicsLayer.h" | 22 #include "platform/graphics/GraphicsLayer.h" |
23 #include "platform/graphics/paint/ClipPathRecorder.h" | 23 #include "platform/graphics/paint/ClipPathRecorder.h" |
24 #include "platform/graphics/paint/CompositingDisplayItem.h" | 24 #include "platform/graphics/paint/CompositingDisplayItem.h" |
25 #include "platform/graphics/paint/DisplayItemList.h" | 25 #include "platform/graphics/paint/DisplayItemList.h" |
26 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 26 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 static inline bool shouldSuppressPaintingLayer(RenderLayer* layer) | 30 static inline bool shouldSuppressPaintingLayer(Layer* layer) |
31 { | 31 { |
32 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. | 32 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. |
33 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 33 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
34 // will do a full paintInvalidationForWholeRenderer(). | 34 // will do a full paintInvalidationForWholeRenderer(). |
35 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) | 35 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) |
36 return true; | 36 return true; |
37 | 37 |
38 return false; | 38 return false; |
39 } | 39 } |
40 | 40 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Paint the reflection first if we have one. | 95 // Paint the reflection first if we have one. |
96 if (m_renderLayer.reflectionInfo()) | 96 if (m_renderLayer.reflectionInfo()) |
97 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF
lags | PaintLayerPaintingReflection); | 97 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF
lags | PaintLayerPaintingReflection); |
98 | 98 |
99 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; | 99 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; |
100 paintLayerContents(context, paintingInfo, localPaintFlags); | 100 paintLayerContents(context, paintingInfo, localPaintFlags); |
101 } | 101 } |
102 | 102 |
103 class ClipPathHelper { | 103 class ClipPathHelper { |
104 public: | 104 public: |
105 ClipPathHelper(GraphicsContext* context, const RenderLayer& renderLayer, con
st LayerPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRe
lativeBoundsComputed, | 105 ClipPathHelper(GraphicsContext* context, const Layer& renderLayer, const Lay
erPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRelative
BoundsComputed, |
106 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) | 106 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) |
107 : m_resourceClipper(0), m_clipStateSaver(*context, false), m_renderLayer
(renderLayer), m_context(context) | 107 : m_resourceClipper(0), m_clipStateSaver(*context, false), m_renderLayer
(renderLayer), m_context(context) |
108 { | 108 { |
109 const RenderStyle& style = renderLayer.renderer()->styleRef(); | 109 const RenderStyle& style = renderLayer.renderer()->styleRef(); |
110 | 110 |
111 // Clip-path, like border radius, must not be applied to the contents of
a composited-scrolling container. | 111 // Clip-path, like border radius, must not be applied to the contents of
a composited-scrolling container. |
112 // It must, however, still be applied to the mask layer, so that the com
positor can properly mask the | 112 // It must, however, still be applied to the mask layer, so that the com
positor can properly mask the |
113 // scrolling contents and scrollbars. | 113 // scrolling contents and scrollbars. |
114 if (!renderLayer.renderer()->hasClipPath() || (renderLayer.needsComposit
edScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) | 114 if (!renderLayer.renderer()->hasClipPath() || (renderLayer.needsComposit
edScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) |
115 return; | 115 return; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ~ClipPathHelper() | 156 ~ClipPathHelper() |
157 { | 157 { |
158 if (m_resourceClipper) | 158 if (m_resourceClipper) |
159 m_resourceClipper->postApplyStatefulResource(m_renderLayer.renderer(
), m_context, m_clipperState); | 159 m_resourceClipper->postApplyStatefulResource(m_renderLayer.renderer(
), m_context, m_clipperState); |
160 } | 160 } |
161 private: | 161 private: |
162 RenderSVGResourceClipper* m_resourceClipper; | 162 RenderSVGResourceClipper* m_resourceClipper; |
163 GraphicsContextStateSaver m_clipStateSaver; | 163 GraphicsContextStateSaver m_clipStateSaver; |
164 OwnPtr<ClipPathRecorder> m_clipPathRecorder; | 164 OwnPtr<ClipPathRecorder> m_clipPathRecorder; |
165 RenderSVGResourceClipper::ClipperState m_clipperState; | 165 RenderSVGResourceClipper::ClipperState m_clipperState; |
166 const RenderLayer& m_renderLayer; | 166 const Layer& m_renderLayer; |
167 GraphicsContext* m_context; | 167 GraphicsContext* m_context; |
168 }; | 168 }; |
169 | 169 |
170 void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
ingInfo& paintingInfo, PaintLayerFlags paintFlags) | 170 void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint
ingInfo& paintingInfo, PaintLayerFlags paintFlags) |
171 { | 171 { |
172 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL
ayerDescendant()); | 172 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL
ayerDescendant()); |
173 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); | 173 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); |
174 | 174 |
175 bool isSelfPaintingLayer = m_renderLayer.isSelfPaintingLayer(); | 175 bool isSelfPaintingLayer = m_renderLayer.isSelfPaintingLayer(); |
176 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr
ollbars; | 176 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr
ollbars; |
(...skipping 28 matching lines...) Expand all Loading... |
205 bool rootRelativeBoundsComputed = false; | 205 bool rootRelativeBoundsComputed = false; |
206 | 206 |
207 // These helpers output clip and compositing operations using a RAII pattern
. Stack-allocated-varibles are destructed in the reverse order of construction, | 207 // These helpers output clip and compositing operations using a RAII pattern
. Stack-allocated-varibles are destructed in the reverse order of construction, |
208 // so they are nested properly. | 208 // so they are nested properly. |
209 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela
tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); | 209 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela
tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); |
210 | 210 |
211 OwnPtr<CompositingRecorder> compositingRecorder; | 211 OwnPtr<CompositingRecorder> compositingRecorder; |
212 OwnPtr<LayerClipRecorder> clipRecorder; | 212 OwnPtr<LayerClipRecorder> clipRecorder; |
213 // Blending operations must be performed only with the nearest ancestor stac
king context. | 213 // Blending operations must be performed only with the nearest ancestor stac
king context. |
214 // Note that there is no need to composite if we're painting the root. | 214 // Note that there is no need to composite if we're painting the root. |
215 // FIXME: this should be unified further into RenderLayer::paintsWithTranspa
rency(). | 215 // FIXME: this should be unified further into Layer::paintsWithTransparency(
). |
216 bool shouldCompositeForBlendMode = (!m_renderLayer.renderer()->isDocumentEle
ment() || m_renderLayer.renderer()->isSVGRoot()) && m_renderLayer.stackingNode()
->isStackingContext() && m_renderLayer.hasNonIsolatedDescendantWithBlendMode(); | 216 bool shouldCompositeForBlendMode = (!m_renderLayer.renderer()->isDocumentEle
ment() || m_renderLayer.renderer()->isSVGRoot()) && m_renderLayer.stackingNode()
->isStackingContext() && m_renderLayer.hasNonIsolatedDescendantWithBlendMode(); |
217 if (shouldCompositeForBlendMode || m_renderLayer.paintsWithTransparency(pain
tingInfo.paintBehavior)) { | 217 if (shouldCompositeForBlendMode || m_renderLayer.paintsWithTransparency(pain
tingInfo.paintBehavior)) { |
218 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, DisplayItem::TransparencyClip, | 218 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, DisplayItem::TransparencyClip, |
219 m_renderLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior), | 219 m_renderLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior), |
220 &paintingInfo, LayoutPoint(), paintFlags)); | 220 &paintingInfo, LayoutPoint(), paintFlags)); |
221 | 221 |
222 compositingRecorder = adoptPtr(new CompositingRecorder(context, m_render
Layer.renderer()->displayItemClient(), | 222 compositingRecorder = adoptPtr(new CompositingRecorder(context, m_render
Layer.renderer()->displayItemClient(), |
223 context->compositeOperationDeprecated(), m_renderLayer.renderer()->s
tyle()->blendMode(), m_renderLayer.renderer()->opacity(), context->compositeOper
ationDeprecated())); | 223 context->compositeOperationDeprecated(), m_renderLayer.renderer()->s
tyle()->blendMode(), m_renderLayer.renderer()->opacity(), context->compositeOper
ationDeprecated())); |
224 } | 224 } |
225 | 225 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 void LayerPainter::paintLayerWithTransform(GraphicsContext* context, const Layer
PaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 325 void LayerPainter::paintLayerWithTransform(GraphicsContext* context, const Layer
PaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
326 { | 326 { |
327 TransformationMatrix layerTransform = m_renderLayer.renderableTransform(pain
tingInfo.paintBehavior); | 327 TransformationMatrix layerTransform = m_renderLayer.renderableTransform(pain
tingInfo.paintBehavior); |
328 // If the transform can't be inverted, then don't paint anything. | 328 // If the transform can't be inverted, then don't paint anything. |
329 if (!layerTransform.isInvertible()) | 329 if (!layerTransform.isInvertible()) |
330 return; | 330 return; |
331 | 331 |
332 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer
here. | 332 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer
here. |
333 // m_renderLayer may be the "root", and then we should avoid looking at its
parent. | 333 // m_renderLayer may be the "root", and then we should avoid looking at its
parent. |
334 RenderLayer* parentLayer = m_renderLayer.parent(); | 334 Layer* parentLayer = m_renderLayer.parent(); |
335 | 335 |
336 ClipRect clipRect(LayoutRect::infiniteRect()); | 336 ClipRect clipRect(LayoutRect::infiniteRect()); |
337 if (parentLayer) { | 337 if (parentLayer) { |
338 // Calculate the clip rectangle that the ancestors establish. | 338 // Calculate the clip rectangle that the ancestors establish. |
339 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags &
PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver
layScrollbarSize); | 339 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags &
PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver
layScrollbarSize); |
340 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == I
gnoreOverflowClip) | 340 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == I
gnoreOverflowClip) |
341 clipRectsContext.setIgnoreOverflowClip(); | 341 clipRectsContext.setIgnoreOverflowClip(); |
342 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsContext); | 342 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsContext); |
343 } | 343 } |
344 | 344 |
345 RenderLayer* paginationLayer = m_renderLayer.enclosingPaginationLayer(); | 345 Layer* paginationLayer = m_renderLayer.enclosingPaginationLayer(); |
346 LayerFragments fragments; | 346 LayerFragments fragments; |
347 if (paginationLayer) { | 347 if (paginationLayer) { |
348 // FIXME: This is a mess. Look closely at this code and the code in Rend
erLayer and fix any | 348 // FIXME: This is a mess. Look closely at this code and the code in Laye
r and fix any |
349 // issues in it & refactor to make it obvious from code structure what i
t does and that it's | 349 // issues in it & refactor to make it obvious from code structure what i
t does and that it's |
350 // correct. | 350 // correct. |
351 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; | 351 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects
) ? UncachedClipRects : PaintingClipRects; |
352 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli
p(paintFlags, m_renderLayer.renderer()); | 352 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli
p(paintFlags, m_renderLayer.renderer()); |
353 // Calculate the transformed bounding box in the current coordinate spac
e, to figure out | 353 // Calculate the transformed bounding box in the current coordinate spac
e, to figure out |
354 // which fragmentainers (e.g. columns) we need to visit. | 354 // which fragmentainers (e.g. columns) we need to visit. |
355 LayoutRect transformedExtent = RenderLayer::transparencyClipBox(&m_rende
rLayer, paginationLayer, RenderLayer::PaintingTransparencyClipBox, RenderLayer::
RootOfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.paint
Behavior); | 355 LayoutRect transformedExtent = Layer::transparencyClipBox(&m_renderLayer
, paginationLayer, Layer::PaintingTransparencyClipBox, Layer::RootOfTransparency
ClipBox, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
356 // FIXME: we don't check if paginationLayer is within paintingInfo.rootL
ayer here. | 356 // FIXME: we don't check if paginationLayer is within paintingInfo.rootL
ayer here. |
357 paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, pai
ntingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflow
Clip, 0, paintingInfo.subPixelAccumulation, &transformedExtent); | 357 paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, pai
ntingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflow
Clip, 0, paintingInfo.subPixelAccumulation, &transformedExtent); |
358 } else { | 358 } else { |
359 // We don't need to collect any fragments in the regular way here. We ha
ve already | 359 // We don't need to collect any fragments in the regular way here. We ha
ve already |
360 // calculated a clip rectangle for the ancestry if it was needed, and cl
ipping this | 360 // calculated a clip rectangle for the ancestry if it was needed, and cl
ipping this |
361 // layer is something that can be done further down the path, when the t
ransform has | 361 // layer is something that can be done further down the path, when the t
ransform has |
362 // been applied. | 362 // been applied. |
363 LayerFragment fragment; | 363 LayerFragment fragment; |
364 fragment.backgroundRect = paintingInfo.paintDirtyRect; | 364 fragment.backgroundRect = paintingInfo.paintDirtyRect; |
365 fragments.append(fragment); | 365 fragments.append(fragment); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont
ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 404 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont
ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
405 { | 405 { |
406 if (!m_renderLayer.hasSelfPaintingLayerDescendant()) | 406 if (!m_renderLayer.hasSelfPaintingLayerDescendant()) |
407 return; | 407 return; |
408 | 408 |
409 #if ENABLE(ASSERT) | 409 #if ENABLE(ASSERT) |
410 LayerListMutationDetector mutationChecker(m_renderLayer.stackingNode()); | 410 LayerListMutationDetector mutationChecker(m_renderLayer.stackingNode()); |
411 #endif | 411 #endif |
412 | 412 |
413 RenderLayerStackingNodeIterator iterator(*m_renderLayer.stackingNode(), chil
drenToVisit); | 413 LayerStackingNodeIterator iterator(*m_renderLayer.stackingNode(), childrenTo
Visit); |
414 while (RenderLayerStackingNode* child = iterator.next()) { | 414 while (LayerStackingNode* child = iterator.next()) { |
415 LayerPainter childPainter(*child->layer()); | 415 LayerPainter childPainter(*child->layer()); |
416 // If this RenderLayer should paint into its own backing or a grouped ba
cking, that will be done via CompositedLayerMapping::paintContents() | 416 // If this Layer should paint into its own backing or a grouped backing,
that will be done via CompositedLayerMapping::paintContents() |
417 // and CompositedLayerMapping::doPaintTask(). | 417 // and CompositedLayerMapping::doPaintTask(). |
418 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo, paintFlag
s)) | 418 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo, paintFlag
s)) |
419 continue; | 419 continue; |
420 | 420 |
421 if (!child->layer()->isPaginated()) | 421 if (!child->layer()->isPaginated()) |
422 childPainter.paintLayer(context, paintingInfo, paintFlags); | 422 childPainter.paintLayer(context, paintingInfo, paintFlags); |
423 else | 423 else |
424 childPainter.paintPaginatedChildLayer(child->layer(), context, paint
ingInfo, paintFlags); | 424 childPainter.paintPaginatedChildLayer(child->layer(), context, paint
ingInfo, paintFlags); |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 // FIXME: inline this. | 428 // FIXME: inline this. |
429 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag
s paintFlags) | 429 static bool paintForFixedRootBackground(const Layer* layer, PaintLayerFlags pain
tFlags) |
430 { | 430 { |
431 return layer->renderer()->isDocumentElement() && (paintFlags & PaintLayerPai
ntingRootBackgroundOnly); | 431 return layer->renderer()->isDocumentElement() && (paintFlags & PaintLayerPai
ntingRootBackgroundOnly); |
432 } | 432 } |
433 | 433 |
434 bool LayerPainter::shouldPaintLayerInSoftwareMode(const LayerPaintingInfo& paint
ingInfo, PaintLayerFlags paintFlags) | 434 bool LayerPainter::shouldPaintLayerInSoftwareMode(const LayerPaintingInfo& paint
ingInfo, PaintLayerFlags paintFlags) |
435 { | 435 { |
436 DisableCompositingQueryAsserts disabler; | 436 DisableCompositingQueryAsserts disabler; |
437 | 437 |
438 return m_renderLayer.compositingState() == NotComposited | 438 return m_renderLayer.compositingState() == NotComposited |
439 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) | 439 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) |
(...skipping 13 matching lines...) Expand all Loading... |
453 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) | 453 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) |
454 { | 454 { |
455 for (size_t i = 0; i < layerFragments.size(); ++i) { | 455 for (size_t i = 0; i < layerFragments.size(); ++i) { |
456 const LayerFragment& fragment = layerFragments.at(i); | 456 const LayerFragment& fragment = layerFragments.at(i); |
457 | 457 |
458 OwnPtr<LayerClipRecorder> clipRecorder; | 458 OwnPtr<LayerClipRecorder> clipRecorder; |
459 | 459 |
460 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 460 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
461 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer
(), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l
ocalPaintingInfo, fragment.paginationOffset, paintFlags)); | 461 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer
(), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l
ocalPaintingInfo, fragment.paginationOffset, paintFlags)); |
462 } | 462 } |
463 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) | 463 if (LayerScrollableArea* scrollableArea = m_renderLayer.scrollableArea()
) |
464 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.render
BoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulat
ion, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroun
dRect.rect()), true); | 464 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.render
BoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulat
ion, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroun
dRect.rect()), true); |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) | 468 static bool checkContainingBlockChainForPagination(LayoutLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) |
469 { | 469 { |
470 RenderView* view = renderer->view(); | 470 RenderView* view = renderer->view(); |
471 RenderLayerModelObject* prevBlock = renderer; | 471 LayoutLayerModelObject* prevBlock = renderer; |
472 RenderBlock* containingBlock; | 472 RenderBlock* containingBlock; |
473 for (containingBlock = renderer->containingBlock(); | 473 for (containingBlock = renderer->containingBlock(); |
474 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; | 474 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; |
475 containingBlock = containingBlock->containingBlock()) | 475 containingBlock = containingBlock->containingBlock()) |
476 prevBlock = containingBlock; | 476 prevBlock = containingBlock; |
477 | 477 |
478 // If the columns block wasn't in our containing block chain, then we aren't
paginated by it. | 478 // If the columns block wasn't in our containing block chain, then we aren't
paginated by it. |
479 if (containingBlock != ancestorColumnsRenderer) | 479 if (containingBlock != ancestorColumnsRenderer) |
480 return false; | 480 return false; |
481 | 481 |
482 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. | 482 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. |
483 if (prevBlock->isOutOfFlowPositioned()) | 483 if (prevBlock->isOutOfFlowPositioned()) |
484 return false; | 484 return false; |
485 | 485 |
486 // Otherwise we are paginated by the columns block. | 486 // Otherwise we are paginated by the columns block. |
487 return true; | 487 return true; |
488 } | 488 } |
489 | 489 |
490 void LayerPainter::paintPaginatedChildLayer(RenderLayer* childLayer, GraphicsCon
text* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags
) | 490 void LayerPainter::paintPaginatedChildLayer(Layer* childLayer, GraphicsContext*
context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
491 { | 491 { |
492 // We need to do multiple passes, breaking up our child layer into strips. | 492 // We need to do multiple passes, breaking up our child layer into strips. |
493 Vector<RenderLayer*> columnLayers; | 493 Vector<Layer*> columnLayers; |
494 RenderLayerStackingNode* ancestorNode = m_renderLayer.stackingNode()->isNorm
alFlowOnly() ? m_renderLayer.parent()->stackingNode() : m_renderLayer.stackingNo
de()->ancestorStackingContextNode(); | 494 LayerStackingNode* ancestorNode = m_renderLayer.stackingNode()->isNormalFlow
Only() ? m_renderLayer.parent()->stackingNode() : m_renderLayer.stackingNode()->
ancestorStackingContextNode(); |
495 for (RenderLayer* curr = childLayer->parent(); curr; curr = curr->parent())
{ | 495 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { |
496 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina
tion(childLayer->renderer(), curr->renderBox())) | 496 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina
tion(childLayer->renderer(), curr->renderBox())) |
497 columnLayers.append(curr); | 497 columnLayers.append(curr); |
498 if (curr->stackingNode() == ancestorNode) | 498 if (curr->stackingNode() == ancestorNode) |
499 break; | 499 break; |
500 } | 500 } |
501 | 501 |
502 // It is possible for paintLayer() to be called after the child layer ceases
to be paginated but before | 502 // It is possible for paintLayer() to be called after the child layer ceases
to be paginated but before |
503 // updatePaginationRecusive() is called and resets the isPaginated() flag, s
ee <rdar://problem/10098679>. | 503 // updatePaginationRecusive() is called and resets the isPaginated() flag, s
ee <rdar://problem/10098679>. |
504 // If this is the case, just bail out, since the upcoming call to updatePagi
nationRecusive() will paint invalidate the layer. | 504 // If this is the case, just bail out, since the upcoming call to updatePagi
nationRecusive() will paint invalidate the layer. |
505 // FIXME: Is this true anymore? This seems very suspicious. | 505 // FIXME: Is this true anymore? This seems very suspicious. |
506 if (!columnLayers.size()) | 506 if (!columnLayers.size()) |
507 return; | 507 return; |
508 | 508 |
509 paintChildLayerIntoColumns(childLayer, context, paintingInfo, paintFlags, co
lumnLayers, columnLayers.size() - 1); | 509 paintChildLayerIntoColumns(childLayer, context, paintingInfo, paintFlags, co
lumnLayers, columnLayers.size() - 1); |
510 } | 510 } |
511 | 511 |
512 void LayerPainter::paintChildLayerIntoColumns(RenderLayer* childLayer, GraphicsC
ontext* context, const LayerPaintingInfo& paintingInfo, | 512 void LayerPainter::paintChildLayerIntoColumns(Layer* childLayer, GraphicsContext
* context, const LayerPaintingInfo& paintingInfo, |
513 PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t
colIndex) | 513 PaintLayerFlags paintFlags, const Vector<Layer*>& columnLayers, size_t colIn
dex) |
514 { | 514 { |
515 RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer())
; | 515 RenderBlock* columnBlock = toRenderBlock(columnLayers[colIndex]->renderer())
; |
516 | 516 |
517 ASSERT(columnBlock && columnBlock->hasColumns()); | 517 ASSERT(columnBlock && columnBlock->hasColumns()); |
518 if (!columnBlock || !columnBlock->hasColumns()) | 518 if (!columnBlock || !columnBlock->hasColumns()) |
519 return; | 519 return; |
520 | 520 |
521 LayoutPoint layerOffset; | 521 LayoutPoint layerOffset; |
522 // FIXME: It looks suspicious to call convertToLayerCoords here | 522 // FIXME: It looks suspicious to call convertToLayerCoords here |
523 // as canUseConvertToLayerCoords is true for this layer. | 523 // as canUseConvertToLayerCoords is true for this layer. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 700 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
701 return; | 701 return; |
702 | 702 |
703 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 703 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); |
704 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 704 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
705 | 705 |
706 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 706 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
707 } | 707 } |
708 | 708 |
709 } // namespace blink | 709 } // namespace blink |
OLD | NEW |