Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2230593002: CSS filters: fix filtered parent with composited, transformed child. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous style from layout test. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 bool PaintLayer::overlapBoundsIncludeChildren() const 2161 bool PaintLayer::overlapBoundsIncludeChildren() const
2162 { 2162 {
2163 const auto* style = layoutObject()->style(); 2163 const auto* style = layoutObject()->style();
2164 if (style && style->filter().hasFilterThatMovesPixels()) 2164 if (style && style->filter().hasFilterThatMovesPixels())
2165 return true; 2165 return true;
2166 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()-> hasReflection()) 2166 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && layoutObject()-> hasReflection())
2167 return true; 2167 return true;
2168 return false; 2168 return false;
2169 } 2169 }
2170 2170
2171 static void expandRectForReflectionAndStackingChildren(const PaintLayer* ancesto rLayer, LayoutRect& result) 2171 static void expandRectForReflectionAndStackingChildren(const PaintLayer* ancesto rLayer, LayoutRect& result, PaintLayer::CalculateBoundsOptions options)
2172 { 2172 {
2173 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref lectionLayer()->hasCompositedLayerMapping() && !RuntimeEnabledFeatures::cssBoxRe flectFilterEnabled()) 2173 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref lectionLayer()->hasCompositedLayerMapping() && !RuntimeEnabledFeatures::cssBoxRe flectFilterEnabled())
2174 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin gBoxForCompositing(ancestorLayer)); 2174 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin gBoxForCompositing(ancestorLayer));
2175 2175
2176 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer- >stackingNode()->hasPositiveZOrderList()); 2176 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer- >stackingNode()->hasPositiveZOrderList());
2177 2177
2178 #if ENABLE(ASSERT) 2178 #if ENABLE(ASSERT)
2179 LayerListMutationDetector mutationChecker(const_cast<PaintLayer*>(ancestorLa yer)->stackingNode()); 2179 LayerListMutationDetector mutationChecker(const_cast<PaintLayer*>(ancestorLa yer)->stackingNode());
2180 #endif 2180 #endif
2181 2181
2182 PaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), AllC hildren); 2182 PaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), AllC hildren);
2183 while (PaintLayerStackingNode* node = iterator.next()) { 2183 while (PaintLayerStackingNode* node = iterator.next()) {
2184 // Here we exclude both directly composited layers and squashing layers 2184 // Here we exclude both directly composited layers and squashing layers
2185 // because those Layers don't paint into the graphics layer 2185 // because those Layers don't paint into the graphics layer
2186 // for this Layer. For example, the bounds of squashed Layers 2186 // for this Layer. For example, the bounds of squashed Layers
2187 // will be included in the computation of the appropriate squashing 2187 // will be included in the computation of the appropriate squashing
2188 // GraphicsLayer. 2188 // GraphicsLayer.
2189 if (node->layer()->compositingState() != NotComposited) 2189 if (options != PaintLayer::CalculateBoundsOptions::IncludeTransformsAndC ompositedChildLayers && node->layer()->compositingState() != NotComposited)
2190 continue; 2190 continue;
2191 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer)); 2191 result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, opt ions));
2192 } 2192 }
2193 } 2193 }
2194 2194
2195 LayoutRect PaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren (const LayoutPoint& offsetFromRoot) const 2195 LayoutRect PaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren (const LayoutPoint& offsetFromRoot, CalculateBoundsOptions options) const
2196 { 2196 {
2197 LayoutRect result = physicalBoundingBox(LayoutPoint()); 2197 LayoutRect result = physicalBoundingBox(LayoutPoint());
2198 2198
2199 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); 2199 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
2200 2200
2201 expandRectForReflectionAndStackingChildren(this, result); 2201 expandRectForReflectionAndStackingChildren(this, result, options);
2202 2202
2203 result.moveBy(offsetFromRoot); 2203 result.moveBy(offsetFromRoot);
2204 return result; 2204 return result;
2205 } 2205 }
2206 2206
2207 LayoutRect PaintLayer::boundingBoxForCompositing(const PaintLayer* ancestorLayer , CalculateBoundsOptions options) const 2207 LayoutRect PaintLayer::boundingBoxForCompositing(const PaintLayer* ancestorLayer , CalculateBoundsOptions options) const
2208 { 2208 {
2209 if (!isSelfPaintingLayer()) 2209 if (!isSelfPaintingLayer())
2210 return LayoutRect(); 2210 return LayoutRect();
2211 2211
(...skipping 23 matching lines...) Expand all
2235 result = physicalBoundingBox(LayoutPoint()); 2235 result = physicalBoundingBox(LayoutPoint());
2236 2236
2237 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded( ); 2237 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded( );
2238 2238
2239 // Reflections are implemented with Layers that hang off of the reflecte d layer. However, 2239 // Reflections are implemented with Layers that hang off of the reflecte d layer. However,
2240 // the reflection layer subtree does not include the subtree of the pare nt Layer, so 2240 // the reflection layer subtree does not include the subtree of the pare nt Layer, so
2241 // a recursive computation of stacking children yields no results. This breaks cases when there are stacking 2241 // a recursive computation of stacking children yields no results. This breaks cases when there are stacking
2242 // children of the parent, that need to be included in reflected composi ted bounds. 2242 // children of the parent, that need to be included in reflected composi ted bounds.
2243 // Fix this by including composited bounds of stacking children of the r eflected Layer. 2243 // Fix this by including composited bounds of stacking children of the r eflected Layer.
2244 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo( ) && parent()->reflectionInfo()->reflectionLayer() == this) 2244 if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo( ) && parent()->reflectionInfo()->reflectionLayer() == this)
2245 expandRectForReflectionAndStackingChildren(parent(), result); 2245 expandRectForReflectionAndStackingChildren(parent(), result, options );
2246 else 2246 else
2247 expandRectForReflectionAndStackingChildren(this, result); 2247 expandRectForReflectionAndStackingChildren(this, result, options);
2248 2248
2249 // Only enlarge by the filter outsets if we know the filter is going to be rendered in software. 2249 // Only enlarge by the filter outsets if we know the filter is going to be rendered in software.
2250 // Accelerated filters will handle their own outsets. 2250 // Accelerated filters will handle their own outsets.
2251 if (paintsWithFilters()) 2251 if (paintsWithFilters())
2252 result = mapLayoutRectForFilter(result); 2252 result = mapLayoutRectForFilter(result);
2253 } 2253 }
2254 2254
2255 if (transform() && paintsWithTransform(GlobalPaintNormalPhase) && (this != a ncestorLayer || options == MaybeIncludeTransformForAncestorLayer)) 2255 if (transform() && (options == IncludeTransformsAndCompositedChildLayers || ((paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || optio ns == MaybeIncludeTransformForAncestorLayer)))))
2256 result = transform()->mapRect(result); 2256 result = transform()->mapRect(result);
2257 2257
2258 if (shouldFragmentCompositedBounds(ancestorLayer)) { 2258 if (shouldFragmentCompositedBounds(ancestorLayer)) {
2259 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result ); 2259 convertFromFlowThreadToVisualBoundingBoxInAncestor(ancestorLayer, result );
2260 return result; 2260 return result;
2261 } 2261 }
2262 LayoutPoint delta; 2262 LayoutPoint delta;
2263 convertToLayerCoords(ancestorLayer, delta); 2263 convertToLayerCoords(ancestorLayer, delta);
2264 result.moveBy(delta); 2264 result.moveBy(delta);
2265 return result; 2265 return result;
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 2924
2925 void showLayerTree(const blink::LayoutObject* layoutObject) 2925 void showLayerTree(const blink::LayoutObject* layoutObject)
2926 { 2926 {
2927 if (!layoutObject) { 2927 if (!layoutObject) {
2928 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2928 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2929 return; 2929 return;
2930 } 2930 }
2931 showLayerTree(layoutObject->enclosingLayer()); 2931 showLayerTree(layoutObject->enclosingLayer());
2932 } 2932 }
2933 #endif 2933 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698