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

Side by Side Diff: sky/engine/core/rendering/RenderLayerClipper.cpp

Issue 953673002: Delete RenderLayerModelObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); 68 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect()));
69 } 69 }
70 70
71 if (renderer.hasClip()) { 71 if (renderer.hasClip()) {
72 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); 72 LayoutRect newClip = toRenderBox(renderer).clipRect(offset);
73 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ; 73 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ;
74 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect())); 74 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect()));
75 } 75 }
76 } 76 }
77 77
78 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer) 78 RenderLayerClipper::RenderLayerClipper(RenderBox& renderer)
79 : m_renderer(renderer) 79 : m_renderer(renderer)
80 { 80 {
81 } 81 }
82 82
83 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context ) const 83 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context ) const
84 { 84 {
85 ASSERT(context.usesCache()); 85 ASSERT(context.usesCache());
86 if (!m_cache) 86 if (!m_cache)
87 return 0; 87 return 0;
88 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot); 88 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 LayoutPoint offset; 206 LayoutPoint offset;
207 if (offsetFromRoot) 207 if (offsetFromRoot)
208 offset = *offsetFromRoot; 208 offset = *offsetFromRoot;
209 else 209 else
210 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); 210 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset);
211 layerBounds = LayoutRect(offset, m_renderer.layer()->size()); 211 layerBounds = LayoutRect(offset, m_renderer.layer()->size());
212 212
213 // Update the clip rects that will be passed to child layers. 213 // Update the clip rects that will be passed to child layers.
214 if (m_renderer.hasOverflowClip()) { 214 if (m_renderer.hasOverflowClip()) {
215 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(offset )); 215 foregroundRect.intersect(m_renderer.overflowClipRect(offset));
216 if (m_renderer.style()->hasBorderRadius()) 216 if (m_renderer.style()->hasBorderRadius())
217 foregroundRect.setHasRadius(true); 217 foregroundRect.setHasRadius(true);
218 218
219 // If we establish an overflow clip at all, then go ahead and make sure our background 219 // If we establish an overflow clip at all, then go ahead and make sure our background
220 // rect is intersected with our layer's bounds including our visual over flow, 220 // rect is intersected with our layer's bounds including our visual over flow,
221 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden. 221 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden.
222 if (toRenderBox(m_renderer).hasVisualOverflow()) { 222 if (m_renderer.hasVisualOverflow()) {
223 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though 223 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
224 // we may need to inflate our clip specifically for shadows o r outsets. 224 // we may need to inflate our clip specifically for shadows o r outsets.
225 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the 225 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
226 // individual region boxes as overflow. 226 // individual region boxes as overflow.
227 LayoutRect layerBoundsWithVisualOverflow = toRenderBox(m_renderer).v isualOverflowRect(); 227 LayoutRect layerBoundsWithVisualOverflow = m_renderer.visualOverflow Rect();
228 layerBoundsWithVisualOverflow.moveBy(offset); 228 layerBoundsWithVisualOverflow.moveBy(offset);
229 backgroundRect.intersect(layerBoundsWithVisualOverflow); 229 backgroundRect.intersect(layerBoundsWithVisualOverflow);
230 } else { 230 } else {
231 LayoutRect bounds = toRenderBox(m_renderer).borderBoxRect(); 231 LayoutRect bounds = m_renderer.borderBoxRect();
232 bounds.moveBy(offset); 232 bounds.moveBy(offset);
233 backgroundRect.intersect(bounds); 233 backgroundRect.intersect(bounds);
234 } 234 }
235 } 235 }
236 236
237 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 237 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box.
238 if (m_renderer.hasClip()) { 238 if (m_renderer.hasClip()) {
239 // Clip applies to *us* as well, so go ahead and update the damageRect. 239 // Clip applies to *us* as well, so go ahead and update the damageRect.
240 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); 240 LayoutRect newPosClip = m_renderer.clipRect(offset);
241 backgroundRect.intersect(newPosClip); 241 backgroundRect.intersect(newPosClip);
242 foregroundRect.intersect(newPosClip); 242 foregroundRect.intersect(newPosClip);
243 } 243 }
244 } 244 }
245 245
246 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli pRects& clipRects) const 246 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli pRects& clipRects) const
247 { 247 {
248 if (!m_renderer.layer()->parent()) { 248 if (!m_renderer.layer()->parent()) {
249 // The root layer's clip rect is always infinite. 249 // The root layer's clip rect is always infinite.
250 clipRects.reset(PaintInfo::infiniteRect()); 250 clipRects.reset(PaintInfo::infiniteRect());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ASSERT(current); 319 ASSERT(current);
320 if (current->transform()) 320 if (current->transform())
321 return const_cast<RenderLayer*>(current); 321 return const_cast<RenderLayer*>(current);
322 } 322 }
323 323
324 ASSERT_NOT_REACHED(); 324 ASSERT_NOT_REACHED();
325 return 0; 325 return 0;
326 } 326 }
327 327
328 } // namespace blink 328 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayerClipper.h ('k') | sky/engine/core/rendering/RenderLayerModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698