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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/Layer.cpp ('k') | Source/core/layout/LayerFilterInfo.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 clipRects.setOverflowClipRect(clipRects.posClipRect()); 65 clipRects.setOverflowClipRect(clipRects.posClipRect());
66 } 66 }
67 } 67 }
68 68
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 LayoutView* view = renderer.view(); 73 LayoutView* view = renderer.view();
74 ASSERT(view); 74 ASSERT(view);
75 if (clipRects.fixed() && context.rootLayer->renderer() == view) 75 if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
76 offset -= view->frameView()->scrollOffsetForViewportConstrainedObjects() ; 76 offset -= view->frameView()->scrollOffsetForViewportConstrainedObjects() ;
77 77
78 if (renderer.hasOverflowClip()) { 78 if (renderer.hasOverflowClip()) {
79 ClipRect newOverflowClip = toLayoutBox(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
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 LayoutRect LayerClipper::childrenClipRect() const 178 LayoutRect LayerClipper::childrenClipRect() const
179 { 179 {
180 // FIXME: border-radius not accounted for. 180 // FIXME: border-radius not accounted for.
181 // FIXME: Regions not accounted for. 181 // FIXME: Regions not accounted for.
182 Layer* clippingRootLayer = clippingRootForPainting(); 182 Layer* clippingRootLayer = clippingRootForPainting();
183 LayoutRect layerBounds; 183 LayoutRect layerBounds;
184 ClipRect backgroundRect, foregroundRect, outlineRect; 184 ClipRect backgroundRect, foregroundRect, outlineRect;
185 // Need to use uncached clip rects, because the value of 'dontClipToOverflow ' may be different from the painting path (<rdar://problem/11844909>). 185 // Need to use uncached clip rects, because the value of 'dontClipToOverflow ' may be different from the painting path (<rdar://problem/11844909>).
186 ClipRectsContext context(clippingRootLayer, UncachedClipRects); 186 ClipRectsContext context(clippingRootLayer, UncachedClipRects);
187 calculateRects(context, LayoutRect(m_renderer.view()->unscaledDocumentRect() ), layerBounds, backgroundRect, foregroundRect, outlineRect); 187 calculateRects(context, LayoutRect(m_renderer.view()->unscaledDocumentRect() ), layerBounds, backgroundRect, foregroundRect, outlineRect);
188 return LayoutRect(clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQu ad(foregroundRect.rect())).enclosingBoundingBox()); 188 return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(Flo atQuad(foregroundRect.rect())).enclosingBoundingBox());
189 } 189 }
190 190
191 LayoutRect LayerClipper::localClipRect() const 191 LayoutRect LayerClipper::localClipRect() const
192 { 192 {
193 // FIXME: border-radius not accounted for. 193 // FIXME: border-radius not accounted for.
194 Layer* clippingRootLayer = clippingRootForPainting(); 194 Layer* clippingRootLayer = clippingRootForPainting();
195 LayoutRect layerBounds; 195 LayoutRect layerBounds;
196 ClipRect backgroundRect, foregroundRect, outlineRect; 196 ClipRect backgroundRect, foregroundRect, outlineRect;
197 ClipRectsContext context(clippingRootLayer, PaintingClipRects); 197 ClipRectsContext context(clippingRootLayer, PaintingClipRects);
198 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun ds, backgroundRect, foregroundRect, outlineRect); 198 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun ds, backgroundRect, foregroundRect, outlineRect);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } else { 297 } else {
298 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 298 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
299 } 299 }
300 300
301 adjustClipRectsForChildren(m_renderer, clipRects); 301 adjustClipRectsForChildren(m_renderer, clipRects);
302 302
303 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { 303 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) {
304 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across 304 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across
305 // some transformed layer boundary, for example, in the LayerCompositor overlapMap, where 305 // some transformed layer boundary, for example, in the LayerCompositor overlapMap, where
306 // clipRects are needed in view space. 306 // clipRects are needed in view space.
307 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); 307 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT oContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipRects);
308 } 308 }
309 } 309 }
310 310
311 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos ition position) 311 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos ition position)
312 { 312 {
313 if (position == FixedPosition) 313 if (position == FixedPosition)
314 return parentRects.fixedClipRect(); 314 return parentRects.fixedClipRect();
315 315
316 if (position == AbsolutePosition) 316 if (position == AbsolutePosition)
317 return parentRects.posClipRect(); 317 return parentRects.posClipRect();
318 318
319 return parentRects.overflowClipRect(); 319 return parentRects.overflowClipRect();
320 } 320 }
321 321
322 ClipRect LayerClipper::backgroundClipRect(const ClipRectsContext& context) const 322 ClipRect LayerClipper::backgroundClipRect(const ClipRectsContext& context) const
323 { 323 {
324 ASSERT(m_renderer.layer()->parent()); 324 ASSERT(m_renderer.layer()->parent());
325 ASSERT(m_renderer.view()); 325 ASSERT(m_renderer.view());
326 326
327 RefPtr<ClipRects> parentClipRects = ClipRects::create(); 327 RefPtr<ClipRects> parentClipRects = ClipRects::create();
328 if (m_renderer.layer() == context.rootLayer) 328 if (m_renderer.layer() == context.rootLayer)
329 parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect())); 329 parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect()));
330 else 330 else
331 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects); 331 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects);
332 332
333 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer .style()->position()); 333 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer .style()->position());
334 334
335 // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite. 335 // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite.
336 if (parentClipRects->fixed() && context.rootLayer->renderer() == m_renderer. view() && result != LayoutRect(LayoutRect::infiniteIntRect())) 336 if (parentClipRects->fixed() && context.rootLayer->layoutObject() == m_rende rer.view() && result != LayoutRect(LayoutRect::infiniteIntRect()))
337 result.move(m_renderer.view()->frameView()->scrollOffsetForViewportConst rainedObjects()); 337 result.move(m_renderer.view()->frameView()->scrollOffsetForViewportConst rainedObjects());
338 338
339 return result; 339 return result;
340 } 340 }
341 341
342 void LayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, Clip Rects& clipRects) const 342 void LayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, Clip Rects& clipRects) const
343 { 343 {
344 if (context.usesCache()) 344 if (context.usesCache())
345 clipRects = *getClipRects(context); 345 clipRects = *getClipRects(context);
346 else 346 else
(...skipping 18 matching lines...) Expand all
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/Layer.cpp ('k') | Source/core/layout/LayerFilterInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698