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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 PaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer; | 195 PaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer; |
196 // Assert on incorrect mappings between layers and groups | 196 // Assert on incorrect mappings between layers and groups |
197 ASSERT(oldSquashedLayer->groupedMapping() == this); | 197 ASSERT(oldSquashedLayer->groupedMapping() == this); |
198 if (oldSquashedLayer->groupedMapping() == this) { | 198 if (oldSquashedLayer->groupedMapping() == this) { |
199 oldSquashedLayer->setGroupedMapping( | 199 oldSquashedLayer->setGroupedMapping( |
200 0, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping); | 200 0, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping); |
201 oldSquashedLayer->setLostGroupedMapping(true); | 201 oldSquashedLayer->setLostGroupedMapping(true); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 updateClippingLayers(false, false); | 205 updateClippingLayers(false, false, false); |
206 updateOverflowControlsLayers(false, false, false, false); | 206 updateOverflowControlsLayers(false, false, false, false); |
207 updateChildTransformLayer(false); | 207 updateChildTransformLayer(false); |
208 updateForegroundLayer(false); | 208 updateForegroundLayer(false); |
209 updateBackgroundLayer(false); | 209 updateBackgroundLayer(false); |
210 updateMaskLayer(false); | 210 updateMaskLayer(false); |
211 updateChildClippingMaskLayer(false); | 211 updateChildClippingMaskLayer(false); |
212 updateScrollingLayers(false); | 212 updateScrollingLayers(false); |
213 updateSquashingLayers(false); | 213 updateSquashingLayers(false); |
214 destroyGraphicsLayers(); | 214 destroyGraphicsLayers(); |
215 } | 215 } |
(...skipping 23 matching lines...) Expand all Loading... |
239 updateStickyConstraints(layoutObject()->styleRef()); | 239 updateStickyConstraints(layoutObject()->styleRef()); |
240 updateLayerBlendMode(layoutObject()->styleRef()); | 240 updateLayerBlendMode(layoutObject()->styleRef()); |
241 updateIsRootForIsolatedGroup(); | 241 updateIsRootForIsolatedGroup(); |
242 } | 242 } |
243 | 243 |
244 void CompositedLayerMapping::destroyGraphicsLayers() { | 244 void CompositedLayerMapping::destroyGraphicsLayers() { |
245 if (m_graphicsLayer) | 245 if (m_graphicsLayer) |
246 m_graphicsLayer->removeFromParent(); | 246 m_graphicsLayer->removeFromParent(); |
247 | 247 |
248 m_ancestorClippingLayer = nullptr; | 248 m_ancestorClippingLayer = nullptr; |
| 249 m_ancestorClippingMaskLayer = nullptr; |
249 m_graphicsLayer = nullptr; | 250 m_graphicsLayer = nullptr; |
250 m_foregroundLayer = nullptr; | 251 m_foregroundLayer = nullptr; |
251 m_backgroundLayer = nullptr; | 252 m_backgroundLayer = nullptr; |
252 m_childContainmentLayer = nullptr; | 253 m_childContainmentLayer = nullptr; |
253 m_childTransformLayer = nullptr; | 254 m_childTransformLayer = nullptr; |
254 m_maskLayer = nullptr; | 255 m_maskLayer = nullptr; |
255 m_childClippingMaskLayer = nullptr; | 256 m_childClippingMaskLayer = nullptr; |
256 | 257 |
257 m_scrollingLayer = nullptr; | 258 m_scrollingLayer = nullptr; |
258 m_scrollingContentsLayer = nullptr; | 259 m_scrollingContentsLayer = nullptr; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 462 } |
462 | 463 |
463 void CompositedLayerMapping::updateCompositingReasons() { | 464 void CompositedLayerMapping::updateCompositingReasons() { |
464 // All other layers owned by this mapping will have the same compositing | 465 // All other layers owned by this mapping will have the same compositing |
465 // reason for their lifetime, so they are initialized only when created. | 466 // reason for their lifetime, so they are initialized only when created. |
466 m_graphicsLayer->setCompositingReasons(m_owningLayer.getCompositingReasons()); | 467 m_graphicsLayer->setCompositingReasons(m_owningLayer.getCompositingReasons()); |
467 m_graphicsLayer->setSquashingDisallowedReasons( | 468 m_graphicsLayer->setSquashingDisallowedReasons( |
468 m_owningLayer.getSquashingDisallowedReasons()); | 469 m_owningLayer.getSquashingDisallowedReasons()); |
469 } | 470 } |
470 | 471 |
471 bool CompositedLayerMapping:: | 472 void CompositedLayerMapping:: |
472 owningLayerClippedByLayerNotAboveCompositedAncestor( | 473 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( |
473 const PaintLayer* scrollParent) { | 474 const PaintLayer* scrollParent, |
| 475 bool& owningLayerIsClipped, |
| 476 bool& owningLayerIsMasked) { |
| 477 owningLayerIsClipped = false; |
| 478 owningLayerIsMasked = false; |
| 479 |
474 if (!m_owningLayer.parent()) | 480 if (!m_owningLayer.parent()) |
475 return false; | 481 return; |
476 | 482 |
477 const PaintLayer* compositingAncestor = | 483 const PaintLayer* compositingAncestor = |
478 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); | 484 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); |
479 if (!compositingAncestor) | 485 if (!compositingAncestor) |
480 return false; | 486 return; |
481 | 487 |
482 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); | 488 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); |
483 if (!clippingContainer) | 489 if (!clippingContainer) |
484 return false; | 490 return; |
485 | 491 |
486 if (clippingContainer->enclosingLayer() == scrollParent) | 492 if (clippingContainer->enclosingLayer() == scrollParent) |
487 return false; | 493 return; |
488 | 494 |
489 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant()) | 495 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant()) |
490 return false; | 496 return; |
491 | 497 |
492 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) | 498 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) |
493 return false; | 499 return; |
| 500 |
| 501 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant()) |
| 502 return; |
494 | 503 |
495 // We ignore overflow clip here; we want composited overflow content to | 504 // We ignore overflow clip here; we want composited overflow content to |
496 // behave as if it lives in an unclipped universe so it can prepaint, etc. | 505 // behave as if it lives in an unclipped universe so it can prepaint, etc. |
497 // This means that we need to check if we are actually clipped before | 506 // This means that we need to check if we are actually clipped before |
498 // setting up m_ancestorClippingLayer otherwise | 507 // setting up m_ancestorClippingLayer otherwise |
499 // updateAncestorClippingLayerGeometry will fail as the clip rect will be | 508 // updateAncestorClippingLayerGeometry will fail as the clip rect will be |
500 // infinite. | 509 // infinite. |
501 // FIXME: this should use cached clip rects, but this sometimes give | 510 // FIXME: this should use cached clip rects, but this sometimes give |
502 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). | 511 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). |
503 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, | 512 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, |
504 IgnoreOverlayScrollbarSize); | 513 IgnoreOverlayScrollbarSize); |
505 clipRectsContext.setIgnoreOverflowClip(); | 514 clipRectsContext.setIgnoreOverflowClip(); |
506 IntRect parentClipRect = pixelSnappedIntRect( | 515 IntRect parentClipRect = pixelSnappedIntRect( |
507 m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect()); | 516 m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect()); |
508 return parentClipRect != LayoutRect::infiniteIntRect(); | 517 owningLayerIsClipped = parentClipRect != LayoutRect::infiniteIntRect(); |
| 518 |
| 519 DCHECK(clippingContainer->style()); |
| 520 owningLayerIsMasked = |
| 521 owningLayerIsClipped && clippingContainer->style()->hasBorderRadius(); |
509 } | 522 } |
510 | 523 |
511 const PaintLayer* CompositedLayerMapping::scrollParent() { | 524 const PaintLayer* CompositedLayerMapping::scrollParent() { |
512 const PaintLayer* scrollParent = m_owningLayer.scrollParent(); | 525 const PaintLayer* scrollParent = m_owningLayer.scrollParent(); |
513 if (scrollParent && !scrollParent->needsCompositedScrolling()) | 526 if (scrollParent && !scrollParent->needsCompositedScrolling()) |
514 return nullptr; | 527 return nullptr; |
515 return scrollParent; | 528 return scrollParent; |
516 } | 529 } |
517 | 530 |
518 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() { | 531 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 needsDescendantsClippingLayer = false; | 567 needsDescendantsClippingLayer = false; |
555 | 568 |
556 const PaintLayer* scrollParent = this->scrollParent(); | 569 const PaintLayer* scrollParent = this->scrollParent(); |
557 | 570 |
558 // This is required because compositing layers are parented according to the | 571 // This is required because compositing layers are parented according to the |
559 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus, | 572 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus, |
560 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the | 573 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the |
561 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further, | 574 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further, |
562 // that sibling need not be composited at all. In such scenarios, an ancestor | 575 // that sibling need not be composited at all. In such scenarios, an ancestor |
563 // clipping layer is necessary to apply the composited clip for this layer. | 576 // clipping layer is necessary to apply the composited clip for this layer. |
564 bool needsAncestorClip = | 577 bool needsAncestorClip = false; |
565 owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent); | 578 bool needsAncestorClippingMask = false; |
566 | 579 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( |
567 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) | 580 scrollParent, needsAncestorClip, needsAncestorClippingMask); |
| 581 if (updateClippingLayers(needsAncestorClip, needsAncestorClippingMask, |
| 582 needsDescendantsClippingLayer)) |
568 layerConfigChanged = true; | 583 layerConfigChanged = true; |
569 | 584 |
570 bool scrollingConfigChanged = false; | 585 bool scrollingConfigChanged = false; |
571 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 586 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
572 layerConfigChanged = true; | 587 layerConfigChanged = true; |
573 scrollingConfigChanged = true; | 588 scrollingConfigChanged = true; |
574 } | 589 } |
575 | 590 |
576 // If the outline needs to draw over the composited scrolling contents layer | 591 // If the outline needs to draw over the composited scrolling contents layer |
577 // or scrollbar layers it needs to be drawn into a separate layer. | 592 // or scrollbar layers it needs to be drawn into a separate layer. |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 m_ancestorClippingLayer->setPosition( | 1104 m_ancestorClippingLayer->setPosition( |
1090 FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); | 1105 FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); |
1091 m_ancestorClippingLayer->setSize(FloatSize(parentClipRect.size())); | 1106 m_ancestorClippingLayer->setSize(FloatSize(parentClipRect.size())); |
1092 | 1107 |
1093 // backgroundRect is relative to compositingContainer, so subtract | 1108 // backgroundRect is relative to compositingContainer, so subtract |
1094 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y | 1109 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y |
1095 // to get back to local coords. | 1110 // to get back to local coords. |
1096 m_ancestorClippingLayer->setOffsetFromLayoutObject( | 1111 m_ancestorClippingLayer->setOffsetFromLayoutObject( |
1097 parentClipRect.location() - snappedOffsetFromCompositedAncestor); | 1112 parentClipRect.location() - snappedOffsetFromCompositedAncestor); |
1098 | 1113 |
| 1114 if (m_ancestorClippingMaskLayer) { |
| 1115 m_ancestorClippingMaskLayer->setOffsetFromLayoutObject(m_ancestorClippingLay
er->offsetFromLayoutObject()); |
| 1116 m_ancestorClippingMaskLayer->setSize(m_ancestorClippingLayer->size()); |
| 1117 m_ancestorClippingMaskLayer->setNeedsDisplay(); |
| 1118 } |
| 1119 |
1099 // The primary layer is then parented in, and positioned relative to this | 1120 // The primary layer is then parented in, and positioned relative to this |
1100 // clipping layer. | 1121 // clipping layer. |
1101 graphicsLayerParentLocation = parentClipRect.location(); | 1122 graphicsLayerParentLocation = parentClipRect.location(); |
1102 } | 1123 } |
1103 | 1124 |
1104 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( | 1125 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( |
1105 const PaintLayer* compositingStackingContext, | 1126 const PaintLayer* compositingStackingContext, |
1106 const PaintLayer* compositingContainer, | 1127 const PaintLayer* compositingContainer, |
1107 IntPoint graphicsLayerParentLocation) { | 1128 IntPoint graphicsLayerParentLocation) { |
1108 if (!m_overflowControlsHostLayer) | 1129 if (!m_overflowControlsHostLayer) |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 // layer (i.e. if there is nothing actually drawn into the | 1661 // layer (i.e. if there is nothing actually drawn into the |
1641 // background anymore.) | 1662 // background anymore.) |
1642 // "hasPaintedContent" should be calculated in a way that does not take the | 1663 // "hasPaintedContent" should be calculated in a way that does not take the |
1643 // outline into consideration. | 1664 // outline into consideration. |
1644 if (m_backgroundLayer) | 1665 if (m_backgroundLayer) |
1645 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 1666 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
1646 | 1667 |
1647 if (m_decorationOutlineLayer) | 1668 if (m_decorationOutlineLayer) |
1648 m_decorationOutlineLayer->setDrawsContent(true); | 1669 m_decorationOutlineLayer->setDrawsContent(true); |
1649 | 1670 |
| 1671 if (m_ancestorClippingMaskLayer) |
| 1672 m_ancestorClippingMaskLayer->setDrawsContent(true); |
| 1673 |
1650 if (m_maskLayer) | 1674 if (m_maskLayer) |
1651 m_maskLayer->setDrawsContent(true); | 1675 m_maskLayer->setDrawsContent(true); |
1652 | 1676 |
1653 if (m_childClippingMaskLayer) | 1677 if (m_childClippingMaskLayer) |
1654 m_childClippingMaskLayer->setDrawsContent(true); | 1678 m_childClippingMaskLayer->setDrawsContent(true); |
1655 } | 1679 } |
1656 | 1680 |
1657 void CompositedLayerMapping::updateChildrenTransform() { | 1681 void CompositedLayerMapping::updateChildrenTransform() { |
1658 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { | 1682 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { |
1659 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); | 1683 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); |
1660 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); | 1684 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); |
1661 } | 1685 } |
1662 | 1686 |
1663 updateShouldFlattenTransform(); | 1687 updateShouldFlattenTransform(); |
1664 } | 1688 } |
1665 | 1689 |
1666 // Return true if the layers changed. | 1690 // Return true if the layers changed. |
1667 bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, | 1691 bool CompositedLayerMapping::updateClippingLayers( |
1668 bool needsDescendantClip) { | 1692 bool needsAncestorClip, |
| 1693 bool needsAncestorClippingMask, |
| 1694 bool needsDescendantClip) { |
1669 bool layersChanged = false; | 1695 bool layersChanged = false; |
1670 | 1696 |
1671 if (needsAncestorClip) { | 1697 if (needsAncestorClip) { |
1672 if (!m_ancestorClippingLayer) { | 1698 if (!m_ancestorClippingLayer) { |
1673 m_ancestorClippingLayer = | 1699 m_ancestorClippingLayer = |
1674 createGraphicsLayer(CompositingReasonLayerForAncestorClip); | 1700 createGraphicsLayer(CompositingReasonLayerForAncestorClip); |
1675 m_ancestorClippingLayer->setMasksToBounds(true); | 1701 m_ancestorClippingLayer->setMasksToBounds(true); |
1676 m_ancestorClippingLayer->setShouldFlattenTransform(false); | 1702 m_ancestorClippingLayer->setShouldFlattenTransform(false); |
1677 layersChanged = true; | 1703 layersChanged = true; |
1678 } | 1704 } |
1679 } else if (m_ancestorClippingLayer) { | 1705 } else if (m_ancestorClippingLayer) { |
| 1706 if (m_ancestorClippingMaskLayer) { |
| 1707 m_ancestorClippingMaskLayer->removeFromParent(); |
| 1708 m_ancestorClippingMaskLayer = nullptr; |
| 1709 } |
1680 m_ancestorClippingLayer->removeFromParent(); | 1710 m_ancestorClippingLayer->removeFromParent(); |
1681 m_ancestorClippingLayer = nullptr; | 1711 m_ancestorClippingLayer = nullptr; |
1682 layersChanged = true; | 1712 layersChanged = true; |
1683 } | 1713 } |
1684 | 1714 |
| 1715 if (needsAncestorClippingMask) { |
| 1716 DCHECK(m_ancestorClippingLayer); |
| 1717 if (!m_ancestorClippingMaskLayer) { |
| 1718 m_ancestorClippingMaskLayer = |
| 1719 createGraphicsLayer(CompositingReasonLayerForAncestorClippingMask); |
| 1720 m_ancestorClippingMaskLayer->setPaintingPhase( |
| 1721 GraphicsLayerPaintAncestorClippingMask); |
| 1722 m_ancestorClippingLayer->setMaskLayer( |
| 1723 m_ancestorClippingMaskLayer.get()); |
| 1724 layersChanged = true; |
| 1725 } |
| 1726 } else if (m_ancestorClippingLayer && m_ancestorClippingMaskLayer) { |
| 1727 m_ancestorClippingMaskLayer->removeFromParent(); |
| 1728 m_ancestorClippingMaskLayer = nullptr; |
| 1729 m_ancestorClippingLayer->setMaskLayer(nullptr); |
| 1730 layersChanged = true; |
| 1731 } |
| 1732 |
1685 if (needsDescendantClip) { | 1733 if (needsDescendantClip) { |
1686 // We don't need a child containment layer if we're the main frame layout | 1734 // We don't need a child containment layer if we're the main frame layout |
1687 // view layer. It's redundant as the frame clip above us will handle this | 1735 // view layer. It's redundant as the frame clip above us will handle this |
1688 // clipping. | 1736 // clipping. |
1689 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { | 1737 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { |
1690 m_childContainmentLayer = | 1738 m_childContainmentLayer = |
1691 createGraphicsLayer(CompositingReasonLayerForDescendantClip); | 1739 createGraphicsLayer(CompositingReasonLayerForDescendantClip); |
1692 m_childContainmentLayer->setMasksToBounds(true); | 1740 m_childContainmentLayer->setMasksToBounds(true); |
1693 layersChanged = true; | 1741 layersChanged = true; |
1694 } | 1742 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 f(mapping->squashingLayer()); | 1945 f(mapping->squashingLayer()); |
1898 | 1946 |
1899 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1947 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
1900 (mode & ApplyToNonScrollingContentLayers)) && | 1948 (mode & ApplyToNonScrollingContentLayers)) && |
1901 mapping->maskLayer()) | 1949 mapping->maskLayer()) |
1902 f(mapping->maskLayer()); | 1950 f(mapping->maskLayer()); |
1903 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1951 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
1904 (mode & ApplyToNonScrollingContentLayers)) && | 1952 (mode & ApplyToNonScrollingContentLayers)) && |
1905 mapping->childClippingMaskLayer()) | 1953 mapping->childClippingMaskLayer()) |
1906 f(mapping->childClippingMaskLayer()); | 1954 f(mapping->childClippingMaskLayer()); |
| 1955 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
| 1956 (mode & ApplyToNonScrollingContentLayers)) && |
| 1957 mapping->ancestorClippingMaskLayer()) |
| 1958 f(mapping->ancestorClippingMaskLayer()); |
1907 | 1959 |
1908 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || | 1960 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || |
1909 (mode & ApplyToNonScrollingContentLayers)) && | 1961 (mode & ApplyToNonScrollingContentLayers)) && |
1910 mapping->backgroundLayer()) | 1962 mapping->backgroundLayer()) |
1911 f(mapping->backgroundLayer()); | 1963 f(mapping->backgroundLayer()); |
1912 | 1964 |
1913 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) | 1965 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) |
1914 f(mapping->layerForHorizontalScrollbar()); | 1966 f(mapping->layerForHorizontalScrollbar()); |
1915 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) | 1967 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) |
1916 f(mapping->layerForVerticalScrollbar()); | 1968 f(mapping->layerForVerticalScrollbar()); |
(...skipping 15 matching lines...) Expand all Loading... |
1932 | 1984 |
1933 void CompositedLayerMapping::updateRenderingContext() { | 1985 void CompositedLayerMapping::updateRenderingContext() { |
1934 // All layers but the squashing layer (which contains 'alien' content) should | 1986 // All layers but the squashing layer (which contains 'alien' content) should |
1935 // be included in this rendering context. | 1987 // be included in this rendering context. |
1936 int id = 0; | 1988 int id = 0; |
1937 | 1989 |
1938 // NB, it is illegal at this point to query an ancestor's compositing state. | 1990 // NB, it is illegal at this point to query an ancestor's compositing state. |
1939 // Some compositing reasons depend on the compositing state of ancestors. So | 1991 // Some compositing reasons depend on the compositing state of ancestors. So |
1940 // if we want a rendering context id for the context root, we cannot ask for | 1992 // if we want a rendering context id for the context root, we cannot ask for |
1941 // the id of its associated WebLayer now; it may not have one yet. We could do | 1993 // the id of its associated WebLayer now; it may not have one yet. We could do |
1942 // a second past after doing the compositing updates to get these ids, but | 1994 // a second pass after doing the compositing updates to get these ids, but |
1943 // this would actually be harmful. We do not want to attach any semantic | 1995 // this would actually be harmful. We do not want to attach any semantic |
1944 // meaning to the context id other than the fact that they group a number of | 1996 // meaning to the context id other than the fact that they group a number of |
1945 // layers together for the sake of 3d sorting. So instead we will ask the | 1997 // layers together for the sake of 3d sorting. So instead we will ask the |
1946 // compositor to vend us an arbitrary, but consistent id. | 1998 // compositor to vend us an arbitrary, but consistent id. |
1947 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { | 1999 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { |
1948 if (Node* node = root->layoutObject()->node()) | 2000 if (Node* node = root->layoutObject()->node()) |
1949 id = static_cast<int>(PtrHash<Node>::hash(node)); | 2001 id = static_cast<int>(PtrHash<Node>::hash(node)); |
1950 } | 2002 } |
1951 | 2003 |
1952 UpdateRenderingContextFunctor functor = {id}; | 2004 UpdateRenderingContextFunctor functor = {id}; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 // Only the topmost layer has a scroll parent. All other layers have a null | 2288 // Only the topmost layer has a scroll parent. All other layers have a null |
2237 // scroll parent. | 2289 // scroll parent. |
2238 if (layer != topmostLayer) | 2290 if (layer != topmostLayer) |
2239 clipParent = 0; | 2291 clipParent = 0; |
2240 | 2292 |
2241 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); | 2293 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); |
2242 } | 2294 } |
2243 | 2295 |
2244 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { | 2296 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { |
2245 const PaintLayer* clipParent = nullptr; | 2297 const PaintLayer* clipParent = nullptr; |
2246 if (!owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent)) { | 2298 bool haveAncestorClipLayer = false; |
| 2299 bool haveAncestorMaskLayer = false; |
| 2300 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( |
| 2301 scrollParent, haveAncestorClipLayer, haveAncestorMaskLayer); |
| 2302 if (!haveAncestorClipLayer) { |
2247 clipParent = m_owningLayer.clipParent(); | 2303 clipParent = m_owningLayer.clipParent(); |
2248 if (clipParent) | 2304 if (clipParent) |
2249 clipParent = | 2305 clipParent = |
2250 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); | 2306 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); |
2251 } | 2307 } |
2252 | 2308 |
2253 if (ScrollingCoordinator* scrollingCoordinator = | 2309 if (ScrollingCoordinator* scrollingCoordinator = |
2254 scrollingCoordinatorFromLayer(m_owningLayer)) { | 2310 scrollingCoordinatorFromLayer(m_owningLayer)) { |
2255 GraphicsLayer* topmostLayer = childForSuperlayers(); | 2311 GraphicsLayer* topmostLayer = childForSuperlayers(); |
2256 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), | 2312 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 translation.translate(-offset.width(), -offset.height()); | 2832 translation.translate(-offset.width(), -offset.height()); |
2777 TransformRecorder transformRecorder(context, graphicsLayer, translation); | 2833 TransformRecorder transformRecorder(context, graphicsLayer, translation); |
2778 | 2834 |
2779 // The dirtyRect is in the coords of the painting root. | 2835 // The dirtyRect is in the coords of the painting root. |
2780 IntRect dirtyRect(clip); | 2836 IntRect dirtyRect(clip); |
2781 dirtyRect.move(offset); | 2837 dirtyRect.move(offset); |
2782 | 2838 |
2783 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { | 2839 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { |
2784 LayoutRect bounds = paintInfo.compositedBounds; | 2840 LayoutRect bounds = paintInfo.compositedBounds; |
2785 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); | 2841 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); |
| 2842 if (paintLayerFlags & PaintLayerPaintingAncestorClippingMaskPhase) |
| 2843 bounds.move(offset); |
2786 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 2844 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
2787 } else { | 2845 } else { |
2788 dirtyRect.move( | 2846 dirtyRect.move( |
2789 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); | 2847 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); |
2790 } | 2848 } |
2791 | 2849 |
2792 #if ENABLE(ASSERT) | 2850 #if ENABLE(ASSERT) |
2793 if (!layoutObject()->view()->frame() || | 2851 if (!layoutObject()->view()->frame() || |
2794 !layoutObject()->view()->frame()->shouldThrottleRendering()) | 2852 !layoutObject()->view()->frame()->shouldThrottleRendering()) |
2795 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); | 2853 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 3106 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
3049 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; | 3107 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; |
3050 else | 3108 else |
3051 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3109 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3052 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) | 3110 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) |
3053 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; | 3111 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; |
3054 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) | 3112 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) |
3055 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; | 3113 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; |
3056 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) | 3114 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) |
3057 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; | 3115 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
| 3116 if (graphicsLayerPaintingPhase & GraphicsLayerPaintAncestorClippingMask) |
| 3117 paintLayerFlags |= PaintLayerPaintingAncestorClippingMaskPhase; |
3058 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) | 3118 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) |
3059 paintLayerFlags |= PaintLayerPaintingOverflowContents; | 3119 paintLayerFlags |= PaintLayerPaintingOverflowContents; |
3060 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) | 3120 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) |
3061 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; | 3121 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; |
3062 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) | 3122 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) |
3063 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; | 3123 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; |
3064 | 3124 |
3065 if (graphicsLayer == m_backgroundLayer.get()) | 3125 if (graphicsLayer == m_backgroundLayer.get()) |
3066 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; | 3126 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; |
3067 else if (compositor()->fixedRootBackgroundLayer() && | 3127 else if (compositor()->fixedRootBackgroundLayer() && |
3068 m_owningLayer.isRootLayer()) | 3128 m_owningLayer.isRootLayer()) |
3069 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3129 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3070 | 3130 |
3071 if (graphicsLayer == m_graphicsLayer.get() || | 3131 if (graphicsLayer == m_graphicsLayer.get() || |
3072 graphicsLayer == m_foregroundLayer.get() || | 3132 graphicsLayer == m_foregroundLayer.get() || |
3073 graphicsLayer == m_backgroundLayer.get() || | 3133 graphicsLayer == m_backgroundLayer.get() || |
3074 graphicsLayer == m_maskLayer.get() || | 3134 graphicsLayer == m_maskLayer.get() || |
3075 graphicsLayer == m_childClippingMaskLayer.get() || | 3135 graphicsLayer == m_childClippingMaskLayer.get() || |
3076 graphicsLayer == m_scrollingContentsLayer.get() || | 3136 graphicsLayer == m_scrollingContentsLayer.get() || |
3077 graphicsLayer == m_decorationOutlineLayer.get()) { | 3137 graphicsLayer == m_decorationOutlineLayer.get() || |
| 3138 graphicsLayer == m_ancestorClippingMaskLayer.get()) { |
3078 bool paintRootBackgroundOntoScrollingContentsLayer = | 3139 bool paintRootBackgroundOntoScrollingContentsLayer = |
3079 m_backgroundPaintsOntoScrollingContentsLayer; | 3140 m_backgroundPaintsOntoScrollingContentsLayer; |
3080 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || | 3141 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || |
3081 (!m_backgroundLayer && !m_foregroundLayer)); | 3142 (!m_backgroundLayer && !m_foregroundLayer)); |
3082 if (paintRootBackgroundOntoScrollingContentsLayer) { | 3143 if (paintRootBackgroundOntoScrollingContentsLayer) { |
3083 if (graphicsLayer == m_scrollingContentsLayer.get()) | 3144 if (graphicsLayer == m_scrollingContentsLayer.get()) |
3084 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 3145 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
3085 else if (!m_backgroundPaintsOntoGraphicsLayer) | 3146 else if (!m_backgroundPaintsOntoGraphicsLayer) |
3086 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3147 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3087 } | 3148 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { | 3383 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { |
3323 name = "Squashing Containment Layer"; | 3384 name = "Squashing Containment Layer"; |
3324 } else if (graphicsLayer == m_squashingLayer.get()) { | 3385 } else if (graphicsLayer == m_squashingLayer.get()) { |
3325 name = "Squashing Layer (first squashed layer: " + | 3386 name = "Squashing Layer (first squashed layer: " + |
3326 (m_squashedLayers.size() > 0 | 3387 (m_squashedLayers.size() > 0 |
3327 ? m_squashedLayers[0].paintLayer->debugName() | 3388 ? m_squashedLayers[0].paintLayer->debugName() |
3328 : "") + | 3389 : "") + |
3329 ")"; | 3390 ")"; |
3330 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { | 3391 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { |
3331 name = "Ancestor Clipping Layer"; | 3392 name = "Ancestor Clipping Layer"; |
| 3393 } else if (graphicsLayer == m_ancestorClippingMaskLayer.get()) { |
| 3394 name = "Ancestor Clipping Mask Layer"; |
3332 } else if (graphicsLayer == m_foregroundLayer.get()) { | 3395 } else if (graphicsLayer == m_foregroundLayer.get()) { |
3333 name = m_owningLayer.debugName() + " (foreground) Layer"; | 3396 name = m_owningLayer.debugName() + " (foreground) Layer"; |
3334 } else if (graphicsLayer == m_backgroundLayer.get()) { | 3397 } else if (graphicsLayer == m_backgroundLayer.get()) { |
3335 name = m_owningLayer.debugName() + " (background) Layer"; | 3398 name = m_owningLayer.debugName() + " (background) Layer"; |
3336 } else if (graphicsLayer == m_childContainmentLayer.get()) { | 3399 } else if (graphicsLayer == m_childContainmentLayer.get()) { |
3337 name = "Child Containment Layer"; | 3400 name = "Child Containment Layer"; |
3338 } else if (graphicsLayer == m_childTransformLayer.get()) { | 3401 } else if (graphicsLayer == m_childTransformLayer.get()) { |
3339 name = "Child Transform Layer"; | 3402 name = "Child Transform Layer"; |
3340 } else if (graphicsLayer == m_maskLayer.get()) { | 3403 } else if (graphicsLayer == m_maskLayer.get()) { |
3341 name = "Mask Layer"; | 3404 name = "Mask Layer"; |
(...skipping 16 matching lines...) Expand all Loading... |
3358 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3421 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3359 name = "Decoration Layer"; | 3422 name = "Decoration Layer"; |
3360 } else { | 3423 } else { |
3361 ASSERT_NOT_REACHED(); | 3424 ASSERT_NOT_REACHED(); |
3362 } | 3425 } |
3363 | 3426 |
3364 return name; | 3427 return name; |
3365 } | 3428 } |
3366 | 3429 |
3367 } // namespace blink | 3430 } // namespace blink |
OLD | NEW |