| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void applyClipRects(const ClipRectsContext& context, | 73 static void applyClipRects(const ClipRectsContext& context, |
| 74 const LayoutBoxModelObject& layoutObject, | 74 const LayoutBoxModelObject& layoutObject, |
| 75 LayoutPoint offset, | 75 LayoutPoint offset, |
| 76 ClipRects& clipRects) { | 76 ClipRects& clipRects) { |
| 77 DCHECK(layoutObject.hasClipRelatedProperty() || | 77 DCHECK(layoutObject.isBox()); |
| 78 (layoutObject.isSVGRoot() && | 78 const LayoutBox& box = *toLayoutBox(&layoutObject); |
| 79 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())); | 79 |
| 80 LayoutView* view = layoutObject.view(); | 80 DCHECK(box.hasClipRelatedProperty() || box.hasControlClip() || |
| 81 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip())); |
| 82 LayoutView* view = box.view(); |
| 81 DCHECK(view); | 83 DCHECK(view); |
| 82 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) | 84 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) |
| 83 offset -= LayoutSize(view->frameView()->getScrollOffset()); | 85 offset -= LayoutSize(view->frameView()->getScrollOffset()); |
| 84 if (layoutObject.hasOverflowClip() || | 86 |
| 85 (layoutObject.isSVGRoot() && | 87 if (box.hasOverflowClip() || |
| 86 toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) || | 88 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip()) || |
| 87 (layoutObject.styleRef().containsPaint() && layoutObject.isBox())) { | 89 box.styleRef().containsPaint() || box.hasControlClip()) { |
| 88 ClipRect newOverflowClip = | 90 ClipRect newOverflowClip = |
| 89 toLayoutBox(layoutObject) | 91 box.overflowClipRect(offset, context.overlayScrollbarClipBehavior); |
| 90 .overflowClipRect(offset, context.overlayScrollbarClipBehavior); | 92 newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius()); |
| 91 newOverflowClip.setHasRadius(layoutObject.styleRef().hasBorderRadius()); | |
| 92 clipRects.setOverflowClipRect( | 93 clipRects.setOverflowClipRect( |
| 93 intersection(newOverflowClip, clipRects.overflowClipRect())); | 94 intersection(newOverflowClip, clipRects.overflowClipRect())); |
| 94 if (layoutObject.isPositioned()) | 95 if (box.isPositioned()) |
| 95 clipRects.setPosClipRect( | 96 clipRects.setPosClipRect( |
| 96 intersection(newOverflowClip, clipRects.posClipRect())); | 97 intersection(newOverflowClip, clipRects.posClipRect())); |
| 97 if (layoutObject.isLayoutView() || | 98 if (box.isLayoutView() || box.hasTransformRelatedProperty()) |
| 98 layoutObject.hasTransformRelatedProperty()) | |
| 99 clipRects.setFixedClipRect( | 99 clipRects.setFixedClipRect( |
| 100 intersection(newOverflowClip, clipRects.fixedClipRect())); | 100 intersection(newOverflowClip, clipRects.fixedClipRect())); |
| 101 if (layoutObject.styleRef().containsPaint()) { | 101 if (box.styleRef().containsPaint()) { |
| 102 clipRects.setPosClipRect( | 102 clipRects.setPosClipRect( |
| 103 intersection(newOverflowClip, clipRects.posClipRect())); | 103 intersection(newOverflowClip, clipRects.posClipRect())); |
| 104 clipRects.setFixedClipRect( | 104 clipRects.setFixedClipRect( |
| 105 intersection(newOverflowClip, clipRects.fixedClipRect())); | 105 intersection(newOverflowClip, clipRects.fixedClipRect())); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 if (layoutObject.hasClip()) { | 108 if (box.hasClip()) { |
| 109 LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); | 109 LayoutRect newClip = box.clipRect(offset); |
| 110 clipRects.setPosClipRect( | 110 clipRects.setPosClipRect( |
| 111 intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); | 111 intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss()); |
| 112 clipRects.setOverflowClipRect( | 112 clipRects.setOverflowClipRect( |
| 113 intersection(newClip, clipRects.overflowClipRect()) | 113 intersection(newClip, clipRects.overflowClipRect()) |
| 114 .setIsClippedByClipCss()); | 114 .setIsClippedByClipCss()); |
| 115 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) | 115 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()) |
| 116 .setIsClippedByClipCss()); | 116 .setIsClippedByClipCss()); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, | 537 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, |
| 538 ClipRects& clipRects) const { | 538 ClipRects& clipRects) const { |
| 539 if (context.usesCache()) | 539 if (context.usesCache()) |
| 540 clipRects = getClipRects(context); | 540 clipRects = getClipRects(context); |
| 541 else | 541 else |
| 542 calculateClipRects(context, clipRects); | 542 calculateClipRects(context, clipRects); |
| 543 } | 543 } |
| 544 | 544 |
| 545 bool PaintLayerClipper::shouldClipOverflow( | 545 bool PaintLayerClipper::shouldClipOverflow( |
| 546 const ClipRectsContext& context) const { | 546 const ClipRectsContext& context) const { |
| 547 LayoutObject* layoutObject = m_layer.layoutObject(); | 547 if (!m_layer.layoutObject()->isBox()) |
| 548 return (layoutObject->hasOverflowClip() || | 548 return false; |
| 549 layoutObject->styleRef().containsPaint() || | 549 const LayoutBox& box = *toLayoutBox(m_layer.layoutObject()); |
| 550 (layoutObject->isSVGRoot() && | 550 |
| 551 toLayoutSVGRoot(layoutObject)->shouldApplyViewportClip())) && | 551 if (!shouldRespectOverflowClip(context)) |
| 552 shouldRespectOverflowClip(context); | 552 return false; |
| 553 |
| 554 return box.hasOverflowClip() || box.styleRef().containsPaint() || |
| 555 box.hasControlClip() || |
| 556 (box.isSVGRoot() && toLayoutSVGRoot(&box)->shouldApplyViewportClip()); |
| 553 } | 557 } |
| 554 | 558 |
| 555 bool PaintLayerClipper::shouldRespectOverflowClip( | 559 bool PaintLayerClipper::shouldRespectOverflowClip( |
| 556 const ClipRectsContext& context) const { | 560 const ClipRectsContext& context) const { |
| 557 if (&m_layer != context.rootLayer) | 561 if (&m_layer != context.rootLayer) |
| 558 return true; | 562 return true; |
| 559 | 563 |
| 560 if (context.respectOverflowClip == IgnoreOverflowClip) | 564 if (context.respectOverflowClip == IgnoreOverflowClip) |
| 561 return false; | 565 return false; |
| 562 | 566 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 573 const LayoutSize& subpixelAccumulation) const { | 577 const LayoutSize& subpixelAccumulation) const { |
| 574 DCHECK(!m_geometryMapper); | 578 DCHECK(!m_geometryMapper); |
| 575 ClipRectsContext context(rootLayer, PaintingClipRects, | 579 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 576 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 580 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 577 if (respectOverflowClip == IgnoreOverflowClip) | 581 if (respectOverflowClip == IgnoreOverflowClip) |
| 578 context.setIgnoreOverflowClip(); | 582 context.setIgnoreOverflowClip(); |
| 579 return getClipRects(context); | 583 return getClipRects(context); |
| 580 } | 584 } |
| 581 | 585 |
| 582 } // namespace blink | 586 } // namespace blink |
| OLD | NEW |