Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 clipRects.setFixed(true); | 62 clipRects.setFixed(true); |
| 63 } else if (position == RelativePosition) { | 63 } else if (position == RelativePosition) { |
| 64 clipRects.setPosClipRect(clipRects.overflowClipRect()); | 64 clipRects.setPosClipRect(clipRects.overflowClipRect()); |
| 65 } else if (position == AbsolutePosition) { | 65 } else if (position == AbsolutePosition) { |
| 66 clipRects.setOverflowClipRect(clipRects.posClipRect()); | 66 clipRects.setOverflowClipRect(clipRects.posClipRect()); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects) | 70 static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects) |
| 71 { | 71 { |
| 72 ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip()); | 72 ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip() || layoutObj ect.style()->containsPaint()); |
|
chrishtr
2015/12/09 23:34:58
hasClipRelatedProperty()
| |
| 73 LayoutView* view = layoutObject.view(); | 73 LayoutView* view = layoutObject.view(); |
| 74 ASSERT(view); | 74 ASSERT(view); |
| 75 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) | 75 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) |
| 76 offset -= toIntSize(view->frameView()->scrollPosition()); | 76 offset -= toIntSize(view->frameView()->scrollPosition()); |
| 77 if (layoutObject.hasOverflowClip()) { | 77 if (layoutObject.hasOverflowClip() || layoutObject.style()->containsPaint()) { |
| 78 ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(of fset, context.scrollbarRelevancy); | 78 ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(of fset, context.scrollbarRelevancy); |
| 79 newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius()); | 79 newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius()); |
| 80 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect())); | 80 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect())); |
| 81 if (layoutObject.isPositioned()) | 81 if (layoutObject.isPositioned()) |
| 82 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); | 82 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); |
| 83 if (layoutObject.isLayoutView()) | 83 if (layoutObject.isLayoutView()) |
| 84 clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.f ixedClipRect())); | 84 clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.f ixedClipRect())); |
| 85 if (layoutObject.style()->containsPaint()) { | |
| 86 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); | |
| 87 clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.f ixedClipRect())); | |
| 88 } | |
| 85 } | 89 } |
| 86 if (layoutObject.hasClip()) { | 90 if (layoutObject.hasClip()) { |
| 87 LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); | 91 LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset); |
| 88 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()). setIsClippedByClipCss()); | 92 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()). setIsClippedByClipCss()); |
| 89 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect()).setIsClippedByClipCss()); | 93 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect()).setIsClippedByClipCss()); |
| 90 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ()).setIsClippedByClipCss()); | 94 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect ()).setIsClippedByClipCss()); |
| 91 | 95 |
| 92 } | 96 } |
| 93 } | 97 } |
| 94 | 98 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 foregroundRect = backgroundRect; | 210 foregroundRect = backgroundRect; |
| 207 | 211 |
| 208 LayoutPoint offset; | 212 LayoutPoint offset; |
| 209 if (offsetFromRoot) | 213 if (offsetFromRoot) |
| 210 offset = *offsetFromRoot; | 214 offset = *offsetFromRoot; |
| 211 else | 215 else |
| 212 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); | 216 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); |
| 213 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size())) ; | 217 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size())) ; |
| 214 | 218 |
| 215 // Update the clip rects that will be passed to child layers. | 219 // Update the clip rects that will be passed to child layers. |
| 216 if (m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) { | 220 if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.style()->containsPaint()) { |
| 217 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(of fset, context.scrollbarRelevancy)); | 221 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(of fset, context.scrollbarRelevancy)); |
| 218 if (m_layoutObject.style()->hasBorderRadius()) | 222 if (m_layoutObject.style()->hasBorderRadius()) |
| 219 foregroundRect.setHasRadius(true); | 223 foregroundRect.setHasRadius(true); |
| 220 | 224 |
| 221 // FIXME: Does not do the right thing with columns yet, since we don't y et factor in the | 225 // FIXME: Does not do the right thing with columns yet, since we don't y et factor in the |
| 222 // individual column boxes as overflow. | 226 // individual column boxes as overflow. |
| 223 | 227 |
| 224 // The LayoutView is special since its overflow clipping rect may be lar ger than its box rect (crbug.com/492871). | 228 // The LayoutView is special since its overflow clipping rect may be lar ger than its box rect (crbug.com/492871). |
| 225 LayoutRect layerBoundsWithVisualOverflow = m_layoutObject.isLayoutView() ? toLayoutView(m_layoutObject).viewRect() : toLayoutBox(m_layoutObject).visualO verflowRect(); | 229 LayoutRect layerBoundsWithVisualOverflow = m_layoutObject.isLayoutView() ? toLayoutView(m_layoutObject).viewRect() : toLayoutBox(m_layoutObject).visualO verflowRect(); |
| 226 toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisualOver flow); // PaintLayer are in physical coordinates, so the overflow has to be flip ped. | 230 toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisualOver flow); // PaintLayer are in physical coordinates, so the overflow has to be flip ped. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 clipRects = *parentLayer->clipper().cachedClipRects(context); | 264 clipRects = *parentLayer->clipper().cachedClipRects(context); |
| 261 } else { | 265 } else { |
| 262 parentLayer->clipper().calculateClipRects(context, clipRects); | 266 parentLayer->clipper().calculateClipRects(context, clipRects); |
| 263 } | 267 } |
| 264 } else { | 268 } else { |
| 265 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 269 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
| 266 } | 270 } |
| 267 | 271 |
| 268 adjustClipRectsForChildren(m_layoutObject, clipRects); | 272 adjustClipRectsForChildren(m_layoutObject, clipRects); |
| 269 | 273 |
| 270 if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) { | 274 if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip() || m_layoutObject.style()->containsPaint()) { |
| 271 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across | 275 // This offset cannot use convertToLayerCoords, because sometimes our ro otLayer may be across |
| 272 // some transformed layer boundary, for example, in the PaintLayerCompos itor overlapMap, where | 276 // some transformed layer boundary, for example, in the PaintLayerCompos itor overlapMap, where |
| 273 // clipRects are needed in view space. | 277 // clipRects are needed in view space. |
| 274 applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObjec t.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipR ects); | 278 applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObjec t.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipR ects); |
| 275 } | 279 } |
| 276 } | 280 } |
| 277 | 281 |
| 278 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos ition position) | 282 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos ition position) |
| 279 { | 283 { |
| 280 if (position == FixedPosition) | 284 if (position == FixedPosition) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 | 335 |
| 332 ClipRects* PaintLayerClipper::paintingClipRects(const PaintLayer* rootLayer, Sho uldRespectOverflowClip respectOverflowClip, const LayoutSize& subpixelAccumulati on) const | 336 ClipRects* PaintLayerClipper::paintingClipRects(const PaintLayer* rootLayer, Sho uldRespectOverflowClip respectOverflowClip, const LayoutSize& subpixelAccumulati on) const |
| 333 { | 337 { |
| 334 ClipRectsContext context(rootLayer, PaintingClipRects, IgnoreOverlayScrollba rSize, subpixelAccumulation); | 338 ClipRectsContext context(rootLayer, PaintingClipRects, IgnoreOverlayScrollba rSize, subpixelAccumulation); |
| 335 if (respectOverflowClip == IgnoreOverflowClip) | 339 if (respectOverflowClip == IgnoreOverflowClip) |
| 336 context.setIgnoreOverflowClip(); | 340 context.setIgnoreOverflowClip(); |
| 337 return getClipRects(context); | 341 return getClipRects(context); |
| 338 } | 342 } |
| 339 | 343 |
| 340 } // namespace blink | 344 } // namespace blink |
| OLD | NEW |