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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 | 664 |
663 if (!isStackingContext()) { | 665 if (!isStackingContext()) { |
664 bool newValue = maxIndex - minIndex == count; | 666 bool newValue = maxIndex - minIndex == count; |
665 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | 667 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; |
666 m_descendantsAreContiguousInStackingOrder = newValue; | 668 m_descendantsAreContiguousInStackingOrder = newValue; |
667 if (didUpdate) | 669 if (didUpdate) |
668 updateNeedsCompositedScrolling(); | 670 updateNeedsCompositedScrolling(); |
669 } | 671 } |
670 } | 672 } |
671 | 673 |
674 static inline bool isPositionedContainer(const RenderLayer* layer) | |
675 { | |
676 // FIXME: This is not in sync with containingBlock. | |
677 // RenderObject::canContainFixedPositionedObject() should probably be used | |
678 // instead. | |
679 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
680 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
681 } | |
682 | |
683 enum StackingOrderDirection { FromBackground, FromForeground }; | |
684 | |
685 // We'd like to be able to iterate through a single paint order list, but for | |
686 // efficiency's sake, we hang onto two lists instead (namely, the pos and neg | |
687 // z-order lists produced by CollectLayers). This function allows us to index | |
688 // into these two lists as if they were one. It also allows us to index into | |
689 // this virtual list either from the start or from the end (i.e., in either | |
690 // stacking order direction). | |
691 static const RenderLayer* getStackingOrderElementAt(const Vector<RenderLayer*>* posZOrderList, const Vector<RenderLayer*>* negZOrderList, const StackingOrderDir ection direction, const size_t index) | |
692 { | |
693 size_t negZOrderListSize = negZOrderList ? negZOrderList->size() : 0; | |
694 | |
695 if (direction == FromBackground) { | |
696 if (index < negZOrderListSize) | |
697 return negZOrderList->at(index); | |
698 | |
699 return posZOrderList->at(index - negZOrderListSize); | |
700 } | |
701 | |
702 size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; | |
703 | |
704 if (index < posZOrderListSize) | |
705 return posZOrderList->at(posZOrderListSize - index - 1); | |
706 | |
707 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); | |
708 } | |
709 | |
710 // Compute what positive and negative z-order lists would look like before and | |
711 // after promotion, so we can later ensure that proper stacking order is | |
712 // preserved between the two sets of lists. | |
713 // | |
714 // A few examples: | |
715 // c = currentLayer | |
716 // - = negative z-order child of currentLayer | |
717 // + = positive z-order child of currentLayer | |
718 // a = positioned ancestor of currentLayer | |
719 // x = any other RenderLayer in the list | |
720 // | |
721 // (a) xxxxx-----++a+++x | |
722 // (b) xxx-----c++++++xx | |
723 // | |
724 // | |
725 // Normally the current layer would be painted in the normal flow list if it | |
726 // doesn't already appear in the positive z-order list. However, in the case | |
727 // that the layer has a positioned ancestor, it will paint directly after the | |
728 // positioned ancestor. In example (a), the current layer would be painted in | |
729 // the middle of its own positive z-order children, so promoting would cause a | |
730 // change in paint order (since a promoted layer will paint all of its positive | |
731 // z-order children strictly after it paints itself). | |
732 // | |
733 // In example (b), it is ok to promote the current layer only if it does not | |
734 // have a background. If it has a background, the background gets painted before | |
735 // the layer's negative z-order children, so again, a promotion would cause a | |
736 // change in paint order (causing the background to get painted after the | |
737 // negative z-order children instead of before). | |
738 void RenderLayer::collectBeforeAfterPromotionZOrderLists( | |
739 RenderLayer* ancestorStackingContext, | |
740 OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, | |
741 OwnPtr<Vector<RenderLayer*> >& negZOrderListBeforePromote, | |
742 OwnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, | |
743 OwnPtr<Vector<RenderLayer*> >& negZOrderListAfterPromote) | |
744 { | |
745 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and | |
746 // m_isNormalFlowOnly are both bitfields, so we have to do it the | |
747 // old-fashioned way. | |
748 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | |
749 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; | |
750 | |
751 // Set the flag on the current layer, then rebuild ancestor stacking | |
752 // context's lists. This way, we can see the exact effects that promoting | |
753 // this layer would cause. | |
754 m_needsCompositedScrolling = false; | |
755 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
756 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListBeforePromote, negZOrderListBeforePromote, 0); | |
757 | |
758 m_isNormalFlowOnly = false; | |
759 m_needsCompositedScrolling = true; | |
760 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListAfterPromote, negZOrderListAfterPromote, this); | |
shawnsingh
2013/04/18 02:22:14
I feel uncomfortable about using this function to
hartmanng
2013/04/18 17:14:00
I get your concern, but I think we're pretty safe
| |
761 | |
762 m_needsCompositedScrolling = oldNeedsCompositedScrolling; | |
763 m_isNormalFlowOnly = oldIsNormalFlowOnly; | |
764 | |
765 | |
766 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
767 | |
768 const RenderLayer* positionedAncestor = parent(); | |
769 while (positionedAncestor && !isPositionedContainer(positionedAncestor) && ! positionedAncestor->isStackingContext()) | |
770 positionedAncestor = positionedAncestor->parent(); | |
771 if (positionedAncestor && (!isPositionedContainer(positionedAncestor) || pos itionedAncestor->isStackingContext())) | |
772 positionedAncestor = 0; | |
773 | |
774 bool currentLayerIsInPosZOrderListBeforePromote = false; | |
775 | |
776 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index++) { | |
777 if (posZOrderListBeforePromote->at(index) == this) { | |
778 currentLayerIsInPosZOrderListBeforePromote = true; | |
779 break; | |
780 } | |
781 } | |
782 | |
783 // Insert this into the posZOrderistBeforePromote directly after the | |
784 // positioned ancestor, if there is one. Otherwise, add it to the very | |
785 // beginning. | |
786 // | |
787 // The current layer will appear in the z-order lists after promotion, so | |
788 // for a meaningful comparison, we must insert it in the z-order lists | |
789 // before promotion if it does not appear there already. | |
790 if (!currentLayerIsInPosZOrderListBeforePromote) { | |
791 if (!positionedAncestor) { | |
792 if (!posZOrderListBeforePromote) | |
793 posZOrderListBeforePromote = adoptPtr(new Vector<RenderLayer*>() ); | |
794 | |
795 posZOrderListBeforePromote->prepend(this); | |
796 posZOrderListSizeBeforePromote++; | |
797 } else { | |
798 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index ++) { | |
799 if (posZOrderListBeforePromote->at(index) == positionedAncestor) { | |
800 posZOrderListBeforePromote->insert(index + 1, this); | |
801 posZOrderListSizeBeforePromote++; | |
802 break; | |
803 } | |
804 } | |
805 } | |
806 } | |
807 } | |
808 | |
809 String RenderLayer::paintOrderListsAsText() | |
810 { | |
811 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
812 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
813 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
814 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
815 | |
816 RenderLayer* ancestorStackingContext = this; | |
817 | |
818 while (ancestorStackingContext) { | |
819 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
820 break; | |
821 ancestorStackingContext = ancestorStackingContext->parent(); | |
822 } | |
823 | |
824 if (!ancestorStackingContext) | |
825 return String(); | |
826 | |
827 collectBeforeAfterPromotionZOrderLists(ancestorStackingContext, | |
828 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
829 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
830 | |
831 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
832 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
833 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
834 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
835 | |
836 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
837 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
838 | |
839 TextStream ts; | |
840 | |
841 ts << "Layer: " << this << " \"" << name() << "\", z-index: " << renderer()- >style()->zIndex() << "\n"; | |
842 | |
843 ts << " stacking context's paint order list BEFORE promote:\n"; | |
844 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
845 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
846 ts << " " << layerBeforePromote << " \"" << layerBeforePromote->name( ) << "\", z-index: " << layerBeforePromote->renderer()->style()->zIndex() << "\n "; | |
847 } | |
848 | |
849 ts << " stacking context's paint order list AFTER promote:\n"; | |
850 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
851 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
852 ts << " " << layerAfterPromote << " \"" << layerAfterPromote->name() << "\", z-index: " << layerAfterPromote->renderer()->style()->zIndex() << "\n"; | |
853 } | |
854 | |
855 return ts.release(); | |
856 } | |
857 | |
858 PassRefPtr<PaintOrderLists> RenderLayer::paintOrderLists() | |
859 { | |
860 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
861 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
862 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
863 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
864 | |
865 RenderLayer* ancestorStackingContext = this; | |
866 | |
867 while (ancestorStackingContext) { | |
868 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
869 break; | |
870 ancestorStackingContext = ancestorStackingContext->parent(); | |
871 } | |
872 | |
873 if (!ancestorStackingContext) | |
874 return 0; | |
875 | |
876 collectBeforeAfterPromotionZOrderLists(ancestorStackingContext, | |
877 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
878 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
879 | |
880 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
881 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
882 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
883 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
884 | |
885 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
886 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
887 | |
888 ListHashSet<RefPtr<Node> > listBeforePromote; | |
889 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
890 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
891 listBeforePromote.add(layerBeforePromote->renderer()->node()); | |
892 } | |
893 | |
894 ListHashSet<RefPtr<Node> > listAfterPromote; | |
895 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
896 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
897 listAfterPromote.add(layerAfterPromote->renderer()->node()); | |
898 } | |
899 | |
900 PassRefPtr<PaintOrderLists> paintOrderLists = adoptRef(new PaintOrderLists(S taticHashSetNodeList::adopt(listBeforePromote), StaticHashSetNodeList::adopt(lis tAfterPromote))); | |
901 return paintOrderLists; | |
902 } | |
903 | |
904 | |
672 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) | 905 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) |
673 { | 906 { |
674 ASSERT(!m_visibleContentStatusDirty); | 907 ASSERT(!m_visibleContentStatusDirty); |
675 | 908 |
676 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 909 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
677 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); | 910 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); |
678 } | 911 } |
679 | 912 |
680 | 913 |
681 void RenderLayer::computeRepaintRectsIncludingDescendants() | 914 void RenderLayer::computeRepaintRectsIncludingDescendants() |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1296 RenderLayer* RenderLayer::stackingContext() const | 1529 RenderLayer* RenderLayer::stackingContext() const |
1297 { | 1530 { |
1298 RenderLayer* layer = parent(); | 1531 RenderLayer* layer = parent(); |
1299 while (layer && !layer->isStackingContext()) | 1532 while (layer && !layer->isStackingContext()) |
1300 layer = layer->parent(); | 1533 layer = layer->parent(); |
1301 | 1534 |
1302 ASSERT(!layer || layer->isStackingContext()); | 1535 ASSERT(!layer || layer->isStackingContext()); |
1303 return layer; | 1536 return layer; |
1304 } | 1537 } |
1305 | 1538 |
1306 static inline bool isPositionedContainer(RenderLayer* layer) | |
1307 { | |
1308 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
1309 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
1310 } | |
1311 | |
1312 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1539 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
1313 { | 1540 { |
1314 return layer->isRootLayer() || layer->hasTransform(); | 1541 return layer->isRootLayer() || layer->hasTransform(); |
1315 } | 1542 } |
1316 | 1543 |
1317 RenderLayer* RenderLayer::enclosingPositionedAncestor() const | 1544 RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
1318 { | 1545 { |
1319 RenderLayer* curr = parent(); | 1546 RenderLayer* curr = parent(); |
1320 while (curr && !isPositionedContainer(curr)) | 1547 while (curr && !isPositionedContainer(curr)) |
1321 curr = curr->parent(); | 1548 curr = curr->parent(); |
(...skipping 4261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5583 } | 5810 } |
5584 | 5811 |
5585 void RenderLayer::rebuildZOrderLists() | 5812 void RenderLayer::rebuildZOrderLists() |
5586 { | 5813 { |
5587 ASSERT(m_layerListMutationAllowed); | 5814 ASSERT(m_layerListMutationAllowed); |
5588 ASSERT(isDirtyStackingContainer()); | 5815 ASSERT(isDirtyStackingContainer()); |
5589 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); | 5816 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); |
5590 m_zOrderListsDirty = false; | 5817 m_zOrderListsDirty = false; |
5591 } | 5818 } |
5592 | 5819 |
5593 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList) | 5820 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList, const RenderLayer* layerToForceAsStackingContext) |
shawnsingh
2013/04/18 02:22:14
To be strict with the distinction between stacking
hartmanng
2013/04/18 17:14:00
Yeah, you're right, good catch.
| |
5594 { | 5821 { |
5595 bool includeHiddenLayers = compositor()->inCompositingMode(); | 5822 bool includeHiddenLayers = compositor()->inCompositingMode(); |
5596 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 5823 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
5597 if (!m_reflection || reflectionLayer() != child) | 5824 if (!m_reflection || reflectionLayer() != child) |
5598 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList); | 5825 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList, layerToForceAsStackingContext); |
5599 | 5826 |
5600 // Sort the two lists. | 5827 // Sort the two lists. |
5601 if (posZOrderList) | 5828 if (posZOrderList) |
5602 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); | 5829 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); |
5603 | 5830 |
5604 if (negZOrderList) | 5831 if (negZOrderList) |
5605 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); | 5832 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); |
5606 | 5833 |
5607 #if ENABLE(DIALOG_ELEMENT) | 5834 #if ENABLE(DIALOG_ELEMENT) |
5608 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. | 5835 // 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... | |
5633 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { | 5860 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { |
5634 if (!m_normalFlowList) | 5861 if (!m_normalFlowList) |
5635 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5862 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
5636 m_normalFlowList->append(child); | 5863 m_normalFlowList->append(child); |
5637 } | 5864 } |
5638 } | 5865 } |
5639 | 5866 |
5640 m_normalFlowListDirty = false; | 5867 m_normalFlowListDirty = false; |
5641 } | 5868 } |
5642 | 5869 |
5643 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer) | 5870 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContext) |
shawnsingh
2013/04/18 02:22:14
same question about variable name as above.
hartmanng
2013/04/18 17:14:00
Done.
| |
5644 { | 5871 { |
5645 #if ENABLE(DIALOG_ELEMENT) | 5872 #if ENABLE(DIALOG_ELEMENT) |
5646 if (isInTopLayer()) | 5873 if (isInTopLayer()) |
5647 return; | 5874 return; |
5648 #endif | 5875 #endif |
5649 | 5876 |
5650 updateDescendantDependentFlags(); | 5877 updateDescendantDependentFlags(); |
5651 | 5878 |
5652 bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer(); | 5879 bool isStacking = (this == layerToForceAsStackingContext) || (behavior == St opAtStackingContexts ? isStackingContext() : isStackingContainer()); |
shawnsingh
2013/04/18 02:22:14
Not your patch, but the existing conditions on thi
hartmanng
2013/04/18 17:14:00
Changed to a switch statement, does this look bett
| |
5653 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. | 5880 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. |
5654 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); | 5881 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); |
5655 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { | 5882 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { |
5656 // Determine which buffer the child should be in. | 5883 // Determine which buffer the child should be in. |
5657 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; | 5884 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; |
5658 | 5885 |
5659 // Create the buffer if it doesn't exist yet. | 5886 // Create the buffer if it doesn't exist yet. |
5660 if (!buffer) | 5887 if (!buffer) |
5661 buffer = adoptPtr(new Vector<RenderLayer*>); | 5888 buffer = adoptPtr(new Vector<RenderLayer*>); |
5662 | 5889 |
5663 // Append ourselves at the end of the appropriate buffer. | 5890 // Append ourselves at the end of the appropriate buffer. |
5664 buffer->append(this); | 5891 buffer->append(this); |
5665 } | 5892 } |
5666 | 5893 |
5667 // Recur into our children to collect more layers, but only if we don't esta blish | 5894 // Recur into our children to collect more layers, but only if we don't esta blish |
5668 // a stacking context/container. | 5895 // a stacking context/container. |
5669 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { | 5896 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { |
5670 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5897 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
5671 // Ignore reflections. | 5898 // Ignore reflections. |
5672 if (!m_reflection || reflectionLayer() != child) | 5899 if (!m_reflection || reflectionLayer() != child) |
5673 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); | 5900 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContext); |
5674 } | 5901 } |
5675 } | 5902 } |
5676 } | 5903 } |
5677 | 5904 |
5678 void RenderLayer::updateLayerListsIfNeeded() | 5905 void RenderLayer::updateLayerListsIfNeeded() |
5679 { | 5906 { |
5680 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | 5907 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
5681 updateZOrderLists(); | 5908 updateZOrderLists(); |
5682 updateNormalFlowList(); | 5909 updateNormalFlowList(); |
5683 | 5910 |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6386 } | 6613 } |
6387 } | 6614 } |
6388 | 6615 |
6389 void showLayerTree(const WebCore::RenderObject* renderer) | 6616 void showLayerTree(const WebCore::RenderObject* renderer) |
6390 { | 6617 { |
6391 if (!renderer) | 6618 if (!renderer) |
6392 return; | 6619 return; |
6393 showLayerTree(renderer->enclosingLayer()); | 6620 showLayerTree(renderer->enclosingLayer()); |
6394 } | 6621 } |
6395 #endif | 6622 #endif |
OLD | NEW |