Chromium Code Reviews| 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()) | |
|
chrishtr
2016/12/02 19:21:47
This looks identical to 495-496.
Stephen Chennney
2016/12/07 21:39:38
Done.
| |
| 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( | |
| 1116 IntSize(parentClipRect.location().x(), parentClipRect.location().y())); | |
| 1117 m_ancestorClippingMaskLayer->setSize(m_ancestorClippingLayer->size()); | |
| 1118 m_ancestorClippingMaskLayer->setNeedsDisplay(); | |
| 1119 } | |
| 1120 | |
| 1099 // The primary layer is then parented in, and positioned relative to this | 1121 // The primary layer is then parented in, and positioned relative to this |
| 1100 // clipping layer. | 1122 // clipping layer. |
| 1101 graphicsLayerParentLocation = parentClipRect.location(); | 1123 graphicsLayerParentLocation = parentClipRect.location(); |
| 1102 } | 1124 } |
| 1103 | 1125 |
| 1104 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( | 1126 void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry( |
| 1105 const PaintLayer* compositingStackingContext, | 1127 const PaintLayer* compositingStackingContext, |
| 1106 const PaintLayer* compositingContainer, | 1128 const PaintLayer* compositingContainer, |
| 1107 IntPoint graphicsLayerParentLocation) { | 1129 IntPoint graphicsLayerParentLocation) { |
| 1108 if (!m_overflowControlsHostLayer) | 1130 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 | 1662 // layer (i.e. if there is nothing actually drawn into the |
| 1641 // background anymore.) | 1663 // background anymore.) |
| 1642 // "hasPaintedContent" should be calculated in a way that does not take the | 1664 // "hasPaintedContent" should be calculated in a way that does not take the |
| 1643 // outline into consideration. | 1665 // outline into consideration. |
| 1644 if (m_backgroundLayer) | 1666 if (m_backgroundLayer) |
| 1645 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 1667 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
| 1646 | 1668 |
| 1647 if (m_decorationOutlineLayer) | 1669 if (m_decorationOutlineLayer) |
| 1648 m_decorationOutlineLayer->setDrawsContent(true); | 1670 m_decorationOutlineLayer->setDrawsContent(true); |
| 1649 | 1671 |
| 1672 if (m_ancestorClippingMaskLayer) | |
| 1673 m_ancestorClippingMaskLayer->setDrawsContent(true); | |
| 1674 | |
| 1650 if (m_maskLayer) | 1675 if (m_maskLayer) |
| 1651 m_maskLayer->setDrawsContent(true); | 1676 m_maskLayer->setDrawsContent(true); |
| 1652 | 1677 |
| 1653 if (m_childClippingMaskLayer) | 1678 if (m_childClippingMaskLayer) |
| 1654 m_childClippingMaskLayer->setDrawsContent(true); | 1679 m_childClippingMaskLayer->setDrawsContent(true); |
| 1655 } | 1680 } |
| 1656 | 1681 |
| 1657 void CompositedLayerMapping::updateChildrenTransform() { | 1682 void CompositedLayerMapping::updateChildrenTransform() { |
| 1658 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { | 1683 if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) { |
| 1659 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); | 1684 childTransformLayer->setTransform(owningLayer().perspectiveTransform()); |
| 1660 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); | 1685 childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin()); |
| 1661 } | 1686 } |
| 1662 | 1687 |
| 1663 updateShouldFlattenTransform(); | 1688 updateShouldFlattenTransform(); |
| 1664 } | 1689 } |
| 1665 | 1690 |
| 1666 // Return true if the layers changed. | 1691 // Return true if the layers changed. |
| 1667 bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, | 1692 bool CompositedLayerMapping::updateClippingLayers( |
| 1668 bool needsDescendantClip) { | 1693 bool needsAncestorClip, |
| 1694 bool needsAncestorClippingMask, | |
| 1695 bool needsDescendantClip) { | |
| 1669 bool layersChanged = false; | 1696 bool layersChanged = false; |
| 1670 | 1697 |
| 1671 if (needsAncestorClip) { | 1698 if (needsAncestorClip) { |
| 1672 if (!m_ancestorClippingLayer) { | 1699 if (!m_ancestorClippingLayer) { |
| 1673 m_ancestorClippingLayer = | 1700 m_ancestorClippingLayer = |
| 1674 createGraphicsLayer(CompositingReasonLayerForAncestorClip); | 1701 createGraphicsLayer(CompositingReasonLayerForAncestorClip); |
| 1675 m_ancestorClippingLayer->setMasksToBounds(true); | 1702 m_ancestorClippingLayer->setMasksToBounds(true); |
| 1676 m_ancestorClippingLayer->setShouldFlattenTransform(false); | 1703 m_ancestorClippingLayer->setShouldFlattenTransform(false); |
| 1677 layersChanged = true; | 1704 layersChanged = true; |
| 1678 } | 1705 } |
| 1679 } else if (m_ancestorClippingLayer) { | 1706 } else if (m_ancestorClippingLayer) { |
| 1707 if (m_ancestorClippingMaskLayer) { | |
| 1708 m_ancestorClippingMaskLayer->removeFromParent(); | |
| 1709 m_ancestorClippingMaskLayer = nullptr; | |
| 1710 } | |
| 1680 m_ancestorClippingLayer->removeFromParent(); | 1711 m_ancestorClippingLayer->removeFromParent(); |
| 1681 m_ancestorClippingLayer = nullptr; | 1712 m_ancestorClippingLayer = nullptr; |
| 1682 layersChanged = true; | 1713 layersChanged = true; |
| 1683 } | 1714 } |
| 1684 | 1715 |
| 1716 if (needsAncestorClippingMask) { | |
| 1717 DCHECK(m_ancestorClippingLayer); | |
| 1718 if (!m_ancestorClippingMaskLayer) { | |
| 1719 m_ancestorClippingMaskLayer = | |
| 1720 createGraphicsLayer(CompositingReasonLayerForAncestorClippingMask); | |
| 1721 m_ancestorClippingMaskLayer->setPaintingPhase( | |
| 1722 GraphicsLayerPaintAncestorClippingMask); | |
| 1723 m_ancestorClippingLayer->setMaskLayer( | |
| 1724 m_ancestorClippingMaskLayer.get()); | |
| 1725 layersChanged = true; | |
| 1726 } | |
| 1727 } else if (m_ancestorClippingLayer && m_ancestorClippingMaskLayer) { | |
|
chrishtr
2016/12/02 19:21:47
Is it strictly necessary to check for m_ancestorCl
Stephen Chennney
2016/12/07 21:39:38
No, it's not necessary, despite me thinking it was
| |
| 1728 m_ancestorClippingMaskLayer->removeFromParent(); | |
| 1729 m_ancestorClippingMaskLayer = nullptr; | |
| 1730 m_ancestorClippingLayer->setMaskLayer(nullptr); | |
| 1731 layersChanged = true; | |
| 1732 } | |
| 1733 | |
| 1685 if (needsDescendantClip) { | 1734 if (needsDescendantClip) { |
| 1686 // We don't need a child containment layer if we're the main frame layout | 1735 // 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 | 1736 // view layer. It's redundant as the frame clip above us will handle this |
| 1688 // clipping. | 1737 // clipping. |
| 1689 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { | 1738 if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) { |
| 1690 m_childContainmentLayer = | 1739 m_childContainmentLayer = |
| 1691 createGraphicsLayer(CompositingReasonLayerForDescendantClip); | 1740 createGraphicsLayer(CompositingReasonLayerForDescendantClip); |
| 1692 m_childContainmentLayer->setMasksToBounds(true); | 1741 m_childContainmentLayer->setMasksToBounds(true); |
| 1693 layersChanged = true; | 1742 layersChanged = true; |
| 1694 } | 1743 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1897 f(mapping->squashingLayer()); | 1946 f(mapping->squashingLayer()); |
| 1898 | 1947 |
| 1899 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1948 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
| 1900 (mode & ApplyToNonScrollingContentLayers)) && | 1949 (mode & ApplyToNonScrollingContentLayers)) && |
| 1901 mapping->maskLayer()) | 1950 mapping->maskLayer()) |
| 1902 f(mapping->maskLayer()); | 1951 f(mapping->maskLayer()); |
| 1903 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | 1952 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || |
| 1904 (mode & ApplyToNonScrollingContentLayers)) && | 1953 (mode & ApplyToNonScrollingContentLayers)) && |
| 1905 mapping->childClippingMaskLayer()) | 1954 mapping->childClippingMaskLayer()) |
| 1906 f(mapping->childClippingMaskLayer()); | 1955 f(mapping->childClippingMaskLayer()); |
| 1956 if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers) || | |
| 1957 (mode & ApplyToNonScrollingContentLayers)) && | |
| 1958 mapping->ancestorClippingMaskLayer()) | |
| 1959 f(mapping->ancestorClippingMaskLayer()); | |
| 1907 | 1960 |
| 1908 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || | 1961 if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers) || |
| 1909 (mode & ApplyToNonScrollingContentLayers)) && | 1962 (mode & ApplyToNonScrollingContentLayers)) && |
| 1910 mapping->backgroundLayer()) | 1963 mapping->backgroundLayer()) |
| 1911 f(mapping->backgroundLayer()); | 1964 f(mapping->backgroundLayer()); |
| 1912 | 1965 |
| 1913 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) | 1966 if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar()) |
| 1914 f(mapping->layerForHorizontalScrollbar()); | 1967 f(mapping->layerForHorizontalScrollbar()); |
| 1915 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) | 1968 if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar()) |
| 1916 f(mapping->layerForVerticalScrollbar()); | 1969 f(mapping->layerForVerticalScrollbar()); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1932 | 1985 |
| 1933 void CompositedLayerMapping::updateRenderingContext() { | 1986 void CompositedLayerMapping::updateRenderingContext() { |
| 1934 // All layers but the squashing layer (which contains 'alien' content) should | 1987 // All layers but the squashing layer (which contains 'alien' content) should |
| 1935 // be included in this rendering context. | 1988 // be included in this rendering context. |
| 1936 int id = 0; | 1989 int id = 0; |
| 1937 | 1990 |
| 1938 // NB, it is illegal at this point to query an ancestor's compositing state. | 1991 // 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 | 1992 // 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 | 1993 // 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 | 1994 // 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 | 1995 // 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 | 1996 // 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 | 1997 // 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 | 1998 // layers together for the sake of 3d sorting. So instead we will ask the |
| 1946 // compositor to vend us an arbitrary, but consistent id. | 1999 // compositor to vend us an arbitrary, but consistent id. |
| 1947 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { | 2000 if (PaintLayer* root = m_owningLayer.renderingContextRoot()) { |
| 1948 if (Node* node = root->layoutObject()->node()) | 2001 if (Node* node = root->layoutObject()->node()) |
| 1949 id = static_cast<int>(PtrHash<Node>::hash(node)); | 2002 id = static_cast<int>(PtrHash<Node>::hash(node)); |
| 1950 } | 2003 } |
| 1951 | 2004 |
| 1952 UpdateRenderingContextFunctor functor = {id}; | 2005 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 | 2289 // Only the topmost layer has a scroll parent. All other layers have a null |
| 2237 // scroll parent. | 2290 // scroll parent. |
| 2238 if (layer != topmostLayer) | 2291 if (layer != topmostLayer) |
| 2239 clipParent = 0; | 2292 clipParent = 0; |
| 2240 | 2293 |
| 2241 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); | 2294 scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent); |
| 2242 } | 2295 } |
| 2243 | 2296 |
| 2244 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { | 2297 void CompositedLayerMapping::updateClipParent(const PaintLayer* scrollParent) { |
| 2245 const PaintLayer* clipParent = nullptr; | 2298 const PaintLayer* clipParent = nullptr; |
| 2246 if (!owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent)) { | 2299 bool haveAncestorClipLayer = false; |
| 2300 bool haveAncestorMaskLayer = false; | |
| 2301 owningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor( | |
| 2302 scrollParent, haveAncestorClipLayer, haveAncestorMaskLayer); | |
| 2303 if (!haveAncestorClipLayer) { | |
| 2247 clipParent = m_owningLayer.clipParent(); | 2304 clipParent = m_owningLayer.clipParent(); |
| 2248 if (clipParent) | 2305 if (clipParent) |
| 2249 clipParent = | 2306 clipParent = |
| 2250 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); | 2307 clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf); |
| 2251 } | 2308 } |
| 2252 | 2309 |
| 2253 if (ScrollingCoordinator* scrollingCoordinator = | 2310 if (ScrollingCoordinator* scrollingCoordinator = |
| 2254 scrollingCoordinatorFromLayer(m_owningLayer)) { | 2311 scrollingCoordinatorFromLayer(m_owningLayer)) { |
| 2255 GraphicsLayer* topmostLayer = childForSuperlayers(); | 2312 GraphicsLayer* topmostLayer = childForSuperlayers(); |
| 2256 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), | 2313 updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2776 translation.translate(-offset.width(), -offset.height()); | 2833 translation.translate(-offset.width(), -offset.height()); |
| 2777 TransformRecorder transformRecorder(context, graphicsLayer, translation); | 2834 TransformRecorder transformRecorder(context, graphicsLayer, translation); |
| 2778 | 2835 |
| 2779 // The dirtyRect is in the coords of the painting root. | 2836 // The dirtyRect is in the coords of the painting root. |
| 2780 IntRect dirtyRect(clip); | 2837 IntRect dirtyRect(clip); |
| 2781 dirtyRect.move(offset); | 2838 dirtyRect.move(offset); |
| 2782 | 2839 |
| 2783 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { | 2840 if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) { |
| 2784 LayoutRect bounds = paintInfo.compositedBounds; | 2841 LayoutRect bounds = paintInfo.compositedBounds; |
| 2785 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); | 2842 bounds.move(paintInfo.paintLayer->subpixelAccumulation()); |
| 2843 if (paintLayerFlags & PaintLayerPaintingAncestorClippingMaskPhase) | |
| 2844 bounds.move(offset); | |
| 2786 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | 2845 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| 2787 } else { | 2846 } else { |
| 2788 dirtyRect.move( | 2847 dirtyRect.move( |
| 2789 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); | 2848 roundedIntSize(paintInfo.paintLayer->subpixelAccumulation())); |
| 2790 } | 2849 } |
| 2791 | 2850 |
| 2792 #if ENABLE(ASSERT) | 2851 #if ENABLE(ASSERT) |
| 2793 if (!layoutObject()->view()->frame() || | 2852 if (!layoutObject()->view()->frame() || |
| 2794 !layoutObject()->view()->frame()->shouldThrottleRendering()) | 2853 !layoutObject()->view()->frame()->shouldThrottleRendering()) |
| 2795 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); | 2854 paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3048 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 3107 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
| 3049 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; | 3108 paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase; |
| 3050 else | 3109 else |
| 3051 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3110 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| 3052 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) | 3111 if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground) |
| 3053 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; | 3112 paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase; |
| 3054 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) | 3113 if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask) |
| 3055 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; | 3114 paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase; |
| 3056 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) | 3115 if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask) |
| 3057 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; | 3116 paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase; |
| 3117 if (graphicsLayerPaintingPhase & GraphicsLayerPaintAncestorClippingMask) | |
| 3118 paintLayerFlags |= PaintLayerPaintingAncestorClippingMaskPhase; | |
| 3058 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) | 3119 if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents) |
| 3059 paintLayerFlags |= PaintLayerPaintingOverflowContents; | 3120 paintLayerFlags |= PaintLayerPaintingOverflowContents; |
| 3060 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) | 3121 if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll) |
| 3061 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; | 3122 paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase; |
| 3062 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) | 3123 if (graphicsLayerPaintingPhase & GraphicsLayerPaintDecoration) |
| 3063 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; | 3124 paintLayerFlags |= PaintLayerPaintingCompositingDecorationPhase; |
| 3064 | 3125 |
| 3065 if (graphicsLayer == m_backgroundLayer.get()) | 3126 if (graphicsLayer == m_backgroundLayer.get()) |
| 3066 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; | 3127 paintLayerFlags |= PaintLayerPaintingRootBackgroundOnly; |
| 3067 else if (compositor()->fixedRootBackgroundLayer() && | 3128 else if (compositor()->fixedRootBackgroundLayer() && |
| 3068 m_owningLayer.isRootLayer()) | 3129 m_owningLayer.isRootLayer()) |
| 3069 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3130 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| 3070 | 3131 |
| 3071 if (graphicsLayer == m_graphicsLayer.get() || | 3132 if (graphicsLayer == m_graphicsLayer.get() || |
| 3072 graphicsLayer == m_foregroundLayer.get() || | 3133 graphicsLayer == m_foregroundLayer.get() || |
| 3073 graphicsLayer == m_backgroundLayer.get() || | 3134 graphicsLayer == m_backgroundLayer.get() || |
| 3074 graphicsLayer == m_maskLayer.get() || | 3135 graphicsLayer == m_maskLayer.get() || |
| 3075 graphicsLayer == m_childClippingMaskLayer.get() || | 3136 graphicsLayer == m_childClippingMaskLayer.get() || |
| 3076 graphicsLayer == m_scrollingContentsLayer.get() || | 3137 graphicsLayer == m_scrollingContentsLayer.get() || |
| 3077 graphicsLayer == m_decorationOutlineLayer.get()) { | 3138 graphicsLayer == m_decorationOutlineLayer.get() || |
| 3139 graphicsLayer == m_ancestorClippingMaskLayer.get()) { | |
| 3078 bool paintRootBackgroundOntoScrollingContentsLayer = | 3140 bool paintRootBackgroundOntoScrollingContentsLayer = |
| 3079 m_backgroundPaintsOntoScrollingContentsLayer; | 3141 m_backgroundPaintsOntoScrollingContentsLayer; |
| 3080 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || | 3142 DCHECK(!paintRootBackgroundOntoScrollingContentsLayer || |
| 3081 (!m_backgroundLayer && !m_foregroundLayer)); | 3143 (!m_backgroundLayer && !m_foregroundLayer)); |
| 3082 if (paintRootBackgroundOntoScrollingContentsLayer) { | 3144 if (paintRootBackgroundOntoScrollingContentsLayer) { |
| 3083 if (graphicsLayer == m_scrollingContentsLayer.get()) | 3145 if (graphicsLayer == m_scrollingContentsLayer.get()) |
| 3084 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; | 3146 paintLayerFlags &= ~PaintLayerPaintingSkipRootBackground; |
| 3085 else if (!m_backgroundPaintsOntoGraphicsLayer) | 3147 else if (!m_backgroundPaintsOntoGraphicsLayer) |
| 3086 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; | 3148 paintLayerFlags |= PaintLayerPaintingSkipRootBackground; |
| 3087 } | 3149 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3322 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { | 3384 } else if (graphicsLayer == m_squashingContainmentLayer.get()) { |
| 3323 name = "Squashing Containment Layer"; | 3385 name = "Squashing Containment Layer"; |
| 3324 } else if (graphicsLayer == m_squashingLayer.get()) { | 3386 } else if (graphicsLayer == m_squashingLayer.get()) { |
| 3325 name = "Squashing Layer (first squashed layer: " + | 3387 name = "Squashing Layer (first squashed layer: " + |
| 3326 (m_squashedLayers.size() > 0 | 3388 (m_squashedLayers.size() > 0 |
| 3327 ? m_squashedLayers[0].paintLayer->debugName() | 3389 ? m_squashedLayers[0].paintLayer->debugName() |
| 3328 : "") + | 3390 : "") + |
| 3329 ")"; | 3391 ")"; |
| 3330 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { | 3392 } else if (graphicsLayer == m_ancestorClippingLayer.get()) { |
| 3331 name = "Ancestor Clipping Layer"; | 3393 name = "Ancestor Clipping Layer"; |
| 3394 } else if (graphicsLayer == m_ancestorClippingMaskLayer.get()) { | |
| 3395 name = "Ancestor Clipping Mask Layer"; | |
| 3332 } else if (graphicsLayer == m_foregroundLayer.get()) { | 3396 } else if (graphicsLayer == m_foregroundLayer.get()) { |
| 3333 name = m_owningLayer.debugName() + " (foreground) Layer"; | 3397 name = m_owningLayer.debugName() + " (foreground) Layer"; |
| 3334 } else if (graphicsLayer == m_backgroundLayer.get()) { | 3398 } else if (graphicsLayer == m_backgroundLayer.get()) { |
| 3335 name = m_owningLayer.debugName() + " (background) Layer"; | 3399 name = m_owningLayer.debugName() + " (background) Layer"; |
| 3336 } else if (graphicsLayer == m_childContainmentLayer.get()) { | 3400 } else if (graphicsLayer == m_childContainmentLayer.get()) { |
| 3337 name = "Child Containment Layer"; | 3401 name = "Child Containment Layer"; |
| 3338 } else if (graphicsLayer == m_childTransformLayer.get()) { | 3402 } else if (graphicsLayer == m_childTransformLayer.get()) { |
| 3339 name = "Child Transform Layer"; | 3403 name = "Child Transform Layer"; |
| 3340 } else if (graphicsLayer == m_maskLayer.get()) { | 3404 } else if (graphicsLayer == m_maskLayer.get()) { |
| 3341 name = "Mask Layer"; | 3405 name = "Mask Layer"; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 3358 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3422 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
| 3359 name = "Decoration Layer"; | 3423 name = "Decoration Layer"; |
| 3360 } else { | 3424 } else { |
| 3361 ASSERT_NOT_REACHED(); | 3425 ASSERT_NOT_REACHED(); |
| 3362 } | 3426 } |
| 3363 | 3427 |
| 3364 return name; | 3428 return name; |
| 3365 } | 3429 } |
| 3366 | 3430 |
| 3367 } // namespace blink | 3431 } // namespace blink |
| OLD | NEW |