OLD | NEW |
---|---|
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "HTMLFrameElement.h" | 71 #include "HTMLFrameElement.h" |
72 #include "HTMLFrameOwnerElement.h" | 72 #include "HTMLFrameOwnerElement.h" |
73 #include "HTMLNames.h" | 73 #include "HTMLNames.h" |
74 #include "HistogramSupport.h" | 74 #include "HistogramSupport.h" |
75 #include "HitTestingTransformState.h" | 75 #include "HitTestingTransformState.h" |
76 #include "HitTestRequest.h" | 76 #include "HitTestRequest.h" |
77 #include "HitTestResult.h" | 77 #include "HitTestResult.h" |
78 #include "OverflowEvent.h" | 78 #include "OverflowEvent.h" |
79 #include "OverlapTestRequestClient.h" | 79 #include "OverlapTestRequestClient.h" |
80 #include "Page.h" | 80 #include "Page.h" |
81 #include "PaintOrderLists.h" | |
81 #include "PlatformMouseEvent.h" | 82 #include "PlatformMouseEvent.h" |
82 #include "RenderArena.h" | 83 #include "RenderArena.h" |
83 #include "RenderFlowThread.h" | 84 #include "RenderFlowThread.h" |
84 #include "RenderGeometryMap.h" | 85 #include "RenderGeometryMap.h" |
85 #include "RenderInline.h" | 86 #include "RenderInline.h" |
86 #include "RenderLayerBacking.h" | 87 #include "RenderLayerBacking.h" |
87 #include "RenderLayerCompositor.h" | 88 #include "RenderLayerCompositor.h" |
88 #include "RenderMarquee.h" | 89 #include "RenderMarquee.h" |
89 #include "RenderReplica.h" | 90 #include "RenderReplica.h" |
90 #include "RenderSVGResourceClipper.h" | 91 #include "RenderSVGResourceClipper.h" |
91 #include "RenderScrollbar.h" | 92 #include "RenderScrollbar.h" |
92 #include "RenderScrollbarPart.h" | 93 #include "RenderScrollbarPart.h" |
93 #include "RenderTheme.h" | 94 #include "RenderTheme.h" |
94 #include "RenderTreeAsText.h" | 95 #include "RenderTreeAsText.h" |
95 #include "RenderView.h" | 96 #include "RenderView.h" |
96 #include "ScaleTransformOperation.h" | 97 #include "ScaleTransformOperation.h" |
97 #include "ScrollAnimator.h" | 98 #include "ScrollAnimator.h" |
98 #include "Scrollbar.h" | 99 #include "Scrollbar.h" |
99 #include "ScrollbarTheme.h" | 100 #include "ScrollbarTheme.h" |
100 #include "ScrollingCoordinator.h" | 101 #include "ScrollingCoordinator.h" |
101 #include "Settings.h" | 102 #include "Settings.h" |
102 #include "ShadowRoot.h" | 103 #include "ShadowRoot.h" |
103 #include "SourceGraphic.h" | 104 #include "SourceGraphic.h" |
105 #include "StaticHashSetNodeList.h" | |
104 #include "StylePropertySet.h" | 106 #include "StylePropertySet.h" |
105 #include "StyleResolver.h" | 107 #include "StyleResolver.h" |
106 #include "TextStream.h" | 108 #include "TextStream.h" |
107 #include "TransformationMatrix.h" | 109 #include "TransformationMatrix.h" |
108 #include "TranslateTransformOperation.h" | 110 #include "TranslateTransformOperation.h" |
109 #include "WebCoreMemoryInstrumentation.h" | 111 #include "WebCoreMemoryInstrumentation.h" |
110 #include <wtf/MemoryInstrumentationVector.h> | 112 #include <wtf/MemoryInstrumentationVector.h> |
111 #include <wtf/StdLibExtras.h> | 113 #include <wtf/StdLibExtras.h> |
112 #include <wtf/UnusedParam.h> | 114 #include <wtf/UnusedParam.h> |
113 #include <wtf/text/CString.h> | 115 #include <wtf/text/CString.h> |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 668 |
667 if (!isStackingContext()) { | 669 if (!isStackingContext()) { |
668 bool newValue = maxIndex - minIndex == count; | 670 bool newValue = maxIndex - minIndex == count; |
669 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | 671 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; |
670 m_descendantsAreContiguousInStackingOrder = newValue; | 672 m_descendantsAreContiguousInStackingOrder = newValue; |
671 if (didUpdate) | 673 if (didUpdate) |
672 updateNeedsCompositedScrolling(); | 674 updateNeedsCompositedScrolling(); |
673 } | 675 } |
674 } | 676 } |
675 | 677 |
678 static inline bool isPositionedContainer(const RenderLayer* layer) | |
679 { | |
680 // FIXME: This is not in sync with containingBlock. | |
681 // RenderObject::canContainFixedPositionedObject() should probably be used | |
682 // instead. | |
Ian Vollick
2013/04/16 19:17:41
Let's just fix this rather than putting in a FIXME
hartmanng
2013/04/17 18:00:20
I tried to fix this, but ran into the following as
| |
683 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
684 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
685 } | |
686 | |
687 enum StackingOrderDirection { FromBackground, FromForeground }; | |
688 | |
689 // We'd like to be able to iterate through a single paint order list, but for | |
690 // efficiency's sake, we hang onto two lists instead (namely, the pos and neg | |
691 // z-order lists produced by CollectLayers). This function allows us to index | |
692 // into these two lists as if they were one. It also allows us to index into | |
693 // this virtual list either from the start or from the end (i.e., in either | |
694 // stacking order direction). | |
695 static const RenderLayer* getStackingOrderElementAt(const Vector<RenderLayer*>* posZOrderList, const Vector<RenderLayer*>* negZOrderList, const StackingOrderDir ection direction, const size_t index) | |
696 { | |
697 size_t negZOrderListSize = negZOrderList ? negZOrderList->size() : 0; | |
698 | |
699 if (direction == FromBackground) { | |
700 if (index < negZOrderListSize) | |
701 return negZOrderList->at(index); | |
702 | |
703 return posZOrderList->at(index - negZOrderListSize); | |
704 } | |
705 | |
706 size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; | |
707 | |
708 if (index < posZOrderListSize) | |
709 return posZOrderList->at(posZOrderListSize - index - 1); | |
710 | |
711 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); | |
712 } | |
713 | |
714 void RenderLayer::collectBeforeAfterPromotionZOrderLists(RenderLayer* ancestorSt ackingContext, | |
715 OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, | |
716 OwnPtr<Vector<RenderLayer*> >& negZOrderListBeforePromote, | |
717 OwnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, | |
718 OwnPtr<Vector<RenderLayer*> >& negZOrderListAfterPromote) | |
719 { | |
720 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and | |
721 // m_isNormalFlowOnly are both bitfields, so we have to do it the | |
722 // old-fashioned way. | |
723 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | |
724 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; | |
725 | |
726 // Set the flag on the current layer, then rebuild ancestor stacking | |
727 // context's lists. This way, we can see the exact effects that promoting | |
728 // this layer would cause. | |
729 m_needsCompositedScrolling = false; | |
730 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
731 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListBeforePromote, negZOrderListBeforePromote, 0); | |
732 | |
733 m_isNormalFlowOnly = false; | |
734 m_needsCompositedScrolling = true; | |
735 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListAfterPromote, negZOrderListAfterPromote, this); | |
736 | |
737 m_needsCompositedScrolling = oldNeedsCompositedScrolling; | |
738 m_isNormalFlowOnly = oldIsNormalFlowOnly; | |
739 } | |
740 | |
741 // Compute what positive and negative z-order lists would look like before and | |
742 // after promotion, so we can later ensure that proper stacking order is | |
743 // preserved between the two sets of lists. | |
744 // | |
745 // A few examples: | |
746 // c = currentLayer | |
747 // - = negative z-order child of currentLayer | |
748 // + = positive z-order child of currentLayer | |
749 // a = positioned ancestor of currentLayer | |
750 // x = any other RenderLayer in the list | |
751 // | |
752 // (a) xxxxx-----++a+++x | |
753 // (b) xxx-----c++++++xx | |
754 // | |
755 // | |
756 // Normally the current layer would be painted in the normal flow list if it | |
757 // doesn't already appear in the positive z-order list. However, in the case | |
758 // that the layer has a positioned ancestor, it will paint directly after the | |
759 // positioned ancestor. In example (a), the current layer would be painted in | |
760 // the middle of its own positive z-order children, so promoting would cause a | |
761 // change in paint order (since a promoted layer will paint all of its positive | |
762 // z-order children strictly after it paints itself). | |
763 // | |
764 // In example (b), it is ok to promote the current layer only if it does not | |
765 // have a background. If it has a background, the background gets painted before | |
766 // the layer's negative z-order children, so again, a promotion would cause a | |
767 // change in paint order (causing the background to get painted after the | |
768 // negative z-order children instead of before). | |
769 void RenderLayer::getPaintOrderLists(RenderLayer* ancestorStackingContext, | |
770 OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, | |
771 OwnPtr<Vector<RenderLayer*> >& negZOrderListBeforePromote, | |
772 OwnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, | |
773 OwnPtr<Vector<RenderLayer*> >& negZOrderListAfterPromote) | |
774 { | |
775 collectBeforeAfterPromotionZOrderLists(ancestorStackingContext, | |
776 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
777 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
778 | |
779 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
780 | |
781 const RenderLayer* positionedAncestor = parent(); | |
782 while (positionedAncestor && !isPositionedContainer(positionedAncestor) && ! positionedAncestor->isStackingContext()) | |
783 positionedAncestor = positionedAncestor->parent(); | |
784 if (positionedAncestor && (!isPositionedContainer(positionedAncestor) || pos itionedAncestor->isStackingContext())) | |
785 positionedAncestor = 0; | |
786 | |
787 bool currentLayerIsInPosZOrderListBeforePromote = false; | |
788 | |
789 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index++) { | |
790 if (posZOrderListBeforePromote->at(index) == this) { | |
791 currentLayerIsInPosZOrderListBeforePromote = true; | |
792 break; | |
793 } | |
794 } | |
795 | |
796 // Insert this into the posZOrderistBeforePromote directly after the | |
797 // positioned ancestor, if there is one. Otherwise, add it to the very | |
798 // beginning. | |
799 // | |
800 // The current layer will appear in the z-order lists after promotion, so | |
801 // for a meaningful comparison, we must insert it in the z-order lists | |
802 // before promotion if it does not appear there already. | |
803 if (!currentLayerIsInPosZOrderListBeforePromote) { | |
804 if (!positionedAncestor) { | |
805 if (!posZOrderListBeforePromote) | |
806 posZOrderListBeforePromote = adoptPtr(new Vector<RenderLayer*>() ); | |
807 | |
808 posZOrderListBeforePromote->prepend(this); | |
809 posZOrderListSizeBeforePromote++; | |
810 } else { | |
811 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index ++) { | |
812 if (posZOrderListBeforePromote->at(index) == positionedAncestor) { | |
813 posZOrderListBeforePromote->insert(index + 1, this); | |
814 posZOrderListSizeBeforePromote++; | |
815 break; | |
816 } | |
817 } | |
818 } | |
819 } | |
820 } | |
821 | |
822 String RenderLayer::paintOrderListsAsText() | |
823 { | |
824 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
825 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
826 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
827 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
828 | |
829 RenderLayer* ancestorStackingContext = this; | |
830 | |
831 while (ancestorStackingContext) { | |
832 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
833 break; | |
834 ancestorStackingContext = ancestorStackingContext->parent(); | |
835 } | |
836 | |
837 if (!ancestorStackingContext) | |
838 return String(); | |
839 | |
840 getPaintOrderLists(ancestorStackingContext, | |
841 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
842 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
843 | |
844 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
845 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
846 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
847 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
848 | |
849 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
850 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
851 | |
852 TextStream ts; | |
853 | |
854 ts << "Layer: " << this << " \"" << name() << "\", z-index: " << renderer()- >style()->zIndex() << "\n"; | |
855 | |
856 ts << " stacking context's paint order list BEFORE promote:\n"; | |
857 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
858 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
859 ts << " " << layerBeforePromote << " \"" << layerBeforePromote->name( ) << "\", z-index: " << layerBeforePromote->renderer()->style()->zIndex() << "\n "; | |
860 } | |
861 | |
862 ts << " stacking context's paint order list AFTER promote:\n"; | |
863 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
864 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
865 ts << " " << layerAfterPromote << " \"" << layerAfterPromote->name() << "\", z-index: " << layerAfterPromote->renderer()->style()->zIndex() << "\n"; | |
866 } | |
867 | |
868 return ts.release(); | |
869 } | |
870 | |
871 PassRefPtr<PaintOrderLists> RenderLayer::paintOrderLists() | |
872 { | |
873 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
874 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
875 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
876 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
877 | |
878 RenderLayer* ancestorStackingContext = this; | |
879 | |
880 while (ancestorStackingContext) { | |
881 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
882 break; | |
883 ancestorStackingContext = ancestorStackingContext->parent(); | |
884 } | |
885 | |
886 if (!ancestorStackingContext) | |
887 return 0; | |
888 | |
889 getPaintOrderLists(ancestorStackingContext, | |
890 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
891 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
892 | |
893 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
894 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
895 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
896 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
897 | |
898 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
899 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
900 | |
901 ListHashSet<RefPtr<Node> > listBeforePromote; | |
902 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
903 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
904 listBeforePromote.add(layerBeforePromote->renderer()->node()); | |
905 } | |
906 | |
907 ListHashSet<RefPtr<Node> > listAfterPromote; | |
908 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
909 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
910 listAfterPromote.add(layerAfterPromote->renderer()->node()); | |
911 } | |
912 | |
913 PassRefPtr<PaintOrderLists> paintOrderLists = adoptRef(new PaintOrderLists(S taticHashSetNodeList::adopt(listBeforePromote), StaticHashSetNodeList::adopt(lis tAfterPromote))); | |
914 return paintOrderLists; | |
915 } | |
916 | |
917 | |
676 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) | 918 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) |
677 { | 919 { |
678 ASSERT(!m_visibleContentStatusDirty); | 920 ASSERT(!m_visibleContentStatusDirty); |
679 | 921 |
680 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 922 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
681 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); | 923 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); |
682 } | 924 } |
683 | 925 |
684 | 926 |
685 void RenderLayer::computeRepaintRectsIncludingDescendants() | 927 void RenderLayer::computeRepaintRectsIncludingDescendants() |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1284 RenderLayer* RenderLayer::stackingContainer() const | 1526 RenderLayer* RenderLayer::stackingContainer() const |
1285 { | 1527 { |
1286 RenderLayer* layer = parent(); | 1528 RenderLayer* layer = parent(); |
1287 while (layer && !layer->isStackingContainer()) | 1529 while (layer && !layer->isStackingContainer()) |
1288 layer = layer->parent(); | 1530 layer = layer->parent(); |
1289 | 1531 |
1290 ASSERT(!layer || layer->isStackingContainer()); | 1532 ASSERT(!layer || layer->isStackingContainer()); |
1291 return layer; | 1533 return layer; |
1292 } | 1534 } |
1293 | 1535 |
1294 static inline bool isPositionedContainer(RenderLayer* layer) | |
1295 { | |
1296 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
1297 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
1298 } | |
1299 | |
1300 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1536 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
1301 { | 1537 { |
1302 return layer->isRootLayer() || layer->hasTransform(); | 1538 return layer->isRootLayer() || layer->hasTransform(); |
1303 } | 1539 } |
1304 | 1540 |
1305 RenderLayer* RenderLayer::enclosingPositionedAncestor() const | 1541 RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
1306 { | 1542 { |
1307 RenderLayer* curr = parent(); | 1543 RenderLayer* curr = parent(); |
1308 while (curr && !isPositionedContainer(curr)) | 1544 while (curr && !isPositionedContainer(curr)) |
1309 curr = curr->parent(); | 1545 curr = curr->parent(); |
(...skipping 4242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5552 } | 5788 } |
5553 | 5789 |
5554 void RenderLayer::rebuildZOrderLists() | 5790 void RenderLayer::rebuildZOrderLists() |
5555 { | 5791 { |
5556 ASSERT(m_layerListMutationAllowed); | 5792 ASSERT(m_layerListMutationAllowed); |
5557 ASSERT(isDirtyStackingContainer()); | 5793 ASSERT(isDirtyStackingContainer()); |
5558 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); | 5794 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); |
5559 m_zOrderListsDirty = false; | 5795 m_zOrderListsDirty = false; |
5560 } | 5796 } |
5561 | 5797 |
5562 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList) | 5798 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList, const RenderLayer* layerToForceAsStackingContext) |
5563 { | 5799 { |
5564 bool includeHiddenLayers = compositor()->inCompositingMode(); | 5800 bool includeHiddenLayers = compositor()->inCompositingMode(); |
5565 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 5801 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
5566 if (!m_reflection || reflectionLayer() != child) | 5802 if (!m_reflection || reflectionLayer() != child) |
5567 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList); | 5803 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList, layerToForceAsStackingContext); |
5568 | 5804 |
5569 // Sort the two lists. | 5805 // Sort the two lists. |
5570 if (posZOrderList) | 5806 if (posZOrderList) |
5571 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); | 5807 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); |
5572 | 5808 |
5573 if (negZOrderList) | 5809 if (negZOrderList) |
5574 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); | 5810 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); |
5575 | 5811 |
5576 #if ENABLE(DIALOG_ELEMENT) | 5812 #if ENABLE(DIALOG_ELEMENT) |
5577 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. | 5813 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. |
(...skipping 24 matching lines...) Expand all Loading... | |
5602 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { | 5838 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { |
5603 if (!m_normalFlowList) | 5839 if (!m_normalFlowList) |
5604 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5840 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
5605 m_normalFlowList->append(child); | 5841 m_normalFlowList->append(child); |
5606 } | 5842 } |
5607 } | 5843 } |
5608 | 5844 |
5609 m_normalFlowListDirty = false; | 5845 m_normalFlowListDirty = false; |
5610 } | 5846 } |
5611 | 5847 |
5612 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer) | 5848 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContext) |
5613 { | 5849 { |
5614 #if ENABLE(DIALOG_ELEMENT) | 5850 #if ENABLE(DIALOG_ELEMENT) |
5615 if (isInTopLayer()) | 5851 if (isInTopLayer()) |
5616 return; | 5852 return; |
5617 #endif | 5853 #endif |
5618 | 5854 |
5619 updateDescendantDependentFlags(); | 5855 updateDescendantDependentFlags(); |
5620 | 5856 |
5621 bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer(); | 5857 bool isStacking = (this == layerToForceAsStackingContext) || (behavior == St opAtStackingContexts ? isStackingContext() : isStackingContainer()); |
5622 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. | 5858 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. |
5623 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); | 5859 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); |
5624 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { | 5860 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { |
5625 // Determine which buffer the child should be in. | 5861 // Determine which buffer the child should be in. |
5626 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; | 5862 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; |
5627 | 5863 |
5628 // Create the buffer if it doesn't exist yet. | 5864 // Create the buffer if it doesn't exist yet. |
5629 if (!buffer) | 5865 if (!buffer) |
5630 buffer = adoptPtr(new Vector<RenderLayer*>); | 5866 buffer = adoptPtr(new Vector<RenderLayer*>); |
5631 | 5867 |
5632 // Append ourselves at the end of the appropriate buffer. | 5868 // Append ourselves at the end of the appropriate buffer. |
5633 buffer->append(this); | 5869 buffer->append(this); |
5634 } | 5870 } |
5635 | 5871 |
5636 // Recur into our children to collect more layers, but only if we don't esta blish | 5872 // Recur into our children to collect more layers, but only if we don't esta blish |
5637 // a stacking context/container. | 5873 // a stacking context/container. |
5638 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { | 5874 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { |
5639 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5875 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
5640 // Ignore reflections. | 5876 // Ignore reflections. |
5641 if (!m_reflection || reflectionLayer() != child) | 5877 if (!m_reflection || reflectionLayer() != child) |
5642 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); | 5878 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContext); |
5643 } | 5879 } |
5644 } | 5880 } |
5645 } | 5881 } |
5646 | 5882 |
5647 void RenderLayer::updateLayerListsIfNeeded() | 5883 void RenderLayer::updateLayerListsIfNeeded() |
5648 { | 5884 { |
5649 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); | 5885 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); |
5650 updateZOrderLists(); | 5886 updateZOrderLists(); |
5651 updateNormalFlowList(); | 5887 updateNormalFlowList(); |
5652 | 5888 |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6356 } | 6592 } |
6357 } | 6593 } |
6358 | 6594 |
6359 void showLayerTree(const WebCore::RenderObject* renderer) | 6595 void showLayerTree(const WebCore::RenderObject* renderer) |
6360 { | 6596 { |
6361 if (!renderer) | 6597 if (!renderer) |
6362 return; | 6598 return; |
6363 showLayerTree(renderer->enclosingLayer()); | 6599 showLayerTree(renderer->enclosingLayer()); |
6364 } | 6600 } |
6365 #endif | 6601 #endif |
OLD | NEW |