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 "core/layout/compositing/CompositingInputsUpdater.h" | 5 #include "core/layout/compositing/CompositingInputsUpdater.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/layout/LayoutBlock.h" | 9 #include "core/layout/LayoutBlock.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 static const PaintLayer* findParentLayerOnClippingContainerChain( | 29 static const PaintLayer* findParentLayerOnClippingContainerChain( |
30 const PaintLayer* layer) { | 30 const PaintLayer* layer) { |
31 LayoutObject* current = layer->layoutObject(); | 31 LayoutObject* current = layer->layoutObject(); |
32 while (current) { | 32 while (current) { |
33 if (current->style()->position() == FixedPosition) { | 33 if (current->style()->position() == FixedPosition) { |
34 for (current = current->parent(); | 34 for (current = current->parent(); |
35 current && !current->canContainFixedPositionObjects(); | 35 current && !current->canContainFixedPositionObjects(); |
36 current = current->parent()) { | 36 current = current->parent()) { |
37 // CSS clip applies to fixed position elements even for ancestors that a
re not what the | 37 // CSS clip applies to fixed position elements even for ancestors that |
38 // fixed element is positioned with respect to. | 38 // are not what the fixed element is positioned with respect to. |
39 if (current->hasClip()) { | 39 if (current->hasClip()) { |
40 DCHECK(current->hasLayer()); | 40 DCHECK(current->hasLayer()); |
41 return static_cast<const LayoutBoxModelObject*>(current)->layer(); | 41 return static_cast<const LayoutBoxModelObject*>(current)->layer(); |
42 } | 42 } |
43 } | 43 } |
44 } else { | 44 } else { |
45 current = current->containingBlock(); | 45 current = current->containingBlock(); |
46 } | 46 } |
47 | 47 |
48 if (current->hasLayer()) | 48 if (current->hasLayer()) |
49 return static_cast<const LayoutBoxModelObject*>(current)->layer(); | 49 return static_cast<const LayoutBoxModelObject*>(current)->layer(); |
50 // Having clip or overflow clip forces the LayoutObject to become a layer, e
xcept for contains: paint, which may apply to SVG. | 50 // Having clip or overflow clip forces the LayoutObject to become a layer, |
| 51 // except for contains: paint, which may apply to SVG. |
51 // SVG (other than LayoutSVGRoot) cannot have PaintLayers. | 52 // SVG (other than LayoutSVGRoot) cannot have PaintLayers. |
52 DCHECK(!current->hasClipRelatedProperty() || | 53 DCHECK(!current->hasClipRelatedProperty() || |
53 current->styleRef().containsPaint()); | 54 current->styleRef().containsPaint()); |
54 } | 55 } |
55 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
56 return nullptr; | 57 return nullptr; |
57 } | 58 } |
58 | 59 |
59 static const PaintLayer* findParentLayerOnContainingBlockChain( | 60 static const PaintLayer* findParentLayerOnContainingBlockChain( |
60 const LayoutObject* object) { | 61 const LayoutObject* object) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 143 } |
143 | 144 |
144 if (updateType == ForceUpdate) { | 145 if (updateType == ForceUpdate) { |
145 PaintLayer::AncestorDependentCompositingInputs properties; | 146 PaintLayer::AncestorDependentCompositingInputs properties; |
146 PaintLayer::RareAncestorDependentCompositingInputs rareProperties; | 147 PaintLayer::RareAncestorDependentCompositingInputs rareProperties; |
147 | 148 |
148 if (!layer->isRootLayer()) { | 149 if (!layer->isRootLayer()) { |
149 properties.clippedAbsoluteBoundingBox = | 150 properties.clippedAbsoluteBoundingBox = |
150 enclosingIntRect(m_geometryMap.absoluteRect( | 151 enclosingIntRect(m_geometryMap.absoluteRect( |
151 FloatRect(layer->boundingBoxForCompositingOverlapTest()))); | 152 FloatRect(layer->boundingBoxForCompositingOverlapTest()))); |
152 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very little se
nse, | 153 // FIXME: Setting the absBounds to 1x1 instead of 0x0 makes very little |
153 // but removing this code will make JSGameBench sad. | 154 // sense, but removing this code will make JSGameBench sad. |
154 // See https://codereview.chromium.org/13912020/ | 155 // See https://codereview.chromium.org/13912020/ |
155 if (properties.clippedAbsoluteBoundingBox.isEmpty()) | 156 if (properties.clippedAbsoluteBoundingBox.isEmpty()) |
156 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); | 157 properties.clippedAbsoluteBoundingBox.setSize(IntSize(1, 1)); |
157 | 158 |
158 IntRect clipRect = | 159 IntRect clipRect = |
159 pixelSnappedIntRect(layer->clipper() | 160 pixelSnappedIntRect(layer->clipper() |
160 .backgroundClipRect(ClipRectsContext( | 161 .backgroundClipRect(ClipRectsContext( |
161 m_rootLayer, AbsoluteClipRects)) | 162 m_rootLayer, AbsoluteClipRects)) |
162 .rect()); | 163 .rect()); |
163 properties.clippedAbsoluteBoundingBox.intersect(clipRect); | 164 properties.clippedAbsoluteBoundingBox.intersect(clipRect); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 ASSERT(!layer->needsCompositingInputsUpdate()); | 274 ASSERT(!layer->needsCompositingInputsUpdate()); |
274 | 275 |
275 for (PaintLayer* child = layer->firstChild(); child; | 276 for (PaintLayer* child = layer->firstChild(); child; |
276 child = child->nextSibling()) | 277 child = child->nextSibling()) |
277 assertNeedsCompositingInputsUpdateBitsCleared(child); | 278 assertNeedsCompositingInputsUpdateBitsCleared(child); |
278 } | 279 } |
279 | 280 |
280 #endif | 281 #endif |
281 | 282 |
282 } // namespace blink | 283 } // namespace blink |
OLD | NEW |