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, false); | 205 updateClippingLayers(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; | |
250 m_graphicsLayer = nullptr; | 249 m_graphicsLayer = nullptr; |
251 m_foregroundLayer = nullptr; | 250 m_foregroundLayer = nullptr; |
252 m_backgroundLayer = nullptr; | 251 m_backgroundLayer = nullptr; |
253 m_childContainmentLayer = nullptr; | 252 m_childContainmentLayer = nullptr; |
254 m_childTransformLayer = nullptr; | 253 m_childTransformLayer = nullptr; |
255 m_maskLayer = nullptr; | 254 m_maskLayer = nullptr; |
256 m_childClippingMaskLayer = nullptr; | 255 m_childClippingMaskLayer = nullptr; |
257 | 256 |
258 m_scrollingLayer = nullptr; | 257 m_scrollingLayer = nullptr; |
259 m_scrollingContentsLayer = nullptr; | 258 m_scrollingContentsLayer = nullptr; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 465 } |
467 | 466 |
468 void CompositedLayerMapping::updateCompositingReasons() { | 467 void CompositedLayerMapping::updateCompositingReasons() { |
469 // All other layers owned by this mapping will have the same compositing | 468 // All other layers owned by this mapping will have the same compositing |
470 // reason for their lifetime, so they are initialized only when created. | 469 // reason for their lifetime, so they are initialized only when created. |
471 m_graphicsLayer->setCompositingReasons(m_owningLayer.getCompositingReasons()); | 470 m_graphicsLayer->setCompositingReasons(m_owningLayer.getCompositingReasons()); |
472 m_graphicsLayer->setSquashingDisallowedReasons( | 471 m_graphicsLayer->setSquashingDisallowedReasons( |
473 m_owningLayer.getSquashingDisallowedReasons()); | 472 m_owningLayer.getSquashingDisallowedReasons()); |
474 } | 473 } |
475 | 474 |
476 void CompositedLayerMapping:: | 475 bool CompositedLayerMapping:: |
477 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( | 476 owningLayerClippedByLayerNotAboveCompositedAncestor( |
478 const PaintLayer* scrollParent, | 477 const PaintLayer* scrollParent) { |
479 bool& owningLayerIsClipped, | |
480 bool& owningLayerIsMasked) { | |
481 owningLayerIsClipped = false; | |
482 owningLayerIsMasked = false; | |
483 | |
484 if (!m_owningLayer.parent()) | 478 if (!m_owningLayer.parent()) |
485 return; | 479 return false; |
486 | 480 |
487 const PaintLayer* compositingAncestor = | 481 const PaintLayer* compositingAncestor = |
488 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); | 482 m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf); |
489 if (!compositingAncestor) | 483 if (!compositingAncestor) |
490 return; | 484 return false; |
491 | 485 |
492 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); | 486 const LayoutObject* clippingContainer = m_owningLayer.clippingContainer(); |
493 if (!clippingContainer) | 487 if (!clippingContainer) |
494 return; | 488 return false; |
495 | 489 |
496 if (clippingContainer->enclosingLayer() == scrollParent) | 490 if (clippingContainer->enclosingLayer() == scrollParent) |
497 return; | 491 return false; |
498 | 492 |
499 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant()) | 493 if (clippingContainer->enclosingLayer()->hasRootScrollerAsDescendant()) |
500 return; | 494 return false; |
501 | 495 |
502 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) | 496 if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer)) |
503 return; | 497 return false; |
504 | 498 |
505 // We ignore overflow clip here; we want composited overflow content to | 499 // We ignore overflow clip here; we want composited overflow content to |
506 // behave as if it lives in an unclipped universe so it can prepaint, etc. | 500 // behave as if it lives in an unclipped universe so it can prepaint, etc. |
507 // This means that we need to check if we are actually clipped before | 501 // This means that we need to check if we are actually clipped before |
508 // setting up m_ancestorClippingLayer otherwise | 502 // setting up m_ancestorClippingLayer otherwise |
509 // updateAncestorClippingLayerGeometry will fail as the clip rect will be | 503 // updateAncestorClippingLayerGeometry will fail as the clip rect will be |
510 // infinite. | 504 // infinite. |
511 // FIXME: this should use cached clip rects, but this sometimes give | 505 // FIXME: this should use cached clip rects, but this sometimes give |
512 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). | 506 // inaccurate results (and trips the ASSERTS in PaintLayerClipper). |
513 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, | 507 ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, |
514 IgnoreOverlayScrollbarSize); | 508 IgnoreOverlayScrollbarSize); |
515 clipRectsContext.setIgnoreOverflowClip(); | 509 clipRectsContext.setIgnoreOverflowClip(); |
516 IntRect parentClipRect = pixelSnappedIntRect( | 510 IntRect parentClipRect = pixelSnappedIntRect( |
517 m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect()); | 511 m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect()); |
518 owningLayerIsClipped = parentClipRect != LayoutRect::infiniteIntRect(); | 512 return parentClipRect != LayoutRect::infiniteIntRect(); |
519 | |
520 // TODO(schenney): CSS clips are not applied to composited children, and | |
521 // should be via mask or by compositing the parent too. | |
522 // https://bugs.chromium.org/p/chromium/issues/detail?id=615870 | |
523 DCHECK(clippingContainer->style()); | |
524 owningLayerIsMasked = | |
525 owningLayerIsClipped && clippingContainer->style()->hasBorderRadius(); | |
526 } | 513 } |
527 | 514 |
528 const PaintLayer* CompositedLayerMapping::scrollParent() { | 515 const PaintLayer* CompositedLayerMapping::scrollParent() { |
529 const PaintLayer* scrollParent = m_owningLayer.scrollParent(); | 516 const PaintLayer* scrollParent = m_owningLayer.scrollParent(); |
530 if (scrollParent && !scrollParent->needsCompositedScrolling()) | 517 if (scrollParent && !scrollParent->needsCompositedScrolling()) |
531 return nullptr; | 518 return nullptr; |
532 return scrollParent; | 519 return scrollParent; |
533 } | 520 } |
534 | 521 |
535 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() { | 522 bool CompositedLayerMapping::updateGraphicsLayerConfiguration() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 needsDescendantsClippingLayer = false; | 558 needsDescendantsClippingLayer = false; |
572 | 559 |
573 const PaintLayer* scrollParent = this->scrollParent(); | 560 const PaintLayer* scrollParent = this->scrollParent(); |
574 | 561 |
575 // This is required because compositing layers are parented according to the | 562 // This is required because compositing layers are parented according to the |
576 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus, | 563 // z-order hierarchy, yet clipping goes down the layoutObject hierarchy. Thus, |
577 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the | 564 // a PaintLayer can be clipped by a PaintLayer that is an ancestor in the |
578 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further, | 565 // layoutObject hierarchy, but a sibling in the z-order hierarchy. Further, |
579 // that sibling need not be composited at all. In such scenarios, an ancestor | 566 // that sibling need not be composited at all. In such scenarios, an ancestor |
580 // clipping layer is necessary to apply the composited clip for this layer. | 567 // clipping layer is necessary to apply the composited clip for this layer. |
581 bool needsAncestorClip = false; | 568 bool needsAncestorClip = |
582 bool needsAncestorClippingMask = false; | 569 owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent); |
583 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( | 570 |
584 scrollParent, needsAncestorClip, needsAncestorClippingMask); | 571 if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer)) |
585 if (updateClippingLayers(needsAncestorClip, needsAncestorClippingMask, | |
586 needsDescendantsClippingLayer)) | |
587 layerConfigChanged = true; | 572 layerConfigChanged = true; |
588 | 573 |
589 bool scrollingConfigChanged = false; | 574 bool scrollingConfigChanged = false; |
590 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 575 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
591 layerConfigChanged = true; | 576 layerConfigChanged = true; |
592 scrollingConfigChanged = true; | 577 scrollingConfigChanged = true; |
593 } | 578 } |
594 | 579 |
595 // If the outline needs to draw over the composited scrolling contents layer | 580 // If the outline needs to draw over the composited scrolling contents layer |
596 // or scrollbar layers it needs to be drawn into a separate layer. | 581 // 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... |
1108 m_ancestorClippingLayer->setPosition( | 1093 m_ancestorClippingLayer->setPosition( |
1109 FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); | 1094 FloatPoint(parentClipRect.location() - graphicsLayerParentLocation)); |
1110 m_ancestorClippingLayer->setSize(FloatSize(parentClipRect.size())); | 1095 m_ancestorClippingLayer->setSize(FloatSize(parentClipRect.size())); |
1111 | 1096 |
1112 // backgroundRect is relative to compositingContainer, so subtract | 1097 // backgroundRect is relative to compositingContainer, so subtract |
1113 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y | 1098 // snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y |
1114 // to get back to local coords. | 1099 // to get back to local coords. |
1115 m_ancestorClippingLayer->setOffsetFromLayoutObject( | 1100 m_ancestorClippingLayer->setOffsetFromLayoutObject( |
1116 parentClipRect.location() - snappedOffsetFromCompositedAncestor); | 1101 parentClipRect.location() - snappedOffsetFromCompositedAncestor); |
1117 | 1102 |
1118 if (m_ancestorClippingMaskLayer) { | |
1119 m_ancestorClippingMaskLayer->setOffsetFromLayoutObject( | |
1120 m_ancestorClippingLayer->offsetFromLayoutObject()); | |
1121 m_ancestorClippingMaskLayer->setSize(m_ancestorClippingLayer->size()); | |
1122 m_ancestorClippingMaskLayer->setNeedsDisplay(); | |
1123 } | |
1124 | |
1125 // The primary layer is then parented in, and positioned relative to this | 1103 // The primary layer is then parented in, and positioned relative to this |
1126 // clipping layer. | 1104 // clipping layer. |
1127 graphicsLayerParentLocation = parentClipRect.location(); | 1105 graphicsLayerParentLocation = parentClipRect.location(); |
1128 } | 1106 } |
1129 | 1107 |
1130 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( | 1108 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( |
1131 const PaintLayer* compositingStackingContext, | 1109 const PaintLayer* compositingStackingContext, |
1132 const PaintLayer* compositingContainer, | 1110 const PaintLayer* compositingContainer, |
1133 IntPoint graphicsLayerParentLocation) { | 1111 IntPoint graphicsLayerParentLocation) { |
1134 if (!m_overflowControlsHostLayer) | 1112 if (!m_overflowControlsHostLayer) |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 // layer (i.e. if there is nothing actually drawn into the | 1644 // layer (i.e. if there is nothing actually drawn into the |
1667 // background anymore.) | 1645 // background anymore.) |
1668 // "hasPaintedContent" should be calculated in a way that does not take the | 1646 // "hasPaintedContent" should be calculated in a way that does not take the |
1669 // outline into consideration. | 1647 // outline into consideration. |
1670 if (m_backgroundLayer) | 1648 if (m_backgroundLayer) |
1671 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 1649 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
1672 | 1650 |
1673 if (m_decorationOutlineLayer) | 1651 if (m_decorationOutlineLayer) |
1674 m_decorationOutlineLayer->setDrawsContent(true); | 1652 m_decorationOutlineLayer->setDrawsContent(true); |
1675 | 1653 |
1676 if (m_ancestorClippingMaskLayer) | |
1677 m_ancestorClippingMaskLayer->setDrawsContent(true); | |
1678 | |
1679 if (m_maskLayer) | 1654 if (m_maskLayer) |
1680 m_maskLayer->setDrawsContent(true); | 1655 m_maskLayer->setDrawsContent(true); |
1681 | 1656 |
1682 if (m_childClippingMaskLayer) | 1657 if (m_childClippingMaskLayer) |
1683 m_childClippingMaskLayer->setDrawsContent(true); | 1658 m_childClippingMaskLayer->setDrawsContent(true); |
1684 } | 1659 } |
1685 | 1660 |
1686 void CompositedLayerMapping::updateChildrenTransform() { | 1661 void CompositedLayerMapping::updateChildrenTransform() { |
1687 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { | 1662 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { |
1688 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); | 1663 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); |
1689 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); | 1664 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); |
1690 } | 1665 } |
1691 | 1666 |
1692 updateShouldFlattenTransform(); | 1667 updateShouldFlattenTransform(); |
1693 } | 1668 } |
1694 | 1669 |
1695 // Return true if the layers changed. | 1670 // Return true if the layers changed. |
1696 bool CompositedLayerMapping::updateClippingLayers( | 1671 bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, |
1697 bool needsAncestorClip, | 1672 bool needsDescendantClip) { |
1698 bool needsAncestorClippingMask, | |
1699 bool needsDescendantClip) { | |
1700 bool layersChanged = false; | 1673 bool layersChanged = false; |
1701 | 1674 |
1702 if (needsAncestorClip) { | 1675 if (needsAncestorClip) { |
1703 if (!m_ancestorClippingLayer) { | 1676 if (!m_ancestorClippingLayer) { |
1704 m_ancestorClippingLayer = | 1677 m_ancestorClippingLayer = |
1705 createGraphicsLayer(CompositingReasonLayerForAncestorClip); | 1678 createGraphicsLayer(CompositingReasonLayerForAncestorClip); |
1706 m_ancestorClippingLayer->setMasksToBounds(true); | 1679 m_ancestorClippingLayer->setMasksToBounds(true); |
1707 m_ancestorClippingLayer->setShouldFlattenTransform(false); | 1680 m_ancestorClippingLayer->setShouldFlattenTransform(false); |
1708 layersChanged = true; | 1681 layersChanged = true; |
1709 } | 1682 } |
1710 } else if (m_ancestorClippingLayer) { | 1683 } else if (m_ancestorClippingLayer) { |
1711 if (m_ancestorClippingMaskLayer) { | |
1712 m_ancestorClippingMaskLayer->removeFromParent(); | |
1713 m_ancestorClippingMaskLayer = nullptr; | |
1714 } | |
1715 m_ancestorClippingLayer->removeFromParent(); | 1684 m_ancestorClippingLayer->removeFromParent(); |
1716 m_ancestorClippingLayer = nullptr; | 1685 m_ancestorClippingLayer = nullptr; |
1717 layersChanged = true; | 1686 layersChanged = true; |
1718 } | 1687 } |
1719 | 1688 |
1720 if (needsAncestorClippingMask) { | |
1721 DCHECK(m_ancestorClippingLayer); | |
1722 if (!m_ancestorClippingMaskLayer) { | |
1723 m_ancestorClippingMaskLayer = | |
1724 createGraphicsLayer(CompositingReasonLayerForAncestorClippingMask); | |
1725 m_ancestorClippingMaskLayer->setPaintingPhase( | |
1726 GraphicsLayerPaintAncestorClippingMask); | |
1727 m_ancestorClippingLayer->setMaskLayer(m_ancestorClippingMaskLayer.get()); | |
1728 layersChanged = true; | |
1729 } | |
1730 } else if (m_ancestorClippingMaskLayer) { | |
1731 m_ancestorClippingMaskLayer->removeFromParent(); | |
1732 m_ancestorClippingMaskLayer = nullptr; | |
1733 m_ancestorClippingLayer->setMaskLayer(nullptr); | |
1734 layersChanged = true; | |
1735 } | |
1736 | |
1737 if (needsDescendantClip) { | 1689 if (needsDescendantClip) { |
1738 // We don't need a child containment layer if we're the main frame layout | 1690 // We don't need a child containment layer if we're the main frame layout |
1739 // view layer. It's redundant as the frame clip above us will handle this | 1691 // view layer. It's redundant as the frame clip above us will handle this |
1740 // clipping. | 1692 // clipping. |
1741 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { | 1693 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { |
1742 m_childContainmentLayer = | 1694 m_childContainmentLayer = |
1743 createGraphicsLayer(CompositingReasonLayerForDescendantClip); | 1695 createGraphicsLayer(CompositingReasonLayerForDescendantClip); |
1744 m_childContainmentLayer->setMasksToBounds(true); | 1696 m_childContainmentLayer->setMasksToBounds(true); |
1745 layersChanged = true; | 1697 layersChanged = true; |
1746 } | 1698 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 f(mapping->squashingLayer()); | 1908 f(mapping->squashingLayer()); |
1957 | 1909 |
1958 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1910 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
1959 (mode & ApplyToNonScrollingContentLayers)) && | 1911 (mode & ApplyToNonScrollingContentLayers)) && |
1960 mapping->maskLayer()) | 1912 mapping->maskLayer()) |
1961 f(mapping->maskLayer()); | 1913 f(mapping->maskLayer()); |
1962 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1914 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
1963 (mode & ApplyToNonScrollingContentLayers)) && | 1915 (mode & ApplyToNonScrollingContentLayers)) && |
1964 mapping->childClippingMaskLayer()) | 1916 mapping->childClippingMaskLayer()) |
1965 f(mapping->childClippingMaskLayer()); | 1917 f(mapping->childClippingMaskLayer()); |
1966 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | |
1967 (mode & ApplyToNonScrollingContentLayers)) && | |
1968 mapping->ancestorClippingMaskLayer()) | |
1969 f(mapping->ancestorClippingMaskLayer()); | |
1970 | 1918 |
1971 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || | 1919 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || |
1972 (mode & ApplyToNonScrollingContentLayers)) && | 1920 (mode & ApplyToNonScrollingContentLayers)) && |
1973 mapping->backgroundLayer()) | 1921 mapping->backgroundLayer()) |
1974 f(mapping->backgroundLayer()); | 1922 f(mapping->backgroundLayer()); |
1975 | 1923 |
1976 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) | 1924 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) |
1977 f(mapping->layerForHorizontalScrollbar()); | 1925 f(mapping->layerForHorizontalScrollbar()); |
1978 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) | 1926 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) |
1979 f(mapping->layerForVerticalScrollbar()); | 1927 f(mapping->layerForVerticalScrollbar()); |
(...skipping 15 matching lines...) Expand all Loading... |
1995 | 1943 |
1996 void CompositedLayerMapping::updateRenderingContext() { | 1944 void CompositedLayerMapping::updateRenderingContext() { |
1997 // All layers but the squashing layer (which contains 'alien' content) should | 1945 // All layers but the squashing layer (which contains 'alien' content) should |
1998 // be included in this rendering context. | 1946 // be included in this rendering context. |
1999 int id = 0; | 1947 int id = 0; |
2000 | 1948 |
2001 // NB, it is illegal at this point to query an ancestor's compositing state. | 1949 // NB, it is illegal at this point to query an ancestor's compositing state. |
2002 // Some compositing reasons depend on the compositing state of ancestors. So | 1950 // Some compositing reasons depend on the compositing state of ancestors. So |
2003 // if we want a rendering context id for the context root, we cannot ask for | 1951 // if we want a rendering context id for the context root, we cannot ask for |
2004 // the id of its associated WebLayer now; it may not have one yet. We could do | 1952 // the id of its associated WebLayer now; it may not have one yet. We could do |
2005 // a second pass after doing the compositing updates to get these ids, but | 1953 // a second past after doing the compositing updates to get these ids, but |
2006 // this would actually be harmful. We do not want to attach any semantic | 1954 // this would actually be harmful. We do not want to attach any semantic |
2007 // meaning to the context id other than the fact that they group a number of | 1955 // meaning to the context id other than the fact that they group a number of |
2008 // layers together for the sake of 3d sorting. So instead we will ask the | 1956 // layers together for the sake of 3d sorting. So instead we will ask the |
2009 // compositor to vend us an arbitrary, but consistent id. | 1957 // compositor to vend us an arbitrary, but consistent id. |
2010 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { | 1958 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { |
2011 if (Node* node = root->layoutObject()->node()) | 1959 if (Node* node = root->layoutObject()->node()) |
2012 id = static_cast<int>(PtrHash<Node>::hash(node)); | 1960 id = static_cast<int>(PtrHash<Node>::hash(node)); |
2013 } | 1961 } |
2014 | 1962 |
2015 UpdateRenderingContextFunctor functor = {id}; | 1963 UpdateRenderingContextFunctor functor = {id}; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 // Only the topmost layer has a scroll parent. All other layers have a null | 2247 // Only the topmost layer has a scroll parent. All other layers have a null |
2300 // scroll parent. | 2248 // scroll parent. |
2301 if (layer != topmostLayer) | 2249 if (layer != topmostLayer) |
2302 clipParent = 0; | 2250 clipParent = 0; |
2303 | 2251 |
2304 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); | 2252 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); |
2305 } | 2253 } |
2306 | 2254 |
2307 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { | 2255 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { |
2308 const PaintLayer* clipParent = nullptr; | 2256 const PaintLayer* clipParent = nullptr; |
2309 bool haveAncestorClipLayer = false; | 2257 if (!owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent)) { |
2310 bool haveAncestorMaskLayer = false; | |
2311 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( | |
2312 scrollParent, haveAncestorClipLayer, haveAncestorMaskLayer); | |
2313 if (!haveAncestorClipLayer) { | |
2314 clipParent = m_owningLayer.clipParent(); | 2258 clipParent = m_owningLayer.clipParent(); |
2315 if (clipParent) | 2259 if (clipParent) |
2316 clipParent = | 2260 clipParent = |
2317 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); | 2261 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); |
2318 } | 2262 } |
2319 | 2263 |
2320 if (ScrollingCoordinator* scrollingCoordinator = | 2264 if (ScrollingCoordinator* scrollingCoordinator = |
2321 scrollingCoordinatorFromLayer(m_owningLayer)) { | 2265 scrollingCoordinatorFromLayer(m_owningLayer)) { |
2322 GraphicsLayer* topmostLayer = childForSuperlayers(); | 2266 GraphicsLayer* topmostLayer = childForSuperlayers(); |
2323 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), | 2267 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 translation.translate(-offset.width(), -offset.height()); | 2787 translation.translate(-offset.width(), -offset.height()); |
2844 TransformRecorder transformRecorder(context, graphicsLayer, translation); | 2788 TransformRecorder transformRecorder(context, graphicsLayer, translation); |
2845 | 2789 |
2846 // The dirtyRect is in the coords of the painting root. | 2790 // The dirtyRect is in the coords of the painting root. |
2847 IntRect dirtyRect(clip); | 2791 IntRect dirtyRect(clip); |
2848 dirtyRect.move(offset); | 2792 dirtyRect.move(offset); |
2849 | 2793 |
2850 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { | 2794 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { |
2851 LayoutRect bounds = paintInfo.compositedBounds; | 2795 LayoutRect bounds = paintInfo.compositedBounds; |
2852 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); | 2796 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); |
2853 if (paintLayerFlags & PaintLayerPaintingAncestorClippingMaskPhase) | |
2854 bounds.move(offset); | |
2855 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 2797 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
2856 } else { | 2798 } else { |
2857 dirtyRect.move( | 2799 dirtyRect.move( |
2858 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); | 2800 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); |
2859 } | 2801 } |
2860 | 2802 |
2861 #if DCHECK_IS_ON() | 2803 #if DCHECK_IS_ON() |
2862 if (!layoutObject()->view()->frame() || | 2804 if (!layoutObject()->view()->frame() || |
2863 !layoutObject()->view()->frame()->shouldThrottleRendering()) | 2805 !layoutObject()->view()->frame()->shouldThrottleRendering()) |
2864 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); | 2806 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 3064 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
3123 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; | 3065 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; |
3124 else | 3066 else |
3125 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3067 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3126 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) | 3068 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) |
3127 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; | 3069 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; |
3128 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) | 3070 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) |
3129 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; | 3071 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; |
3130 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) | 3072 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) |
3131 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; | 3073 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
3132 if (graphicsLayerPaintingPhase & GraphicsLayerPaintAncestorClippingMask) | |
3133 paintLayerFlags |= PaintLayerPaintingAncestorClippingMaskPhase; | |
3134 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) | 3074 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) |
3135 paintLayerFlags |= PaintLayerPaintingOverflowContents; | 3075 paintLayerFlags |= PaintLayerPaintingOverflowContents; |
3136 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) | 3076 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) |
3137 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; | 3077 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; |
3138 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) | 3078 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) |
3139 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; | 3079 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; |
3140 | 3080 |
3141 if (graphicsLayer == m_backgroundLayer.get()) | 3081 if (graphicsLayer == m_backgroundLayer.get()) |
3142 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; | 3082 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; |
3143 else if (compositor()->fixedRootBackgroundLayer() && | 3083 else if (compositor()->fixedRootBackgroundLayer() && |
3144 m_owningLayer.isRootLayer()) | 3084 m_owningLayer.isRootLayer()) |
3145 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3085 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3146 | 3086 |
3147 if (graphicsLayer == m_graphicsLayer.get() || | 3087 if (graphicsLayer == m_graphicsLayer.get() || |
3148 graphicsLayer == m_foregroundLayer.get() || | 3088 graphicsLayer == m_foregroundLayer.get() || |
3149 graphicsLayer == m_backgroundLayer.get() || | 3089 graphicsLayer == m_backgroundLayer.get() || |
3150 graphicsLayer == m_maskLayer.get() || | 3090 graphicsLayer == m_maskLayer.get() || |
3151 graphicsLayer == m_childClippingMaskLayer.get() || | 3091 graphicsLayer == m_childClippingMaskLayer.get() || |
3152 graphicsLayer == m_scrollingContentsLayer.get() || | 3092 graphicsLayer == m_scrollingContentsLayer.get() || |
3153 graphicsLayer == m_decorationOutlineLayer.get() || | 3093 graphicsLayer == m_decorationOutlineLayer.get()) { |
3154 graphicsLayer == m_ancestorClippingMaskLayer.get()) { | |
3155 bool paintRootBackgroundOntoScrollingContentsLayer = | 3094 bool paintRootBackgroundOntoScrollingContentsLayer = |
3156 m_backgroundPaintsOntoScrollingContentsLayer; | 3095 m_backgroundPaintsOntoScrollingContentsLayer; |
3157 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || | 3096 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || |
3158 (!m_backgroundLayer && !m_foregroundLayer)); | 3097 (!m_backgroundLayer && !m_foregroundLayer)); |
3159 if (paintRootBackgroundOntoScrollingContentsLayer) { | 3098 if (paintRootBackgroundOntoScrollingContentsLayer) { |
3160 if (graphicsLayer == m_scrollingContentsLayer.get()) | 3099 if (graphicsLayer == m_scrollingContentsLayer.get()) |
3161 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 3100 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
3162 else if (!m_backgroundPaintsOntoGraphicsLayer) | 3101 else if (!m_backgroundPaintsOntoGraphicsLayer) |
3163 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3102 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
3164 } | 3103 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3399 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { | 3338 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { |
3400 name = "Squashing Containment Layer"; | 3339 name = "Squashing Containment Layer"; |
3401 } else if (graphicsLayer == m_squashingLayer.get()) { | 3340 } else if (graphicsLayer == m_squashingLayer.get()) { |
3402 name = "Squashing Layer (first squashed layer: " + | 3341 name = "Squashing Layer (first squashed layer: " + |
3403 (m_squashedLayers.size() > 0 | 3342 (m_squashedLayers.size() > 0 |
3404 ? m_squashedLayers[0].paintLayer->debugName() | 3343 ? m_squashedLayers[0].paintLayer->debugName() |
3405 : "") + | 3344 : "") + |
3406 ")"; | 3345 ")"; |
3407 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { | 3346 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { |
3408 name = "Ancestor Clipping Layer"; | 3347 name = "Ancestor Clipping Layer"; |
3409 } else if (graphicsLayer == m_ancestorClippingMaskLayer.get()) { | |
3410 name = "Ancestor Clipping Mask Layer"; | |
3411 } else if (graphicsLayer == m_foregroundLayer.get()) { | 3348 } else if (graphicsLayer == m_foregroundLayer.get()) { |
3412 name = m_owningLayer.debugName() + " (foreground) Layer"; | 3349 name = m_owningLayer.debugName() + " (foreground) Layer"; |
3413 } else if (graphicsLayer == m_backgroundLayer.get()) { | 3350 } else if (graphicsLayer == m_backgroundLayer.get()) { |
3414 name = m_owningLayer.debugName() + " (background) Layer"; | 3351 name = m_owningLayer.debugName() + " (background) Layer"; |
3415 } else if (graphicsLayer == m_childContainmentLayer.get()) { | 3352 } else if (graphicsLayer == m_childContainmentLayer.get()) { |
3416 name = "Child Containment Layer"; | 3353 name = "Child Containment Layer"; |
3417 } else if (graphicsLayer == m_childTransformLayer.get()) { | 3354 } else if (graphicsLayer == m_childTransformLayer.get()) { |
3418 name = "Child Transform Layer"; | 3355 name = "Child Transform Layer"; |
3419 } else if (graphicsLayer == m_maskLayer.get()) { | 3356 } else if (graphicsLayer == m_maskLayer.get()) { |
3420 name = "Mask Layer"; | 3357 name = "Mask Layer"; |
(...skipping 16 matching lines...) Expand all Loading... |
3437 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3374 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
3438 name = "Decoration Layer"; | 3375 name = "Decoration Layer"; |
3439 } else { | 3376 } else { |
3440 ASSERT_NOT_REACHED(); | 3377 ASSERT_NOT_REACHED(); |
3441 } | 3378 } |
3442 | 3379 |
3443 return name; | 3380 return name; |
3444 } | 3381 } |
3445 | 3382 |
3446 } // namespace blink | 3383 } // namespace blink |
OLD | NEW |