| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // ancestors further. | 323 // ancestors further. |
| 324 if (layer->isSelfPaintingLayer()) { | 324 if (layer->isSelfPaintingLayer()) { |
| 325 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || | 325 DCHECK(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || |
| 326 parent()->m_hasSelfPaintingLayerDescendant); | 326 parent()->m_hasSelfPaintingLayerDescendant); |
| 327 break; | 327 break; |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 bool PaintLayer::sticksToViewport() const { | 332 bool PaintLayer::sticksToViewport() const { |
| 333 if (layoutObject()->style()->position() != FixedPosition && | 333 if (layoutObject()->style()->position() != EPosition::kFixed && |
| 334 layoutObject()->style()->position() != StickyPosition) | 334 layoutObject()->style()->position() != EPosition::kSticky) |
| 335 return false; | 335 return false; |
| 336 | 336 |
| 337 // TODO(pdr): This approach of calculating the nearest scroll node is O(n). | 337 // TODO(pdr): This approach of calculating the nearest scroll node is O(n). |
| 338 // An option for improving this is to cache the nearest scroll node in | 338 // An option for improving this is to cache the nearest scroll node in |
| 339 // the local border box properties. | 339 // the local border box properties. |
| 340 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 340 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 341 const auto* viewProperties = layoutObject()->view()->paintProperties(); | 341 const auto* viewProperties = layoutObject()->view()->paintProperties(); |
| 342 const ScrollPaintPropertyNode* ancestorTargetScrollNode; | 342 const ScrollPaintPropertyNode* ancestorTargetScrollNode; |
| 343 if (layoutObject()->style()->position() == FixedPosition) { | 343 if (layoutObject()->style()->position() == EPosition::kFixed) { |
| 344 ancestorTargetScrollNode = viewProperties->localBorderBoxProperties() | 344 ancestorTargetScrollNode = viewProperties->localBorderBoxProperties() |
| 345 ->transform() | 345 ->transform() |
| 346 ->findEnclosingScrollNode(); | 346 ->findEnclosingScrollNode(); |
| 347 } else { | 347 } else { |
| 348 ancestorTargetScrollNode = viewProperties->contentsProperties() | 348 ancestorTargetScrollNode = viewProperties->contentsProperties() |
| 349 ->transform() | 349 ->transform() |
| 350 ->findEnclosingScrollNode(); | 350 ->findEnclosingScrollNode(); |
| 351 } | 351 } |
| 352 | 352 |
| 353 const auto* properties = layoutObject()->paintProperties(); | 353 const auto* properties = layoutObject()->paintProperties(); |
| 354 const auto* transform = properties->localBorderBoxProperties()->transform(); | 354 const auto* transform = properties->localBorderBoxProperties()->transform(); |
| 355 return transform->findEnclosingScrollNode() == ancestorTargetScrollNode; | 355 return transform->findEnclosingScrollNode() == ancestorTargetScrollNode; |
| 356 } | 356 } |
| 357 | 357 |
| 358 return (layoutObject()->style()->position() == FixedPosition && | 358 return (layoutObject()->style()->position() == EPosition::kFixed && |
| 359 layoutObject()->containerForFixedPosition() == | 359 layoutObject()->containerForFixedPosition() == |
| 360 layoutObject()->view()) || | 360 layoutObject()->view()) || |
| 361 (layoutObject()->style()->position() == StickyPosition && | 361 (layoutObject()->style()->position() == EPosition::kSticky && |
| 362 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root())); | 362 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root())); |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { | 365 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { |
| 366 if (sticksToViewport() != other->sticksToViewport()) | 366 if (sticksToViewport() != other->sticksToViewport()) |
| 367 return true; | 367 return true; |
| 368 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 368 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void PaintLayer::updateLayerPositionsAfterOverflowScroll() { | 371 void PaintLayer::updateLayerPositionsAfterOverflowScroll() { |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 } | 2678 } |
| 2679 | 2679 |
| 2680 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const { | 2680 bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const { |
| 2681 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 2681 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
| 2682 return transform() && | 2682 return transform() && |
| 2683 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || | 2683 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || |
| 2684 compositingState() != PaintsIntoOwnBacking); | 2684 compositingState() != PaintsIntoOwnBacking); |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 return (transform() || | 2687 return (transform() || |
| 2688 layoutObject()->style()->position() == FixedPosition) && | 2688 layoutObject()->style()->position() == EPosition::kFixed) && |
| 2689 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || | 2689 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || |
| 2690 compositingState() != PaintsIntoOwnBacking); | 2690 compositingState() != PaintsIntoOwnBacking); |
| 2691 } | 2691 } |
| 2692 | 2692 |
| 2693 bool PaintLayer::compositesWithTransform() const { | 2693 bool PaintLayer::compositesWithTransform() const { |
| 2694 return transformAncestor() || transform(); | 2694 return transformAncestor() || transform(); |
| 2695 } | 2695 } |
| 2696 | 2696 |
| 2697 bool PaintLayer::compositesWithOpacity() const { | 2697 bool PaintLayer::compositesWithOpacity() const { |
| 2698 return opacityAncestor() || layoutObject()->style()->hasOpacity(); | 2698 return opacityAncestor() || layoutObject()->style()->hasOpacity(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2711 | 2711 |
| 2712 if (paintsWithFilters() && | 2712 if (paintsWithFilters() && |
| 2713 layoutObject()->style()->filter().hasFilterThatAffectsOpacity()) | 2713 layoutObject()->style()->filter().hasFilterThatAffectsOpacity()) |
| 2714 return false; | 2714 return false; |
| 2715 | 2715 |
| 2716 // FIXME: Handle simple transforms. | 2716 // FIXME: Handle simple transforms. |
| 2717 if (transform() && compositingState() != PaintsIntoOwnBacking) | 2717 if (transform() && compositingState() != PaintsIntoOwnBacking) |
| 2718 return false; | 2718 return false; |
| 2719 | 2719 |
| 2720 if (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() && | 2720 if (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() && |
| 2721 layoutObject()->style()->position() == FixedPosition && | 2721 layoutObject()->style()->position() == EPosition::kFixed && |
| 2722 compositingState() != PaintsIntoOwnBacking) | 2722 compositingState() != PaintsIntoOwnBacking) |
| 2723 return false; | 2723 return false; |
| 2724 | 2724 |
| 2725 // This function should not be called when layer-lists are dirty. | 2725 // This function should not be called when layer-lists are dirty. |
| 2726 // TODO(schenney) This check never hits in layout tests or most platforms, but | 2726 // TODO(schenney) This check never hits in layout tests or most platforms, but |
| 2727 // does hit in PopupBlockerBrowserTest.AllowPopupThroughContentSetting on | 2727 // does hit in PopupBlockerBrowserTest.AllowPopupThroughContentSetting on |
| 2728 // Win 7 Test Builder. | 2728 // Win 7 Test Builder. |
| 2729 if (m_stackingNode->zOrderListsDirty()) | 2729 if (m_stackingNode->zOrderListsDirty()) |
| 2730 return false; | 2730 return false; |
| 2731 | 2731 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3218 } | 3218 } |
| 3219 | 3219 |
| 3220 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3220 void showLayerTree(const blink::LayoutObject* layoutObject) { |
| 3221 if (!layoutObject) { | 3221 if (!layoutObject) { |
| 3222 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3222 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
| 3223 return; | 3223 return; |
| 3224 } | 3224 } |
| 3225 showLayerTree(layoutObject->enclosingLayer()); | 3225 showLayerTree(layoutObject->enclosingLayer()); |
| 3226 } | 3226 } |
| 3227 #endif | 3227 #endif |
| OLD | NEW |