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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Created 4 years, 2 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 static void applyClipRects(const ClipRectsContext& context, 70 static void applyClipRects(const ClipRectsContext& context,
71 const LayoutBoxModelObject& layoutObject, 71 const LayoutBoxModelObject& layoutObject,
72 LayoutPoint offset, 72 LayoutPoint offset,
73 ClipRects& clipRects) { 73 ClipRects& clipRects) {
74 DCHECK(layoutObject.hasClipRelatedProperty() || 74 DCHECK(layoutObject.hasClipRelatedProperty() ||
75 (layoutObject.isSVGRoot() && 75 (layoutObject.isSVGRoot() &&
76 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())); 76 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()));
77 LayoutView* view = layoutObject.view(); 77 LayoutView* view = layoutObject.view();
78 DCHECK(view); 78 DCHECK(view);
79 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) 79 if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
80 offset -= toIntSize(view->frameView()->scrollPosition()); 80 offset -= LayoutSize(view->frameView()->scrollOffset());
81 if (layoutObject.hasOverflowClip() || 81 if (layoutObject.hasOverflowClip() ||
82 (layoutObject.isSVGRoot() && 82 (layoutObject.isSVGRoot() &&
83 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) || 83 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) ||
84 (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) { 84 (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) {
85 ClipRect newOverflowClip = 85 ClipRect newOverflowClip =
86 toLayoutBox(layoutObject) 86 toLayoutBox(layoutObject)
87 .overflowClipRect(offset, context.overlayScrollbarClipBehavior); 87 .overflowClipRect(offset, context.overlayScrollbarClipBehavior);
88 newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius()); 88 newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius());
89 clipRects.setOverflowClipRect( 89 clipRects.setOverflowClipRect(
90 intersection(newOverflowClip, clipRects.overflowClipRect())); 90 intersection(newOverflowClip, clipRects.overflowClipRect()));
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 m_layer.parent()->clipper().getOrCalculateClipRects(context, 333 m_layer.parent()->clipper().getOrCalculateClipRects(context,
334 *parentClipRects); 334 *parentClipRects);
335 335
336 ClipRect result = backgroundClipRectForPosition( 336 ClipRect result = backgroundClipRectForPosition(
337 *parentClipRects, m_layer.layoutObject()->styleRef().position()); 337 *parentClipRects, m_layer.layoutObject()->styleRef().position());
338 338
339 // Note: infinite clipRects should not be scrolled here, otherwise they will a ccidentally no longer be considered infinite. 339 // Note: infinite clipRects should not be scrolled here, otherwise they will a ccidentally no longer be considered infinite.
340 if (parentClipRects->fixed() && 340 if (parentClipRects->fixed() &&
341 context.rootLayer->layoutObject() == layoutView && 341 context.rootLayer->layoutObject() == layoutView &&
342 result != LayoutRect(LayoutRect::infiniteIntRect())) 342 result != LayoutRect(LayoutRect::infiniteIntRect()))
343 result.move(toIntSize(layoutView->frameView()->scrollPosition())); 343 result.move(LayoutSize(layoutView->frameView()->scrollOffset()));
344 344
345 return result; 345 return result;
346 } 346 }
347 347
348 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 348 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
349 ClipRects& clipRects) const { 349 ClipRects& clipRects) const {
350 if (context.usesCache()) 350 if (context.usesCache())
351 clipRects = getClipRects(context); 351 clipRects = getClipRects(context);
352 else 352 else
353 calculateClipRects(context, clipRects); 353 calculateClipRects(context, clipRects);
(...skipping 19 matching lines...) Expand all
373 ShouldRespectOverflowClipType respectOverflowClip, 373 ShouldRespectOverflowClipType respectOverflowClip,
374 const LayoutSize& subpixelAccumulation) const { 374 const LayoutSize& subpixelAccumulation) const {
375 ClipRectsContext context(rootLayer, PaintingClipRects, 375 ClipRectsContext context(rootLayer, PaintingClipRects,
376 IgnoreOverlayScrollbarSize, subpixelAccumulation); 376 IgnoreOverlayScrollbarSize, subpixelAccumulation);
377 if (respectOverflowClip == IgnoreOverflowClip) 377 if (respectOverflowClip == IgnoreOverflowClip)
378 context.setIgnoreOverflowClip(); 378 context.setIgnoreOverflowClip();
379 return getClipRects(context); 379 return getClipRects(context);
380 } 380 }
381 381
382 } // namespace blink 382 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698