| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "core/layout/LayoutPart.h" | 61 #include "core/layout/LayoutPart.h" |
| 62 #include "core/layout/LayoutTreeAsText.h" | 62 #include "core/layout/LayoutTreeAsText.h" |
| 63 #include "core/layout/LayoutView.h" | 63 #include "core/layout/LayoutView.h" |
| 64 #include "core/layout/api/LayoutPartItem.h" | 64 #include "core/layout/api/LayoutPartItem.h" |
| 65 #include "core/layout/api/LayoutViewItem.h" | 65 #include "core/layout/api/LayoutViewItem.h" |
| 66 #include "core/layout/compositing/CompositedLayerMapping.h" | 66 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 67 #include "core/layout/compositing/PaintLayerCompositor.h" | 67 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 68 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 68 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 69 #include "core/layout/svg/LayoutSVGRoot.h" | 69 #include "core/layout/svg/LayoutSVGRoot.h" |
| 70 #include "core/page/Page.h" | 70 #include "core/page/Page.h" |
| 71 #include "core/page/scrolling/RootScrollerController.h" |
| 71 #include "core/page/scrolling/ScrollingCoordinator.h" | 72 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 72 #include "core/paint/BoxReflectionUtils.h" | 73 #include "core/paint/BoxReflectionUtils.h" |
| 73 #include "core/paint/FilterEffectBuilder.h" | 74 #include "core/paint/FilterEffectBuilder.h" |
| 74 #include "core/paint/ObjectPaintInvalidator.h" | 75 #include "core/paint/ObjectPaintInvalidator.h" |
| 75 #include "core/paint/PaintTiming.h" | 76 #include "core/paint/PaintTiming.h" |
| 76 #include "platform/LengthFunctions.h" | 77 #include "platform/LengthFunctions.h" |
| 77 #include "platform/RuntimeEnabledFeatures.h" | 78 #include "platform/RuntimeEnabledFeatures.h" |
| 78 #include "platform/geometry/FloatPoint3D.h" | 79 #include "platform/geometry/FloatPoint3D.h" |
| 79 #include "platform/geometry/FloatRect.h" | 80 #include "platform/geometry/FloatRect.h" |
| 80 #include "platform/geometry/TransformState.h" | 81 #include "platform/geometry/TransformState.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 m_hasVisibleContent(false), | 135 m_hasVisibleContent(false), |
| 135 m_needsDescendantDependentFlagsUpdate(true), | 136 m_needsDescendantDependentFlagsUpdate(true), |
| 136 m_hasVisibleDescendant(false), | 137 m_hasVisibleDescendant(false), |
| 137 #if DCHECK_IS_ON() | 138 #if DCHECK_IS_ON() |
| 138 m_needsPositionUpdate(true), | 139 m_needsPositionUpdate(true), |
| 139 #endif | 140 #endif |
| 140 m_is3DTransformedDescendantDirty(true), | 141 m_is3DTransformedDescendantDirty(true), |
| 141 m_has3DTransformedDescendant(false), | 142 m_has3DTransformedDescendant(false), |
| 142 m_containsDirtyOverlayScrollbars(false), | 143 m_containsDirtyOverlayScrollbars(false), |
| 143 m_needsAncestorDependentCompositingInputsUpdate(true), | 144 m_needsAncestorDependentCompositingInputsUpdate(true), |
| 144 m_needsDescendantDependentCompositingInputsUpdate(true), | |
| 145 m_childNeedsCompositingInputsUpdate(true), | 145 m_childNeedsCompositingInputsUpdate(true), |
| 146 m_hasCompositingDescendant(false), | 146 m_hasCompositingDescendant(false), |
| 147 m_isAllScrollingContentComposited(false), | 147 m_isAllScrollingContentComposited(false), |
| 148 m_shouldIsolateCompositedDescendants(false), | 148 m_shouldIsolateCompositedDescendants(false), |
| 149 m_lostGroupedMapping(false), | 149 m_lostGroupedMapping(false), |
| 150 m_needsRepaint(false), | 150 m_needsRepaint(false), |
| 151 m_previousPaintResult(FullyPainted), | 151 m_previousPaintResult(FullyPainted), |
| 152 m_needsPaintPhaseDescendantOutlines(false), | 152 m_needsPaintPhaseDescendantOutlines(false), |
| 153 m_previousPaintPhaseDescendantOutlinesWasEmpty(false), | 153 m_previousPaintPhaseDescendantOutlinesWasEmpty(false), |
| 154 m_needsPaintPhaseFloat(false), | 154 m_needsPaintPhaseFloat(false), |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // negative z-index descendants into an ancestor's GraphicsLayer. | 667 // negative z-index descendants into an ancestor's GraphicsLayer. |
| 668 m_isAllScrollingContentComposited = false; | 668 m_isAllScrollingContentComposited = false; |
| 669 return; | 669 return; |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 | 673 |
| 674 void PaintLayer::updateDescendantDependentFlags() { | 674 void PaintLayer::updateDescendantDependentFlags() { |
| 675 if (m_needsDescendantDependentFlagsUpdate) { | 675 if (m_needsDescendantDependentFlagsUpdate) { |
| 676 m_hasVisibleDescendant = false; | 676 m_hasVisibleDescendant = false; |
| 677 m_hasNonIsolatedDescendantWithBlendMode = false; |
| 678 m_hasDescendantWithClipPath = false; |
| 679 m_hasRootScrollerAsDescendant = false; |
| 677 | 680 |
| 678 for (PaintLayer* child = firstChild(); child; | 681 for (PaintLayer* child = firstChild(); child; |
| 679 child = child->nextSibling()) { | 682 child = child->nextSibling()) { |
| 680 child->updateDescendantDependentFlags(); | 683 child->updateDescendantDependentFlags(); |
| 681 | 684 |
| 682 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 685 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
| 683 m_hasVisibleDescendant = true; | 686 m_hasVisibleDescendant = true; |
| 687 |
| 688 m_hasNonIsolatedDescendantWithBlendMode |= |
| 689 (!child->stackingNode()->isStackingContext() && |
| 690 child->hasNonIsolatedDescendantWithBlendMode()) || |
| 691 child->layoutObject()->styleRef().hasBlendMode(); |
| 692 |
| 693 m_hasDescendantWithClipPath |= child->hasDescendantWithClipPath() || |
| 694 child->layoutObject()->hasClipPath(); |
| 695 |
| 696 m_hasRootScrollerAsDescendant |= child->hasRootScrollerAsDescendant() || |
| 697 (child == |
| 698 child->layoutObject() |
| 699 ->document() |
| 700 .rootScrollerController() |
| 701 ->rootScrollerPaintLayer()); |
| 684 } | 702 } |
| 685 | 703 |
| 686 m_needsDescendantDependentFlagsUpdate = false; | 704 m_needsDescendantDependentFlagsUpdate = false; |
| 687 } | 705 } |
| 688 | 706 |
| 689 bool previouslyHasVisibleContent = m_hasVisibleContent; | 707 bool previouslyHasVisibleContent = m_hasVisibleContent; |
| 690 if (layoutObject()->style()->visibility() == EVisibility::Visible) { | 708 if (layoutObject()->style()->visibility() == EVisibility::Visible) { |
| 691 m_hasVisibleContent = true; | 709 m_hasVisibleContent = true; |
| 692 } else { | 710 } else { |
| 693 // layer may be hidden but still have some visible content, check for this | 711 // layer may be hidden but still have some visible content, check for this |
| (...skipping 17 matching lines...) Expand all Loading... |
| 711 if (r == layoutObject()) | 729 if (r == layoutObject()) |
| 712 r = 0; | 730 r = 0; |
| 713 } while (r && !r->nextSibling()); | 731 } while (r && !r->nextSibling()); |
| 714 if (r) | 732 if (r) |
| 715 r = r->nextSibling(); | 733 r = r->nextSibling(); |
| 716 } | 734 } |
| 717 } | 735 } |
| 718 } | 736 } |
| 719 | 737 |
| 720 if (hasVisibleContent() != previouslyHasVisibleContent) { | 738 if (hasVisibleContent() != previouslyHasVisibleContent) { |
| 721 setNeedsCompositingInputsUpdate(); | 739 setNeedsCompositingInputsUpdateInternal(); |
| 722 // We need to tell m_layoutObject to recheck its rect because we | 740 // We need to tell m_layoutObject to recheck its rect because we |
| 723 // pretend that invisible LayoutObjects have 0x0 rects. Changing | 741 // pretend that invisible LayoutObjects have 0x0 rects. Changing |
| 724 // visibility therefore changes our rect and we need to visit | 742 // visibility therefore changes our rect and we need to visit |
| 725 // this LayoutObject during the invalidateTreeIfNeeded walk. | 743 // this LayoutObject during the invalidateTreeIfNeeded walk. |
| 726 m_layoutObject->setMayNeedPaintInvalidation(); | 744 m_layoutObject->setMayNeedPaintInvalidation(); |
| 727 } | 745 } |
| 728 } | 746 } |
| 729 | 747 |
| 730 void PaintLayer::dirty3DTransformedDescendantStatus() { | 748 void PaintLayer::dirty3DTransformedDescendantStatus() { |
| 731 PaintLayerStackingNode* stackingNode = | 749 PaintLayerStackingNode* stackingNode = |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 for (PaintLayer* curr = compositingContainer(); curr; | 1001 for (PaintLayer* curr = compositingContainer(); curr; |
| 984 curr = curr->compositingContainer()) { | 1002 curr = curr->compositingContainer()) { |
| 985 if (curr->isPaintInvalidationContainer()) | 1003 if (curr->isPaintInvalidationContainer()) |
| 986 return curr; | 1004 return curr; |
| 987 } | 1005 } |
| 988 | 1006 |
| 989 return nullptr; | 1007 return nullptr; |
| 990 } | 1008 } |
| 991 | 1009 |
| 992 void PaintLayer::setNeedsCompositingInputsUpdate() { | 1010 void PaintLayer::setNeedsCompositingInputsUpdate() { |
| 1011 setNeedsCompositingInputsUpdateInternal(); |
| 1012 |
| 1013 // TODO(chrishtr): This is a bit of a heavy hammer, because not all |
| 1014 // things which require compositing inputs update require a descendant- |
| 1015 // dependent flags udpate. Reduce call sites after SPv2 launch allows |
| 1016 /// removal of CompositingInputsUpdater. |
| 1017 markAncestorChainForDescendantDependentFlagsUpdate(); |
| 1018 } |
| 1019 |
| 1020 void PaintLayer::setNeedsCompositingInputsUpdateInternal() { |
| 993 m_needsAncestorDependentCompositingInputsUpdate = true; | 1021 m_needsAncestorDependentCompositingInputsUpdate = true; |
| 994 m_needsDescendantDependentCompositingInputsUpdate = true; | |
| 995 | 1022 |
| 996 for (PaintLayer* current = this; | 1023 for (PaintLayer* current = this; |
| 997 current && !current->m_childNeedsCompositingInputsUpdate; | 1024 current && !current->m_childNeedsCompositingInputsUpdate; |
| 998 current = current->parent()) | 1025 current = current->parent()) |
| 999 current->m_childNeedsCompositingInputsUpdate = true; | 1026 current->m_childNeedsCompositingInputsUpdate = true; |
| 1000 | 1027 |
| 1001 compositor()->setNeedsCompositingUpdate( | 1028 compositor()->setNeedsCompositingUpdate( |
| 1002 CompositingUpdateAfterCompositingInputChange); | 1029 CompositingUpdateAfterCompositingInputChange); |
| 1003 } | 1030 } |
| 1004 | 1031 |
| 1005 void PaintLayer::updateAncestorDependentCompositingInputs( | 1032 void PaintLayer::updateAncestorDependentCompositingInputs( |
| 1006 const AncestorDependentCompositingInputs& compositingInputs, | 1033 const AncestorDependentCompositingInputs& compositingInputs, |
| 1007 bool hasAncestorWithClipPath) { | 1034 bool hasAncestorWithClipPath) { |
| 1008 m_ancestorDependentCompositingInputs = | 1035 m_ancestorDependentCompositingInputs = |
| 1009 makeUnique<AncestorDependentCompositingInputs>(compositingInputs); | 1036 makeUnique<AncestorDependentCompositingInputs>(compositingInputs); |
| 1010 m_hasAncestorWithClipPath = hasAncestorWithClipPath; | 1037 m_hasAncestorWithClipPath = hasAncestorWithClipPath; |
| 1011 m_needsAncestorDependentCompositingInputsUpdate = false; | 1038 m_needsAncestorDependentCompositingInputsUpdate = false; |
| 1012 } | 1039 } |
| 1013 | 1040 |
| 1014 void PaintLayer::updateDescendantDependentCompositingInputs( | |
| 1015 bool hasDescendantWithClipPath, | |
| 1016 bool hasNonIsolatedDescendantWithBlendMode, | |
| 1017 bool hasRootScrollerAsDescendant) { | |
| 1018 m_hasDescendantWithClipPath = hasDescendantWithClipPath; | |
| 1019 m_hasNonIsolatedDescendantWithBlendMode = | |
| 1020 hasNonIsolatedDescendantWithBlendMode; | |
| 1021 m_hasRootScrollerAsDescendant = hasRootScrollerAsDescendant; | |
| 1022 m_needsDescendantDependentCompositingInputsUpdate = false; | |
| 1023 } | |
| 1024 | |
| 1025 void PaintLayer::didUpdateCompositingInputs() { | 1041 void PaintLayer::didUpdateCompositingInputs() { |
| 1026 DCHECK(!needsCompositingInputsUpdate()); | 1042 DCHECK(!needsCompositingInputsUpdate()); |
| 1027 m_childNeedsCompositingInputsUpdate = false; | 1043 m_childNeedsCompositingInputsUpdate = false; |
| 1028 if (m_scrollableArea) | 1044 if (m_scrollableArea) |
| 1029 m_scrollableArea->updateNeedsCompositedScrolling(); | 1045 m_scrollableArea->updateNeedsCompositedScrolling(); |
| 1030 } | 1046 } |
| 1031 | 1047 |
| 1032 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const { | 1048 bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const { |
| 1033 DCHECK(!m_needsDescendantDependentCompositingInputsUpdate); | |
| 1034 if (m_hasNonIsolatedDescendantWithBlendMode) | 1049 if (m_hasNonIsolatedDescendantWithBlendMode) |
| 1035 return true; | 1050 return true; |
| 1036 if (layoutObject()->isSVGRoot()) | 1051 if (layoutObject()->isSVGRoot()) |
| 1037 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants(); | 1052 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants(); |
| 1038 return false; | 1053 return false; |
| 1039 } | 1054 } |
| 1040 | 1055 |
| 1041 void PaintLayer::setCompositingReasons(CompositingReasons reasons, | 1056 void PaintLayer::setCompositingReasons(CompositingReasons reasons, |
| 1042 CompositingReasons mask) { | 1057 CompositingReasons mask) { |
| 1043 CompositingReasons oldReasons = | 1058 CompositingReasons oldReasons = |
| (...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3208 #endif | 3223 #endif |
| 3209 | 3224 |
| 3210 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() | 3225 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() |
| 3211 : m_disabler(&gCompositingQueryMode, CompositingQueriesAreAllowed) {} | 3226 : m_disabler(&gCompositingQueryMode, CompositingQueriesAreAllowed) {} |
| 3212 | 3227 |
| 3213 } // namespace blink | 3228 } // namespace blink |
| 3214 | 3229 |
| 3215 #ifndef NDEBUG | 3230 #ifndef NDEBUG |
| 3216 // FIXME: Rename? | 3231 // FIXME: Rename? |
| 3217 void showLayerTree(const blink::PaintLayer* layer) { | 3232 void showLayerTree(const blink::PaintLayer* layer) { |
| 3233 blink::DisableCompositingQueryAsserts disabler; |
| 3218 if (!layer) { | 3234 if (!layer) { |
| 3219 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3235 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
| 3220 return; | 3236 return; |
| 3221 } | 3237 } |
| 3222 | 3238 |
| 3223 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) { | 3239 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) { |
| 3224 WTF::String output = externalRepresentation( | 3240 WTF::String output = externalRepresentation( |
| 3225 frame, | 3241 frame, |
| 3226 blink::LayoutAsTextShowAllLayers | blink::LayoutAsTextShowLayerNesting | | 3242 blink::LayoutAsTextShowAllLayers | blink::LayoutAsTextShowLayerNesting | |
| 3227 blink::LayoutAsTextShowCompositedLayers | | 3243 blink::LayoutAsTextShowCompositedLayers | |
| 3228 blink::LayoutAsTextShowAddresses | | 3244 blink::LayoutAsTextShowAddresses | |
| 3229 blink::LayoutAsTextShowIDAndClass | | 3245 blink::LayoutAsTextShowIDAndClass | |
| 3230 blink::LayoutAsTextDontUpdateLayout | | 3246 blink::LayoutAsTextDontUpdateLayout | |
| 3231 blink::LayoutAsTextShowLayoutState, | 3247 blink::LayoutAsTextShowLayoutState, |
| 3232 layer); | 3248 layer); |
| 3233 LOG(INFO) << output.utf8().data(); | 3249 LOG(INFO) << output.utf8().data(); |
| 3234 } | 3250 } |
| 3235 } | 3251 } |
| 3236 | 3252 |
| 3237 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3253 void showLayerTree(const blink::LayoutObject* layoutObject) { |
| 3238 if (!layoutObject) { | 3254 if (!layoutObject) { |
| 3239 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3255 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
| 3240 return; | 3256 return; |
| 3241 } | 3257 } |
| 3242 showLayerTree(layoutObject->enclosingLayer()); | 3258 showLayerTree(layoutObject->enclosingLayer()); |
| 3243 } | 3259 } |
| 3244 #endif | 3260 #endif |
| OLD | NEW |