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

Side by Side Diff: Source/core/layout/LayerClipper.cpp

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/LayerClipper.h ('k') | Source/core/layout/LayerReflectionInfo.h » ('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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 static void applyClipRects(const ClipRectsContext& context, LayoutObject& render er, LayoutPoint offset, ClipRects& clipRects) 69 static void applyClipRects(const ClipRectsContext& context, LayoutObject& render er, LayoutPoint offset, ClipRects& clipRects)
70 { 70 {
71 ASSERT(renderer.hasOverflowClip() || renderer.hasClip()); 71 ASSERT(renderer.hasOverflowClip() || renderer.hasClip());
72 72
73 RenderView* view = renderer.view(); 73 RenderView* view = renderer.view();
74 ASSERT(view); 74 ASSERT(view);
75 if (clipRects.fixed() && context.rootLayer->renderer() == view) 75 if (clipRects.fixed() && context.rootLayer->renderer() == view)
76 offset -= view->frameView()->scrollOffsetForViewportConstrainedObjects() ; 76 offset -= view->frameView()->scrollOffsetForViewportConstrainedObjects() ;
77 77
78 if (renderer.hasOverflowClip()) { 78 if (renderer.hasOverflowClip()) {
79 ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset , context.scrollbarRelevancy); 79 ClipRect newOverflowClip = toLayoutBox(renderer).overflowClipRect(offset , context.scrollbarRelevancy);
80 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius()); 80 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius());
81 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect())); 81 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect()));
82 if (renderer.isPositioned()) 82 if (renderer.isPositioned())
83 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); 83 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect()));
84 } 84 }
85 85
86 if (renderer.hasClip()) { 86 if (renderer.hasClip()) {
87 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); 87 LayoutRect newClip = toLayoutBox(renderer).clipRect(offset);
88 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ; 88 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ;
89 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect())); 89 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect()));
90 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ())); 90 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ()));
91 } 91 }
92 } 92 }
93 93
94 LayerClipper::LayerClipper(LayoutBoxModelObject& renderer) 94 LayerClipper::LayerClipper(LayoutBoxModelObject& renderer)
95 : m_renderer(renderer) 95 : m_renderer(renderer)
96 { 96 {
97 } 97 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (offsetFromRoot) 228 if (offsetFromRoot)
229 offset = *offsetFromRoot; 229 offset = *offsetFromRoot;
230 else 230 else
231 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); 231 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset);
232 layerBounds = LayoutRect(offset, LayoutSize(m_renderer.layer()->size())); 232 layerBounds = LayoutRect(offset, LayoutSize(m_renderer.layer()->size()));
233 233
234 // Update the clip rects that will be passed to child layers. 234 // Update the clip rects that will be passed to child layers.
235 if (m_renderer.hasOverflowClip()) { 235 if (m_renderer.hasOverflowClip()) {
236 // This layer establishes a clip of some kind. 236 // This layer establishes a clip of some kind.
237 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli p) { 237 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli p) {
238 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(of fset, context.scrollbarRelevancy)); 238 foregroundRect.intersect(toLayoutBox(m_renderer).overflowClipRect(of fset, context.scrollbarRelevancy));
239 if (m_renderer.style()->hasBorderRadius()) 239 if (m_renderer.style()->hasBorderRadius())
240 foregroundRect.setHasRadius(true); 240 foregroundRect.setHasRadius(true);
241 } 241 }
242 242
243 // If we establish an overflow clip at all, then go ahead and make sure our background 243 // If we establish an overflow clip at all, then go ahead and make sure our background
244 // rect is intersected with our layer's bounds including our visual over flow, 244 // rect is intersected with our layer's bounds including our visual over flow,
245 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden. 245 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden.
246 if (toRenderBox(m_renderer).hasVisualOverflow()) { 246 if (toLayoutBox(m_renderer).hasVisualOverflow()) {
247 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though 247 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
248 // we may need to inflate our clip specifically for shadows o r outsets. 248 // we may need to inflate our clip specifically for shadows o r outsets.
249 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the 249 // FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
250 // individual region boxes as overflow. 250 // individual region boxes as overflow.
251 LayoutRect layerBoundsWithVisualOverflow = toRenderBox(m_renderer).v isualOverflowRect(); 251 LayoutRect layerBoundsWithVisualOverflow = toLayoutBox(m_renderer).v isualOverflowRect();
252 toRenderBox(m_renderer).flipForWritingMode(layerBoundsWithVisualOver flow); // Layers are in physical coordinates, so the overflow has to be flipped. 252 toLayoutBox(m_renderer).flipForWritingMode(layerBoundsWithVisualOver flow); // Layers are in physical coordinates, so the overflow has to be flipped.
253 layerBoundsWithVisualOverflow.moveBy(offset); 253 layerBoundsWithVisualOverflow.moveBy(offset);
254 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo wClip) 254 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo wClip)
255 backgroundRect.intersect(layerBoundsWithVisualOverflow); 255 backgroundRect.intersect(layerBoundsWithVisualOverflow);
256 } else { 256 } else {
257 LayoutRect bounds = toRenderBox(m_renderer).borderBoxRect(); 257 LayoutRect bounds = toLayoutBox(m_renderer).borderBoxRect();
258 bounds.moveBy(offset); 258 bounds.moveBy(offset);
259 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo wClip) 259 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo wClip)
260 backgroundRect.intersect(bounds); 260 backgroundRect.intersect(bounds);
261 } 261 }
262 } 262 }
263 263
264 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 264 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box.
265 if (m_renderer.hasClip()) { 265 if (m_renderer.hasClip()) {
266 // Clip applies to *us* as well, so go ahead and update the damageRect. 266 // Clip applies to *us* as well, so go ahead and update the damageRect.
267 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); 267 LayoutRect newPosClip = toLayoutBox(m_renderer).clipRect(offset);
268 backgroundRect.intersect(newPosClip); 268 backgroundRect.intersect(newPosClip);
269 foregroundRect.intersect(newPosClip); 269 foregroundRect.intersect(newPosClip);
270 outlineRect.intersect(newPosClip); 270 outlineRect.intersect(newPosClip);
271 } 271 }
272 } 272 }
273 273
274 void LayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects & clipRects) const 274 void LayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects & clipRects) const
275 { 275 {
276 bool rootLayerScrolls = m_renderer.document().settings() && m_renderer.docum ent().settings()->rootLayerScrolls(); 276 bool rootLayerScrolls = m_renderer.document().settings() && m_renderer.docum ent().settings()->rootLayerScrolls();
277 if (!m_renderer.layer()->parent() && !rootLayerScrolls) { 277 if (!m_renderer.layer()->parent() && !rootLayerScrolls) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ASSERT(current); 365 ASSERT(current);
366 if (current->transform() || current->isPaintInvalidationContainer()) 366 if (current->transform() || current->isPaintInvalidationContainer())
367 return const_cast<Layer*>(current); 367 return const_cast<Layer*>(current);
368 } 368 }
369 369
370 ASSERT_NOT_REACHED(); 370 ASSERT_NOT_REACHED();
371 return 0; 371 return 0;
372 } 372 }
373 373
374 } // namespace blink 374 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayerClipper.h ('k') | Source/core/layout/LayerReflectionInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698