Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1294233004: Subtree caching implementation in blink-core (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't mark non-self-painting layers for needsRepaint Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 , m_has3DTransformedDescendant(false) 116 , m_has3DTransformedDescendant(false)
117 , m_containsDirtyOverlayScrollbars(false) 117 , m_containsDirtyOverlayScrollbars(false)
118 , m_hasFilterInfo(false) 118 , m_hasFilterInfo(false)
119 , m_needsAncestorDependentCompositingInputsUpdate(true) 119 , m_needsAncestorDependentCompositingInputsUpdate(true)
120 , m_needsDescendantDependentCompositingInputsUpdate(true) 120 , m_needsDescendantDependentCompositingInputsUpdate(true)
121 , m_childNeedsCompositingInputsUpdate(true) 121 , m_childNeedsCompositingInputsUpdate(true)
122 , m_hasCompositingDescendant(false) 122 , m_hasCompositingDescendant(false)
123 , m_hasNonCompositedChild(false) 123 , m_hasNonCompositedChild(false)
124 , m_shouldIsolateCompositedDescendants(false) 124 , m_shouldIsolateCompositedDescendants(false)
125 , m_lostGroupedMapping(false) 125 , m_lostGroupedMapping(false)
126 , m_needsRepaint(false)
126 , m_layoutObject(layoutObject) 127 , m_layoutObject(layoutObject)
127 , m_parent(0) 128 , m_parent(0)
128 , m_previous(0) 129 , m_previous(0)
129 , m_next(0) 130 , m_next(0)
130 , m_first(0) 131 , m_first(0)
131 , m_last(0) 132 , m_last(0)
132 , m_staticInlinePosition(0) 133 , m_staticInlinePosition(0)
133 , m_staticBlockPosition(0) 134 , m_staticBlockPosition(0)
134 , m_enclosingPaginationLayer(0) 135 , m_enclosingPaginationLayer(0)
135 , m_potentialCompositingReasonsFromStyle(CompositingReasonNone) 136 , m_potentialCompositingReasonsFromStyle(CompositingReasonNone)
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 { 852 {
852 const AncestorDependentCompositingInputs& properties = ancestorDependentComp ositingInputs(); 853 const AncestorDependentCompositingInputs& properties = ancestorDependentComp ositingInputs();
853 854
854 TransformState transformState(TransformState::ApplyTransformDirection, Float Point()); 855 TransformState transformState(TransformState::ApplyTransformDirection, Float Point());
855 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct. 856 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct.
856 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); 857 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip);
857 transformState.flatten(); 858 transformState.flatten();
858 return LayoutPoint(transformState.lastPlanarPoint()); 859 return LayoutPoint(transformState.lastPlanarPoint());
859 } 860 }
860 861
861 const DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const 862 DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const
862 { 863 {
863 if (!stackingNode()->isTreatedAsStackingContextForPainting()) 864 if (!stackingNode()->isTreatedAsStackingContextForPainting())
864 return parent(); 865 return parent();
865 if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()- >ancestorStackingContextNode()) 866 if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()- >ancestorStackingContextNode())
866 return ancestorStackingNode->layer(); 867 return ancestorStackingNode->layer();
867 return 0; 868 return nullptr;
868 } 869 }
869 870
870 bool DeprecatedPaintLayer::isPaintInvalidationContainer() const 871 bool DeprecatedPaintLayer::isPaintInvalidationContainer() const
871 { 872 {
872 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking; 873 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking;
873 } 874 }
874 875
875 // Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers 876 // Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers
876 // receive graphics layers that are parented to the compositing ancestor of the squashed layer. 877 // receive graphics layers that are parented to the compositing ancestor of the squashed layer.
877 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecat edPaintLayerMapping(IncludeSelfOrNot includeSelf) const 878 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecat edPaintLayerMapping(IncludeSelfOrNot includeSelf) const
878 { 879 {
879 ASSERT(isAllowedToQueryCompositingState()); 880 ASSERT(isAllowedToQueryCompositingState());
880 881
881 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking) 882 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking)
882 return const_cast<DeprecatedPaintLayer*>(this); 883 return const_cast<DeprecatedPaintLayer*>(this);
883 884
884 for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) { 885 for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr- >compositingContainer()) {
885 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking) 886 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking)
886 return const_cast<DeprecatedPaintLayer*>(curr); 887 return curr;
887 } 888 }
888 889
889 return 0; 890 return nullptr;
890 } 891 }
891 892
892 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer 893 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer
893 // including crossing frame boundaries. 894 // including crossing frame boundaries.
894 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidationCr ossingFrameBoundaries() const 895 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidationCr ossingFrameBoundaries() const
895 { 896 {
896 const DeprecatedPaintLayer* layer = this; 897 const DeprecatedPaintLayer* layer = this;
897 DeprecatedPaintLayer* compositedLayer = 0; 898 DeprecatedPaintLayer* compositedLayer = 0;
898 while (!compositedLayer) { 899 while (!compositedLayer) {
899 compositedLayer = layer->enclosingLayerForPaintInvalidation(); 900 compositedLayer = layer->enclosingLayerForPaintInvalidation();
900 if (!compositedLayer) { 901 if (!compositedLayer) {
901 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect(); 902 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect();
902 if (!owner) 903 if (!owner)
903 break; 904 break;
904 layer = owner->enclosingLayer(); 905 layer = owner->enclosingLayer();
905 } 906 }
906 } 907 }
907 return compositedLayer; 908 return compositedLayer;
908 } 909 }
909 910
910 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation() const 911 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation() const
911 { 912 {
912 ASSERT(isAllowedToQueryCompositingState()); 913 ASSERT(isAllowedToQueryCompositingState());
913 914
914 if (isPaintInvalidationContainer()) 915 if (isPaintInvalidationContainer())
915 return const_cast<DeprecatedPaintLayer*>(this); 916 return const_cast<DeprecatedPaintLayer*>(this);
916 917
917 for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) { 918 for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr- >compositingContainer()) {
918 if (curr->isPaintInvalidationContainer()) 919 if (curr->isPaintInvalidationContainer())
919 return const_cast<DeprecatedPaintLayer*>(curr); 920 return curr;
920 } 921 }
921 922
922 return 0; 923 return nullptr;
923 } 924 }
924 925
925 void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate() 926 void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate()
926 { 927 {
927 m_needsAncestorDependentCompositingInputsUpdate = true; 928 m_needsAncestorDependentCompositingInputsUpdate = true;
928 m_needsDescendantDependentCompositingInputsUpdate = true; 929 m_needsDescendantDependentCompositingInputsUpdate = true;
929 930
930 for (DeprecatedPaintLayer* current = this; current && !current->m_childNeeds CompositingInputsUpdate; current = current->parent()) 931 for (DeprecatedPaintLayer* current = this; current && !current->m_childNeeds CompositingInputsUpdate; current = current->parent())
931 current->m_childNeedsCompositingInputsUpdate = true; 932 current->m_childNeedsCompositingInputsUpdate = true;
932 933
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 iter->value.append(physicalBoundingBox(parentLayer)); 2680 iter->value.append(physicalBoundingBox(parentLayer));
2680 } 2681 }
2681 } 2682 }
2682 } else { 2683 } else {
2683 rect.append(logicalBoundingBox()); 2684 rect.append(logicalBoundingBox());
2684 rects.set(this, rect); 2685 rects.set(this, rect);
2685 } 2686 }
2686 } 2687 }
2687 } 2688 }
2688 2689
2690 void DeprecatedPaintLayer::setNeedsRepaint()
2691 {
2692 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2693
2694 DeprecatedPaintLayer* layer = this;
2695 while (!layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescenda nt()) {
2696 layer = layer->parent();
2697 ASSERT(layer); // At least the root layer is self painting.
2698 }
2699
2700 if (layer->m_needsRepaint)
2701 return;
2702 layer->m_needsRepaint = true;
2703 layer->markCompositingContainerChainForNeedsRepaint();
2704 }
2705
2706 void DeprecatedPaintLayer::markCompositingContainerChainForNeedsRepaint()
2707 {
2708 DeprecatedPaintLayer* layer = this;
2709 while (true) {
2710 DeprecatedPaintLayer* container = layer->compositingContainer();
2711 if (!container) {
2712 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect();
2713 if (!owner)
2714 break;
2715 container = owner->enclosingLayer();
2716 }
2717 if (container->m_needsRepaint)
2718 break;
2719 if (container->isSelfPaintingLayer() || container->hasSelfPaintingLayerD escendant())
2720 container->m_needsRepaint = true;
2721 layer = container;
2722 }
2723 }
2724
2689 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() 2725 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts()
2690 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { } 2726 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
2691 2727
2692 } // namespace blink 2728 } // namespace blink
2693 2729
2694 #ifndef NDEBUG 2730 #ifndef NDEBUG
2695 // FIXME: Rename? 2731 // FIXME: Rename?
2696 void showLayerTree(const blink::DeprecatedPaintLayer* layer) 2732 void showLayerTree(const blink::DeprecatedPaintLayer* layer)
2697 { 2733 {
2698 if (!layer) { 2734 if (!layer) {
2699 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2735 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2700 return; 2736 return;
2701 } 2737 }
2702 2738
2703 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) { 2739 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) {
2704 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); 2740 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState);
2705 fprintf(stderr, "%s\n", output.utf8().data()); 2741 fprintf(stderr, "%s\n", output.utf8().data());
2706 } 2742 }
2707 } 2743 }
2708 2744
2709 void showLayerTree(const blink::LayoutObject* layoutObject) 2745 void showLayerTree(const blink::LayoutObject* layoutObject)
2710 { 2746 {
2711 if (!layoutObject) { 2747 if (!layoutObject) {
2712 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2748 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2713 return; 2749 return;
2714 } 2750 }
2715 showLayerTree(layoutObject->enclosingLayer()); 2751 showLayerTree(layoutObject->enclosingLayer());
2716 } 2752 }
2717 #endif 2753 #endif
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698