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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (position == FixedPosition) { | 58 if (position == FixedPosition) { |
59 clipRects.setPosClipRect(clipRects.fixedClipRect()); | 59 clipRects.setPosClipRect(clipRects.fixedClipRect()); |
60 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); | 60 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); |
61 clipRects.setFixed(true); | 61 clipRects.setFixed(true); |
62 } else if (position == RelativePosition) { | 62 } else if (position == RelativePosition) { |
63 clipRects.setPosClipRect(clipRects.overflowClipRect()); | 63 clipRects.setPosClipRect(clipRects.overflowClipRect()); |
64 } else if (position == AbsolutePosition) { | 64 } else if (position == AbsolutePosition) { |
65 clipRects.setOverflowClipRect(clipRects.posClipRect()); | 65 clipRects.setOverflowClipRect(clipRects.posClipRect()); |
66 } | 66 } |
67 } | 67 } |
| 68 |
68 static void applyClipRects(const ClipRectsContext& context, LayoutObject& layout
Object, LayoutPoint offset, ClipRects& clipRects) | 69 static void applyClipRects(const ClipRectsContext& context, LayoutObject& layout
Object, LayoutPoint offset, ClipRects& clipRects) |
69 { | 70 { |
70 ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip()); | 71 ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip()); |
71 LayoutView* view = layoutObject.view(); | 72 LayoutView* view = layoutObject.view(); |
72 ASSERT(view); | 73 ASSERT(view); |
73 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) | 74 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) |
74 offset -= toIntSize(view->frameView()->scrollPosition()); | 75 offset -= toIntSize(view->frameView()->scrollPosition()); |
75 if (layoutObject.hasOverflowClip()) { | 76 if (layoutObject.hasOverflowClip()) { |
76 ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(of
fset, context.scrollbarRelevancy); | 77 ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(of
fset, context.scrollbarRelevancy); |
77 newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius()); | 78 newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius()); |
78 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov
erflowClipRect())); | 79 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov
erflowClipRect())); |
79 if (layoutObject.isPositioned()) | 80 if (layoutObject.isPositioned()) |
80 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos
ClipRect())); | 81 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos
ClipRect())); |
81 if (layoutObject.isLayoutView()) | 82 if (layoutObject.isLayoutView()) |
82 clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.f
ixedClipRect())); | 83 clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.f
ixedClipRect())); |
83 } | 84 } |
84 if (layoutObject.hasClip()) { | 85 if (layoutObject.hasClip()) { |
85 LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); | 86 LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); |
86 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()))
; | 87 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()).
setIsClippedByClipCss()); |
87 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect())); | 88 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect()).setIsClippedByClipCss()); |
88 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect
())); | 89 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect
()).setIsClippedByClipCss()); |
| 90 |
89 } | 91 } |
90 } | 92 } |
91 | 93 |
92 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l
ayoutObject) | 94 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l
ayoutObject) |
93 : m_layoutObject(layoutObject) | 95 : m_layoutObject(layoutObject) |
94 { | 96 { |
95 } | 97 } |
96 | 98 |
97 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext
& context) const | 99 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext
& context) const |
98 { | 100 { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (shouldRespectOverflowClip(context)) | 255 if (shouldRespectOverflowClip(context)) |
254 backgroundRect.intersect(bounds); | 256 backgroundRect.intersect(bounds); |
255 } | 257 } |
256 } | 258 } |
257 | 259 |
258 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. | 260 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. |
259 if (m_layoutObject.hasClip()) { | 261 if (m_layoutObject.hasClip()) { |
260 // Clip applies to *us* as well, so go ahead and update the damageRect. | 262 // Clip applies to *us* as well, so go ahead and update the damageRect. |
261 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); | 263 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); |
262 backgroundRect.intersect(newPosClip); | 264 backgroundRect.intersect(newPosClip); |
| 265 backgroundRect.setIsClippedByClipCss(); |
263 foregroundRect.intersect(newPosClip); | 266 foregroundRect.intersect(newPosClip); |
| 267 foregroundRect.setIsClippedByClipCss(); |
264 outlineRect.intersect(newPosClip); | 268 outlineRect.intersect(newPosClip); |
| 269 outlineRect.setIsClippedByClipCss(); |
265 } | 270 } |
266 } | 271 } |
267 | 272 |
268 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con
text, ClipRects& clipRects) const | 273 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con
text, ClipRects& clipRects) const |
269 { | 274 { |
270 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje
ct.document().settings()->rootLayerScrolls(); | 275 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje
ct.document().settings()->rootLayerScrolls(); |
271 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { | 276 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { |
272 // The root layer's clip rect is always infinite. | 277 // The root layer's clip rect is always infinite. |
273 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 278 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
274 return; | 279 return; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if (context.respectOverflowClip == IgnoreOverflowClip) | 378 if (context.respectOverflowClip == IgnoreOverflowClip) |
374 return false; | 379 return false; |
375 | 380 |
376 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore
OverflowClip) | 381 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore
OverflowClip) |
377 return false; | 382 return false; |
378 | 383 |
379 return true; | 384 return true; |
380 } | 385 } |
381 | 386 |
382 } // namespace blink | 387 } // namespace blink |
OLD | NEW |