Chromium Code Reviews| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 #include "RenderTreeAsText.h" | 93 #include "RenderTreeAsText.h" |
| 94 #include "RenderView.h" | 94 #include "RenderView.h" |
| 95 #include "ScaleTransformOperation.h" | 95 #include "ScaleTransformOperation.h" |
| 96 #include "ScrollAnimator.h" | 96 #include "ScrollAnimator.h" |
| 97 #include "Scrollbar.h" | 97 #include "Scrollbar.h" |
| 98 #include "ScrollbarTheme.h" | 98 #include "ScrollbarTheme.h" |
| 99 #include "ScrollingCoordinator.h" | 99 #include "ScrollingCoordinator.h" |
| 100 #include "Settings.h" | 100 #include "Settings.h" |
| 101 #include "ShadowRoot.h" | 101 #include "ShadowRoot.h" |
| 102 #include "SourceGraphic.h" | 102 #include "SourceGraphic.h" |
| 103 #include "StaticHashSetNodeList.h" | |
| 103 #include "StylePropertySet.h" | 104 #include "StylePropertySet.h" |
| 104 #include "StyleResolver.h" | 105 #include "StyleResolver.h" |
| 105 #include "TextStream.h" | 106 #include "TextStream.h" |
| 106 #include "TransformationMatrix.h" | 107 #include "TransformationMatrix.h" |
| 107 #include "TranslateTransformOperation.h" | 108 #include "TranslateTransformOperation.h" |
| 108 #include "WebCoreMemoryInstrumentation.h" | 109 #include "WebCoreMemoryInstrumentation.h" |
| 109 #include <wtf/MemoryInstrumentationVector.h> | 110 #include <wtf/MemoryInstrumentationVector.h> |
| 110 #include <wtf/StdLibExtras.h> | 111 #include <wtf/StdLibExtras.h> |
| 111 #include <wtf/UnusedParam.h> | 112 #include <wtf/UnusedParam.h> |
| 112 #include <wtf/text/CString.h> | 113 #include <wtf/text/CString.h> |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 | 633 |
| 633 if (!isStackingContext()) { | 634 if (!isStackingContext()) { |
| 634 bool newValue = maxIndex - minIndex == count; | 635 bool newValue = maxIndex - minIndex == count; |
| 635 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | 636 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; |
| 636 m_descendantsAreContiguousInStackingOrder = newValue; | 637 m_descendantsAreContiguousInStackingOrder = newValue; |
| 637 if (didUpdate) | 638 if (didUpdate) |
| 638 updateNeedsCompositedScrolling(); | 639 updateNeedsCompositedScrolling(); |
| 639 } | 640 } |
| 640 } | 641 } |
| 641 | 642 |
| 643 static inline bool isPositionedContainer(const RenderLayer* layer) | |
| 644 { | |
| 645 // FIXME: This is not in sync with containingBlock. | |
| 646 // RenderObject::canContainFixedPositionedObject() should probably be used | |
| 647 // instead. | |
| 648 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
| 649 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
| 650 } | |
| 651 | |
| 652 enum StackingOrderDirection { FromBackground, FromForeground }; | |
| 653 | |
| 654 // We'd like to be able to iterate through a single paint order list, but for | |
| 655 // efficiency's sake, we hang onto two lists instead (namely, the pos and neg | |
| 656 // z-order lists produced by CollectLayers). This function allows us to index | |
| 657 // into these two lists as if they were one. It also allows us to index into | |
| 658 // this virtual list either from the start or from the end (i.e., in either | |
| 659 // stacking order direction). | |
| 660 static const RenderLayer* getStackingOrderElementAt(const Vector<RenderLayer*>* posZOrderList, const Vector<RenderLayer*>* negZOrderList, const StackingOrderDir ection direction, const size_t index) | |
| 661 { | |
| 662 size_t negZOrderListSize = negZOrderList ? negZOrderList->size() : 0; | |
| 663 | |
| 664 if (direction == FromBackground) { | |
| 665 if (index < negZOrderListSize) | |
| 666 return negZOrderList->at(index); | |
| 667 | |
| 668 return posZOrderList->at(index - negZOrderListSize); | |
| 669 } | |
| 670 | |
| 671 size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; | |
| 672 | |
| 673 if (index < posZOrderListSize) | |
| 674 return posZOrderList->at(posZOrderListSize - index - 1); | |
| 675 | |
| 676 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); | |
| 677 } | |
| 678 | |
| 679 // Compute what positive and negative z-order lists would look like before and | |
| 680 // after promotion, so we can later ensure that proper stacking order is | |
| 681 // preserved between the two sets of lists. | |
| 682 // | |
| 683 // A few examples: | |
| 684 // c = currentLayer | |
| 685 // - = negative z-order child of currentLayer | |
| 686 // + = positive z-order child of currentLayer | |
| 687 // a = positioned ancestor of currentLayer | |
| 688 // x = any other RenderLayer in the list | |
| 689 // | |
| 690 // (a) xxxxx-----++a+++x | |
| 691 // (b) xxx-----c++++++xx | |
| 692 // | |
| 693 // | |
| 694 // Normally the current layer would be painted in the normal flow list if it | |
| 695 // doesn't already appear in the positive z-order list. However, in the case | |
| 696 // that the layer has a positioned ancestor, it will paint directly after the | |
| 697 // positioned ancestor. In example (a), the current layer would be painted in | |
| 698 // the middle of its own positive z-order children, so promoting would cause a | |
| 699 // change in paint order (since a promoted layer will paint all of its positive | |
| 700 // z-order children strictly after it paints itself). | |
| 701 // | |
| 702 // In example (b), it is ok to promote the current layer only if it does not | |
| 703 // have a background. If it has a background, the background gets painted before | |
| 704 // the layer's negative z-order children, so again, a promotion would cause a | |
| 705 // change in paint order (causing the background to get painted after the | |
| 706 // negative z-order children instead of before). | |
| 707 void RenderLayer::collectBeforePromotionZOrderList( | |
|
Julien - ping for review
2013/04/22 21:49:30
Some of the line breaking are *really* weird (like
hartmanng
2013/04/23 21:32:37
Done.
| |
| 708 RenderLayer* ancestorStackingContext, | |
| 709 OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, | |
| 710 OwnPtr<Vector<RenderLayer*> >& negZOrderListBeforePromote) | |
| 711 { | |
| 712 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and | |
| 713 // m_isNormalFlowOnly are both bitfields, so we have to do it the | |
| 714 // old-fashioned way. | |
| 715 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | |
| 716 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; | |
| 717 | |
| 718 // Set the flag on the current layer, then rebuild ancestor stacking | |
| 719 // context's lists. This way, we can see the exact effects that promoting | |
| 720 // this layer would cause. | |
| 721 m_needsCompositedScrolling = false; | |
| 722 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
| 723 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListBeforePromote, negZOrderListBeforePromote, 0); | |
| 724 | |
| 725 m_needsCompositedScrolling = oldNeedsCompositedScrolling; | |
| 726 m_isNormalFlowOnly = oldIsNormalFlowOnly; | |
| 727 | |
| 728 | |
| 729 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
| 730 | |
| 731 const RenderLayer* positionedAncestor = parent(); | |
| 732 while (positionedAncestor && !isPositionedContainer(positionedAncestor) && ! positionedAncestor->isStackingContext()) | |
| 733 positionedAncestor = positionedAncestor->parent(); | |
| 734 if (positionedAncestor && (!isPositionedContainer(positionedAncestor) || pos itionedAncestor->isStackingContext())) | |
| 735 positionedAncestor = 0; | |
| 736 | |
| 737 bool currentLayerIsInPosZOrderListBeforePromote = false; | |
| 738 | |
| 739 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index++) { | |
| 740 if (posZOrderListBeforePromote->at(index) == this) { | |
| 741 currentLayerIsInPosZOrderListBeforePromote = true; | |
| 742 break; | |
| 743 } | |
| 744 } | |
| 745 | |
| 746 // Insert this into the posZOrderistBeforePromote directly after the | |
| 747 // positioned ancestor, if there is one. Otherwise, add it to the very | |
| 748 // beginning. | |
| 749 // | |
| 750 // The current layer will appear in the z-order lists after promotion, so | |
| 751 // for a meaningful comparison, we must insert it in the z-order lists | |
| 752 // before promotion if it does not appear there already. | |
| 753 if (!currentLayerIsInPosZOrderListBeforePromote) { | |
| 754 if (!positionedAncestor) { | |
| 755 if (!posZOrderListBeforePromote) | |
| 756 posZOrderListBeforePromote = adoptPtr(new Vector<RenderLayer*>() ); | |
| 757 | |
| 758 posZOrderListBeforePromote->prepend(this); | |
| 759 posZOrderListSizeBeforePromote++; | |
| 760 } else { | |
| 761 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index ++) { | |
| 762 if (posZOrderListBeforePromote->at(index) == positionedAncestor) { | |
| 763 posZOrderListBeforePromote->insert(index + 1, this); | |
| 764 posZOrderListSizeBeforePromote++; | |
| 765 break; | |
| 766 } | |
| 767 } | |
| 768 } | |
| 769 } | |
| 770 } | |
| 771 | |
| 772 void RenderLayer::collectAfterPromotionZOrderList( | |
| 773 RenderLayer* ancestorStackingContext, | |
| 774 OwnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, | |
| 775 OwnPtr<Vector<RenderLayer*> >& negZOrderListAfterPromote) | |
| 776 { | |
| 777 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and | |
| 778 // m_isNormalFlowOnly are both bitfields, so we have to do it the | |
| 779 // old-fashioned way. | |
| 780 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | |
| 781 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; | |
| 782 | |
| 783 // Set the flag on the current layer, then rebuild ancestor stacking | |
| 784 // context's lists. This way, we can see the exact effects that promoting | |
| 785 // this layer would cause. | |
| 786 m_isNormalFlowOnly = false; | |
| 787 m_needsCompositedScrolling = true; | |
| 788 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde rListAfterPromote, negZOrderListAfterPromote, this); | |
| 789 | |
| 790 m_needsCompositedScrolling = oldNeedsCompositedScrolling; | |
| 791 m_isNormalFlowOnly = oldIsNormalFlowOnly; | |
| 792 } | |
| 793 | |
| 794 #ifndef NDEBUG | |
| 795 String RenderLayer::paintOrderListsAsText() | |
| 796 { | |
| 797 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
| 798 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
| 799 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
| 800 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
| 801 | |
| 802 RenderLayer* ancestorStackingContext = this; | |
| 803 | |
| 804 while (ancestorStackingContext) { | |
| 805 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
|
Julien - ping for review
2013/04/22 21:49:30
The 'ancestorStackingContext != this' check is art
hartmanng
2013/04/23 21:32:37
Done.
| |
| 806 break; | |
| 807 ancestorStackingContext = ancestorStackingContext->parent(); | |
| 808 } | |
|
Julien - ping for review
2013/04/22 21:49:30
This should be in its own function really as it is
hartmanng
2013/04/23 21:32:37
Done.
| |
| 809 | |
| 810 if (!ancestorStackingContext) | |
| 811 return String(); | |
| 812 | |
| 813 collectBeforePromotionZOrderList(ancestorStackingContext, posZOrderListBefor ePromote, negZOrderListBeforePromote); | |
| 814 collectAfterPromotionZOrderList(ancestorStackingContext, posZOrderListAfterP romote, negZOrderListAfterPromote); | |
|
Julien - ping for review
2013/04/22 21:49:30
The code duplication makes me sad. It seems that i
hartmanng
2013/04/23 21:32:37
I'm not sure I understand your suggestion.
collec
| |
| 815 | |
| 816 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
| 817 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
| 818 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
| 819 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
| 820 | |
| 821 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
| 822 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
| 823 | |
| 824 TextStream ts; | |
| 825 | |
| 826 ts << "Layer: " << this << " \"" << debugName() << "\", z-index: " << render er()->style()->zIndex() << "\n"; | |
| 827 | |
| 828 ts << " stacking context's paint order list BEFORE promote:\n"; | |
| 829 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
| 830 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
| 831 ts << " " << layerBeforePromote << " \"" << layerBeforePromote->debug Name() << "\", z-index: " << layerBeforePromote->renderer()->style()->zIndex() < < "\n"; | |
| 832 } | |
| 833 | |
| 834 ts << " stacking context's paint order list AFTER promote:\n"; | |
| 835 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
| 836 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
| 837 ts << " " << layerAfterPromote << " \"" << layerAfterPromote->debugNa me() << "\", z-index: " << layerAfterPromote->renderer()->style()->zIndex() << " \n"; | |
| 838 } | |
| 839 | |
| 840 return ts.release(); | |
| 841 } | |
| 842 #endif | |
| 843 | |
| 844 PassRefPtr<NodeList> RenderLayer::paintOrderListBeforePromote() | |
|
hartmanng
2013/04/23 21:32:37
I reworked these two functions, and the ones in In
| |
| 845 { | |
| 846 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
| 847 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
| 848 | |
| 849 RenderLayer* ancestorStackingContext = this; | |
| 850 | |
| 851 while (ancestorStackingContext) { | |
| 852 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
| 853 break; | |
| 854 ancestorStackingContext = ancestorStackingContext->parent(); | |
| 855 } | |
| 856 | |
| 857 if (!ancestorStackingContext) | |
| 858 return 0; | |
| 859 | |
| 860 collectBeforePromotionZOrderList(ancestorStackingContext, | |
| 861 posZOrderListBeforePromote, negZOrderListBeforePromote); | |
| 862 | |
| 863 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
| 864 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
| 865 | |
| 866 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
| 867 | |
| 868 ListHashSet<RefPtr<Node> > listBeforePromote; | |
| 869 for (size_t index = 0; index < sizeBeforePromote; index++) { | |
| 870 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in dex); | |
| 871 listBeforePromote.add(layerBeforePromote->renderer()->node()); | |
| 872 } | |
| 873 | |
| 874 return StaticHashSetNodeList::adopt(listBeforePromote); | |
| 875 } | |
| 876 | |
| 877 PassRefPtr<NodeList> RenderLayer::paintOrderListAfterPromote() | |
| 878 { | |
| 879 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
| 880 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
| 881 | |
| 882 RenderLayer* ancestorStackingContext = this; | |
| 883 | |
| 884 while (ancestorStackingContext) { | |
| 885 if (ancestorStackingContext != this && ancestorStackingContext->isStacki ngContext()) | |
| 886 break; | |
| 887 ancestorStackingContext = ancestorStackingContext->parent(); | |
| 888 } | |
| 889 | |
| 890 if (!ancestorStackingContext) | |
| 891 return 0; | |
| 892 | |
| 893 collectAfterPromotionZOrderList(ancestorStackingContext, | |
| 894 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
| 895 | |
| 896 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
| 897 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
| 898 | |
| 899 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
| 900 | |
| 901 ListHashSet<RefPtr<Node> > listAfterPromote; | |
| 902 for (size_t index = 0; index < sizeAfterPromote; index++) { | |
| 903 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index ); | |
| 904 listAfterPromote.add(layerAfterPromote->renderer()->node()); | |
| 905 } | |
| 906 | |
| 907 return StaticHashSetNodeList::adopt(listAfterPromote); | |
| 908 } | |
| 909 | |
| 910 | |
| 642 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) | 911 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) |
| 643 { | 912 { |
| 644 ASSERT(!m_visibleContentStatusDirty); | 913 ASSERT(!m_visibleContentStatusDirty); |
| 645 | 914 |
| 646 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 915 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
| 647 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); | 916 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); |
| 648 } | 917 } |
| 649 | 918 |
| 650 | 919 |
| 651 void RenderLayer::computeRepaintRectsIncludingDescendants() | 920 void RenderLayer::computeRepaintRectsIncludingDescendants() |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 RenderLayer* RenderLayer::stackingContext() const | 1535 RenderLayer* RenderLayer::stackingContext() const |
| 1267 { | 1536 { |
| 1268 RenderLayer* layer = parent(); | 1537 RenderLayer* layer = parent(); |
| 1269 while (layer && !layer->isStackingContext()) | 1538 while (layer && !layer->isStackingContext()) |
| 1270 layer = layer->parent(); | 1539 layer = layer->parent(); |
| 1271 | 1540 |
| 1272 ASSERT(!layer || layer->isStackingContext()); | 1541 ASSERT(!layer || layer->isStackingContext()); |
| 1273 return layer; | 1542 return layer; |
| 1274 } | 1543 } |
| 1275 | 1544 |
| 1276 static inline bool isPositionedContainer(RenderLayer* layer) | |
| 1277 { | |
| 1278 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
| 1279 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | |
| 1280 } | |
| 1281 | |
| 1282 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1545 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
| 1283 { | 1546 { |
| 1284 return layer->isRootLayer() || layer->hasTransform(); | 1547 return layer->isRootLayer() || layer->hasTransform(); |
| 1285 } | 1548 } |
| 1286 | 1549 |
| 1287 RenderLayer* RenderLayer::enclosingPositionedAncestor() const | 1550 RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
| 1288 { | 1551 { |
| 1289 RenderLayer* curr = parent(); | 1552 RenderLayer* curr = parent(); |
| 1290 while (curr && !isPositionedContainer(curr)) | 1553 while (curr && !isPositionedContainer(curr)) |
| 1291 curr = curr->parent(); | 1554 curr = curr->parent(); |
| (...skipping 4243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5535 } | 5798 } |
| 5536 | 5799 |
| 5537 void RenderLayer::rebuildZOrderLists() | 5800 void RenderLayer::rebuildZOrderLists() |
| 5538 { | 5801 { |
| 5539 ASSERT(m_layerListMutationAllowed); | 5802 ASSERT(m_layerListMutationAllowed); |
| 5540 ASSERT(isDirtyStackingContainer()); | 5803 ASSERT(isDirtyStackingContainer()); |
| 5541 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); | 5804 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); |
| 5542 m_zOrderListsDirty = false; | 5805 m_zOrderListsDirty = false; |
| 5543 } | 5806 } |
| 5544 | 5807 |
| 5545 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList) | 5808 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList, const RenderLayer* layerToForceAsStackingContainer) |
| 5546 { | 5809 { |
| 5547 bool includeHiddenLayers = compositor()->inCompositingMode(); | 5810 bool includeHiddenLayers = compositor()->inCompositingMode(); |
| 5548 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 5811 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 5549 if (!m_reflection || reflectionLayer() != child) | 5812 if (!m_reflection || reflectionLayer() != child) |
| 5550 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList); | 5813 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n egZOrderList, layerToForceAsStackingContainer); |
| 5551 | 5814 |
| 5552 // Sort the two lists. | 5815 // Sort the two lists. |
| 5553 if (posZOrderList) | 5816 if (posZOrderList) |
| 5554 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); | 5817 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI ndex); |
| 5555 | 5818 |
| 5556 if (negZOrderList) | 5819 if (negZOrderList) |
| 5557 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); | 5820 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); |
| 5558 | 5821 |
| 5559 #if ENABLE(DIALOG_ELEMENT) | 5822 #if ENABLE(DIALOG_ELEMENT) |
| 5560 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. | 5823 // 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... | |
| 5585 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { | 5848 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { |
| 5586 if (!m_normalFlowList) | 5849 if (!m_normalFlowList) |
| 5587 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5850 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
| 5588 m_normalFlowList->append(child); | 5851 m_normalFlowList->append(child); |
| 5589 } | 5852 } |
| 5590 } | 5853 } |
| 5591 | 5854 |
| 5592 m_normalFlowListDirty = false; | 5855 m_normalFlowListDirty = false; |
| 5593 } | 5856 } |
| 5594 | 5857 |
| 5595 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer) | 5858 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContainer) |
| 5596 { | 5859 { |
| 5597 #if ENABLE(DIALOG_ELEMENT) | 5860 #if ENABLE(DIALOG_ELEMENT) |
| 5598 if (isInTopLayer()) | 5861 if (isInTopLayer()) |
| 5599 return; | 5862 return; |
| 5600 #endif | 5863 #endif |
| 5601 | 5864 |
| 5602 updateDescendantDependentFlags(); | 5865 updateDescendantDependentFlags(); |
| 5603 | 5866 |
| 5604 bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() : isStackingContainer(); | 5867 bool isStacking = false; |
| 5868 | |
| 5869 switch (behavior) { | |
| 5870 case StopAtStackingContexts: | |
| 5871 isStacking = (this == layerToForceAsStackingContainer) || isStacking Context(); | |
| 5872 break; | |
| 5873 | |
| 5874 case StopAtStackingContainers: | |
| 5875 isStacking = (this == layerToForceAsStackingContainer) || isStacking Container(); | |
| 5876 break; | |
| 5877 } | |
| 5878 | |
| 5605 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. | 5879 // Overflow layers are just painted by their enclosing layers, so they don't get put in zorder lists. |
| 5606 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); | 5880 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_ hasVisibleDescendant && isStacking)); |
| 5607 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { | 5881 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea d()) { |
| 5608 // Determine which buffer the child should be in. | 5882 // Determine which buffer the child should be in. |
| 5609 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; | 5883 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne gBuffer; |
| 5610 | 5884 |
| 5611 // Create the buffer if it doesn't exist yet. | 5885 // Create the buffer if it doesn't exist yet. |
| 5612 if (!buffer) | 5886 if (!buffer) |
| 5613 buffer = adoptPtr(new Vector<RenderLayer*>); | 5887 buffer = adoptPtr(new Vector<RenderLayer*>); |
| 5614 | 5888 |
| 5615 // Append ourselves at the end of the appropriate buffer. | 5889 // Append ourselves at the end of the appropriate buffer. |
| 5616 buffer->append(this); | 5890 buffer->append(this); |
| 5617 } | 5891 } |
| 5618 | 5892 |
| 5619 // Recur into our children to collect more layers, but only if we don't esta blish | 5893 // Recur into our children to collect more layers, but only if we don't esta blish |
| 5620 // a stacking context/container. | 5894 // a stacking context/container. |
| 5621 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { | 5895 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { |
| 5622 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5896 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 5623 // Ignore reflections. | 5897 // Ignore reflections. |
| 5624 if (!m_reflection || reflectionLayer() != child) | 5898 if (!m_reflection || reflectionLayer() != child) |
| 5625 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); | 5899 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); |
| 5626 } | 5900 } |
| 5627 } | 5901 } |
| 5628 } | 5902 } |
| 5629 | 5903 |
| 5630 void RenderLayer::updateLayerListsIfNeeded() | 5904 void RenderLayer::updateLayerListsIfNeeded() |
| 5631 { | 5905 { |
| 5632 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | 5906 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
| 5633 updateZOrderLists(); | 5907 updateZOrderLists(); |
| 5634 updateNormalFlowList(); | 5908 updateNormalFlowList(); |
| 5635 | 5909 |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6326 } | 6600 } |
| 6327 } | 6601 } |
| 6328 | 6602 |
| 6329 void showLayerTree(const WebCore::RenderObject* renderer) | 6603 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6330 { | 6604 { |
| 6331 if (!renderer) | 6605 if (!renderer) |
| 6332 return; | 6606 return; |
| 6333 showLayerTree(renderer->enclosingLayer()); | 6607 showLayerTree(renderer->enclosingLayer()); |
| 6334 } | 6608 } |
| 6335 #endif | 6609 #endif |
| OLD | NEW |