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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 } | 732 } |
734 | 733 |
735 if (hasVisibleContent() != previouslyHasVisibleContent) { | 734 if (hasVisibleContent() != previouslyHasVisibleContent) { |
736 setNeedsCompositingInputsUpdateInternal(); | 735 setNeedsCompositingInputsUpdateInternal(); |
737 // We need to tell m_layoutObject to recheck its rect because we | 736 // We need to tell m_layoutObject to recheck its rect because we |
738 // pretend that invisible LayoutObjects have 0x0 rects. Changing | 737 // pretend that invisible LayoutObjects have 0x0 rects. Changing |
739 // visibility therefore changes our rect and we need to visit | 738 // visibility therefore changes our rect and we need to visit |
740 // this LayoutObject during the invalidateTreeIfNeeded walk. | 739 // this LayoutObject during the invalidateTreeIfNeeded walk. |
741 m_layoutObject->setMayNeedPaintInvalidation(); | 740 m_layoutObject->setMayNeedPaintInvalidation(); |
742 } | 741 } |
742 | |
743 update3DTransformedDescendantStatus(); | |
743 } | 744 } |
744 | 745 |
745 void PaintLayer::dirty3DTransformedDescendantStatus() { | 746 void PaintLayer::update3DTransformedDescendantStatus() { |
746 PaintLayerStackingNode* stackingNode = | 747 m_has3DTransformedDescendant = false; |
747 m_stackingNode->ancestorStackingContextNode(); | |
748 if (!stackingNode) | |
749 return; | |
750 | 748 |
751 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; | 749 m_stackingNode->updateZOrderLists(); |
752 | 750 |
753 // This propagates up through preserve-3d hierarchies to the enclosing | 751 // Transformed or preserve-3d descendants can only be in the z-order lists, |
754 // flattening layer. Note that preserves3D() creates stacking context, so we | 752 // not in the normal flow list, so we only need to check those. |
755 // can just run up the stacking containers. | 753 PaintLayerStackingNodeIterator iterator( |
756 while (stackingNode && stackingNode->layer()->preserves3D()) { | 754 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren); |
757 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; | 755 while (PaintLayerStackingNode* node = iterator.next()) { |
758 stackingNode = stackingNode->ancestorStackingContextNode(); | 756 const PaintLayer& childLayer = *node->layer(); |
757 bool childHas3D = false; | |
758 // If the child lives in a 3d hierarchy, then the layer at the root of | |
759 // that hierarchy needs the m_has3DTransformedDescendant set. | |
760 if (childLayer.preserves3D() && (childLayer.has3DTransform() || | |
761 childLayer.has3DTransformedDescendant())) | |
762 childHas3D = true; | |
763 else if (childLayer.has3DTransform()) | |
764 childHas3D = true; | |
765 | |
766 m_has3DTransformedDescendant = m_has3DTransformedDescendant || childHas3D; | |
Xianzhu
2016/12/28 18:08:11
We should break the loop when m_has3DTransformedDe
chrishtr
2016/12/28 18:49:46
Fixed.
| |
759 } | 767 } |
760 } | 768 } |
761 | 769 |
762 // Return true if this layer or any preserve-3d descendants have 3d. | |
763 bool PaintLayer::update3DTransformedDescendantStatus() { | |
764 if (m_is3DTransformedDescendantDirty) { | |
765 m_has3DTransformedDescendant = false; | |
766 | |
767 m_stackingNode->updateZOrderLists(); | |
768 | |
769 // Transformed or preserve-3d descendants can only be in the z-order lists, | |
770 // not in the normal flow list, so we only need to check those. | |
771 PaintLayerStackingNodeIterator iterator( | |
772 *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren); | |
773 while (PaintLayerStackingNode* node = iterator.next()) | |
774 m_has3DTransformedDescendant |= | |
775 node->layer()->update3DTransformedDescendantStatus(); | |
776 | |
777 m_is3DTransformedDescendantDirty = false; | |
778 } | |
779 | |
780 // If we live in a 3d hierarchy, then the layer at the root of that hierarchy | |
781 // needs the m_has3DTransformedDescendant set. | |
782 if (preserves3D()) | |
783 return has3DTransform() || m_has3DTransformedDescendant; | |
784 | |
785 return has3DTransform(); | |
786 } | |
787 | |
788 void PaintLayer::updateLayerPosition() { | 770 void PaintLayer::updateLayerPosition() { |
789 LayoutPoint localPoint; | 771 LayoutPoint localPoint; |
790 | 772 |
791 bool didResize = false; | 773 bool didResize = false; |
792 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 774 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
793 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 775 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); |
794 IntRect lineBox = enclosingIntRect(inlineFlow->linesBoundingBox()); | 776 IntRect lineBox = enclosingIntRect(inlineFlow->linesBoundingBox()); |
795 m_size = lineBox.size(); | 777 m_size = lineBox.size(); |
796 } else if (LayoutBox* box = layoutBox()) { | 778 } else if (LayoutBox* box = layoutBox()) { |
797 IntSize newSize = pixelSnappedIntSize(box->size(), box->location()); | 779 IntSize newSize = pixelSnappedIntSize(box->size(), box->location()); |
(...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3254 } | 3236 } |
3255 | 3237 |
3256 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3238 void showLayerTree(const blink::LayoutObject* layoutObject) { |
3257 if (!layoutObject) { | 3239 if (!layoutObject) { |
3258 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3240 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
3259 return; | 3241 return; |
3260 } | 3242 } |
3261 showLayerTree(layoutObject->enclosingLayer()); | 3243 showLayerTree(layoutObject->enclosingLayer()); |
3262 } | 3244 } |
3263 #endif | 3245 #endif |
OLD | NEW |