OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 void CompositedDeprecatedPaintLayerMapping::updateCompositingReasons() | 353 void CompositedDeprecatedPaintLayerMapping::updateCompositingReasons() |
354 { | 354 { |
355 // All other layers owned by this mapping will have the same compositing rea
son | 355 // All other layers owned by this mapping will have the same compositing rea
son |
356 // for their lifetime, so they are initialized only when created. | 356 // for their lifetime, so they are initialized only when created. |
357 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); | 357 m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons()); |
358 } | 358 } |
359 | 359 |
360 bool CompositedDeprecatedPaintLayerMapping::owningLayerClippedByLayerNotAboveCom
positedAncestor() | 360 bool CompositedDeprecatedPaintLayerMapping::owningLayerClippedByLayerNotAboveCom
positedAncestor(DeprecatedPaintLayer* scrollParent) |
361 { | 361 { |
362 if (!m_owningLayer.parent()) | 362 if (!m_owningLayer.parent()) |
363 return false; | 363 return false; |
364 | 364 |
365 const DeprecatedPaintLayer* compositingAncestor = m_owningLayer.enclosingLay
erWithCompositedDeprecatedPaintLayerMapping(ExcludeSelf); | 365 const DeprecatedPaintLayer* compositingAncestor = m_owningLayer.enclosingLay
erWithCompositedDeprecatedPaintLayerMapping(ExcludeSelf); |
366 if (!compositingAncestor) | 366 if (!compositingAncestor) |
367 return false; | 367 return false; |
368 | 368 |
369 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); | 369 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); |
370 if (!clippingContainer) | 370 if (!clippingContainer) |
371 return false; | 371 return false; |
372 | 372 |
| 373 if (clippingContainer->enclosingLayer() == scrollParent) |
| 374 return false; |
| 375 |
373 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) | 376 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) |
374 return false; | 377 return false; |
375 | 378 |
376 // We ignore overflow clip here; we want composited overflow content to | 379 // We ignore overflow clip here; we want composited overflow content to |
377 // behave as if it lives in an unclipped universe so it can prepaint, etc. | 380 // behave as if it lives in an unclipped universe so it can prepaint, etc. |
378 // This means that we need to check if we are actually clipped before | 381 // This means that we need to check if we are actually clipped before |
379 // setting up m_ancestorClippingLayer otherwise | 382 // setting up m_ancestorClippingLayer otherwise |
380 // updateAncestorClippingLayerGeometry will fail as the clip rect will be | 383 // updateAncestorClippingLayerGeometry will fail as the clip rect will be |
381 // infinite. | 384 // infinite. |
382 // FIXME: this should use cached clip rects, but this sometimes give | 385 // FIXME: this should use cached clip rects, but this sometimes give |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (m_owningLayer.needsCompositedScrolling()) | 422 if (m_owningLayer.needsCompositedScrolling()) |
420 needsDescendantsClippingLayer = false; | 423 needsDescendantsClippingLayer = false; |
421 | 424 |
422 DeprecatedPaintLayer* scrollParent = compositor->preferCompositingToLCDTextE
nabled() ? m_owningLayer.scrollParent() : 0; | 425 DeprecatedPaintLayer* scrollParent = compositor->preferCompositingToLCDTextE
nabled() ? m_owningLayer.scrollParent() : 0; |
423 | 426 |
424 // This is required because compositing layers are parented according to the
z-order hierarchy, yet | 427 // This is required because compositing layers are parented according to the
z-order hierarchy, yet |
425 // clipping goes down the layoutObject hierarchy. Thus, a DeprecatedPaintLay
er can be clipped by a | 428 // clipping goes down the layoutObject hierarchy. Thus, a DeprecatedPaintLay
er can be clipped by a |
426 // DeprecatedPaintLayer that is an ancestor in the layoutObject hierarchy, b
ut a sibling in the z-order | 429 // DeprecatedPaintLayer that is an ancestor in the layoutObject hierarchy, b
ut a sibling in the z-order |
427 // hierarchy. Further, that sibling need not be composited at all. In such s
cenarios, an ancestor | 430 // hierarchy. Further, that sibling need not be composited at all. In such s
cenarios, an ancestor |
428 // clipping layer is necessary to apply the composited clip for this layer. | 431 // clipping layer is necessary to apply the composited clip for this layer. |
429 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(); | 432 bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor
(scrollParent); |
430 | |
431 if (scrollParent) { | |
432 // If our containing block is our ancestor scrolling layer, then we'll a
lready be clipped | |
433 // to it via our scroll parent and we don't need an ancestor clipping la
yer. | |
434 if (m_owningLayer.layoutObject()->containingBlock()->enclosingLayer() ==
m_owningLayer.ancestorScrollingLayer()) | |
435 needsAncestorClip = false; | |
436 } | |
437 | 433 |
438 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) | 434 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) |
439 layerConfigChanged = true; | 435 layerConfigChanged = true; |
440 | 436 |
441 bool scrollingConfigChanged = false; | 437 bool scrollingConfigChanged = false; |
442 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 438 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
443 layerConfigChanged = true; | 439 layerConfigChanged = true; |
444 scrollingConfigChanged = true; | 440 scrollingConfigChanged = true; |
445 } | 441 } |
446 | 442 |
447 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) | 443 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) |
448 layerConfigChanged = true; | 444 layerConfigChanged = true; |
449 | 445 |
450 bool hasPerspective = false; | 446 bool hasPerspective = false; |
451 // FIXME: Can |style| be really null that late in the DocumentCycle? | 447 // FIXME: Can |style| be really null that late in the DocumentCycle? |
452 if (const ComputedStyle* style = layoutObject->style()) | 448 if (const ComputedStyle* style = layoutObject->style()) |
453 hasPerspective = style->hasPerspective(); | 449 hasPerspective = style->hasPerspective(); |
454 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox(); | 450 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox(); |
455 if (updateChildTransformLayer(needsChildTransformLayer)) | 451 if (updateChildTransformLayer(needsChildTransformLayer)) |
456 layerConfigChanged = true; | 452 layerConfigChanged = true; |
457 | 453 |
458 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) | 454 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) |
459 layerConfigChanged = true; | 455 layerConfigChanged = true; |
460 | 456 |
461 updateScrollParent(scrollParent); | 457 updateScrollParent(scrollParent); |
462 updateClipParent(); | 458 updateClipParent(scrollParent); |
463 | 459 |
464 if (layerConfigChanged) | 460 if (layerConfigChanged) |
465 updateInternalHierarchy(); | 461 updateInternalHierarchy(); |
466 | 462 |
467 if (scrollingConfigChanged) { | 463 if (scrollingConfigChanged) { |
468 if (layoutObject->view()) | 464 if (layoutObject->view()) |
469 compositor->scrollingLayerDidChange(&m_owningLayer); | 465 compositor->scrollingLayerDidChange(&m_owningLayer); |
470 } | 466 } |
471 | 467 |
472 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer | 468 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 if (!layer) | 1617 if (!layer) |
1622 return; | 1618 return; |
1623 | 1619 |
1624 // Only the topmost layer has a scroll parent. All other layers have a null
scroll parent. | 1620 // Only the topmost layer has a scroll parent. All other layers have a null
scroll parent. |
1625 if (layer != topmostLayer) | 1621 if (layer != topmostLayer) |
1626 clipParent = 0; | 1622 clipParent = 0; |
1627 | 1623 |
1628 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); | 1624 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); |
1629 } | 1625 } |
1630 | 1626 |
1631 void CompositedDeprecatedPaintLayerMapping::updateClipParent() | 1627 void CompositedDeprecatedPaintLayerMapping::updateClipParent(DeprecatedPaintLaye
r* scrollParent) |
1632 { | 1628 { |
1633 if (owningLayerClippedByLayerNotAboveCompositedAncestor()) | 1629 if (owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent)) |
1634 return; | 1630 return; |
1635 | 1631 |
1636 DeprecatedPaintLayer* clipParent = m_owningLayer.clipParent(); | 1632 DeprecatedPaintLayer* clipParent = m_owningLayer.clipParent(); |
1637 if (clipParent) | 1633 if (clipParent) |
1638 clipParent = clipParent->enclosingLayerWithCompositedDeprecatedPaintLaye
rMapping(IncludeSelf); | 1634 clipParent = clipParent->enclosingLayerWithCompositedDeprecatedPaintLaye
rMapping(IncludeSelf); |
1639 | 1635 |
1640 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { | 1636 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLay
er(m_owningLayer)) { |
1641 GraphicsLayer* topmostLayer = childForSuperlayers(); | 1637 GraphicsLayer* topmostLayer = childForSuperlayers(); |
1642 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topm
ostLayer, clipParent, scrollingCoordinator); | 1638 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topm
ostLayer, clipParent, scrollingCoordinator); |
1643 updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostL
ayer, clipParent, scrollingCoordinator); | 1639 updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostL
ayer, clipParent, scrollingCoordinator); |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2338 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2343 name = "Scrolling Block Selection Layer"; | 2339 name = "Scrolling Block Selection Layer"; |
2344 } else { | 2340 } else { |
2345 ASSERT_NOT_REACHED(); | 2341 ASSERT_NOT_REACHED(); |
2346 } | 2342 } |
2347 | 2343 |
2348 return name; | 2344 return name; |
2349 } | 2345 } |
2350 | 2346 |
2351 } // namespace blink | 2347 } // namespace blink |
OLD | NEW |