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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts); | 81 WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts); |
82 public: | 82 public: |
83 DisableCompositingQueryAsserts(); | 83 DisableCompositingQueryAsserts(); |
84 private: | 84 private: |
85 TemporaryChange<CompositingQueryMode> m_disabler; | 85 TemporaryChange<CompositingQueryMode> m_disabler; |
86 }; | 86 }; |
87 | 87 |
88 class Layer { | 88 class Layer { |
89 WTF_MAKE_NONCOPYABLE(Layer); | 89 WTF_MAKE_NONCOPYABLE(Layer); |
90 public: | 90 public: |
91 Layer(LayoutLayerModelObject*, LayerType); | 91 Layer(LayoutBoxModelObject*, LayerType); |
92 ~Layer(); | 92 ~Layer(); |
93 | 93 |
94 String debugName() const; | 94 String debugName() const; |
95 | 95 |
96 LayoutLayerModelObject* renderer() const { return m_renderer; } | 96 LayoutBoxModelObject* renderer() const { return m_renderer; } |
97 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } | 97 RenderBox* renderBox() const { return m_renderer && m_renderer->isBox() ? to
RenderBox(m_renderer) : 0; } |
98 Layer* parent() const { return m_parent; } | 98 Layer* parent() const { return m_parent; } |
99 Layer* previousSibling() const { return m_previous; } | 99 Layer* previousSibling() const { return m_previous; } |
100 Layer* nextSibling() const { return m_next; } | 100 Layer* nextSibling() const { return m_next; } |
101 Layer* firstChild() const { return m_first; } | 101 Layer* firstChild() const { return m_first; } |
102 Layer* lastChild() const { return m_last; } | 102 Layer* lastChild() const { return m_last; } |
103 | 103 |
104 const Layer* compositingContainer() const; | 104 const Layer* compositingContainer() const; |
105 | 105 |
106 void addChild(Layer* newChild, Layer* beforeChild = 0); | 106 void addChild(Layer* newChild, Layer* beforeChild = 0); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } | 275 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } |
276 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } | 276 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } |
277 | 277 |
278 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 | 278 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 |
279 bool shouldPreserve3D() const { return !renderer()->hasReflection() && rende
rer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } | 279 bool shouldPreserve3D() const { return !renderer()->hasReflection() && rende
rer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } |
280 | 280 |
281 void filterNeedsPaintInvalidation(); | 281 void filterNeedsPaintInvalidation(); |
282 bool hasFilter() const { return renderer()->hasFilter(); } | 282 bool hasFilter() const { return renderer()->hasFilter(); } |
283 | 283 |
284 void* operator new(size_t); | 284 void* operator new(size_t); |
285 // Only safe to call from LayoutLayerModelObject::destroyLayer() | 285 // Only safe to call from LayoutBoxModelObject::destroyLayer() |
286 void operator delete(void*); | 286 void operator delete(void*); |
287 | 287 |
288 CompositingState compositingState() const; | 288 CompositingState compositingState() const; |
289 | 289 |
290 // This returns true if our document is in a phase of its lifestyle during w
hich | 290 // This returns true if our document is in a phase of its lifestyle during w
hich |
291 // compositing state may legally be read. | 291 // compositing state may legally be read. |
292 bool isAllowedToQueryCompositingState() const; | 292 bool isAllowedToQueryCompositingState() const; |
293 | 293 |
294 // Don't null check this. | 294 // Don't null check this. |
295 CompositedLayerMapping* compositedLayerMapping() const; | 295 CompositedLayerMapping* compositedLayerMapping() const; |
296 GraphicsLayer* graphicsLayerBacking() const; | 296 GraphicsLayer* graphicsLayerBacking() const; |
297 GraphicsLayer* graphicsLayerBackingForScrolling() const; | 297 GraphicsLayer* graphicsLayerBackingForScrolling() const; |
298 // NOTE: If you are using hasCompositedLayerMapping to determine the state o
f compositing for this layer, | 298 // NOTE: If you are using hasCompositedLayerMapping to determine the state o
f compositing for this layer, |
299 // (and not just to do bookkeeping related to the mapping like, say, allocat
ing or deallocating a mapping), | 299 // (and not just to do bookkeeping related to the mapping like, say, allocat
ing or deallocating a mapping), |
300 // then you may have incorrect logic. Use compositingState() instead. | 300 // then you may have incorrect logic. Use compositingState() instead. |
301 // FIXME: This is identical to null checking compositedLayerMapping(), why n
ot just call that? | 301 // FIXME: This is identical to null checking compositedLayerMapping(), why n
ot just call that? |
302 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get
(); } | 302 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get
(); } |
303 void ensureCompositedLayerMapping(); | 303 void ensureCompositedLayerMapping(); |
304 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); | 304 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); |
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 LayoutObject*,
const LayoutLayerModelObject* paintInvalidationContainer, const PaintInvalidati
onState* = 0); | 315 static LayoutPoint positionFromPaintInvalidationBacking(const LayoutObject*,
const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidation
State* = 0); |
316 | 316 |
317 static void mapPointToPaintBackingCoordinates(const LayoutLayerModelObject*
paintInvalidationContainer, FloatPoint&); | 317 static void mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* pa
intInvalidationContainer, FloatPoint&); |
318 static void mapRectToPaintBackingCoordinates(const LayoutLayerModelObject* p
aintInvalidationContainer, LayoutRect&); | 318 static void mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* pai
ntInvalidationContainer, LayoutRect&); |
319 | 319 |
320 // Adjusts the given rect (in the coordinate space of the LayoutObject) 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 LayoutObject*, const Lay
outLayerModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalid
ationState* = 0); | 321 static void mapRectToPaintInvalidationBacking(const LayoutObject*, const Lay
outBoxModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalidat
ionState* = 0); |
322 | 322 |
323 // Computes the bounding paint invalidation rect for |layoutObject|, 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 LayoutObject*, 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; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // LayoutObject::canContainFixedPositionedObject() should probably be us
ed | 381 // LayoutObject::canContainFixedPositionedObject() should probably be us
ed |
382 // instead. | 382 // instead. |
383 LayoutLayerModelObject* layerRenderer = renderer(); | 383 LayoutBoxModelObject* 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 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // as opposed to the tree formed by the z-order and normal flow lists). | 651 // as opposed to the tree formed by the z-order and normal flow lists). |
652 unsigned m_hasNonCompositedChild : 1; | 652 unsigned m_hasNonCompositedChild : 1; |
653 | 653 |
654 // Should be for stacking contexts having unisolated blending descendants. | 654 // Should be for stacking contexts having unisolated blending descendants. |
655 unsigned m_shouldIsolateCompositedDescendants : 1; | 655 unsigned m_shouldIsolateCompositedDescendants : 1; |
656 | 656 |
657 // True if this render layer just lost its grouped mapping due to the Compos
itedLayerMapping being destroyed, | 657 // True if this render layer just lost its grouped mapping due to the Compos
itedLayerMapping being destroyed, |
658 // and we don't yet know to what graphics layer this Layer will be assigned. | 658 // and we don't yet know to what graphics layer this Layer will be assigned. |
659 unsigned m_lostGroupedMapping : 1; | 659 unsigned m_lostGroupedMapping : 1; |
660 | 660 |
661 LayoutLayerModelObject* m_renderer; | 661 LayoutBoxModelObject* m_renderer; |
662 | 662 |
663 Layer* m_parent; | 663 Layer* m_parent; |
664 Layer* m_previous; | 664 Layer* m_previous; |
665 Layer* m_next; | 665 Layer* m_next; |
666 Layer* m_first; | 666 Layer* m_first; |
667 Layer* m_last; | 667 Layer* m_last; |
668 | 668 |
669 // Our current relative position offset. | 669 // Our current relative position offset. |
670 LayoutSize m_offsetForInFlowPosition; | 670 LayoutSize m_offsetForInFlowPosition; |
671 | 671 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 } // namespace blink | 718 } // namespace blink |
719 | 719 |
720 #ifndef NDEBUG | 720 #ifndef NDEBUG |
721 // Outside the WebCore namespace for ease of invocation from gdb. | 721 // Outside the WebCore namespace for ease of invocation from gdb. |
722 void showLayerTree(const blink::Layer*); | 722 void showLayerTree(const blink::Layer*); |
723 void showLayerTree(const blink::LayoutObject*); | 723 void showLayerTree(const blink::LayoutObject*); |
724 #endif | 724 #endif |
725 | 725 |
726 #endif // Layer_h | 726 #endif // Layer_h |
OLD | NEW |