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/layout/compositing/CompositingInputsUpdater.h" | 6 #include "core/layout/compositing/CompositingInputsUpdater.h" |
7 | 7 |
8 #include "core/layout/Layer.h" | 8 #include "core/layout/Layer.h" |
9 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
10 #include "core/layout/compositing/LayerCompositor.h" | 10 #include "core/layout/compositing/LayerCompositor.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 static const Layer* findParentLayerOnClippingContainerChain(const Layer* layer) | 32 static const Layer* findParentLayerOnClippingContainerChain(const Layer* layer) |
33 { | 33 { |
34 LayoutObject* current = layer->renderer(); | 34 LayoutObject* current = layer->renderer(); |
35 while (current) { | 35 while (current) { |
36 if (current->style()->position() == FixedPosition) { | 36 if (current->style()->position() == FixedPosition) { |
37 for (current = current->parent(); current && !current->canContainFix
edPositionObjects(); current = current->parent()) { | 37 for (current = current->parent(); current && !current->canContainFix
edPositionObjects(); current = current->parent()) { |
38 // All types of clips apply to fixed-position descendants of oth
er fixed-position elements. | 38 // All types of clips apply to fixed-position descendants of oth
er fixed-position elements. |
39 // Note: it's unclear whether this is what the spec says. Firefo
x does not clip, but Chrome does. | 39 // Note: it's unclear whether this is what the spec says. Firefo
x does not clip, but Chrome does. |
40 if (current->style()->position() == FixedPosition && current->ha
sClipOrOverflowClip()) { | 40 if (current->style()->position() == FixedPosition && current->ha
sClipOrOverflowClip()) { |
41 ASSERT(current->hasLayer()); | 41 ASSERT(current->hasLayer()); |
42 return static_cast<const LayoutLayerModelObject*>(current)->
layer(); | 42 return static_cast<const LayoutBoxModelObject*>(current)->la
yer(); |
43 } | 43 } |
44 | 44 |
45 // CSS clip applies to fixed position elements even for ancestor
s that are not what the | 45 // CSS clip applies to fixed position elements even for ancestor
s that are not what the |
46 // fixed element is positioned with respect to. | 46 // fixed element is positioned with respect to. |
47 if (current->hasClip()) { | 47 if (current->hasClip()) { |
48 ASSERT(current->hasLayer()); | 48 ASSERT(current->hasLayer()); |
49 return static_cast<const LayoutLayerModelObject*>(current)->
layer(); | 49 return static_cast<const LayoutBoxModelObject*>(current)->la
yer(); |
50 } | 50 } |
51 } | 51 } |
52 } else { | 52 } else { |
53 current = current->containingBlock(); | 53 current = current->containingBlock(); |
54 } | 54 } |
55 | 55 |
56 if (current->hasLayer()) | 56 if (current->hasLayer()) |
57 return static_cast<const LayoutLayerModelObject*>(current)->layer(); | 57 return static_cast<const LayoutBoxModelObject*>(current)->layer(); |
58 // Having clip or overflow clip forces the LayoutObject to become a laye
r. | 58 // Having clip or overflow clip forces the LayoutObject to become a laye
r. |
59 ASSERT(!current->hasClipOrOverflowClip()); | 59 ASSERT(!current->hasClipOrOverflowClip()); |
60 } | 60 } |
61 ASSERT_NOT_REACHED(); | 61 ASSERT_NOT_REACHED(); |
62 return 0; | 62 return 0; |
63 } | 63 } |
64 | 64 |
65 static const Layer* findParentLayerOnContainingBlockChain(const LayoutObject* ob
ject) | 65 static const Layer* findParentLayerOnContainingBlockChain(const LayoutObject* ob
ject) |
66 { | 66 { |
67 for (const LayoutObject* current = object; current; current = current->conta
iningBlock()) { | 67 for (const LayoutObject* current = object; current; current = current->conta
iningBlock()) { |
68 if (current->hasLayer()) | 68 if (current->hasLayer()) |
69 return static_cast<const LayoutLayerModelObject*>(current)->layer(); | 69 return static_cast<const LayoutBoxModelObject*>(current)->layer(); |
70 } | 70 } |
71 ASSERT_NOT_REACHED(); | 71 ASSERT_NOT_REACHED(); |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 static bool hasClippedStackingAncestor(const Layer* layer, const Layer* clipping
Layer) | 75 static bool hasClippedStackingAncestor(const Layer* layer, const Layer* clipping
Layer) |
76 { | 76 { |
77 if (layer == clippingLayer) | 77 if (layer == clippingLayer) |
78 return false; | 78 return false; |
79 const LayoutObject* clippingRenderer = clippingLayer->renderer(); | 79 const LayoutObject* clippingRenderer = clippingLayer->renderer(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 ASSERT(!layer->childNeedsCompositingInputsUpdate()); | 188 ASSERT(!layer->childNeedsCompositingInputsUpdate()); |
189 ASSERT(!layer->needsCompositingInputsUpdate()); | 189 ASSERT(!layer->needsCompositingInputsUpdate()); |
190 | 190 |
191 for (Layer* child = layer->firstChild(); child; child = child->nextSibling()
) | 191 for (Layer* child = layer->firstChild(); child; child = child->nextSibling()
) |
192 assertNeedsCompositingInputsUpdateBitsCleared(child); | 192 assertNeedsCompositingInputsUpdateBitsCleared(child); |
193 } | 193 } |
194 | 194 |
195 #endif | 195 #endif |
196 | 196 |
197 } // namespace blink | 197 } // namespace blink |
OLD | NEW |