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

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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // Ensure that our parent's clip has been calculated so that we can examine 398 // Ensure that our parent's clip has been calculated so that we can examine
399 // the values. 399 // the values.
400 if (parentLayer) { 400 if (parentLayer) {
401 parentLayer->clipper().getOrCalculateClipRects(context, clipRects); 401 parentLayer->clipper().getOrCalculateClipRects(context, clipRects);
402 } else { 402 } else {
403 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 403 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
404 } 404 }
405 405
406 adjustClipRectsForChildren(layoutObject, clipRects); 406 adjustClipRectsForChildren(layoutObject, clipRects);
407 407
408 if (shouldClipOverflow(context) || layoutObject.hasClip() || 408 if (shouldClipOverflow(context) || layoutObject.hasClip()) {
409 (layoutObject.isSVGRoot() &&
410 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())) {
411 // This offset cannot use convertToLayerCoords, because sometimes our 409 // This offset cannot use convertToLayerCoords, because sometimes our
412 // rootLayer may be across some transformed layer boundary, for example, in 410 // rootLayer may be across some transformed layer boundary, for example, in
413 // the PaintLayerCompositor overlapMap, where clipRects are needed in view 411 // the PaintLayerCompositor overlapMap, where clipRects are needed in view
414 // space. 412 // space.
415 applyClipRects(context, layoutObject, 413 applyClipRects(context, layoutObject,
416 LayoutPoint(layoutObject.localToAncestorPoint( 414 LayoutPoint(layoutObject.localToAncestorPoint(
417 FloatPoint(), context.rootLayer->layoutObject())), 415 FloatPoint(), context.rootLayer->layoutObject())),
418 clipRects); 416 clipRects);
419 } 417 }
420 } 418 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 515 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
518 ClipRects& clipRects) const { 516 ClipRects& clipRects) const {
519 if (context.usesCache()) 517 if (context.usesCache())
520 clipRects = getClipRects(context); 518 clipRects = getClipRects(context);
521 else 519 else
522 calculateClipRects(context, clipRects); 520 calculateClipRects(context, clipRects);
523 } 521 }
524 522
525 bool PaintLayerClipper::shouldClipOverflow( 523 bool PaintLayerClipper::shouldClipOverflow(
526 const ClipRectsContext& context) const { 524 const ClipRectsContext& context) const {
527 return (m_layer.layoutObject()->hasOverflowClip() || 525 LayoutObject* layoutObject = m_layer.layoutObject();
528 m_layer.layoutObject()->styleRef().containsPaint()) && 526 return (layoutObject->hasOverflowClip() ||
527 layoutObject->styleRef().containsPaint() ||
528 (layoutObject->isSVGRoot() &&
529 toLayoutSVGRoot(layoutObject)->shouldApplyViewportClip())) &&
529 shouldRespectOverflowClip(context); 530 shouldRespectOverflowClip(context);
530 } 531 }
531 532
532 bool PaintLayerClipper::shouldRespectOverflowClip( 533 bool PaintLayerClipper::shouldRespectOverflowClip(
533 const ClipRectsContext& context) const { 534 const ClipRectsContext& context) const {
534 if (&m_layer != context.rootLayer) 535 if (&m_layer != context.rootLayer)
535 return true; 536 return true;
536 537
537 if (context.respectOverflowClip == IgnoreOverflowClip) 538 if (context.respectOverflowClip == IgnoreOverflowClip)
538 return false; 539 return false;
(...skipping 11 matching lines...) Expand all
550 const LayoutSize& subpixelAccumulation) const { 551 const LayoutSize& subpixelAccumulation) const {
551 DCHECK(!m_geometryMapper); 552 DCHECK(!m_geometryMapper);
552 ClipRectsContext context(rootLayer, PaintingClipRects, 553 ClipRectsContext context(rootLayer, PaintingClipRects,
553 IgnoreOverlayScrollbarSize, subpixelAccumulation); 554 IgnoreOverlayScrollbarSize, subpixelAccumulation);
554 if (respectOverflowClip == IgnoreOverflowClip) 555 if (respectOverflowClip == IgnoreOverflowClip)
555 context.setIgnoreOverflowClip(); 556 context.setIgnoreOverflowClip();
556 return getClipRects(context); 557 return getClipRects(context);
557 } 558 }
558 559
559 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698