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

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

Issue 2624383002: Apply SVG viewport clips in PaintLayer; paint background of replaced like boxes. (Closed)
Patch Set: none Created 3 years, 11 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // Ensure that our parent's clip has been calculated so that we can examine 405 // Ensure that our parent's clip has been calculated so that we can examine
406 // the values. 406 // the values.
407 if (parentLayer) { 407 if (parentLayer) {
408 parentLayer->clipper().getOrCalculateClipRects(context, clipRects); 408 parentLayer->clipper().getOrCalculateClipRects(context, clipRects);
409 } else { 409 } else {
410 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 410 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
411 } 411 }
412 412
413 adjustClipRectsForChildren(layoutObject, clipRects); 413 adjustClipRectsForChildren(layoutObject, clipRects);
414 414
415 if (shouldClipOverflow(context) || layoutObject.hasClip() || 415 if (shouldClipOverflow(context) || layoutObject.hasClip()) {
416 (layoutObject.isSVGRoot() &&
417 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())) {
418 // This offset cannot use convertToLayerCoords, because sometimes our 416 // This offset cannot use convertToLayerCoords, because sometimes our
419 // rootLayer may be across some transformed layer boundary, for example, in 417 // rootLayer may be across some transformed layer boundary, for example, in
420 // the PaintLayerCompositor overlapMap, where clipRects are needed in view 418 // the PaintLayerCompositor overlapMap, where clipRects are needed in view
421 // space. 419 // space.
422 applyClipRects(context, layoutObject, 420 applyClipRects(context, layoutObject,
423 LayoutPoint(layoutObject.localToAncestorPoint( 421 LayoutPoint(layoutObject.localToAncestorPoint(
424 FloatPoint(), context.rootLayer->layoutObject())), 422 FloatPoint(), context.rootLayer->layoutObject())),
425 clipRects); 423 clipRects);
426 } 424 }
427 } 425 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 537 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
540 ClipRects& clipRects) const { 538 ClipRects& clipRects) const {
541 if (context.usesCache()) 539 if (context.usesCache())
542 clipRects = getClipRects(context); 540 clipRects = getClipRects(context);
543 else 541 else
544 calculateClipRects(context, clipRects); 542 calculateClipRects(context, clipRects);
545 } 543 }
546 544
547 bool PaintLayerClipper::shouldClipOverflow( 545 bool PaintLayerClipper::shouldClipOverflow(
548 const ClipRectsContext& context) const { 546 const ClipRectsContext& context) const {
549 return (m_layer.layoutObject()->hasOverflowClip() || 547 LayoutObject* layoutObject = m_layer.layoutObject();
550 m_layer.layoutObject()->styleRef().containsPaint()) && 548 return (layoutObject->hasOverflowClip() ||
549 layoutObject->styleRef().containsPaint() ||
550 (layoutObject->isSVGRoot() &&
551 toLayoutSVGRoot(layoutObject)->shouldApplyViewportClip())) &&
551 shouldRespectOverflowClip(context); 552 shouldRespectOverflowClip(context);
552 } 553 }
553 554
554 bool PaintLayerClipper::shouldRespectOverflowClip( 555 bool PaintLayerClipper::shouldRespectOverflowClip(
555 const ClipRectsContext& context) const { 556 const ClipRectsContext& context) const {
556 if (&m_layer != context.rootLayer) 557 if (&m_layer != context.rootLayer)
557 return true; 558 return true;
558 559
559 if (context.respectOverflowClip == IgnoreOverflowClip) 560 if (context.respectOverflowClip == IgnoreOverflowClip)
560 return false; 561 return false;
(...skipping 11 matching lines...) Expand all
572 const LayoutSize& subpixelAccumulation) const { 573 const LayoutSize& subpixelAccumulation) const {
573 DCHECK(!m_geometryMapper); 574 DCHECK(!m_geometryMapper);
574 ClipRectsContext context(rootLayer, PaintingClipRects, 575 ClipRectsContext context(rootLayer, PaintingClipRects,
575 IgnoreOverlayScrollbarSize, subpixelAccumulation); 576 IgnoreOverlayScrollbarSize, subpixelAccumulation);
576 if (respectOverflowClip == IgnoreOverflowClip) 577 if (respectOverflowClip == IgnoreOverflowClip)
577 context.setIgnoreOverflowClip(); 578 context.setIgnoreOverflowClip();
578 return getClipRects(context); 579 return getClipRects(context);
579 } 580 }
580 581
581 } // namespace blink 582 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BoxClipper.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerClipperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698