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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 intersection(newOverflowClip, clipRects.fixedClipRect())); | 96 intersection(newOverflowClip, clipRects.fixedClipRect())); |
97 if (box.styleRef().containsPaint()) { | 97 if (box.styleRef().containsPaint()) { |
98 clipRects.setPosClipRect( | 98 clipRects.setPosClipRect( |
99 intersection(newOverflowClip, clipRects.posClipRect())); | 99 intersection(newOverflowClip, clipRects.posClipRect())); |
100 clipRects.setFixedClipRect( | 100 clipRects.setFixedClipRect( |
101 intersection(newOverflowClip, clipRects.fixedClipRect())); | 101 intersection(newOverflowClip, clipRects.fixedClipRect())); |
102 } | 102 } |
103 } | 103 } |
104 if (box.hasClip()) { | 104 if (box.hasClip()) { |
105 LayoutRect newClip = box.clipRect(offset); | 105 LayoutRect newClip = box.clipRect(offset); |
106 clipRects.setPosClipRect( | 106 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())); |
107 intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); | |
108 clipRects.setOverflowClipRect( | 107 clipRects.setOverflowClipRect( |
109 intersection(newClip, clipRects.overflowClipRect()) | 108 intersection(newClip, clipRects.overflowClipRect())); |
110 .setIsClippedByClipCss()); | 109 clipRects.setFixedClipRect( |
111 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) | 110 intersection(newClip, clipRects.fixedClipRect())); |
112 .setIsClippedByClipCss()); | |
113 } | 111 } |
114 } | 112 } |
115 | 113 |
116 PaintLayerClipper::PaintLayerClipper(const PaintLayer& layer, | 114 PaintLayerClipper::PaintLayerClipper(const PaintLayer& layer, |
117 GeometryMapper* geometryMapper) | 115 GeometryMapper* geometryMapper) |
118 : m_layer(layer), m_geometryMapper(geometryMapper) {} | 116 : m_layer(layer), m_geometryMapper(geometryMapper) {} |
119 | 117 |
120 ClipRects* PaintLayerClipper::clipRectsIfCached( | 118 ClipRects* PaintLayerClipper::clipRectsIfCached( |
121 const ClipRectsContext& context) const { | 119 const ClipRectsContext& context) const { |
122 DCHECK(context.usesCache()); | 120 DCHECK(context.usesCache()); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 layerBoundsWithVisualOverflow.moveBy(offset); | 375 layerBoundsWithVisualOverflow.moveBy(offset); |
378 backgroundRect.intersect(layerBoundsWithVisualOverflow); | 376 backgroundRect.intersect(layerBoundsWithVisualOverflow); |
379 } | 377 } |
380 | 378 |
381 // CSS clip (different than clipping due to overflow) can clip to any box, | 379 // CSS clip (different than clipping due to overflow) can clip to any box, |
382 // even if it falls outside of the border box. | 380 // even if it falls outside of the border box. |
383 if (layoutObject.hasClip()) { | 381 if (layoutObject.hasClip()) { |
384 // Clip applies to *us* as well, so go ahead and update the damageRect. | 382 // Clip applies to *us* as well, so go ahead and update the damageRect. |
385 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); | 383 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); |
386 backgroundRect.intersect(newPosClip); | 384 backgroundRect.intersect(newPosClip); |
387 backgroundRect.setIsClippedByClipCss(); | |
388 foregroundRect.intersect(newPosClip); | 385 foregroundRect.intersect(newPosClip); |
389 foregroundRect.setIsClippedByClipCss(); | |
390 } | 386 } |
391 } | 387 } |
392 | 388 |
393 void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, | 389 void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, |
394 ClipRects& clipRects) const { | 390 ClipRects& clipRects) const { |
395 const LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); | 391 const LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); |
396 if (!m_layer.parent() && | 392 if (!m_layer.parent() && |
397 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 393 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
398 // The root layer's clip rect is always infinite. | 394 // The root layer's clip rect is always infinite. |
399 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 395 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 const LayoutSize& subpixelAccumulation) const { | 579 const LayoutSize& subpixelAccumulation) const { |
584 DCHECK(!m_geometryMapper); | 580 DCHECK(!m_geometryMapper); |
585 ClipRectsContext context(rootLayer, PaintingClipRects, | 581 ClipRectsContext context(rootLayer, PaintingClipRects, |
586 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 582 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
587 if (respectOverflowClip == IgnoreOverflowClip) | 583 if (respectOverflowClip == IgnoreOverflowClip) |
588 context.setIgnoreOverflowClip(); | 584 context.setIgnoreOverflowClip(); |
589 return getClipRects(context); | 585 return getClipRects(context); |
590 } | 586 } |
591 | 587 |
592 } // namespace blink | 588 } // namespace blink |
OLD | NEW |