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

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: 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 { 844 {
844 const AncestorDependentCompositingInputs& properties = ancestorDependentComp ositingInputs(); 845 const AncestorDependentCompositingInputs& properties = ancestorDependentComp ositingInputs();
845 846
846 TransformState transformState(TransformState::ApplyTransformDirection, Float Point()); 847 TransformState transformState(TransformState::ApplyTransformDirection, Float Point());
847 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct. 848 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct.
848 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); 849 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip);
849 transformState.flatten(); 850 transformState.flatten();
850 return LayoutPoint(transformState.lastPlanarPoint()); 851 return LayoutPoint(transformState.lastPlanarPoint());
851 } 852 }
852 853
853 const DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const 854 DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const
854 { 855 {
855 if (!stackingNode()->isTreatedAsStackingContextForPainting()) 856 if (!stackingNode()->isTreatedAsStackingContextForPainting())
856 return parent(); 857 return parent();
857 if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()- >ancestorStackingContextNode()) 858 if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()- >ancestorStackingContextNode())
858 return ancestorStackingNode->layer(); 859 return ancestorStackingNode->layer();
859 return 0; 860 return nullptr;
860 } 861 }
861 862
862 bool DeprecatedPaintLayer::isPaintInvalidationContainer() const 863 bool DeprecatedPaintLayer::isPaintInvalidationContainer() const
863 { 864 {
864 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking; 865 return compositingState() == PaintsIntoOwnBacking || compositingState() == P aintsIntoGroupedBacking;
865 } 866 }
866 867
867 // Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers 868 // Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers
868 // receive graphics layers that are parented to the compositing ancestor of the squashed layer. 869 // receive graphics layers that are parented to the compositing ancestor of the squashed layer.
869 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecat edPaintLayerMapping(IncludeSelfOrNot includeSelf) const 870 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecat edPaintLayerMapping(IncludeSelfOrNot includeSelf) const
870 { 871 {
871 ASSERT(isAllowedToQueryCompositingState()); 872 ASSERT(isAllowedToQueryCompositingState());
872 873
873 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking) 874 if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && c ompositingState() != PaintsIntoGroupedBacking)
874 return const_cast<DeprecatedPaintLayer*>(this); 875 return const_cast<DeprecatedPaintLayer*>(this);
875 876
876 for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) { 877 for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr- >compositingContainer()) {
877 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking) 878 if (curr->compositingState() != NotComposited && curr->compositingState( ) != PaintsIntoGroupedBacking)
878 return const_cast<DeprecatedPaintLayer*>(curr); 879 return curr;
879 } 880 }
880 881
881 return 0; 882 return nullptr;
882 } 883 }
883 884
884 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer 885 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer
885 // including crossing frame boundaries. 886 // including crossing frame boundaries.
886 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidationCr ossingFrameBoundaries() const 887 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidationCr ossingFrameBoundaries() const
887 { 888 {
888 const DeprecatedPaintLayer* layer = this; 889 const DeprecatedPaintLayer* layer = this;
889 DeprecatedPaintLayer* compositedLayer = 0; 890 DeprecatedPaintLayer* compositedLayer = 0;
890 while (!compositedLayer) { 891 while (!compositedLayer) {
891 compositedLayer = layer->enclosingLayerForPaintInvalidation(); 892 compositedLayer = layer->enclosingLayerForPaintInvalidation();
892 if (!compositedLayer) { 893 if (!compositedLayer) {
893 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect(); 894 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect();
894 if (!owner) 895 if (!owner)
895 break; 896 break;
896 layer = owner->enclosingLayer(); 897 layer = owner->enclosingLayer();
897 } 898 }
898 } 899 }
899 return compositedLayer; 900 return compositedLayer;
900 } 901 }
901 902
902 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation() const 903 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation() const
903 { 904 {
904 ASSERT(isAllowedToQueryCompositingState()); 905 ASSERT(isAllowedToQueryCompositingState());
905 906
906 if (isPaintInvalidationContainer()) 907 if (isPaintInvalidationContainer())
907 return const_cast<DeprecatedPaintLayer*>(this); 908 return const_cast<DeprecatedPaintLayer*>(this);
908 909
909 for (const DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) { 910 for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr- >compositingContainer()) {
910 if (curr->isPaintInvalidationContainer()) 911 if (curr->isPaintInvalidationContainer())
911 return const_cast<DeprecatedPaintLayer*>(curr); 912 return curr;
912 } 913 }
913 914
914 return 0; 915 return nullptr;
915 } 916 }
916 917
917 void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate() 918 void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate()
918 { 919 {
919 m_needsAncestorDependentCompositingInputsUpdate = true; 920 m_needsAncestorDependentCompositingInputsUpdate = true;
920 m_needsDescendantDependentCompositingInputsUpdate = true; 921 m_needsDescendantDependentCompositingInputsUpdate = true;
921 922
922 for (DeprecatedPaintLayer* current = this; current && !current->m_childNeeds CompositingInputsUpdate; current = current->parent()) 923 for (DeprecatedPaintLayer* current = this; current && !current->m_childNeeds CompositingInputsUpdate; current = current->parent())
923 current->m_childNeedsCompositingInputsUpdate = true; 924 current->m_childNeedsCompositingInputsUpdate = true;
924 925
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 iter->value.append(physicalBoundingBox(parentLayer)); 2653 iter->value.append(physicalBoundingBox(parentLayer));
2653 } 2654 }
2654 } 2655 }
2655 } else { 2656 } else {
2656 rect.append(logicalBoundingBox()); 2657 rect.append(logicalBoundingBox());
2657 rects.set(this, rect); 2658 rects.set(this, rect);
2658 } 2659 }
2659 } 2660 }
2660 } 2661 }
2661 2662
2663 void DeprecatedPaintLayer::setNeedsRepaint()
2664 {
2665 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
2666
2667 DeprecatedPaintLayer* layer = this;
2668 while (!layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescenda nt()) {
2669 layer = layer->parent();
2670 ASSERT(layer); // At least the root layer is self painting.
2671 }
2672
2673 if (layer->m_needsRepaint)
2674 return;
2675 layer->m_needsRepaint = true;
2676 layer->markCompositingContainerChainForNeedsRepaint();
2677 }
2678
2679 void DeprecatedPaintLayer::markCompositingContainerChainForNeedsRepaint()
2680 {
2681 DeprecatedPaintLayer* layer = this;
2682 while (true) {
2683 DeprecatedPaintLayer* container = layer->compositingContainer();
2684 if (!container) {
2685 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj ect();
2686 if (!owner)
2687 break;
2688 container = owner->enclosingLayer();
2689 }
2690 if (container->m_needsRepaint)
2691 break;
2692 container->m_needsRepaint = true;
2693 layer = container;
2694 }
2695 }
2696
2662 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() 2697 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts()
2663 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { } 2698 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
2664 2699
2665 } // namespace blink 2700 } // namespace blink
2666 2701
2667 #ifndef NDEBUG 2702 #ifndef NDEBUG
2668 // FIXME: Rename? 2703 // FIXME: Rename?
2669 void showLayerTree(const blink::DeprecatedPaintLayer* layer) 2704 void showLayerTree(const blink::DeprecatedPaintLayer* layer)
2670 { 2705 {
2671 if (!layer) { 2706 if (!layer) {
2672 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2707 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2673 return; 2708 return;
2674 } 2709 }
2675 2710
2676 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) { 2711 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) {
2677 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); 2712 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState);
2678 fprintf(stderr, "%s\n", output.utf8().data()); 2713 fprintf(stderr, "%s\n", output.utf8().data());
2679 } 2714 }
2680 } 2715 }
2681 2716
2682 void showLayerTree(const blink::LayoutObject* layoutObject) 2717 void showLayerTree(const blink::LayoutObject* layoutObject)
2683 { 2718 {
2684 if (!layoutObject) { 2719 if (!layoutObject) {
2685 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2720 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2686 return; 2721 return;
2687 } 2722 }
2688 showLayerTree(layoutObject->enclosingLayer()); 2723 showLayerTree(layoutObject->enclosingLayer());
2689 } 2724 }
2690 #endif 2725 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698