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

Side by Side Diff: Source/core/rendering/RenderLayerClipper.cpp

Issue 751573002: Use viewportConstrainedVisibleContentRect() to get the scrolling offset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 } 67 }
68 68
69 static void applyClipRects(const ClipRectsContext& context, RenderObject& render er, LayoutPoint offset, ClipRects& clipRects) 69 static void applyClipRects(const ClipRectsContext& context, RenderObject& 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()->scrollOffsetForFixedPosition(); 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 = toRenderBox(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()) {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 RefPtr<ClipRects> parentClipRects = ClipRects::create(); 328 RefPtr<ClipRects> parentClipRects = ClipRects::create();
329 if (m_renderer.layer() == context.rootLayer) 329 if (m_renderer.layer() == context.rootLayer)
330 parentClipRects->reset(LayoutRect::infiniteIntRect()); 330 parentClipRects->reset(LayoutRect::infiniteIntRect());
331 else 331 else
332 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects); 332 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects);
333 333
334 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer .style()->position()); 334 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer .style()->position());
335 335
336 // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite. 336 // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite.
337 if (parentClipRects->fixed() && context.rootLayer->renderer() == m_renderer. view() && result != LayoutRect::infiniteIntRect()) 337 if (parentClipRects->fixed() && context.rootLayer->renderer() == m_renderer. view() && result != LayoutRect::infiniteIntRect())
338 result.move(m_renderer.view()->frameView()->scrollOffsetForFixedPosition ()); 338 result.move(m_renderer.view()->frameView()->scrollOffsetForViewportConst rainedObjects());
339 339
340 return result; 340 return result;
341 } 341 }
342 342
343 void RenderLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context , ClipRects& clipRects) const 343 void RenderLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context , ClipRects& clipRects) const
344 { 344 {
345 if (context.usesCache()) 345 if (context.usesCache())
346 clipRects = *getClipRects(context); 346 clipRects = *getClipRects(context);
347 else 347 else
348 calculateClipRects(context, clipRects); 348 calculateClipRects(context, clipRects);
(...skipping 17 matching lines...) Expand all
366 ASSERT(current); 366 ASSERT(current);
367 if (current->transform() || current->isPaintInvalidationContainer()) 367 if (current->transform() || current->isPaintInvalidationContainer())
368 return const_cast<RenderLayer*>(current); 368 return const_cast<RenderLayer*>(current);
369 } 369 }
370 370
371 ASSERT_NOT_REACHED(); 371 ASSERT_NOT_REACHED();
372 return 0; 372 return 0;
373 } 373 }
374 374
375 } // namespace blink 375 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698