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

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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // Ensure that our parent's clip has been calculated so that we can examine 403 // Ensure that our parent's clip has been calculated so that we can examine
404 // the values. 404 // the values.
405 if (parentLayer) { 405 if (parentLayer) {
406 parentLayer->clipper().getOrCalculateClipRects(context, clipRects); 406 parentLayer->clipper().getOrCalculateClipRects(context, clipRects);
407 } else { 407 } else {
408 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 408 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
409 } 409 }
410 410
411 adjustClipRectsForChildren(layoutObject, clipRects); 411 adjustClipRectsForChildren(layoutObject, clipRects);
412 412
413 if (shouldClipOverflow(context) || layoutObject.hasClip() || 413 if (shouldClipOverflow(context) || layoutObject.hasClip()) {
414 (layoutObject.isSVGRoot() &&
415 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())) {
416 // This offset cannot use convertToLayerCoords, because sometimes our 414 // This offset cannot use convertToLayerCoords, because sometimes our
417 // rootLayer may be across some transformed layer boundary, for example, in 415 // rootLayer may be across some transformed layer boundary, for example, in
418 // the PaintLayerCompositor overlapMap, where clipRects are needed in view 416 // the PaintLayerCompositor overlapMap, where clipRects are needed in view
419 // space. 417 // space.
420 applyClipRects(context, layoutObject, 418 applyClipRects(context, layoutObject,
421 LayoutPoint(layoutObject.localToAncestorPoint( 419 LayoutPoint(layoutObject.localToAncestorPoint(
422 FloatPoint(), context.rootLayer->layoutObject())), 420 FloatPoint(), context.rootLayer->layoutObject())),
423 clipRects); 421 clipRects);
424 } 422 }
425 } 423 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 523 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
526 ClipRects& clipRects) const { 524 ClipRects& clipRects) const {
527 if (context.usesCache()) 525 if (context.usesCache())
528 clipRects = getClipRects(context); 526 clipRects = getClipRects(context);
529 else 527 else
530 calculateClipRects(context, clipRects); 528 calculateClipRects(context, clipRects);
531 } 529 }
532 530
533 bool PaintLayerClipper::shouldClipOverflow( 531 bool PaintLayerClipper::shouldClipOverflow(
534 const ClipRectsContext& context) const { 532 const ClipRectsContext& context) const {
535 return (m_layer.layoutObject()->hasOverflowClip() || 533 LayoutObject* layoutObject = m_layer.layoutObject();
536 m_layer.layoutObject()->styleRef().containsPaint()) && 534 return (layoutObject->hasOverflowClip() ||
535 layoutObject->styleRef().containsPaint() ||
536 (layoutObject->isSVGRoot() &&
537 toLayoutSVGRoot(layoutObject)->shouldApplyViewportClip())) &&
537 shouldRespectOverflowClip(context); 538 shouldRespectOverflowClip(context);
538 } 539 }
539 540
540 bool PaintLayerClipper::shouldRespectOverflowClip( 541 bool PaintLayerClipper::shouldRespectOverflowClip(
541 const ClipRectsContext& context) const { 542 const ClipRectsContext& context) const {
542 if (&m_layer != context.rootLayer) 543 if (&m_layer != context.rootLayer)
543 return true; 544 return true;
544 545
545 if (context.respectOverflowClip == IgnoreOverflowClip) 546 if (context.respectOverflowClip == IgnoreOverflowClip)
546 return false; 547 return false;
(...skipping 11 matching lines...) Expand all
558 const LayoutSize& subpixelAccumulation) const { 559 const LayoutSize& subpixelAccumulation) const {
559 DCHECK(!m_geometryMapper); 560 DCHECK(!m_geometryMapper);
560 ClipRectsContext context(rootLayer, PaintingClipRects, 561 ClipRectsContext context(rootLayer, PaintingClipRects,
561 IgnoreOverlayScrollbarSize, subpixelAccumulation); 562 IgnoreOverlayScrollbarSize, subpixelAccumulation);
562 if (respectOverflowClip == IgnoreOverflowClip) 563 if (respectOverflowClip == IgnoreOverflowClip)
563 context.setIgnoreOverflowClip(); 564 context.setIgnoreOverflowClip();
564 return getClipRects(context); 565 return getClipRects(context);
565 } 566 }
566 567
567 } // namespace blink 568 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698