| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); | 168 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 LayoutRect DeprecatedPaintLayerClipper::childrenClipRect() const | 172 LayoutRect DeprecatedPaintLayerClipper::childrenClipRect() const |
| 173 { | 173 { |
| 174 // FIXME: border-radius not accounted for. | 174 // FIXME: border-radius not accounted for. |
| 175 // FIXME: Flow thread based columns not accounted for. | 175 // FIXME: Flow thread based columns not accounted for. |
| 176 DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting(); | 176 DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting(); |
| 177 LayoutRect layerBounds; | 177 LayoutRect layerBounds; |
| 178 ClipRect backgroundRect, foregroundRect, outlineRect; | 178 ClipRect backgroundRect, foregroundRect; |
| 179 // Need to use uncached clip rects, because the value of 'dontClipToOverflow
' may be different from the painting path (<rdar://problem/11844909>). | 179 // Need to use uncached clip rects, because the value of 'dontClipToOverflow
' may be different from the painting path (<rdar://problem/11844909>). |
| 180 ClipRectsContext context(clippingRootLayer, UncachedClipRects); | 180 ClipRectsContext context(clippingRootLayer, UncachedClipRects); |
| 181 calculateRects(context, LayoutRect(m_layoutObject.view()->unscaledDocumentRe
ct()), layerBounds, backgroundRect, foregroundRect, outlineRect); | 181 calculateRects(context, LayoutRect(m_layoutObject.view()->unscaledDocumentRe
ct()), layerBounds, backgroundRect, foregroundRect); |
| 182 return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(Flo
atQuad(FloatRect(foregroundRect.rect()))).enclosingBoundingBox()); | 182 return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(Flo
atQuad(FloatRect(foregroundRect.rect()))).enclosingBoundingBox()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 LayoutRect DeprecatedPaintLayerClipper::localClipRect() const | 185 LayoutRect DeprecatedPaintLayerClipper::localClipRect() const |
| 186 { | 186 { |
| 187 // FIXME: border-radius not accounted for. | 187 // FIXME: border-radius not accounted for. |
| 188 DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting(); | 188 DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting(); |
| 189 LayoutRect layerBounds; | 189 LayoutRect layerBounds; |
| 190 ClipRect backgroundRect, foregroundRect, outlineRect; | 190 ClipRect backgroundRect, foregroundRect; |
| 191 ClipRectsContext context(clippingRootLayer, PaintingClipRects); | 191 ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
| 192 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun
ds, backgroundRect, foregroundRect, outlineRect); | 192 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBoun
ds, backgroundRect, foregroundRect); |
| 193 | 193 |
| 194 LayoutRect clipRect = backgroundRect.rect(); | 194 LayoutRect clipRect = backgroundRect.rect(); |
| 195 // TODO(chrishtr): avoid converting to IntRect and back. | 195 // TODO(chrishtr): avoid converting to IntRect and back. |
| 196 if (clipRect == LayoutRect(LayoutRect::infiniteIntRect())) | 196 if (clipRect == LayoutRect(LayoutRect::infiniteIntRect())) |
| 197 return clipRect; | 197 return clipRect; |
| 198 | 198 |
| 199 LayoutPoint clippingRootOffset; | 199 LayoutPoint clippingRootOffset; |
| 200 m_layoutObject.layer()->convertToLayerCoords(clippingRootLayer, clippingRoot
Offset); | 200 m_layoutObject.layer()->convertToLayerCoords(clippingRootLayer, clippingRoot
Offset); |
| 201 clipRect.moveBy(-clippingRootOffset); | 201 clipRect.moveBy(-clippingRootOffset); |
| 202 | 202 |
| 203 return clipRect; | 203 return clipRect; |
| 204 } | 204 } |
| 205 | 205 |
| 206 void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context
, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, | 206 void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context
, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, |
| 207 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c
onst LayoutPoint* offsetFromRoot) const | 207 ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offse
tFromRoot) const |
| 208 { | 208 { |
| 209 bool isClippingRoot = m_layoutObject.layer() == context.rootLayer; | 209 bool isClippingRoot = m_layoutObject.layer() == context.rootLayer; |
| 210 | 210 |
| 211 if (!isClippingRoot && m_layoutObject.layer()->parent()) { | 211 if (!isClippingRoot && m_layoutObject.layer()->parent()) { |
| 212 backgroundRect = backgroundClipRect(context); | 212 backgroundRect = backgroundClipRect(context); |
| 213 backgroundRect.move(context.subPixelAccumulation); | 213 backgroundRect.move(context.subPixelAccumulation); |
| 214 backgroundRect.intersect(paintDirtyRect); | 214 backgroundRect.intersect(paintDirtyRect); |
| 215 } else { | 215 } else { |
| 216 backgroundRect = paintDirtyRect; | 216 backgroundRect = paintDirtyRect; |
| 217 } | 217 } |
| 218 | 218 |
| 219 foregroundRect = backgroundRect; | 219 foregroundRect = backgroundRect; |
| 220 outlineRect = backgroundRect; | |
| 221 | 220 |
| 222 LayoutPoint offset; | 221 LayoutPoint offset; |
| 223 if (offsetFromRoot) | 222 if (offsetFromRoot) |
| 224 offset = *offsetFromRoot; | 223 offset = *offsetFromRoot; |
| 225 else | 224 else |
| 226 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); | 225 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); |
| 227 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()))
; | 226 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()))
; |
| 228 | 227 |
| 229 // Update the clip rects that will be passed to child layers. | 228 // Update the clip rects that will be passed to child layers. |
| 230 if (m_layoutObject.hasOverflowClip()) { | 229 if (m_layoutObject.hasOverflowClip()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 258 } | 257 } |
| 259 | 258 |
| 260 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. | 259 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. |
| 261 if (m_layoutObject.hasClip()) { | 260 if (m_layoutObject.hasClip()) { |
| 262 // Clip applies to *us* as well, so go ahead and update the damageRect. | 261 // Clip applies to *us* as well, so go ahead and update the damageRect. |
| 263 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); | 262 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); |
| 264 backgroundRect.intersect(newPosClip); | 263 backgroundRect.intersect(newPosClip); |
| 265 backgroundRect.setIsClippedByClipCss(); | 264 backgroundRect.setIsClippedByClipCss(); |
| 266 foregroundRect.intersect(newPosClip); | 265 foregroundRect.intersect(newPosClip); |
| 267 foregroundRect.setIsClippedByClipCss(); | 266 foregroundRect.setIsClippedByClipCss(); |
| 268 outlineRect.intersect(newPosClip); | |
| 269 outlineRect.setIsClippedByClipCss(); | |
| 270 } | 267 } |
| 271 } | 268 } |
| 272 | 269 |
| 273 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con
text, ClipRects& clipRects) const | 270 void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& con
text, ClipRects& clipRects) const |
| 274 { | 271 { |
| 275 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje
ct.document().settings()->rootLayerScrolls(); | 272 bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObje
ct.document().settings()->rootLayerScrolls(); |
| 276 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { | 273 if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) { |
| 277 // The root layer's clip rect is always infinite. | 274 // The root layer's clip rect is always infinite. |
| 278 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 275 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
| 279 return; | 276 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 if (context.respectOverflowClip == IgnoreOverflowClip) | 375 if (context.respectOverflowClip == IgnoreOverflowClip) |
| 379 return false; | 376 return false; |
| 380 | 377 |
| 381 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore
OverflowClip) | 378 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore
OverflowClip) |
| 382 return false; | 379 return false; |
| 383 | 380 |
| 384 return true; | 381 return true; |
| 385 } | 382 } |
| 386 | 383 |
| 387 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |