OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (changeType == CanvasChanged) | 195 if (changeType == CanvasChanged) |
196 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); | 196 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); |
197 | 197 |
198 if (changeType == CanvasContextChanged) { | 198 if (changeType == CanvasContextChanged) { |
199 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); | 199 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); |
200 | 200 |
201 // Although we're missing test coverage, we need to call | 201 // Although we're missing test coverage, we need to call |
202 // GraphicsLayer::setContentsToPlatformLayer with the new platform | 202 // GraphicsLayer::setContentsToPlatformLayer with the new platform |
203 // layer for this canvas. | 203 // layer for this canvas. |
204 // See http://crbug.com/349195 | 204 // See http://crbug.com/349195 |
205 if (hasCompositedLayerMapping()) | 205 if (m_compositedLayerMapping) |
206 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); | 206 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); |
207 } | 207 } |
208 | 208 |
209 if (m_compositedLayerMapping) | 209 if (m_compositedLayerMapping) |
210 m_compositedLayerMapping->contentChanged(changeType); | 210 m_compositedLayerMapping->contentChanged(changeType); |
211 } | 211 } |
212 | 212 |
213 bool RenderLayer::paintsWithFilters() const | 213 bool RenderLayer::paintsWithFilters() const |
214 { | 214 { |
215 if (!renderer()->hasFilter()) | 215 if (!renderer()->hasFilter()) |
216 return false; | 216 return false; |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask); | 1042 m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask); |
1043 } | 1043 } |
1044 | 1044 |
1045 void RenderLayer::setHasCompositingDescendant(bool hasCompositingDescendant) | 1045 void RenderLayer::setHasCompositingDescendant(bool hasCompositingDescendant) |
1046 { | 1046 { |
1047 if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescen
dant)) | 1047 if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescen
dant)) |
1048 return; | 1048 return; |
1049 | 1049 |
1050 m_hasCompositingDescendant = hasCompositingDescendant; | 1050 m_hasCompositingDescendant = hasCompositingDescendant; |
1051 | 1051 |
1052 if (hasCompositedLayerMapping()) | 1052 if (m_compositedLayerMapping) |
1053 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); | 1053 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); |
1054 } | 1054 } |
1055 | 1055 |
1056 void RenderLayer::setShouldIsolateCompositedDescendants(bool shouldIsolateCompos
itedDescendants) | 1056 void RenderLayer::setShouldIsolateCompositedDescendants(bool shouldIsolateCompos
itedDescendants) |
1057 { | 1057 { |
1058 if (m_shouldIsolateCompositedDescendants == static_cast<unsigned>(shouldIsol
ateCompositedDescendants)) | 1058 if (m_shouldIsolateCompositedDescendants == static_cast<unsigned>(shouldIsol
ateCompositedDescendants)) |
1059 return; | 1059 return; |
1060 | 1060 |
1061 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants; | 1061 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants; |
1062 | 1062 |
1063 if (hasCompositedLayerMapping()) | 1063 if (m_compositedLayerMapping) |
1064 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); | 1064 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); |
1065 } | 1065 } |
1066 | 1066 |
1067 bool RenderLayer::hasAncestorWithFilterOutsets() const | 1067 bool RenderLayer::hasAncestorWithFilterOutsets() const |
1068 { | 1068 { |
1069 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { | 1069 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { |
1070 RenderLayerModelObject* renderer = curr->renderer(); | 1070 RenderLayerModelObject* renderer = curr->renderer(); |
1071 if (renderer->style()->hasFilterOutsets()) | 1071 if (renderer->style()->hasFilterOutsets()) |
1072 return true; | 1072 return true; |
1073 } | 1073 } |
1074 return false; | 1074 return false; |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 return result; | 2267 return result; |
2268 } | 2268 } |
2269 | 2269 |
2270 LayoutRect RenderLayer::boundingBoxForCompositingOverlapTest() const | 2270 LayoutRect RenderLayer::boundingBoxForCompositingOverlapTest() const |
2271 { | 2271 { |
2272 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragme
ntsBoundingBox(this); | 2272 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragme
ntsBoundingBox(this); |
2273 } | 2273 } |
2274 | 2274 |
2275 static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest
orLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result) | 2275 static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest
orLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result) |
2276 { | 2276 { |
2277 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref
lectionLayer()->hasCompositedLayerMapping()) | 2277 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref
lectionLayer()->compositedLayerMapping()) |
2278 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin
gBoxForCompositing(ancestorLayer)); | 2278 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin
gBoxForCompositing(ancestorLayer)); |
2279 | 2279 |
2280 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer-
>stackingNode()->hasPositiveZOrderList()); | 2280 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer-
>stackingNode()->hasPositiveZOrderList()); |
2281 | 2281 |
2282 #if ENABLE(ASSERT) | 2282 #if ENABLE(ASSERT) |
2283 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(ancestorL
ayer)->stackingNode()); | 2283 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(ancestorL
ayer)->stackingNode()); |
2284 #endif | 2284 #endif |
2285 | 2285 |
2286 RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), All
Children); | 2286 RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), All
Children); |
2287 while (RenderLayerStackingNode* node = iterator.next()) { | 2287 while (RenderLayerStackingNode* node = iterator.next()) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 LayoutPoint origin; | 2336 LayoutPoint origin; |
2337 result = physicalBoundingBox(ancestorLayer, &origin); | 2337 result = physicalBoundingBox(ancestorLayer, &origin); |
2338 | 2338 |
2339 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded
(); | 2339 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded
(); |
2340 | 2340 |
2341 // Reflections are implemented with RenderLayers that hang off of the re
flected layer. However, | 2341 // Reflections are implemented with RenderLayers that hang off of the re
flected layer. However, |
2342 // the reflection layer subtree does not include the subtree of the pare
nt RenderLayer, so | 2342 // the reflection layer subtree does not include the subtree of the pare
nt RenderLayer, so |
2343 // a recursive computation of stacking children yields no results. This
breaks cases when there are stacking | 2343 // a recursive computation of stacking children yields no results. This
breaks cases when there are stacking |
2344 // children of the parent, that need to be included in reflected composi
ted bounds. | 2344 // children of the parent, that need to be included in reflected composi
ted bounds. |
2345 // Fix this by including composited bounds of stacking children of the r
eflected RenderLayer. | 2345 // Fix this by including composited bounds of stacking children of the r
eflected RenderLayer. |
2346 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo(
) && parent()->reflectionInfo()->reflectionLayer() == this) | 2346 if (compositedLayerMapping() && parent() && parent()->reflectionInfo() &
& parent()->reflectionInfo()->reflectionLayer() == this) |
2347 expandRectForReflectionAndStackingChildren(parent(), options, result
); | 2347 expandRectForReflectionAndStackingChildren(parent(), options, result
); |
2348 else | 2348 else |
2349 expandRectForReflectionAndStackingChildren(this, options, result); | 2349 expandRectForReflectionAndStackingChildren(this, options, result); |
2350 | 2350 |
2351 // FIXME: We can optimize the size of the composited layers, by not enla
rging | 2351 // FIXME: We can optimize the size of the composited layers, by not enla
rging |
2352 // filtered areas with the outsets if we know that the filter is going t
o render in hardware. | 2352 // filtered areas with the outsets if we know that the filter is going t
o render in hardware. |
2353 // https://bugs.webkit.org/show_bug.cgi?id=81239 | 2353 // https://bugs.webkit.org/show_bug.cgi?id=81239 |
2354 m_renderer->style()->filterOutsets().expandRect(result); | 2354 m_renderer->style()->filterOutsets().expandRect(result); |
2355 } | 2355 } |
2356 | 2356 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 } | 2839 } |
2840 } | 2840 } |
2841 | 2841 |
2842 void showLayerTree(const blink::RenderObject* renderer) | 2842 void showLayerTree(const blink::RenderObject* renderer) |
2843 { | 2843 { |
2844 if (!renderer) | 2844 if (!renderer) |
2845 return; | 2845 return; |
2846 showLayerTree(renderer->enclosingLayer()); | 2846 showLayerTree(renderer->enclosingLayer()); |
2847 } | 2847 } |
2848 #endif | 2848 #endif |
OLD | NEW |