OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 // before we call calculateClipRects so that calculateClipRects will hit | 170 // before we call calculateClipRects so that calculateClipRects will hit |
171 // the cache. | 171 // the cache. |
172 ClipRects* parentClipRects = nullptr; | 172 ClipRects* parentClipRects = nullptr; |
173 if (context.rootLayer != &m_layer && m_layer.parent()) | 173 if (context.rootLayer != &m_layer && m_layer.parent()) |
174 parentClipRects = &m_layer.parent()->clipper().getClipRects(context); | 174 parentClipRects = &m_layer.parent()->clipper().getClipRects(context); |
175 RefPtr<ClipRects> clipRects = ClipRects::create(); | 175 RefPtr<ClipRects> clipRects = ClipRects::create(); |
176 calculateClipRects(context, *clipRects); | 176 calculateClipRects(context, *clipRects); |
177 return storeClipRectsInCache(context, parentClipRects, *clipRects); | 177 return storeClipRectsInCache(context, parentClipRects, *clipRects); |
178 } | 178 } |
179 | 179 |
180 void PaintLayerClipper::clearClipRectsIncludingDescendants() { | 180 void PaintLayerClipper::clearCache(ClipRectsCacheSlot cacheSlot) { |
wkorman
2017/01/06 02:51:50
Current unit tests in PaintLayerClipperTest look f
| |
181 if (cacheSlot == NumberOfClipRectsCacheSlots) | |
182 m_layer.clearClipRectsCache(); | |
183 else if (ClipRectsCache* cache = m_layer.clipRectsCache()) | |
184 cache->clear(cacheSlot); | |
185 | |
181 if (m_geometryMapper) | 186 if (m_geometryMapper) |
182 m_geometryMapper.reset(new GeometryMapper); | 187 m_geometryMapper.reset(new GeometryMapper); |
183 m_layer.clearClipRectsCache(); | 188 } |
184 | 189 |
185 for (PaintLayer* layer = m_layer.firstChild(); layer; | 190 void PaintLayerClipper::clearClipRectsIncludingDescendants() { |
186 layer = layer->nextSibling()) { | 191 clearClipRectsIncludingDescendants(NumberOfClipRectsCacheSlots); |
187 layer->clipper().clearClipRectsIncludingDescendants(); | |
188 } | |
189 } | 192 } |
190 | 193 |
191 void PaintLayerClipper::clearClipRectsIncludingDescendants( | 194 void PaintLayerClipper::clearClipRectsIncludingDescendants( |
192 ClipRectsCacheSlot cacheSlot) { | 195 ClipRectsCacheSlot cacheSlot) { |
193 if (m_geometryMapper) | 196 std::stack<const PaintLayer*> layers; |
194 m_geometryMapper.reset(new GeometryMapper); | 197 layers.push(&m_layer); |
195 | 198 |
196 if (ClipRectsCache* cache = m_layer.clipRectsCache()) | 199 while (!layers.empty()) { |
197 cache->clear(cacheSlot); | 200 const PaintLayer* currentLayer = layers.top(); |
198 | 201 layers.pop(); |
199 for (PaintLayer* layer = m_layer.firstChild(); layer; | 202 currentLayer->clipper().clearCache(cacheSlot); |
200 layer = layer->nextSibling()) { | 203 for (const PaintLayer* layer = currentLayer->firstChild(); layer; |
201 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); | 204 layer = layer->nextSibling()) |
205 layers.push(layer); | |
202 } | 206 } |
203 } | 207 } |
204 | 208 |
205 LayoutRect PaintLayerClipper::localClipRect( | 209 LayoutRect PaintLayerClipper::localClipRect( |
206 const PaintLayer* clippingRootLayer) const { | 210 const PaintLayer* clippingRootLayer) const { |
207 ClipRectsContext context(clippingRootLayer, PaintingClipRects); | 211 ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
208 if (m_geometryMapper) { | 212 if (m_geometryMapper) { |
209 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( | 213 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( |
210 context, clipRectWithGeometryMapper(context, false)); | 214 context, clipRectWithGeometryMapper(context, false)); |
211 | 215 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 const LayoutSize& subpixelAccumulation) const { | 558 const LayoutSize& subpixelAccumulation) const { |
555 DCHECK(!m_geometryMapper); | 559 DCHECK(!m_geometryMapper); |
556 ClipRectsContext context(rootLayer, PaintingClipRects, | 560 ClipRectsContext context(rootLayer, PaintingClipRects, |
557 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 561 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
558 if (respectOverflowClip == IgnoreOverflowClip) | 562 if (respectOverflowClip == IgnoreOverflowClip) |
559 context.setIgnoreOverflowClip(); | 563 context.setIgnoreOverflowClip(); |
560 return getClipRects(context); | 564 return getClipRects(context); |
561 } | 565 } |
562 | 566 |
563 } // namespace blink | 567 } // namespace blink |
OLD | NEW |