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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md 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 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 static void applyClipRects(const ClipRectsContext& context, 72 static void applyClipRects(const ClipRectsContext& context,
73 const LayoutBoxModelObject& layoutObject, 73 const LayoutBoxModelObject& layoutObject,
74 LayoutPoint offset, 74 LayoutPoint offset,
75 ClipRects& clipRects) { 75 ClipRects& clipRects) {
76 DCHECK(layoutObject.hasClipRelatedProperty() || 76 DCHECK(layoutObject.hasClipRelatedProperty() ||
77 (layoutObject.isSVGRoot() && 77 (layoutObject.isSVGRoot() &&
78 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())); 78 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()));
79 LayoutView* view = layoutObject.view(); 79 LayoutView* view = layoutObject.view();
80 DCHECK(view); 80 DCHECK(view);
81 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) 81 if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
82 offset -= toIntSize(view->frameView()->scrollPosition()); 82 offset -= LayoutSize(view->frameView()->scrollOffset());
83 if (layoutObject.hasOverflowClip() || 83 if (layoutObject.hasOverflowClip() ||
84 (layoutObject.isSVGRoot() && 84 (layoutObject.isSVGRoot() &&
85 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) || 85 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) ||
86 (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) { 86 (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) {
87 ClipRect newOverflowClip = 87 ClipRect newOverflowClip =
88 toLayoutBox(layoutObject) 88 toLayoutBox(layoutObject)
89 .overflowClipRect(offset, context.overlayScrollbarClipBehavior); 89 .overflowClipRect(offset, context.overlayScrollbarClipBehavior);
90 newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius()); 90 newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius());
91 clipRects.setOverflowClipRect( 91 clipRects.setOverflowClipRect(
92 intersection(newOverflowClip, clipRects.overflowClipRect())); 92 intersection(newOverflowClip, clipRects.overflowClipRect()));
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 *parentClipRects); 341 *parentClipRects);
342 342
343 ClipRect result = backgroundClipRectForPosition( 343 ClipRect result = backgroundClipRectForPosition(
344 *parentClipRects, m_layer.layoutObject()->styleRef().position()); 344 *parentClipRects, m_layer.layoutObject()->styleRef().position());
345 345
346 // Note: infinite clipRects should not be scrolled here, otherwise they will 346 // Note: infinite clipRects should not be scrolled here, otherwise they will
347 // accidentally no longer be considered infinite. 347 // accidentally no longer be considered infinite.
348 if (parentClipRects->fixed() && 348 if (parentClipRects->fixed() &&
349 context.rootLayer->layoutObject() == layoutView && 349 context.rootLayer->layoutObject() == layoutView &&
350 result != LayoutRect(LayoutRect::infiniteIntRect())) 350 result != LayoutRect(LayoutRect::infiniteIntRect()))
351 result.move(toIntSize(layoutView->frameView()->scrollPosition())); 351 result.move(LayoutSize(layoutView->frameView()->scrollOffset()));
352 352
353 return result; 353 return result;
354 } 354 }
355 355
356 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 356 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
357 ClipRects& clipRects) const { 357 ClipRects& clipRects) const {
358 if (context.usesCache()) 358 if (context.usesCache())
359 clipRects = getClipRects(context); 359 clipRects = getClipRects(context);
360 else 360 else
361 calculateClipRects(context, clipRects); 361 calculateClipRects(context, clipRects);
(...skipping 19 matching lines...) Expand all
381 ShouldRespectOverflowClipType respectOverflowClip, 381 ShouldRespectOverflowClipType respectOverflowClip,
382 const LayoutSize& subpixelAccumulation) const { 382 const LayoutSize& subpixelAccumulation) const {
383 ClipRectsContext context(rootLayer, PaintingClipRects, 383 ClipRectsContext context(rootLayer, PaintingClipRects,
384 IgnoreOverlayScrollbarSize, subpixelAccumulation); 384 IgnoreOverlayScrollbarSize, subpixelAccumulation);
385 if (respectOverflowClip == IgnoreOverflowClip) 385 if (respectOverflowClip == IgnoreOverflowClip)
386 context.setIgnoreOverflowClip(); 386 context.setIgnoreOverflowClip();
387 return getClipRects(context); 387 return getClipRects(context);
388 } 388 }
389 389
390 } // namespace blink 390 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FramePainter.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698