| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); | 107 intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); |
| 108 clipRects.setOverflowClipRect( | 108 clipRects.setOverflowClipRect( |
| 109 intersection(newClip, clipRects.overflowClipRect()) | 109 intersection(newClip, clipRects.overflowClipRect()) |
| 110 .setIsClippedByClipCss()); | 110 .setIsClippedByClipCss()); |
| 111 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) | 111 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) |
| 112 .setIsClippedByClipCss()); | 112 .setIsClippedByClipCss()); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 PaintLayerClipper::PaintLayerClipper(const PaintLayer& layer, | 116 PaintLayerClipper::PaintLayerClipper(const PaintLayer& layer, |
| 117 bool useGeometryMapper) | 117 GeometryMapper* geometryMapper) |
| 118 : m_layer(layer), | 118 : m_layer(layer), m_geometryMapper(geometryMapper) {} |
| 119 m_geometryMapper(useGeometryMapper ? new GeometryMapper : nullptr) {} | |
| 120 | 119 |
| 121 ClipRects* PaintLayerClipper::clipRectsIfCached( | 120 ClipRects* PaintLayerClipper::clipRectsIfCached( |
| 122 const ClipRectsContext& context) const { | 121 const ClipRectsContext& context) const { |
| 123 DCHECK(context.usesCache()); | 122 DCHECK(context.usesCache()); |
| 124 if (!m_layer.clipRectsCache()) | 123 if (!m_layer.clipRectsCache()) |
| 125 return nullptr; | 124 return nullptr; |
| 126 ClipRectsCache::Entry& entry = | 125 ClipRectsCache::Entry& entry = |
| 127 m_layer.clipRectsCache()->get(context.cacheSlot()); | 126 m_layer.clipRectsCache()->get(context.cacheSlot()); |
| 128 // FIXME: We used to ASSERT that we always got a consistent root layer. | 127 // FIXME: We used to ASSERT that we always got a consistent root layer. |
| 129 // We should add a test that has an inconsistent root. See | 128 // We should add a test that has an inconsistent root. See |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 RefPtr<ClipRects> clipRects = ClipRects::create(); | 170 RefPtr<ClipRects> clipRects = ClipRects::create(); |
| 172 calculateClipRects(context, *clipRects); | 171 calculateClipRects(context, *clipRects); |
| 173 return storeClipRectsInCache(context, parentClipRects, *clipRects); | 172 return storeClipRectsInCache(context, parentClipRects, *clipRects); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void PaintLayerClipper::clearCache(ClipRectsCacheSlot cacheSlot) { | 175 void PaintLayerClipper::clearCache(ClipRectsCacheSlot cacheSlot) { |
| 177 if (cacheSlot == NumberOfClipRectsCacheSlots) | 176 if (cacheSlot == NumberOfClipRectsCacheSlots) |
| 178 m_layer.clearClipRectsCache(); | 177 m_layer.clearClipRectsCache(); |
| 179 else if (ClipRectsCache* cache = m_layer.clipRectsCache()) | 178 else if (ClipRectsCache* cache = m_layer.clipRectsCache()) |
| 180 cache->clear(cacheSlot); | 179 cache->clear(cacheSlot); |
| 181 | |
| 182 if (m_geometryMapper) | |
| 183 m_geometryMapper.reset(new GeometryMapper); | |
| 184 } | 180 } |
| 185 | 181 |
| 186 void PaintLayerClipper::clearClipRectsIncludingDescendants() { | 182 void PaintLayerClipper::clearClipRectsIncludingDescendants() { |
| 187 clearClipRectsIncludingDescendants(NumberOfClipRectsCacheSlots); | 183 clearClipRectsIncludingDescendants(NumberOfClipRectsCacheSlots); |
| 188 } | 184 } |
| 189 | 185 |
| 190 void PaintLayerClipper::clearClipRectsIncludingDescendants( | 186 void PaintLayerClipper::clearClipRectsIncludingDescendants( |
| 191 ClipRectsCacheSlot cacheSlot) { | 187 ClipRectsCacheSlot cacheSlot) { |
| 192 std::stack<const PaintLayer*> layers; | 188 std::stack<const PaintLayer*> layers; |
| 193 layers.push(&m_layer); | 189 layers.push(&m_layer); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 const LayoutSize& subpixelAccumulation) const { | 568 const LayoutSize& subpixelAccumulation) const { |
| 573 DCHECK(!m_geometryMapper); | 569 DCHECK(!m_geometryMapper); |
| 574 ClipRectsContext context(rootLayer, PaintingClipRects, | 570 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 575 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 571 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 576 if (respectOverflowClip == IgnoreOverflowClip) | 572 if (respectOverflowClip == IgnoreOverflowClip) |
| 577 context.setIgnoreOverflowClip(); | 573 context.setIgnoreOverflowClip(); |
| 578 return getClipRects(context); | 574 return getClipRects(context); |
| 579 } | 575 } |
| 580 | 576 |
| 581 } // namespace blink | 577 } // namespace blink |
| OLD | NEW |