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 4984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4995 outlineRect = backgroundRect; | 4995 outlineRect = backgroundRect; |
4996 | 4996 |
4997 LayoutPoint offset; | 4997 LayoutPoint offset; |
4998 if (offsetFromRoot) | 4998 if (offsetFromRoot) |
4999 offset = *offsetFromRoot; | 4999 offset = *offsetFromRoot; |
5000 else | 5000 else |
5001 convertToLayerCoords(clipRectsContext.rootLayer, offset); | 5001 convertToLayerCoords(clipRectsContext.rootLayer, offset); |
5002 layerBounds = LayoutRect(offset, size()); | 5002 layerBounds = LayoutRect(offset, size()); |
5003 | 5003 |
5004 // Update the clip rects that will be passed to child layers. | 5004 // Update the clip rects that will be passed to child layers. |
5005 if (renderer()->hasClipOrOverflowClip()) { | 5005 if (renderer()->hasOverflowClip()) { |
5006 // This layer establishes a clip of some kind. | 5006 // This layer establishes a clip of some kind. |
5007 if (renderer()->hasOverflowClip() && (this != clipRectsContext.rootLayer
|| clipRectsContext.respectOverflowClip == RespectOverflowClip)) { | 5007 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverfl
owClip == RespectOverflowClip) { |
5008 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o
ffset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy))
; | 5008 foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(o
ffset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy))
; |
5009 if (renderer()->style()->hasBorderRadius()) | 5009 if (renderer()->style()->hasBorderRadius()) |
5010 foregroundRect.setHasRadius(true); | 5010 foregroundRect.setHasRadius(true); |
5011 } | 5011 } |
5012 | 5012 |
5013 if (renderer()->hasClip()) { | 5013 // If we establish an overflow clip at all, then go ahead and make sure
our background |
5014 // Clip applies to *us* as well, so go ahead and update the damageRe
ct. | |
5015 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, cl
ipRectsContext.region); | |
5016 backgroundRect.intersect(newPosClip); | |
5017 foregroundRect.intersect(newPosClip); | |
5018 outlineRect.intersect(newPosClip); | |
5019 } | |
5020 | |
5021 // If we establish a clip at all, then go ahead and make sure our backgr
ound | |
5022 // rect is intersected with our layer's bounds including our visual over
flow, | 5014 // rect is intersected with our layer's bounds including our visual over
flow, |
5023 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. | 5015 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. |
5024 if (renderBox()->hasVisualOverflow()) { | 5016 if (renderBox()->hasVisualOverflow()) { |
| 5017 // FIXME: Perhaps we should be propagating the borderbox as the clip
rect for children, even though |
| 5018 // we may need to inflate our clip specifically for shadows o
r outsets. |
5025 // FIXME: Does not do the right thing with CSS regions yet, since we
don't yet factor in the | 5019 // FIXME: Does not do the right thing with CSS regions yet, since we
don't yet factor in the |
5026 // individual region boxes as overflow. | 5020 // individual region boxes as overflow. |
5027 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl
owRect(); | 5021 LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverfl
owRect(); |
5028 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L
ayers are in physical coordinates, so the overflow has to be flipped. | 5022 renderBox()->flipForWritingMode(layerBoundsWithVisualOverflow); // L
ayers are in physical coordinates, so the overflow has to be flipped. |
5029 layerBoundsWithVisualOverflow.moveBy(offset); | 5023 layerBoundsWithVisualOverflow.moveBy(offset); |
5030 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv
erflowClip == RespectOverflowClip) | 5024 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv
erflowClip == RespectOverflowClip) |
5031 backgroundRect.intersect(layerBoundsWithVisualOverflow); | 5025 backgroundRect.intersect(layerBoundsWithVisualOverflow); |
5032 } else if (renderer()->hasOverflowClip()) { | 5026 } else { |
5033 // Shift the bounds to be for our region only. | 5027 // Shift the bounds to be for our region only. |
5034 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont
ext.region); | 5028 LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsCont
ext.region); |
5035 bounds.moveBy(offset); | 5029 bounds.moveBy(offset); |
5036 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv
erflowClip == RespectOverflowClip) | 5030 if (this != clipRectsContext.rootLayer || clipRectsContext.respectOv
erflowClip == RespectOverflowClip) |
5037 backgroundRect.intersect(bounds); | 5031 backgroundRect.intersect(bounds); |
5038 } | 5032 } |
5039 } | 5033 } |
| 5034 |
| 5035 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. |
| 5036 if (renderer()->hasClip()) { |
| 5037 // Clip applies to *us* as well, so go ahead and update the damageRect. |
| 5038 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRe
ctsContext.region); |
| 5039 backgroundRect.intersect(newPosClip); |
| 5040 foregroundRect.intersect(newPosClip); |
| 5041 outlineRect.intersect(newPosClip); |
| 5042 } |
5040 } | 5043 } |
5041 | 5044 |
5042 LayoutRect RenderLayer::childrenClipRect() const | 5045 LayoutRect RenderLayer::childrenClipRect() const |
5043 { | 5046 { |
5044 // FIXME: border-radius not accounted for. | 5047 // FIXME: border-radius not accounted for. |
5045 // FIXME: Regions not accounted for. | 5048 // FIXME: Regions not accounted for. |
5046 RenderView* renderView = renderer()->view(); | 5049 RenderView* renderView = renderer()->view(); |
5047 RenderLayer* clippingRootLayer = clippingRootForPainting(); | 5050 RenderLayer* clippingRootLayer = clippingRootForPainting(); |
5048 LayoutRect layerBounds; | 5051 LayoutRect layerBounds; |
5049 ClipRect backgroundRect, foregroundRect, outlineRect; | 5052 ClipRect backgroundRect, foregroundRect, outlineRect; |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 } | 6400 } |
6398 } | 6401 } |
6399 | 6402 |
6400 void showLayerTree(const WebCore::RenderObject* renderer) | 6403 void showLayerTree(const WebCore::RenderObject* renderer) |
6401 { | 6404 { |
6402 if (!renderer) | 6405 if (!renderer) |
6403 return; | 6406 return; |
6404 showLayerTree(renderer->enclosingLayer()); | 6407 showLayerTree(renderer->enclosingLayer()); |
6405 } | 6408 } |
6406 #endif | 6409 #endif |
OLD | NEW |