Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 groupedMapping(nullptr) {} | 126 groupedMapping(nullptr) {} |
| 127 | 127 |
| 128 PaintLayerRareData::~PaintLayerRareData() {} | 128 PaintLayerRareData::~PaintLayerRareData() {} |
| 129 | 129 |
| 130 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) | 130 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) |
| 131 : m_hasSelfPaintingLayerDescendant(false), | 131 : m_hasSelfPaintingLayerDescendant(false), |
| 132 m_hasSelfPaintingLayerDescendantDirty(false), | 132 m_hasSelfPaintingLayerDescendantDirty(false), |
| 133 m_isRootLayer(layoutObject->isLayoutView()), | 133 m_isRootLayer(layoutObject->isLayoutView()), |
| 134 m_isVisibleContentDirty(true), | 134 m_isVisibleContentDirty(true), |
| 135 m_hasVisibleContent(false), | 135 m_hasVisibleContent(false), |
| 136 m_isVisibleDescendantDirty(false), | 136 m_needsDescendantDependentFlagsUpdate(false), |
| 137 m_hasVisibleDescendant(false), | 137 m_hasVisibleDescendant(false), |
| 138 #if DCHECK_IS_ON() | 138 #if DCHECK_IS_ON() |
| 139 m_needsPositionUpdate(true), | 139 m_needsPositionUpdate(true), |
| 140 #endif | 140 #endif |
| 141 m_is3DTransformedDescendantDirty(true), | 141 m_is3DTransformedDescendantDirty(true), |
| 142 m_has3DTransformedDescendant(false), | 142 m_has3DTransformedDescendant(false), |
| 143 m_containsDirtyOverlayScrollbars(false), | 143 m_containsDirtyOverlayScrollbars(false), |
| 144 m_needsAncestorDependentCompositingInputsUpdate(true), | 144 m_needsAncestorDependentCompositingInputsUpdate(true), |
| 145 m_needsDescendantDependentCompositingInputsUpdate(true), | 145 m_needsDescendantDependentCompositingInputsUpdate(true), |
| 146 m_childNeedsCompositingInputsUpdate(true), | 146 m_childNeedsCompositingInputsUpdate(true), |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 | 304 |
| 305 // FIXME(400589): We would like to do this in | 305 // FIXME(400589): We would like to do this in |
| 306 // PaintLayerScrollableArea::updateAfterLayout, but it depends on the size | 306 // PaintLayerScrollableArea::updateAfterLayout, but it depends on the size |
| 307 // computed by updateLayerPosition. | 307 // computed by updateLayerPosition. |
| 308 if (m_scrollableArea) { | 308 if (m_scrollableArea) { |
| 309 if (ScrollAnimatorBase* scrollAnimator = | 309 if (ScrollAnimatorBase* scrollAnimator = |
| 310 m_scrollableArea->existingScrollAnimator()) | 310 m_scrollableArea->existingScrollAnimator()) |
| 311 scrollAnimator->updateAfterLayout(); | 311 scrollAnimator->updateAfterLayout(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 // FIXME: We should be able to remove this call because we don't care about | |
| 315 // any descendant-dependent flags, but code somewhere else is reading these | |
| 316 // flags and depending on us to update them. | |
| 317 updateDescendantDependentFlags(); | |
|
chrishtr
2016/12/01 16:13:37
This is not needed because it will happen later du
| |
| 318 | |
| 319 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 314 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 320 child->updateLayerPositionRecursive(); | 315 child->updateLayerPositionRecursive(); |
| 321 } | 316 } |
| 322 | 317 |
| 323 void PaintLayer::updateHasSelfPaintingLayerDescendant() const { | 318 void PaintLayer::updateHasSelfPaintingLayerDescendant() const { |
| 324 DCHECK(m_hasSelfPaintingLayerDescendantDirty); | 319 DCHECK(m_hasSelfPaintingLayerDescendantDirty); |
| 325 | 320 |
| 326 m_hasSelfPaintingLayerDescendant = false; | 321 m_hasSelfPaintingLayerDescendant = false; |
| 327 | 322 |
| 328 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { | 323 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 // invalidation code structure. | 629 // invalidation code structure. |
| 635 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, | 630 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, |
| 636 rect); | 631 rect); |
| 637 | 632 |
| 638 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, | 633 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, |
| 639 rect); | 634 rect); |
| 640 } | 635 } |
| 641 | 636 |
| 642 void PaintLayer::dirtyVisibleContentStatus() { | 637 void PaintLayer::dirtyVisibleContentStatus() { |
| 643 m_isVisibleContentDirty = true; | 638 m_isVisibleContentDirty = true; |
| 644 if (parent()) | 639 markAncestorChainForDescendantDependentFlagsUpdate(); |
|
Xianzhu
2016/12/01 17:59:32
This will also set m_needsDescendantDependentFlags
chrishtr
2016/12/01 18:05:22
It's intended yes. It's because visible contents u
| |
| 645 parent()->dirtyAncestorChainVisibleDescendantStatus(); | |
| 646 // Non-self-painting layers paint into their ancestor layer, and count as part | 640 // Non-self-painting layers paint into their ancestor layer, and count as part |
| 647 // of the "visible contents" of the parent, so we need to dirty it. | 641 // of the "visible contents" of the parent, so we need to dirty it. |
| 648 if (!isSelfPaintingLayer()) | 642 if (!isSelfPaintingLayer()) |
| 649 parent()->dirtyVisibleContentStatus(); | 643 parent()->dirtyVisibleContentStatus(); |
| 650 } | 644 } |
| 651 | 645 |
| 652 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) { | 646 void PaintLayer::markAncestorChainForDescendantDependentFlagsUpdate() { |
| 653 if (m_isVisibleContentDirty) | |
| 654 return; | |
| 655 if (hasVisibleContent() == (visibility == EVisibility::Visible)) | |
|
chrishtr
2016/12/01 16:13:37
This is cleanup for what looks like unnecessary co
| |
| 656 return; | |
| 657 dirtyVisibleContentStatus(); | |
| 658 } | |
| 659 | |
| 660 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() { | |
| 661 for (PaintLayer* layer = this; layer; layer = layer->parent()) { | 647 for (PaintLayer* layer = this; layer; layer = layer->parent()) { |
| 662 if (layer->m_isVisibleDescendantDirty) | 648 if (layer->m_needsDescendantDependentFlagsUpdate) |
| 663 break; | 649 break; |
| 664 layer->m_isVisibleDescendantDirty = true; | 650 layer->m_needsDescendantDependentFlagsUpdate = true; |
| 665 } | 651 } |
| 666 } | 652 } |
| 667 | 653 |
| 668 // FIXME: this is quite brute-force. We could be more efficient if we were to | 654 // FIXME: this is quite brute-force. We could be more efficient if we were to |
| 669 // track state and update it as appropriate as changes are made in the layout | 655 // track state and update it as appropriate as changes are made in the layout |
| 670 // tree. | 656 // tree. |
| 671 void PaintLayer::updateScrollingStateAfterCompositingChange() { | 657 void PaintLayer::updateScrollingStateAfterCompositingChange() { |
| 672 TRACE_EVENT0("blink", | 658 TRACE_EVENT0("blink", |
| 673 "PaintLayer::updateScrollingStateAfterCompositingChange"); | 659 "PaintLayer::updateScrollingStateAfterCompositingChange"); |
| 674 m_isAllScrollingContentComposited = true; | 660 m_isAllScrollingContentComposited = true; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 687 } else if (!child->stackingNode()->isStackingContext()) { | 673 } else if (!child->stackingNode()->isStackingContext()) { |
| 688 // If the child is composited, but not a stacking context, it may paint | 674 // If the child is composited, but not a stacking context, it may paint |
| 689 // negative z-index descendants into an ancestor's GraphicsLayer. | 675 // negative z-index descendants into an ancestor's GraphicsLayer. |
| 690 m_isAllScrollingContentComposited = false; | 676 m_isAllScrollingContentComposited = false; |
| 691 return; | 677 return; |
| 692 } | 678 } |
| 693 } | 679 } |
| 694 } | 680 } |
| 695 | 681 |
| 696 void PaintLayer::updateDescendantDependentFlags() { | 682 void PaintLayer::updateDescendantDependentFlags() { |
| 697 if (m_isVisibleDescendantDirty) { | 683 if (m_needsDescendantDependentFlagsUpdate) { |
| 698 m_hasVisibleDescendant = false; | 684 m_hasVisibleDescendant = false; |
| 699 | 685 |
| 700 for (PaintLayer* child = firstChild(); child; | 686 for (PaintLayer* child = firstChild(); child; |
| 701 child = child->nextSibling()) { | 687 child = child->nextSibling()) { |
| 702 child->updateDescendantDependentFlags(); | 688 child->updateDescendantDependentFlags(); |
| 703 | 689 |
| 704 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 690 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
| 705 m_hasVisibleDescendant = true; | 691 m_hasVisibleDescendant = true; |
| 706 } | 692 } |
| 707 | 693 |
| 708 m_isVisibleDescendantDirty = false; | 694 m_needsDescendantDependentFlagsUpdate = false; |
| 709 } | 695 } |
| 710 | 696 |
| 711 if (m_isVisibleContentDirty) { | 697 if (m_isVisibleContentDirty) { |
| 712 bool previouslyHasVisibleContent = m_hasVisibleContent; | 698 bool previouslyHasVisibleContent = m_hasVisibleContent; |
| 713 if (layoutObject()->style()->visibility() == EVisibility::Visible) { | 699 if (layoutObject()->style()->visibility() == EVisibility::Visible) { |
| 714 m_hasVisibleContent = true; | 700 m_hasVisibleContent = true; |
| 715 } else { | 701 } else { |
| 716 // layer may be hidden but still have some visible content, check for this | 702 // layer may be hidden but still have some visible content, check for this |
| 717 m_hasVisibleContent = false; | 703 m_hasVisibleContent = false; |
| 718 LayoutObject* r = layoutObject()->slowFirstChild(); | 704 LayoutObject* r = layoutObject()->slowFirstChild(); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1270 // building up generated content layers. This is ok, since the lists will | 1256 // building up generated content layers. This is ok, since the lists will |
| 1271 // start off dirty in that case anyway. | 1257 // start off dirty in that case anyway. |
| 1272 child->stackingNode()->dirtyStackingContextZOrderLists(); | 1258 child->stackingNode()->dirtyStackingContextZOrderLists(); |
| 1273 } | 1259 } |
| 1274 | 1260 |
| 1275 // Non-self-painting children paint into this layer, so the visible contents | 1261 // Non-self-painting children paint into this layer, so the visible contents |
| 1276 // status of this layer is affected. | 1262 // status of this layer is affected. |
| 1277 if (!child->isSelfPaintingLayer()) | 1263 if (!child->isSelfPaintingLayer()) |
| 1278 dirtyVisibleContentStatus(); | 1264 dirtyVisibleContentStatus(); |
| 1279 | 1265 |
| 1280 dirtyAncestorChainVisibleDescendantStatus(); | 1266 markAncestorChainForDescendantDependentFlagsUpdate(); |
| 1281 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1267 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1282 | 1268 |
| 1283 child->setNeedsRepaint(); | 1269 child->setNeedsRepaint(); |
| 1284 | |
| 1285 child->updateDescendantDependentFlags(); | |
|
chrishtr
2016/12/01 16:13:37
Same here - not necessary.
| |
| 1286 } | 1270 } |
| 1287 | 1271 |
| 1288 PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild) { | 1272 PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild) { |
| 1289 if (oldChild->previousSibling()) | 1273 if (oldChild->previousSibling()) |
| 1290 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); | 1274 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); |
| 1291 if (oldChild->nextSibling()) | 1275 if (oldChild->nextSibling()) |
| 1292 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); | 1276 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); |
| 1293 | 1277 |
| 1294 if (m_first == oldChild) | 1278 if (m_first == oldChild) |
| 1295 m_first = oldChild->nextSibling(); | 1279 m_first = oldChild->nextSibling(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1314 oldChild->setPreviousSibling(0); | 1298 oldChild->setPreviousSibling(0); |
| 1315 oldChild->setNextSibling(0); | 1299 oldChild->setNextSibling(0); |
| 1316 oldChild->m_parent = 0; | 1300 oldChild->m_parent = 0; |
| 1317 | 1301 |
| 1318 // Remove any ancestor overflow layers which descended into the removed child. | 1302 // Remove any ancestor overflow layers which descended into the removed child. |
| 1319 if (oldChild->ancestorOverflowLayer()) | 1303 if (oldChild->ancestorOverflowLayer()) |
| 1320 oldChild->removeAncestorOverflowLayer(oldChild->ancestorOverflowLayer()); | 1304 oldChild->removeAncestorOverflowLayer(oldChild->ancestorOverflowLayer()); |
| 1321 | 1305 |
| 1322 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1306 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1323 | 1307 |
| 1324 oldChild->updateDescendantDependentFlags(); | |
| 1325 | |
| 1326 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1308 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
| 1327 dirtyAncestorChainVisibleDescendantStatus(); | 1309 markAncestorChainForDescendantDependentFlagsUpdate(); |
| 1328 | 1310 |
| 1329 if (oldChild->enclosingPaginationLayer()) | 1311 if (oldChild->enclosingPaginationLayer()) |
| 1330 oldChild->clearPaginationRecursive(); | 1312 oldChild->clearPaginationRecursive(); |
| 1331 | 1313 |
| 1332 setNeedsRepaint(); | 1314 setNeedsRepaint(); |
| 1333 | 1315 |
| 1334 return oldChild; | 1316 return oldChild; |
| 1335 } | 1317 } |
| 1336 | 1318 |
| 1337 void PaintLayer::removeOnlyThisLayerAfterStyleChange() { | 1319 void PaintLayer::removeOnlyThisLayerAfterStyleChange() { |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2999 | 2981 |
| 3000 m_stackingNode->styleDidChange(oldStyle); | 2982 m_stackingNode->styleDidChange(oldStyle); |
| 3001 | 2983 |
| 3002 if (m_scrollableArea) | 2984 if (m_scrollableArea) |
| 3003 m_scrollableArea->updateAfterStyleChange(oldStyle); | 2985 m_scrollableArea->updateAfterStyleChange(oldStyle); |
| 3004 | 2986 |
| 3005 // Overlay scrollbars can make this layer self-painting so we need | 2987 // Overlay scrollbars can make this layer self-painting so we need |
| 3006 // to recompute the bit once scrollbars have been updated. | 2988 // to recompute the bit once scrollbars have been updated. |
| 3007 updateSelfPaintingLayer(); | 2989 updateSelfPaintingLayer(); |
| 3008 | 2990 |
| 3009 updateDescendantDependentFlags(); | |
|
chrishtr
2016/12/01 16:13:37
Same here - not necessary.
| |
| 3010 | |
| 3011 updateTransform(oldStyle, layoutObject()->styleRef()); | 2991 updateTransform(oldStyle, layoutObject()->styleRef()); |
| 3012 updateFilters(oldStyle, layoutObject()->styleRef()); | 2992 updateFilters(oldStyle, layoutObject()->styleRef()); |
| 3013 updateClipPath(oldStyle, layoutObject()->styleRef()); | 2993 updateClipPath(oldStyle, layoutObject()->styleRef()); |
| 3014 | 2994 |
| 3015 setNeedsCompositingInputsUpdate(); | 2995 setNeedsCompositingInputsUpdate(); |
| 3016 } | 2996 } |
| 3017 | 2997 |
| 3018 bool PaintLayer::scrollsOverflow() const { | 2998 bool PaintLayer::scrollsOverflow() const { |
| 3019 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) | 2999 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) |
| 3020 return scrollableArea->scrollsOverflow(); | 3000 return scrollableArea->scrollsOverflow(); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3266 } | 3246 } |
| 3267 | 3247 |
| 3268 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3248 void showLayerTree(const blink::LayoutObject* layoutObject) { |
| 3269 if (!layoutObject) { | 3249 if (!layoutObject) { |
| 3270 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3250 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
| 3271 return; | 3251 return; |
| 3272 } | 3252 } |
| 3273 showLayerTree(layoutObject->enclosingLayer()); | 3253 showLayerTree(layoutObject->enclosingLayer()); |
| 3274 } | 3254 } |
| 3275 #endif | 3255 #endif |
| OLD | NEW |