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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 LayoutPoint offset; | 210 LayoutPoint offset; |
211 if (offsetFromRoot) | 211 if (offsetFromRoot) |
212 offset = *offsetFromRoot; | 212 offset = *offsetFromRoot; |
213 else | 213 else |
214 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); | 214 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); |
215 layerBounds = LayoutRect(offset, m_renderer.layer()->size()); | 215 layerBounds = LayoutRect(offset, m_renderer.layer()->size()); |
216 | 216 |
217 // Update the clip rects that will be passed to child layers. | 217 // Update the clip rects that will be passed to child layers. |
218 if (m_renderer.hasOverflowClip()) { | 218 if (m_renderer.hasOverflowClip()) { |
219 // This layer establishes a clip of some kind. | 219 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(offset
)); |
220 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli
p) { | 220 if (m_renderer.style()->hasBorderRadius()) |
221 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(of
fset)); | 221 foregroundRect.setHasRadius(true); |
222 if (m_renderer.style()->hasBorderRadius()) | |
223 foregroundRect.setHasRadius(true); | |
224 } | |
225 | 222 |
226 // If we establish an overflow clip at all, then go ahead and make sure
our background | 223 // If we establish an overflow clip at all, then go ahead and make sure
our background |
227 // rect is intersected with our layer's bounds including our visual over
flow, | 224 // rect is intersected with our layer's bounds including our visual over
flow, |
228 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. | 225 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. |
229 if (toRenderBox(m_renderer).hasVisualOverflow()) { | 226 if (toRenderBox(m_renderer).hasVisualOverflow()) { |
230 // FIXME: Perhaps we should be propagating the borderbox as the clip
rect for children, even though | 227 // FIXME: Perhaps we should be propagating the borderbox as the clip
rect for children, even though |
231 // we may need to inflate our clip specifically for shadows o
r outsets. | 228 // we may need to inflate our clip specifically for shadows o
r outsets. |
232 // FIXME: Does not do the right thing with CSS regions yet, since we
don't yet factor in the | 229 // FIXME: Does not do the right thing with CSS regions yet, since we
don't yet factor in the |
233 // individual region boxes as overflow. | 230 // individual region boxes as overflow. |
234 LayoutRect layerBoundsWithVisualOverflow = toRenderBox(m_renderer).v
isualOverflowRect(); | 231 LayoutRect layerBoundsWithVisualOverflow = toRenderBox(m_renderer).v
isualOverflowRect(); |
235 layerBoundsWithVisualOverflow.moveBy(offset); | 232 layerBoundsWithVisualOverflow.moveBy(offset); |
236 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo
wClip) | 233 backgroundRect.intersect(layerBoundsWithVisualOverflow); |
237 backgroundRect.intersect(layerBoundsWithVisualOverflow); | |
238 } else { | 234 } else { |
239 LayoutRect bounds = toRenderBox(m_renderer).borderBoxRect(); | 235 LayoutRect bounds = toRenderBox(m_renderer).borderBoxRect(); |
240 bounds.moveBy(offset); | 236 bounds.moveBy(offset); |
241 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo
wClip) | 237 backgroundRect.intersect(bounds); |
242 backgroundRect.intersect(bounds); | |
243 } | 238 } |
244 } | 239 } |
245 | 240 |
246 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. | 241 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. |
247 if (m_renderer.hasClip()) { | 242 if (m_renderer.hasClip()) { |
248 // Clip applies to *us* as well, so go ahead and update the damageRect. | 243 // Clip applies to *us* as well, so go ahead and update the damageRect. |
249 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); | 244 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); |
250 backgroundRect.intersect(newPosClip); | 245 backgroundRect.intersect(newPosClip); |
251 foregroundRect.intersect(newPosClip); | 246 foregroundRect.intersect(newPosClip); |
252 outlineRect.intersect(newPosClip); | 247 outlineRect.intersect(newPosClip); |
(...skipping 21 matching lines...) Expand all Loading... |
274 clipRects = *parentLayer->clipper().cachedClipRects(context); | 269 clipRects = *parentLayer->clipper().cachedClipRects(context); |
275 } else { | 270 } else { |
276 parentLayer->clipper().calculateClipRects(context, clipRects); | 271 parentLayer->clipper().calculateClipRects(context, clipRects); |
277 } | 272 } |
278 } else { | 273 } else { |
279 clipRects.reset(PaintInfo::infiniteRect()); | 274 clipRects.reset(PaintInfo::infiniteRect()); |
280 } | 275 } |
281 | 276 |
282 adjustClipRectsForChildren(m_renderer, clipRects); | 277 adjustClipRectsForChildren(m_renderer, clipRects); |
283 | 278 |
284 // FIXME: This logic looks wrong. We'll apply overflow clip rects even if we
were told to IgnoreOverflowClip if m_renderer.hasClip(). | 279 if (m_renderer.hasOverflowClip()) { |
285 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect
OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { | |
286 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across | 280 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across |
287 // some transformed layer boundary, for example, in the RenderLayerCompo
sitor overlapMap, where | 281 // some transformed layer boundary, for example, in the RenderLayerCompo
sitor overlapMap, where |
288 // clipRects are needed in view space. | 282 // clipRects are needed in view space. |
289 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); | 283 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); |
290 } | 284 } |
291 } | 285 } |
292 | 286 |
293 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) | 287 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) |
294 { | 288 { |
295 if (position == AbsolutePosition) | 289 if (position == AbsolutePosition) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 ASSERT(current); | 324 ASSERT(current); |
331 if (current->transform()) | 325 if (current->transform()) |
332 return const_cast<RenderLayer*>(current); | 326 return const_cast<RenderLayer*>(current); |
333 } | 327 } |
334 | 328 |
335 ASSERT_NOT_REACHED(); | 329 ASSERT_NOT_REACHED(); |
336 return 0; | 330 return 0; |
337 } | 331 } |
338 | 332 |
339 } // namespace blink | 333 } // namespace blink |
OLD | NEW |