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 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 LayoutPoint delta; | 3198 LayoutPoint delta; |
3199 if (offsetFromRoot) | 3199 if (offsetFromRoot) |
3200 delta = *offsetFromRoot; | 3200 delta = *offsetFromRoot; |
3201 else | 3201 else |
3202 convertToLayerCoords(ancestorLayer, delta); | 3202 convertToLayerCoords(ancestorLayer, delta); |
3203 | 3203 |
3204 result.moveBy(delta); | 3204 result.moveBy(delta); |
3205 return result; | 3205 return result; |
3206 } | 3206 } |
3207 | 3207 |
3208 LayoutRect RenderLayer::physicalBoundingBoxIncludingReflectionAndStackingChildre
n(const RenderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const | 3208 static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest
orLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result) |
3209 { | 3209 { |
3210 LayoutPoint origin; | 3210 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref
lectionLayer()->hasCompositedLayerMapping()) |
3211 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); | 3211 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin
gBoxForCompositing(ancestorLayer)); |
3212 | 3212 |
3213 if (m_reflectionInfo && !m_reflectionInfo->reflectionLayer()->hasCompositedL
ayerMapping()) | 3213 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer-
>stackingNode()->hasPositiveZOrderList()); |
3214 result.unite(m_reflectionInfo->reflectionLayer()->physicalBoundingBox(th
is)); | |
3215 | |
3216 ASSERT(m_stackingNode->isStackingContext() || !m_stackingNode->hasPositiveZO
rderList()); | |
3217 | |
3218 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); | |
3219 | 3214 |
3220 #if ASSERT_ENABLED | 3215 #if ASSERT_ENABLED |
3221 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st
ackingNode()); | 3216 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(ancestorL
ayer)->stackingNode()); |
3222 #endif | 3217 #endif |
3223 | 3218 |
3224 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren)
; | |
3225 while (RenderLayerStackingNode* node = iterator.next()) { | |
3226 if (node->layer()->hasCompositedLayerMapping()) | |
3227 continue; | |
3228 // FIXME: Can we call physicalBoundingBoxIncludingReflectionAndStackingC
hildren instead of boundingBoxForCompositing? | |
3229 result.unite(node->layer()->boundingBoxForCompositing(this)); | |
3230 } | |
3231 | |
3232 result.moveBy(offsetFromRoot); | |
3233 return result; | |
3234 } | |
3235 | |
3236 static void expandCompositingRectForStackingChildren(const RenderLayer* ancestor
Layer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result) | |
3237 { | |
3238 RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), All
Children); | 3219 RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), All
Children); |
3239 while (RenderLayerStackingNode* node = iterator.next()) { | 3220 while (RenderLayerStackingNode* node = iterator.next()) { |
3240 // Here we exclude both directly composited layers and squashing layers | 3221 // Here we exclude both directly composited layers and squashing layers |
3241 // because those RenderLayers don't paint into the graphics layer | 3222 // because those RenderLayers don't paint into the graphics layer |
3242 // for this RenderLayer. For example, the bounds of squashed RenderLayer
s | 3223 // for this RenderLayer. For example, the bounds of squashed RenderLayer
s |
3243 // will be included in the computation of the appropriate squashing | 3224 // will be included in the computation of the appropriate squashing |
3244 // GraphicsLayer. | 3225 // GraphicsLayer. |
3245 if (options != RenderLayer::ApplyBoundsChickenEggHacks && node->layer()-
>compositingState() != NotComposited) | 3226 if (options != RenderLayer::ApplyBoundsChickenEggHacks && node->layer()-
>compositingState() != NotComposited) |
3246 continue; | 3227 continue; |
3247 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, opt
ions)); | 3228 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, opt
ions)); |
3248 } | 3229 } |
3249 } | 3230 } |
3250 | 3231 |
| 3232 LayoutRect RenderLayer::physicalBoundingBoxIncludingReflectionAndStackingChildre
n(const RenderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const |
| 3233 { |
| 3234 LayoutPoint origin; |
| 3235 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); |
| 3236 |
| 3237 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
| 3238 |
| 3239 expandRectForReflectionAndStackingChildren(this, DoNotApplyBoundsChickenEggH
acks, result); |
| 3240 |
| 3241 result.moveBy(offsetFromRoot); |
| 3242 return result; |
| 3243 } |
| 3244 |
3251 LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay
er, CalculateBoundsOptions options) const | 3245 LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay
er, CalculateBoundsOptions options) const |
3252 { | 3246 { |
3253 if (!isSelfPaintingLayer()) | 3247 if (!isSelfPaintingLayer()) |
3254 return LayoutRect(); | 3248 return LayoutRect(); |
3255 | 3249 |
3256 if (!ancestorLayer) | 3250 if (!ancestorLayer) |
3257 ancestorLayer = this; | 3251 ancestorLayer = this; |
3258 | 3252 |
3259 // FIXME: This could be improved to do a check like hasVisibleNonCompositing
DescendantLayers() (bug 92580). | 3253 // FIXME: This could be improved to do a check like hasVisibleNonCompositing
DescendantLayers() (bug 92580). |
3260 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) | 3254 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) |
(...skipping 14 matching lines...) Expand all Loading... |
3275 convertToLayerCoords(ancestorLayer, delta); | 3269 convertToLayerCoords(ancestorLayer, delta); |
3276 localClipRect.moveBy(delta); | 3270 localClipRect.moveBy(delta); |
3277 return localClipRect; | 3271 return localClipRect; |
3278 } | 3272 } |
3279 | 3273 |
3280 LayoutPoint origin; | 3274 LayoutPoint origin; |
3281 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); | 3275 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); |
3282 | 3276 |
3283 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); | 3277 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
3284 | 3278 |
3285 if (m_reflectionInfo && !m_reflectionInfo->reflectionLayer()->hasCompositedL
ayerMapping()) | |
3286 result.unite(m_reflectionInfo->reflectionLayer()->boundingBoxForComposit
ing(this)); | |
3287 | |
3288 ASSERT(m_stackingNode->isStackingContext() || !m_stackingNode->hasPositiveZO
rderList()); | |
3289 | |
3290 #if ASSERT_ENABLED | |
3291 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st
ackingNode()); | |
3292 #endif | |
3293 | |
3294 // Reflections are implemented with RenderLayers that hang off of the reflec
ted layer. However, | 3279 // Reflections are implemented with RenderLayers that hang off of the reflec
ted layer. However, |
3295 // the reflection layer subtree does not include the subtree of the parent R
enderLayer, so | 3280 // the reflection layer subtree does not include the subtree of the parent R
enderLayer, so |
3296 // a recursive computation of stacking children yields no results. This brea
ks cases when there are stacking | 3281 // a recursive computation of stacking children yields no results. This brea
ks cases when there are stacking |
3297 // children of the parent, that need to be included in reflected composited
bounds. | 3282 // children of the parent, that need to be included in reflected composited
bounds. |
3298 // Fix this by including composited bounds of stacking children of the refle
cted RenderLayer. | 3283 // Fix this by including composited bounds of stacking children of the refle
cted RenderLayer. |
3299 if (parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->re
flectionLayer() == this) | 3284 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo() &&
parent()->reflectionInfo()->reflectionLayer() == this) |
3300 expandCompositingRectForStackingChildren(parent(), options, result); | 3285 expandRectForReflectionAndStackingChildren(parent(), options, result); |
3301 else | 3286 else |
3302 expandCompositingRectForStackingChildren(this, options, result); | 3287 expandRectForReflectionAndStackingChildren(this, options, result); |
3303 | 3288 |
3304 // FIXME: We can optimize the size of the composited layers, by not enlargin
g | 3289 // FIXME: We can optimize the size of the composited layers, by not enlargin
g |
3305 // filtered areas with the outsets if we know that the filter is going to re
nder in hardware. | 3290 // filtered areas with the outsets if we know that the filter is going to re
nder in hardware. |
3306 // https://bugs.webkit.org/show_bug.cgi?id=81239 | 3291 // https://bugs.webkit.org/show_bug.cgi?id=81239 |
3307 m_renderer->style()->filterOutsets().expandRect(result); | 3292 m_renderer->style()->filterOutsets().expandRect(result); |
3308 | 3293 |
3309 if (shouldIncludeTransform) | 3294 if (shouldIncludeTransform) |
3310 result = transform()->mapRect(result); | 3295 result = transform()->mapRect(result); |
3311 | 3296 |
3312 LayoutPoint delta; | 3297 LayoutPoint delta; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3774 } | 3759 } |
3775 } | 3760 } |
3776 | 3761 |
3777 void showLayerTree(const WebCore::RenderObject* renderer) | 3762 void showLayerTree(const WebCore::RenderObject* renderer) |
3778 { | 3763 { |
3779 if (!renderer) | 3764 if (!renderer) |
3780 return; | 3765 return; |
3781 showLayerTree(renderer->enclosingLayer()); | 3766 showLayerTree(renderer->enclosingLayer()); |
3782 } | 3767 } |
3783 #endif | 3768 #endif |
OLD | NEW |