Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 clipRects.setPosClipRect(clipRects.fixedClipRect()); | 63 clipRects.setPosClipRect(clipRects.fixedClipRect()); |
| 64 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); | 64 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); |
| 65 clipRects.setFixed(true); | 65 clipRects.setFixed(true); |
| 66 } else if (position == RelativePosition) { | 66 } else if (position == RelativePosition) { |
| 67 clipRects.setPosClipRect(clipRects.overflowClipRect()); | 67 clipRects.setPosClipRect(clipRects.overflowClipRect()); |
| 68 } else if (position == AbsolutePosition) { | 68 } else if (position == AbsolutePosition) { |
| 69 clipRects.setOverflowClipRect(clipRects.posClipRect()); | 69 clipRects.setOverflowClipRect(clipRects.posClipRect()); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 static LayoutRect overflowOrControlClip(const LayoutBox& box, | |
| 74 const LayoutPoint& location, | |
| 75 OverlayScrollbarClipBehavior behavior) { | |
| 76 if (box.hasControlClip()) | |
| 77 return box.controlClipRect(location); | |
| 78 return box.overflowClipRect(location, behavior); | |
| 79 } | |
| 80 | |
| 73 static void applyClipRects(const ClipRectsContext& context, | 81 static void applyClipRects(const ClipRectsContext& context, |
| 74 const LayoutBoxModelObject& layoutObject, | 82 const LayoutBoxModelObject& layoutObject, |
| 75 LayoutPoint offset, | 83 LayoutPoint offset, |
| 76 ClipRects& clipRects) { | 84 ClipRects& clipRects) { |
| 77 DCHECK(layoutObject.isBox()); | 85 DCHECK(layoutObject.isBox()); |
| 78 const LayoutBox& box = *toLayoutBox(&layoutObject); | 86 const LayoutBox& box = *toLayoutBox(&layoutObject); |
| 79 | 87 |
| 80 DCHECK(box.hasClipRelatedProperty() || box.hasControlClip() || | 88 DCHECK(box.hasClipRelatedProperty() || box.hasControlClip() || |
| 81 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip())); | 89 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip())); |
| 82 LayoutView* view = box.view(); | 90 LayoutView* view = box.view(); |
| 83 DCHECK(view); | 91 DCHECK(view); |
| 84 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) | 92 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) |
| 85 offset -= LayoutSize(view->frameView()->getScrollOffset()); | 93 offset -= LayoutSize(view->frameView()->getScrollOffset()); |
| 86 | 94 |
| 87 if (box.hasOverflowClip() || | 95 if (box.hasOverflowClip() || |
| 88 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip()) || | 96 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip()) || |
| 89 box.styleRef().containsPaint() || box.hasControlClip()) { | 97 box.styleRef().containsPaint() || box.hasControlClip()) { |
| 90 ClipRect newOverflowClip = | 98 ClipRect newOverflowClip = overflowOrControlClip( |
|
pdr.
2017/01/20 19:17:36
Can you make the same change in PaintPropertyTreeB
chrishtr
2017/01/20 22:51:10
Added a TODO. Will do this in another CL because t
| |
| 91 box.overflowClipRect(offset, context.overlayScrollbarClipBehavior); | 99 box, offset, context.overlayScrollbarClipBehavior); |
| 92 newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius()); | 100 newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius()); |
| 93 clipRects.setOverflowClipRect( | 101 clipRects.setOverflowClipRect( |
| 94 intersection(newOverflowClip, clipRects.overflowClipRect())); | 102 intersection(newOverflowClip, clipRects.overflowClipRect())); |
| 95 if (box.isPositioned()) | 103 if (box.isPositioned()) |
| 96 clipRects.setPosClipRect( | 104 clipRects.setPosClipRect( |
| 97 intersection(newOverflowClip, clipRects.posClipRect())); | 105 intersection(newOverflowClip, clipRects.posClipRect())); |
| 98 if (box.isLayoutView() || box.hasTransformRelatedProperty()) | 106 if (box.isLayoutView() || box.hasTransformRelatedProperty()) |
| 99 clipRects.setFixedClipRect( | 107 clipRects.setFixedClipRect( |
| 100 intersection(newOverflowClip, clipRects.fixedClipRect())); | 108 intersection(newOverflowClip, clipRects.fixedClipRect())); |
| 101 if (box.styleRef().containsPaint()) { | 109 if (box.styleRef().containsPaint()) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 | 353 |
| 346 LayoutPoint offset; | 354 LayoutPoint offset; |
| 347 if (offsetFromRoot) | 355 if (offsetFromRoot) |
| 348 offset = *offsetFromRoot; | 356 offset = *offsetFromRoot; |
| 349 else | 357 else |
| 350 m_layer.convertToLayerCoords(context.rootLayer, offset); | 358 m_layer.convertToLayerCoords(context.rootLayer, offset); |
| 351 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); | 359 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); |
| 352 | 360 |
| 353 // Update the clip rects that will be passed to child layers. | 361 // Update the clip rects that will be passed to child layers. |
| 354 if (shouldClipOverflow(context)) { | 362 if (shouldClipOverflow(context)) { |
| 355 foregroundRect.intersect( | 363 LayoutRect overflowOrControlClipRect = |
| 356 toLayoutBox(layoutObject) | 364 overflowOrControlClip(toLayoutBox(layoutObject), offset, |
| 357 .overflowClipRect(offset, context.overlayScrollbarClipBehavior)); | 365 context.overlayScrollbarClipBehavior); |
| 366 foregroundRect.intersect(overflowOrControlClipRect); | |
| 358 if (layoutObject.styleRef().hasBorderRadius()) | 367 if (layoutObject.styleRef().hasBorderRadius()) |
| 359 foregroundRect.setHasRadius(true); | 368 foregroundRect.setHasRadius(true); |
| 360 | 369 |
| 361 // FIXME: Does not do the right thing with columns yet, since we don't yet | 370 // FIXME: Does not do the right thing with columns yet, since we don't yet |
| 362 // factor in the individual column boxes as overflow. | 371 // factor in the individual column boxes as overflow. |
| 363 | 372 |
| 364 // The LayoutView is special since its overflow clipping rect may be larger | 373 // The LayoutView is special since its overflow clipping rect may be larger |
| 365 // than its box rect (crbug.com/492871). | 374 // than its box rect (crbug.com/492871). |
| 366 LayoutRect layerBoundsWithVisualOverflow = | 375 LayoutRect layerBoundsWithVisualOverflow = |
| 367 layoutObject.isLayoutView() | 376 layoutObject.isLayoutView() |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 const LayoutSize& subpixelAccumulation) const { | 586 const LayoutSize& subpixelAccumulation) const { |
| 578 DCHECK(!m_geometryMapper); | 587 DCHECK(!m_geometryMapper); |
| 579 ClipRectsContext context(rootLayer, PaintingClipRects, | 588 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 580 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 589 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 581 if (respectOverflowClip == IgnoreOverflowClip) | 590 if (respectOverflowClip == IgnoreOverflowClip) |
| 582 context.setIgnoreOverflowClip(); | 591 context.setIgnoreOverflowClip(); |
| 583 return getClipRects(context); | 592 return getClipRects(context); |
| 584 } | 593 } |
| 585 | 594 |
| 586 } // namespace blink | 595 } // namespace blink |
| OLD | NEW |