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 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 if (!enclosingPaginationLayer()) | 2116 if (!enclosingPaginationLayer()) |
2117 return physicalBoundingBox(ancestorLayer); | 2117 return physicalBoundingBox(ancestorLayer); |
2118 | 2118 |
2119 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutOb
ject()); | 2119 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutOb
ject()); |
2120 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu
lt); | 2120 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu
lt); |
2121 return result; | 2121 return result; |
2122 } | 2122 } |
2123 | 2123 |
2124 LayoutRect DeprecatedPaintLayer::boundingBoxForCompositingOverlapTest() const | 2124 LayoutRect DeprecatedPaintLayer::boundingBoxForCompositingOverlapTest() const |
2125 { | 2125 { |
2126 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragme
ntsBoundingBox(this); | 2126 // Apply NeverIncludeTransformForAncestorLayer, because the geometry map in
CompositingInputsUpdater will take care of applying the |
| 2127 // transform of |this| (== the ancestorLayer argument to boundingBoxForCompo
siting). |
| 2128 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing(this, Neve
rIncludeTransformForAncestorLayer) : fragmentsBoundingBox(this); |
2127 } | 2129 } |
2128 | 2130 |
2129 static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLaye
r* ancestorLayer, DeprecatedPaintLayer::CalculateBoundsOptions options, LayoutRe
ct& result) | 2131 static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLaye
r* ancestorLayer, LayoutRect& result) |
2130 { | 2132 { |
2131 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref
lectionLayer()->hasCompositedDeprecatedPaintLayerMapping()) | 2133 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref
lectionLayer()->hasCompositedDeprecatedPaintLayerMapping()) |
2132 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin
gBoxForCompositing(ancestorLayer)); | 2134 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin
gBoxForCompositing(ancestorLayer)); |
2133 | 2135 |
2134 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer-
>stackingNode()->hasPositiveZOrderList()); | 2136 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer-
>stackingNode()->hasPositiveZOrderList()); |
2135 | 2137 |
2136 #if ENABLE(ASSERT) | 2138 #if ENABLE(ASSERT) |
2137 LayerListMutationDetector mutationChecker(const_cast<DeprecatedPaintLayer*>(
ancestorLayer)->stackingNode()); | 2139 LayerListMutationDetector mutationChecker(const_cast<DeprecatedPaintLayer*>(
ancestorLayer)->stackingNode()); |
2138 #endif | 2140 #endif |
2139 | 2141 |
2140 DeprecatedPaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNo
de(), AllChildren); | 2142 DeprecatedPaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNo
de(), AllChildren); |
2141 while (DeprecatedPaintLayerStackingNode* node = iterator.next()) { | 2143 while (DeprecatedPaintLayerStackingNode* node = iterator.next()) { |
2142 // Here we exclude both directly composited layers and squashing layers | 2144 // Here we exclude both directly composited layers and squashing layers |
2143 // because those Layers don't paint into the graphics layer | 2145 // because those Layers don't paint into the graphics layer |
2144 // for this Layer. For example, the bounds of squashed Layers | 2146 // for this Layer. For example, the bounds of squashed Layers |
2145 // will be included in the computation of the appropriate squashing | 2147 // will be included in the computation of the appropriate squashing |
2146 // GraphicsLayer. | 2148 // GraphicsLayer. |
2147 if (options != DeprecatedPaintLayer::ApplyBoundsChickenEggHacks && node-
>layer()->compositingState() != NotComposited) | 2149 if (node->layer()->compositingState() != NotComposited) |
2148 continue; | 2150 continue; |
2149 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, opt
ions)); | 2151 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer)); |
2150 } | 2152 } |
2151 } | 2153 } |
2152 | 2154 |
2153 LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStacki
ngChildren(const DeprecatedPaintLayer* ancestorLayer, const LayoutPoint& offsetF
romRoot) const | 2155 LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStacki
ngChildren(const DeprecatedPaintLayer* ancestorLayer, const LayoutPoint& offsetF
romRoot) const |
2154 { | 2156 { |
2155 LayoutPoint origin; | 2157 LayoutPoint origin; |
2156 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); | 2158 LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); |
2157 | 2159 |
2158 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfN
eeded(); | 2160 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfN
eeded(); |
2159 | 2161 |
2160 expandRectForReflectionAndStackingChildren(this, DoNotApplyBoundsChickenEggH
acks, result); | 2162 expandRectForReflectionAndStackingChildren(this, result); |
2161 | 2163 |
2162 result.moveBy(offsetFromRoot); | 2164 result.moveBy(offsetFromRoot); |
2163 return result; | 2165 return result; |
2164 } | 2166 } |
2165 | 2167 |
2166 LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaint
Layer* ancestorLayer, CalculateBoundsOptions options) const | 2168 LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaint
Layer* ancestorLayer, CalculateBoundsOptions options) const |
2167 { | 2169 { |
2168 if (!isSelfPaintingLayer()) | 2170 if (!isSelfPaintingLayer()) |
2169 return LayoutRect(); | 2171 return LayoutRect(); |
2170 | 2172 |
(...skipping 21 matching lines...) Expand all Loading... |
2192 result = physicalBoundingBox(ancestorLayer, &origin); | 2194 result = physicalBoundingBox(ancestorLayer, &origin); |
2193 | 2195 |
2194 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList
sIfNeeded(); | 2196 const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerList
sIfNeeded(); |
2195 | 2197 |
2196 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, | 2198 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, |
2197 // the reflection layer subtree does not include the subtree of the pare
nt Layer, so | 2199 // the reflection layer subtree does not include the subtree of the pare
nt Layer, so |
2198 // a recursive computation of stacking children yields no results. This
breaks cases when there are stacking | 2200 // a recursive computation of stacking children yields no results. This
breaks cases when there are stacking |
2199 // children of the parent, that need to be included in reflected composi
ted bounds. | 2201 // children of the parent, that need to be included in reflected composi
ted bounds. |
2200 // Fix this by including composited bounds of stacking children of the r
eflected Layer. | 2202 // Fix this by including composited bounds of stacking children of the r
eflected Layer. |
2201 if (hasCompositedDeprecatedPaintLayerMapping() && parent() && parent()->
reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this) | 2203 if (hasCompositedDeprecatedPaintLayerMapping() && parent() && parent()->
reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this) |
2202 expandRectForReflectionAndStackingChildren(parent(), options, result
); | 2204 expandRectForReflectionAndStackingChildren(parent(), result); |
2203 else | 2205 else |
2204 expandRectForReflectionAndStackingChildren(this, options, result); | 2206 expandRectForReflectionAndStackingChildren(this, result); |
2205 | 2207 |
2206 // FIXME: We can optimize the size of the composited layers, by not enla
rging | 2208 // FIXME: We can optimize the size of the composited layers, by not enla
rging |
2207 // filtered areas with the outsets if we know that the filter is going t
o render in hardware. | 2209 // filtered areas with the outsets if we know that the filter is going t
o render in hardware. |
2208 // https://bugs.webkit.org/show_bug.cgi?id=81239 | 2210 // https://bugs.webkit.org/show_bug.cgi?id=81239 |
2209 result.expand(m_layoutObject->style()->filterOutsets()); | 2211 result.expand(m_layoutObject->style()->filterOutsets()); |
2210 } | 2212 } |
2211 | 2213 |
2212 if (transform() && (paintsWithTransform(GlobalPaintNormalPhase) || options =
= ApplyBoundsChickenEggHacks)) | 2214 if (transform() && paintsWithTransform(GlobalPaintNormalPhase) && (this != a
ncestorLayer || options == MaybeIncludeTransformForAncestorLayer)) |
2213 result = transform()->mapRect(result); | 2215 result = transform()->mapRect(result); |
2214 | 2216 |
2215 if (enclosingPaginationLayer()) { | 2217 if (enclosingPaginationLayer()) { |
2216 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer,
result); | 2218 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer,
result); |
2217 return result; | 2219 return result; |
2218 } | 2220 } |
2219 LayoutPoint delta; | 2221 LayoutPoint delta; |
2220 convertToLayerCoords(ancestorLayer, delta); | 2222 convertToLayerCoords(ancestorLayer, delta); |
2221 result.moveBy(delta); | 2223 result.moveBy(delta); |
2222 return result; | 2224 return result; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 | 2708 |
2707 void showLayerTree(const blink::LayoutObject* layoutObject) | 2709 void showLayerTree(const blink::LayoutObject* layoutObject) |
2708 { | 2710 { |
2709 if (!layoutObject) { | 2711 if (!layoutObject) { |
2710 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2712 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2711 return; | 2713 return; |
2712 } | 2714 } |
2713 showLayerTree(layoutObject->enclosingLayer()); | 2715 showLayerTree(layoutObject->enclosingLayer()); |
2714 } | 2716 } |
2715 #endif | 2717 #endif |
OLD | NEW |