Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerClipper.cpp

Issue 1318963006: Add a UseCounter for clip CSS or -webkit-clip-path that clips positioned descendants. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/ClipRect.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 const ClipRect& rect& = intersection(newClip, clipRects.posClipRect( ));
pdr. 2015/09/05 00:07:48 One too many ampersands!
chrishtr 2015/09/05 00:21:16 Fixed.
88 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ())); 89 rect.setIsClippedByClipCss();
90 clipRects.setPosClipRect(rect);
91 }
92
93 {
94 const ClipRect& rect = intersection(newClip, clipRects.overflowClipR ect());
95 rect.setIsClippedByClipCss();
96 clipRects.setOverflowClipRect(rect);
97 }
98
99 {
100 const ClipRect& rect = intersection(newClip, clipRects.fixedClipRect ());
101 rect.setIsClippedByClipCss();
102 clipRects.setFixedClipRect(rect);
103 }
89 } 104 }
90 } 105 }
91 106
92 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l ayoutObject) 107 DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(LayoutBoxModelObject& l ayoutObject)
93 : m_layoutObject(layoutObject) 108 : m_layoutObject(layoutObject)
94 { 109 {
95 } 110 }
96 111
97 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext & context) const 112 ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext & context) const
98 { 113 {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (shouldRespectOverflowClip(context)) 268 if (shouldRespectOverflowClip(context))
254 backgroundRect.intersect(bounds); 269 backgroundRect.intersect(bounds);
255 } 270 }
256 } 271 }
257 272
258 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 273 // 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()) { 274 if (m_layoutObject.hasClip()) {
260 // Clip applies to *us* as well, so go ahead and update the damageRect. 275 // Clip applies to *us* as well, so go ahead and update the damageRect.
261 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); 276 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset);
262 backgroundRect.intersect(newPosClip); 277 backgroundRect.intersect(newPosClip);
278 backgroundRect.setIsClippedByClipCss();
263 foregroundRect.intersect(newPosClip); 279 foregroundRect.intersect(newPosClip);
280 foregroundRect.setIsClippedByClipCss();
264 outlineRect.intersect(newPosClip); 281 outlineRect.intersect(newPosClip);
282 outlineRect.setIsClippedByClipCss();
265 } 283 }
266 } 284 }
267 285
268 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con text, ClipRects& clipRects) const 286 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con text, ClipRects& clipRects) const
269 { 287 {
270 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje ct.document().settings()->rootLayerScrolls(); 288 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje ct.document().settings()->rootLayerScrolls();
271 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { 289 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) {
272 // The root layer's clip rect is always infinite. 290 // The root layer's clip rect is always infinite.
273 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 291 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
274 return; 292 return;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 if (context.respectOverflowClip == IgnoreOverflowClip) 391 if (context.respectOverflowClip == IgnoreOverflowClip)
374 return false; 392 return false;
375 393
376 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip) 394 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip)
377 return false; 395 return false;
378 396
379 return true; 397 return true;
380 } 398 }
381 399
382 } // namespace blink 400 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/ClipRect.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698