Chromium Code Reviews| 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 { |
| 87 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect())); | 88 ClipRect rect = intersection(newClip, clipRects.posClipRect()); |
|
pdr.
2015/09/04 22:55:14
Please use some ampersands here.
chrishtr
2015/09/04 23:39:00
Done
| |
| 88 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ())); | 89 rect.setIsClippedByClipCss(); |
| 90 clipRects.setPosClipRect(rect); | |
| 91 } | |
|
pdr.
2015/09/04 22:55:14
nit: newline
chrishtr
2015/09/04 23:39:00
Done
| |
| 92 { | |
| 93 ClipRect rect = intersection(newClip, clipRects.overflowClipRect()); | |
| 94 rect.setIsClippedByClipCss(); | |
| 95 clipRects.setOverflowClipRect(rect); | |
| 96 } | |
| 97 | |
| 98 { | |
| 99 ClipRect rect = intersection(newClip, clipRects.fixedClipRect()); | |
| 100 rect.setIsClippedByClipCss(); | |
| 101 clipRects.setFixedClipRect(rect); | |
| 102 } | |
| 89 } | 103 } |
| 90 } | 104 } |
| 91 | 105 |
| 92 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l ayoutObject) | 106 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l ayoutObject) |
| 93 : m_layoutObject(layoutObject) | 107 : m_layoutObject(layoutObject) |
| 94 { | 108 { |
| 95 } | 109 } |
| 96 | 110 |
| 97 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext & context) const | 111 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext & context) const |
| 98 { | 112 { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 if (shouldRespectOverflowClip(context)) | 267 if (shouldRespectOverflowClip(context)) |
| 254 backgroundRect.intersect(bounds); | 268 backgroundRect.intersect(bounds); |
| 255 } | 269 } |
| 256 } | 270 } |
| 257 | 271 |
| 258 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. | 272 // 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()) { | 273 if (m_layoutObject.hasClip()) { |
| 260 // Clip applies to *us* as well, so go ahead and update the damageRect. | 274 // Clip applies to *us* as well, so go ahead and update the damageRect. |
| 261 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); | 275 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); |
| 262 backgroundRect.intersect(newPosClip); | 276 backgroundRect.intersect(newPosClip); |
| 277 backgroundRect.setIsClippedByClipCss(); | |
| 263 foregroundRect.intersect(newPosClip); | 278 foregroundRect.intersect(newPosClip); |
| 279 foregroundRect.setIsClippedByClipCss(); | |
| 264 outlineRect.intersect(newPosClip); | 280 outlineRect.intersect(newPosClip); |
| 281 outlineRect.setIsClippedByClipCss(); | |
| 265 } | 282 } |
| 266 } | 283 } |
| 267 | 284 |
| 268 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con text, ClipRects& clipRects) const | 285 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con text, ClipRects& clipRects) const |
| 269 { | 286 { |
| 270 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje ct.document().settings()->rootLayerScrolls(); | 287 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje ct.document().settings()->rootLayerScrolls(); |
| 271 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { | 288 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { |
| 272 // The root layer's clip rect is always infinite. | 289 // The root layer's clip rect is always infinite. |
| 273 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 290 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
| 274 return; | 291 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 if (context.respectOverflowClip == IgnoreOverflowClip) | 390 if (context.respectOverflowClip == IgnoreOverflowClip) |
| 374 return false; | 391 return false; |
| 375 | 392 |
| 376 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip) | 393 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip) |
| 377 return false; | 394 return false; |
| 378 | 395 |
| 379 return true; | 396 return true; |
| 380 } | 397 } |
| 381 | 398 |
| 382 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |