OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Returns the enclosing layer root into which this layer paints, inclusive
of this one. Note that the enclosing layer may or may not have its own | 201 // Returns the enclosing layer root into which this layer paints, inclusive
of this one. Note that the enclosing layer may or may not have its own |
202 // GraphicsLayer backing, but is nevertheless the root for a call to the Lay
er::paint*() methods. | 202 // GraphicsLayer backing, but is nevertheless the root for a call to the Lay
er::paint*() methods. |
203 Layer* enclosingLayerForPaintInvalidation() const; | 203 Layer* enclosingLayerForPaintInvalidation() const; |
204 | 204 |
205 Layer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const; | 205 Layer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const; |
206 | 206 |
207 bool hasAncestorWithFilterOutsets() const; | 207 bool hasAncestorWithFilterOutsets() const; |
208 | 208 |
209 bool canUseConvertToLayerCoords() const | 209 bool canUseConvertToLayerCoords() const |
210 { | 210 { |
211 // These RenderObjects have an impact on their layers without the render
ers knowing about it. | 211 // These LayoutObjects have an impact on their layers without the render
ers knowing about it. |
212 return !renderer()->hasColumns() && !renderer()->hasTransformRelatedProp
erty() && !renderer()->isSVGRoot(); | 212 return !renderer()->hasColumns() && !renderer()->hasTransformRelatedProp
erty() && !renderer()->isSVGRoot(); |
213 } | 213 } |
214 | 214 |
215 void convertToLayerCoords(const Layer* ancestorLayer, LayoutPoint&) const; | 215 void convertToLayerCoords(const Layer* ancestorLayer, LayoutPoint&) const; |
216 void convertToLayerCoords(const Layer* ancestorLayer, LayoutRect&) const; | 216 void convertToLayerCoords(const Layer* ancestorLayer, LayoutRect&) const; |
217 | 217 |
218 // Does the same as convertToLayerCoords() when not in multicol. For multico
l, however, | 218 // Does the same as convertToLayerCoords() when not in multicol. For multico
l, however, |
219 // convertToLayerCoords() calculates the offset in flow-thread coordinates (
what the layout | 219 // convertToLayerCoords() calculates the offset in flow-thread coordinates (
what the layout |
220 // engine uses internally), while this method calculates the visual coordina
tes; i.e. it figures | 220 // engine uses internally), while this method calculates the visual coordina
tes; i.e. it figures |
221 // out which column the layer starts in and adds in the offset. See | 221 // out which column the layer starts in and adds in the offset. See |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; } | 305 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; } |
306 void setGroupedMapping(CompositedLayerMapping* groupedMapping, bool layerBei
ngDestroyed = false); | 306 void setGroupedMapping(CompositedLayerMapping* groupedMapping, bool layerBei
ngDestroyed = false); |
307 | 307 |
308 bool hasCompositedMask() const; | 308 bool hasCompositedMask() const; |
309 bool hasCompositedClippingMask() const; | 309 bool hasCompositedClippingMask() const; |
310 bool needsCompositedScrolling() const { return m_scrollableArea && m_scrolla
bleArea->needsCompositedScrolling(); } | 310 bool needsCompositedScrolling() const { return m_scrollableArea && m_scrolla
bleArea->needsCompositedScrolling(); } |
311 | 311 |
312 // Computes the position of the given render object in the space of |paintIn
validationContainer|. | 312 // Computes the position of the given render object in the space of |paintIn
validationContainer|. |
313 // FIXME: invert the logic to have paint invalidation containers take care o
f painting objects into them, rather than the reverse. | 313 // FIXME: invert the logic to have paint invalidation containers take care o
f painting objects into them, rather than the reverse. |
314 // This will allow us to clean up this static method messiness. | 314 // This will allow us to clean up this static method messiness. |
315 static LayoutPoint positionFromPaintInvalidationBacking(const RenderObject*,
const LayoutLayerModelObject* paintInvalidationContainer, const PaintInvalidati
onState* = 0); | 315 static LayoutPoint positionFromPaintInvalidationBacking(const LayoutObject*,
const LayoutLayerModelObject* paintInvalidationContainer, const PaintInvalidati
onState* = 0); |
316 | 316 |
317 static void mapPointToPaintBackingCoordinates(const LayoutLayerModelObject*
paintInvalidationContainer, FloatPoint&); | 317 static void mapPointToPaintBackingCoordinates(const LayoutLayerModelObject*
paintInvalidationContainer, FloatPoint&); |
318 static void mapRectToPaintBackingCoordinates(const LayoutLayerModelObject* p
aintInvalidationContainer, LayoutRect&); | 318 static void mapRectToPaintBackingCoordinates(const LayoutLayerModelObject* p
aintInvalidationContainer, LayoutRect&); |
319 | 319 |
320 // Adjusts the given rect (in the coordinate space of the RenderObject) to t
he coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. | 320 // Adjusts the given rect (in the coordinate space of the LayoutObject) to t
he coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. |
321 static void mapRectToPaintInvalidationBacking(const RenderObject*, const Lay
outLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalid
ationState* = 0); | 321 static void mapRectToPaintInvalidationBacking(const LayoutObject*, const Lay
outLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalid
ationState* = 0); |
322 | 322 |
323 // Computes the bounding paint invalidation rect for |renderObject|, in the
coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. | 323 // Computes the bounding paint invalidation rect for |layoutObject|, in the
coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. |
324 static LayoutRect computePaintInvalidationRect(const RenderObject*, const La
yer* paintInvalidationContainer, const PaintInvalidationState* = 0); | 324 static LayoutRect computePaintInvalidationRect(const LayoutObject*, const La
yer* paintInvalidationContainer, const PaintInvalidationState* = 0); |
325 | 325 |
326 bool paintsWithTransparency(PaintBehavior paintBehavior) const | 326 bool paintsWithTransparency(PaintBehavior paintBehavior) const |
327 { | 327 { |
328 return isTransparent() && ((paintBehavior & PaintBehaviorFlattenComposit
ingLayers) || compositingState() != PaintsIntoOwnBacking); | 328 return isTransparent() && ((paintBehavior & PaintBehaviorFlattenComposit
ingLayers) || compositingState() != PaintsIntoOwnBacking); |
329 } | 329 } |
330 | 330 |
331 bool paintsWithTransform(PaintBehavior) const; | 331 bool paintsWithTransform(PaintBehavior) const; |
332 | 332 |
333 // Returns true if background phase is painted opaque in the given rect. | 333 // Returns true if background phase is painted opaque in the given rect. |
334 // The query rect is given in local coordinates. | 334 // The query rect is given in local coordinates. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 void computeSelfHitTestRects(LayerHitTestRects&) const; | 371 void computeSelfHitTestRects(LayerHitTestRects&) const; |
372 | 372 |
373 // FIXME: This should probably return a ScrollableArea but a lot of internal
methods are mistakenly exposed. | 373 // FIXME: This should probably return a ScrollableArea but a lot of internal
methods are mistakenly exposed. |
374 LayerScrollableArea* scrollableArea() const { return m_scrollableArea.get();
} | 374 LayerScrollableArea* scrollableArea() const { return m_scrollableArea.get();
} |
375 LayerClipper& clipper() { return m_clipper; } | 375 LayerClipper& clipper() { return m_clipper; } |
376 const LayerClipper& clipper() const { return m_clipper; } | 376 const LayerClipper& clipper() const { return m_clipper; } |
377 | 377 |
378 inline bool isPositionedContainer() const | 378 inline bool isPositionedContainer() const |
379 { | 379 { |
380 // FIXME: This is not in sync with containingBlock. | 380 // FIXME: This is not in sync with containingBlock. |
381 // RenderObject::canContainFixedPositionedObject() should probably be us
ed | 381 // LayoutObject::canContainFixedPositionedObject() should probably be us
ed |
382 // instead. | 382 // instead. |
383 LayoutLayerModelObject* layerRenderer = renderer(); | 383 LayoutLayerModelObject* layerRenderer = renderer(); |
384 return isRootLayer() || layerRenderer->isPositioned() || hasTransformRel
atedProperty(); | 384 return isRootLayer() || layerRenderer->isPositioned() || hasTransformRel
atedProperty(); |
385 } | 385 } |
386 | 386 |
387 bool scrollsOverflow() const; | 387 bool scrollsOverflow() const; |
388 | 388 |
389 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p
otentialCompositingReasonsFromStyle; } | 389 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p
otentialCompositingReasonsFromStyle; } |
390 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A
SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m
_potentialCompositingReasonsFromStyle = reasons; } | 390 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A
SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m
_potentialCompositingReasonsFromStyle = reasons; } |
391 | 391 |
392 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential
CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas
ons; } | 392 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential
CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas
ons; } |
393 | 393 |
394 class AncestorDependentCompositingInputs { | 394 class AncestorDependentCompositingInputs { |
395 public: | 395 public: |
396 AncestorDependentCompositingInputs() | 396 AncestorDependentCompositingInputs() |
397 : opacityAncestor(0) | 397 : opacityAncestor(0) |
398 , transformAncestor(0) | 398 , transformAncestor(0) |
399 , filterAncestor(0) | 399 , filterAncestor(0) |
400 , clippingContainer(0) | 400 , clippingContainer(0) |
401 , ancestorScrollingLayer(0) | 401 , ancestorScrollingLayer(0) |
402 , scrollParent(0) | 402 , scrollParent(0) |
403 , clipParent(0) | 403 , clipParent(0) |
404 , hasAncestorWithClipPath(false) | 404 , hasAncestorWithClipPath(false) |
405 { } | 405 { } |
406 | 406 |
407 IntRect clippedAbsoluteBoundingBox; | 407 IntRect clippedAbsoluteBoundingBox; |
408 const Layer* opacityAncestor; | 408 const Layer* opacityAncestor; |
409 const Layer* transformAncestor; | 409 const Layer* transformAncestor; |
410 const Layer* filterAncestor; | 410 const Layer* filterAncestor; |
411 const RenderObject* clippingContainer; | 411 const LayoutObject* clippingContainer; |
412 const Layer* ancestorScrollingLayer; | 412 const Layer* ancestorScrollingLayer; |
413 | 413 |
414 // A scroll parent is a compositor concept. It's only needed in blink | 414 // A scroll parent is a compositor concept. It's only needed in blink |
415 // because we need to use it as a promotion trigger. A layer has a | 415 // because we need to use it as a promotion trigger. A layer has a |
416 // scroll parent if neither its compositor scrolling ancestor, nor any | 416 // scroll parent if neither its compositor scrolling ancestor, nor any |
417 // other layer scrolled by this ancestor, is a stacking ancestor of this | 417 // other layer scrolled by this ancestor, is a stacking ancestor of this |
418 // layer. Layers with scroll parents must be scrolled with the main | 418 // layer. Layers with scroll parents must be scrolled with the main |
419 // scrolling layer by the compositor. | 419 // scrolling layer by the compositor. |
420 const Layer* scrollParent; | 420 const Layer* scrollParent; |
421 | 421 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 void updateDescendantDependentCompositingInputs(const DescendantDependentCom
positingInputs&); | 454 void updateDescendantDependentCompositingInputs(const DescendantDependentCom
positingInputs&); |
455 void didUpdateCompositingInputs(); | 455 void didUpdateCompositingInputs(); |
456 | 456 |
457 const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs
() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_an
cestorDependentCompositingInputs; } | 457 const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs
() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_an
cestorDependentCompositingInputs; } |
458 const DescendantDependentCompositingInputs& descendantDependentCompositingIn
puts() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); retur
n m_descendantDependentCompositingInputs; } | 458 const DescendantDependentCompositingInputs& descendantDependentCompositingIn
puts() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); retur
n m_descendantDependentCompositingInputs; } |
459 | 459 |
460 IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentComposi
tingInputs().clippedAbsoluteBoundingBox; } | 460 IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentComposi
tingInputs().clippedAbsoluteBoundingBox; } |
461 const Layer* opacityAncestor() const { return ancestorDependentCompositingIn
puts().opacityAncestor; } | 461 const Layer* opacityAncestor() const { return ancestorDependentCompositingIn
puts().opacityAncestor; } |
462 const Layer* transformAncestor() const { return ancestorDependentCompositing
Inputs().transformAncestor; } | 462 const Layer* transformAncestor() const { return ancestorDependentCompositing
Inputs().transformAncestor; } |
463 const Layer* filterAncestor() const { return ancestorDependentCompositingInp
uts().filterAncestor; } | 463 const Layer* filterAncestor() const { return ancestorDependentCompositingInp
uts().filterAncestor; } |
464 const RenderObject* clippingContainer() const { return ancestorDependentComp
ositingInputs().clippingContainer; } | 464 const LayoutObject* clippingContainer() const { return ancestorDependentComp
ositingInputs().clippingContainer; } |
465 const Layer* ancestorScrollingLayer() const { return ancestorDependentCompos
itingInputs().ancestorScrollingLayer; } | 465 const Layer* ancestorScrollingLayer() const { return ancestorDependentCompos
itingInputs().ancestorScrollingLayer; } |
466 Layer* scrollParent() const { return const_cast<Layer*>(ancestorDependentCom
positingInputs().scrollParent); } | 466 Layer* scrollParent() const { return const_cast<Layer*>(ancestorDependentCom
positingInputs().scrollParent); } |
467 Layer* clipParent() const { return const_cast<Layer*>(ancestorDependentCompo
sitingInputs().clipParent); } | 467 Layer* clipParent() const { return const_cast<Layer*>(ancestorDependentCompo
sitingInputs().clipParent); } |
468 bool hasAncestorWithClipPath() const { return ancestorDependentCompositingIn
puts().hasAncestorWithClipPath; } | 468 bool hasAncestorWithClipPath() const { return ancestorDependentCompositingIn
puts().hasAncestorWithClipPath; } |
469 bool hasDescendantWithClipPath() const { return descendantDependentCompositi
ngInputs().hasDescendantWithClipPath; } | 469 bool hasDescendantWithClipPath() const { return descendantDependentCompositi
ngInputs().hasDescendantWithClipPath; } |
470 bool hasNonIsolatedDescendantWithBlendMode() const; | 470 bool hasNonIsolatedDescendantWithBlendMode() const; |
471 | 471 |
472 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } | 472 bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState())
; return m_lostGroupedMapping; } |
473 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } | 473 void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; } |
474 | 474 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 OwnPtr<LayerReflectionInfo> m_reflectionInfo; | 712 OwnPtr<LayerReflectionInfo> m_reflectionInfo; |
713 | 713 |
714 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. | 714 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. |
715 }; | 715 }; |
716 | 716 |
717 } // namespace blink | 717 } // namespace blink |
718 | 718 |
719 #ifndef NDEBUG | 719 #ifndef NDEBUG |
720 // Outside the WebCore namespace for ease of invocation from gdb. | 720 // Outside the WebCore namespace for ease of invocation from gdb. |
721 void showLayerTree(const blink::Layer*); | 721 void showLayerTree(const blink::Layer*); |
722 void showLayerTree(const blink::RenderObject*); | 722 void showLayerTree(const blink::LayoutObject*); |
723 #endif | 723 #endif |
724 | 724 |
725 #endif // Layer_h | 725 #endif // Layer_h |
OLD | NEW |