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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2604973002: Move computation of 3D descendants to the descendant-dependent flags walk. (Closed)
Patch Set: none Created 3 years, 11 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
OLDNEW
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) 131 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject)
132 : m_hasSelfPaintingLayerDescendant(false), 132 : m_hasSelfPaintingLayerDescendant(false),
133 m_hasSelfPaintingLayerDescendantDirty(false), 133 m_hasSelfPaintingLayerDescendantDirty(false),
134 m_isRootLayer(layoutObject->isLayoutView()), 134 m_isRootLayer(layoutObject->isLayoutView()),
135 m_hasVisibleContent(false), 135 m_hasVisibleContent(false),
136 m_needsDescendantDependentFlagsUpdate(true), 136 m_needsDescendantDependentFlagsUpdate(true),
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),
142 m_has3DTransformedDescendant(false), 141 m_has3DTransformedDescendant(false),
143 m_containsDirtyOverlayScrollbars(false), 142 m_containsDirtyOverlayScrollbars(false),
144 m_needsAncestorDependentCompositingInputsUpdate(true), 143 m_needsAncestorDependentCompositingInputsUpdate(true),
145 m_childNeedsCompositingInputsUpdate(true), 144 m_childNeedsCompositingInputsUpdate(true),
146 m_hasCompositingDescendant(false), 145 m_hasCompositingDescendant(false),
147 m_isAllScrollingContentComposited(false), 146 m_isAllScrollingContentComposited(false),
148 m_shouldIsolateCompositedDescendants(false), 147 m_shouldIsolateCompositedDescendants(false),
149 m_lostGroupedMapping(false), 148 m_lostGroupedMapping(false),
150 m_needsRepaint(false), 149 m_needsRepaint(false),
151 m_previousPaintResult(FullyPainted), 150 m_previousPaintResult(FullyPainted),
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // PaintLayers with transforms act as clip rects roots, so clear the cached 407 // PaintLayers with transforms act as clip rects roots, so clear the cached
409 // clip rects here. 408 // clip rects here.
410 clipper().clearClipRectsIncludingDescendants(); 409 clipper().clearClipRectsIncludingDescendants();
411 } else if (hasTransform) { 410 } else if (hasTransform) {
412 clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects); 411 clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
413 } 412 }
414 413
415 updateTransformationMatrix(); 414 updateTransformationMatrix();
416 415
417 if (had3DTransform != has3DTransform()) 416 if (had3DTransform != has3DTransform())
418 dirty3DTransformedDescendantStatus(); 417 markAncestorChainForDescendantDependentFlagsUpdate();
419 418
420 if (FrameView* frameView = layoutObject()->document().view()) 419 if (FrameView* frameView = layoutObject()->document().view())
421 frameView->setNeedsUpdateWidgetGeometries(); 420 frameView->setNeedsUpdateWidgetGeometries();
422 } 421 }
423 422
424 static PaintLayer* enclosingLayerForContainingBlock(PaintLayer* layer) { 423 static PaintLayer* enclosingLayerForContainingBlock(PaintLayer* layer) {
425 if (LayoutObject* containingBlock = layer->layoutObject()->containingBlock()) 424 if (LayoutObject* containingBlock = layer->layoutObject()->containingBlock())
426 return containingBlock->enclosingLayer(); 425 return containingBlock->enclosingLayer();
427 return 0; 426 return 0;
428 } 427 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 735 }
737 736
738 if (hasVisibleContent() != previouslyHasVisibleContent) { 737 if (hasVisibleContent() != previouslyHasVisibleContent) {
739 setNeedsCompositingInputsUpdateInternal(); 738 setNeedsCompositingInputsUpdateInternal();
740 // We need to tell m_layoutObject to recheck its rect because we 739 // We need to tell m_layoutObject to recheck its rect because we
741 // pretend that invisible LayoutObjects have 0x0 rects. Changing 740 // pretend that invisible LayoutObjects have 0x0 rects. Changing
742 // visibility therefore changes our rect and we need to visit 741 // visibility therefore changes our rect and we need to visit
743 // this LayoutObject during the invalidateTreeIfNeeded walk. 742 // this LayoutObject during the invalidateTreeIfNeeded walk.
744 m_layoutObject->setMayNeedPaintInvalidation(); 743 m_layoutObject->setMayNeedPaintInvalidation();
745 } 744 }
745
746 update3DTransformedDescendantStatus();
746 } 747 }
747 748
748 void PaintLayer::dirty3DTransformedDescendantStatus() { 749 void PaintLayer::update3DTransformedDescendantStatus() {
749 PaintLayerStackingNode* stackingNode = 750 m_has3DTransformedDescendant = false;
750 m_stackingNode->ancestorStackingContextNode();
751 if (!stackingNode)
752 return;
753 751
754 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; 752 m_stackingNode->updateZOrderLists();
755 753
756 // This propagates up through preserve-3d hierarchies to the enclosing 754 // Transformed or preserve-3d descendants can only be in the z-order lists,
757 // flattening layer. Note that preserves3D() creates stacking context, so we 755 // not in the normal flow list, so we only need to check those.
758 // can just run up the stacking containers. 756 PaintLayerStackingNodeIterator iterator(
759 while (stackingNode && stackingNode->layer()->preserves3D()) { 757 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren);
760 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; 758 while (PaintLayerStackingNode* node = iterator.next()) {
761 stackingNode = stackingNode->ancestorStackingContextNode(); 759 const PaintLayer& childLayer = *node->layer();
760 bool childHas3D = false;
761 // If the child lives in a 3d hierarchy, then the layer at the root of
762 // that hierarchy needs the m_has3DTransformedDescendant set.
763 if (childLayer.preserves3D() && (childLayer.has3DTransform() ||
764 childLayer.has3DTransformedDescendant()))
765 childHas3D = true;
766 else if (childLayer.has3DTransform())
767 childHas3D = true;
768
769 if (childHas3D) {
770 m_has3DTransformedDescendant = true;
771 break;
772 }
762 } 773 }
763 } 774 }
764 775
765 // Return true if this layer or any preserve-3d descendants have 3d.
766 bool PaintLayer::update3DTransformedDescendantStatus() {
767 if (m_is3DTransformedDescendantDirty) {
768 m_has3DTransformedDescendant = false;
769
770 m_stackingNode->updateZOrderLists();
771
772 // Transformed or preserve-3d descendants can only be in the z-order lists,
773 // not in the normal flow list, so we only need to check those.
774 PaintLayerStackingNodeIterator iterator(
775 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren);
776 while (PaintLayerStackingNode* node = iterator.next())
777 m_has3DTransformedDescendant |=
778 node->layer()->update3DTransformedDescendantStatus();
779
780 m_is3DTransformedDescendantDirty = false;
781 }
782
783 // If we live in a 3d hierarchy, then the layer at the root of that hierarchy
784 // needs the m_has3DTransformedDescendant set.
785 if (preserves3D())
786 return has3DTransform() || m_has3DTransformedDescendant;
787
788 return has3DTransform();
789 }
790
791 void PaintLayer::updateLayerPosition() { 776 void PaintLayer::updateLayerPosition() {
792 LayoutPoint localPoint; 777 LayoutPoint localPoint;
793 778
794 bool didResize = false; 779 bool didResize = false;
795 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { 780 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) {
796 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); 781 LayoutInline* inlineFlow = toLayoutInline(layoutObject());
797 IntRect lineBox = enclosingIntRect(inlineFlow->linesBoundingBox()); 782 IntRect lineBox = enclosingIntRect(inlineFlow->linesBoundingBox());
798 m_size = lineBox.size(); 783 m_size = lineBox.size();
799 } else if (LayoutBox* box = layoutBox()) { 784 } else if (LayoutBox* box = layoutBox()) {
800 IntSize newSize = pixelSnappedIntSize(box->size(), box->location()); 785 IntSize newSize = pixelSnappedIntSize(box->size(), box->location());
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 } 3236 }
3252 3237
3253 void showLayerTree(const blink::LayoutObject* layoutObject) { 3238 void showLayerTree(const blink::LayoutObject* layoutObject) {
3254 if (!layoutObject) { 3239 if (!layoutObject) {
3255 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3240 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3256 return; 3241 return;
3257 } 3242 }
3258 showLayerTree(layoutObject->enclosingLayer()); 3243 showLayerTree(layoutObject->enclosingLayer());
3259 } 3244 }
3260 #endif 3245 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698