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(RenderLayer* ancestorStacking
Context, OwnPtr<Vector<RenderLayer*> >& posZOrderListBeforePromote, OwnPtr<Vecto
r<RenderLayer*> >& negZOrderListBeforePromote, size_t& posZOrderListSizeBeforePr
omote, size_t& negZOrderListSizeBeforePromote) |
| 708 { |
| 709 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and |
| 710 // m_isNormalFlowOnly are both bitfields, so we have to do it the |
| 711 // old-fashioned way. |
| 712 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; |
| 713 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; |
| 714 |
| 715 // Set the flag on the current layer, then rebuild ancestor stacking |
| 716 // context's lists. This way, we can see the exact effects that promoting |
| 717 // this layer would cause. |
| 718 m_needsCompositedScrolling = false; |
| 719 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); |
| 720 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde
rListBeforePromote, negZOrderListBeforePromote, 0); |
| 721 |
| 722 m_needsCompositedScrolling = oldNeedsCompositedScrolling; |
| 723 m_isNormalFlowOnly = oldIsNormalFlowOnly; |
| 724 |
| 725 |
| 726 posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrderListB
eforePromote->size() : 0; |
| 727 negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrderListB
eforePromote->size() : 0; |
| 728 |
| 729 const RenderLayer* positionedAncestor = parent(); |
| 730 while (positionedAncestor && !isPositionedContainer(positionedAncestor) && !
positionedAncestor->isStackingContext()) |
| 731 positionedAncestor = positionedAncestor->parent(); |
| 732 if (positionedAncestor && (!isPositionedContainer(positionedAncestor) || pos
itionedAncestor->isStackingContext())) |
| 733 positionedAncestor = 0; |
| 734 |
| 735 bool currentLayerIsInPosZOrderListBeforePromote = false; |
| 736 |
| 737 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index++) { |
| 738 if (posZOrderListBeforePromote->at(index) == this) { |
| 739 currentLayerIsInPosZOrderListBeforePromote = true; |
| 740 break; |
| 741 } |
| 742 } |
| 743 |
| 744 // Insert this into the posZOrderListBeforePromote directly after the |
| 745 // positioned ancestor, if there is one. Otherwise, add it to the very |
| 746 // beginning. |
| 747 // |
| 748 // The current layer will appear in the z-order lists after promotion, so |
| 749 // for a meaningful comparison, we must insert it in the z-order lists |
| 750 // before promotion if it does not appear there already. |
| 751 if (!currentLayerIsInPosZOrderListBeforePromote) { |
| 752 if (!positionedAncestor) { |
| 753 if (!posZOrderListBeforePromote) |
| 754 posZOrderListBeforePromote = adoptPtr(new Vector<RenderLayer*>()
); |
| 755 |
| 756 posZOrderListBeforePromote->prepend(this); |
| 757 posZOrderListSizeBeforePromote++; |
| 758 } else { |
| 759 for (size_t index = 0; index < posZOrderListSizeBeforePromote; index
++) { |
| 760 if (posZOrderListBeforePromote->at(index) == positionedAncestor)
{ |
| 761 posZOrderListBeforePromote->insert(index + 1, this); |
| 762 posZOrderListSizeBeforePromote++; |
| 763 break; |
| 764 } |
| 765 } |
| 766 } |
| 767 } |
| 768 } |
| 769 |
| 770 void RenderLayer::collectAfterPromotionZOrderList(RenderLayer* ancestorStackingC
ontext, OwnPtr<Vector<RenderLayer*> >& posZOrderListAfterPromote, OwnPtr<Vector<
RenderLayer*> >& negZOrderListAfterPromote, size_t& posZOrderListSizeAfterPromot
e, size_t& negZOrderListSizeAfterPromote) |
| 771 { |
| 772 // We can't use TemporaryChange<> here since m_needsCompositedScrolling and |
| 773 // m_isNormalFlowOnly are both bitfields, so we have to do it the |
| 774 // old-fashioned way. |
| 775 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; |
| 776 bool oldIsNormalFlowOnly = m_isNormalFlowOnly; |
| 777 |
| 778 // Set the flag on the current layer, then rebuild ancestor stacking |
| 779 // context's lists. This way, we can see the exact effects that promoting |
| 780 // this layer would cause. |
| 781 m_isNormalFlowOnly = false; |
| 782 m_needsCompositedScrolling = true; |
| 783 ancestorStackingContext->rebuildZOrderLists(StopAtStackingContexts, posZOrde
rListAfterPromote, negZOrderListAfterPromote, this); |
| 784 |
| 785 m_needsCompositedScrolling = oldNeedsCompositedScrolling; |
| 786 m_isNormalFlowOnly = oldIsNormalFlowOnly; |
| 787 |
| 788 posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrderListAft
erPromote->size() : 0; |
| 789 negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrderListAft
erPromote->size() : 0; |
| 790 } |
| 791 |
| 792 #ifndef NDEBUG |
| 793 String RenderLayer::paintOrderListsAsText() |
| 794 { |
| 795 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; |
| 796 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; |
| 797 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; |
| 798 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; |
| 799 size_t posZOrderListSizeBeforePromote, negZOrderListSizeBeforePromote, posZO
rderListSizeAfterPromote, negZOrderListSizeAfterPromote; |
| 800 |
| 801 RenderLayer* stackingContext = ancestorStackingContext(); |
| 802 |
| 803 if (!stackingContext) |
| 804 return String(); |
| 805 |
| 806 collectBeforePromotionZOrderList(stackingContext, posZOrderListBeforePromote
, negZOrderListBeforePromote, posZOrderListSizeBeforePromote, negZOrderListSizeB
eforePromote); |
| 807 collectAfterPromotionZOrderList(stackingContext, posZOrderListAfterPromote,
negZOrderListAfterPromote, posZOrderListSizeAfterPromote, negZOrderListSizeAfter
Promote); |
| 808 |
| 809 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz
eBeforePromote; |
| 810 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA
fterPromote; |
| 811 |
| 812 TextStream ts; |
| 813 |
| 814 ts << "Layer: " << this << " \"" << debugName() << "\", z-index: " << render
er()->style()->zIndex() << "\n"; |
| 815 |
| 816 ts << " stacking context's paint order list BEFORE promote:\n"; |
| 817 for (size_t index = 0; index < sizeBeforePromote; index++) { |
| 818 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr
derListBeforePromote.get(), negZOrderListBeforePromote.get(), FromBackground, in
dex); |
| 819 ts << " " << layerBeforePromote << " \"" << layerBeforePromote->debug
Name() << "\", z-index: " << layerBeforePromote->renderer()->style()->zIndex() <
< "\n"; |
| 820 } |
| 821 |
| 822 ts << " stacking context's paint order list AFTER promote:\n"; |
| 823 for (size_t index = 0; index < sizeAfterPromote; index++) { |
| 824 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd
erListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground, index
); |
| 825 ts << " " << layerAfterPromote << " \"" << layerAfterPromote->debugNa
me() << "\", z-index: " << layerAfterPromote->renderer()->style()->zIndex() << "
\n"; |
| 826 } |
| 827 |
| 828 return ts.release(); |
| 829 } |
| 830 #endif |
| 831 |
| 832 PassRefPtr<NodeList> RenderLayer::paintOrderList(PaintOrderListType type) |
| 833 { |
| 834 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
| 835 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
| 836 size_t posZOrderListSize, negZOrderListSize; |
| 837 |
| 838 RenderLayer* stackingContext = ancestorStackingContext(); |
| 839 |
| 840 if (!stackingContext) |
| 841 return 0; |
| 842 |
| 843 switch(type) { |
| 844 case BeforePromote: |
| 845 collectBeforePromotionZOrderList(stackingContext, posZOrderList, neg
ZOrderList, posZOrderListSize, negZOrderListSize); |
| 846 break; |
| 847 |
| 848 case AfterPromote: |
| 849 collectAfterPromotionZOrderList(stackingContext, posZOrderList, negZ
OrderList, posZOrderListSize, negZOrderListSize); |
| 850 break; |
| 851 |
| 852 default: |
| 853 return 0; |
| 854 } |
| 855 |
| 856 size_t size = posZOrderListSize + negZOrderListSize; |
| 857 |
| 858 ListHashSet<RefPtr<Node> > list; |
| 859 for (size_t index = 0; index < size; index++) { |
| 860 const RenderLayer* layer = getStackingOrderElementAt(posZOrderList.get()
, negZOrderList.get(), FromBackground, index); |
| 861 list.add(layer->renderer()->node()); |
| 862 } |
| 863 |
| 864 return StaticHashSetNodeList::adopt(list); |
| 865 } |
| 866 |
642 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta
iner, const RenderGeometryMap* geometryMap) | 867 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta
iner, const RenderGeometryMap* geometryMap) |
643 { | 868 { |
644 ASSERT(!m_visibleContentStatusDirty); | 869 ASSERT(!m_visibleContentStatusDirty); |
645 | 870 |
646 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 871 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
647 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr
yMap); | 872 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr
yMap); |
648 } | 873 } |
649 | 874 |
650 | 875 |
651 void RenderLayer::computeRepaintRectsIncludingDescendants() | 876 void RenderLayer::computeRepaintRectsIncludingDescendants() |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 } | 1486 } |
1262 | 1487 |
1263 RenderLayer* RenderLayer::ancestorStackingContext() const | 1488 RenderLayer* RenderLayer::ancestorStackingContext() const |
1264 { | 1489 { |
1265 RenderLayer* ancestor = parent(); | 1490 RenderLayer* ancestor = parent(); |
1266 while (ancestor && !ancestor->isStackingContext()) | 1491 while (ancestor && !ancestor->isStackingContext()) |
1267 ancestor = ancestor->parent(); | 1492 ancestor = ancestor->parent(); |
1268 return ancestor; | 1493 return ancestor; |
1269 } | 1494 } |
1270 | 1495 |
1271 static inline bool isPositionedContainer(RenderLayer* layer) | |
1272 { | |
1273 RenderLayerModelObject* layerRenderer = layer->renderer(); | |
1274 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr
ansform(); | |
1275 } | |
1276 | |
1277 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1496 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
1278 { | 1497 { |
1279 return layer->isRootLayer() || layer->hasTransform(); | 1498 return layer->isRootLayer() || layer->hasTransform(); |
1280 } | 1499 } |
1281 | 1500 |
1282 RenderLayer* RenderLayer::enclosingPositionedAncestor() const | 1501 RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
1283 { | 1502 { |
1284 RenderLayer* curr = parent(); | 1503 RenderLayer* curr = parent(); |
1285 while (curr && !isPositionedContainer(curr)) | 1504 while (curr && !isPositionedContainer(curr)) |
1286 curr = curr->parent(); | 1505 curr = curr->parent(); |
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 } | 5752 } |
5534 | 5753 |
5535 void RenderLayer::rebuildZOrderLists() | 5754 void RenderLayer::rebuildZOrderLists() |
5536 { | 5755 { |
5537 ASSERT(m_layerListMutationAllowed); | 5756 ASSERT(m_layerListMutationAllowed); |
5538 ASSERT(isDirtyStackingContainer()); | 5757 ASSERT(isDirtyStackingContainer()); |
5539 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis
t); | 5758 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis
t); |
5540 m_zOrderListsDirty = false; | 5759 m_zOrderListsDirty = false; |
5541 } | 5760 } |
5542 | 5761 |
5543 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect
or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList) | 5762 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect
or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList,
const RenderLayer* layerToForceAsStackingContainer) |
5544 { | 5763 { |
5545 bool includeHiddenLayers = compositor()->inCompositingMode(); | 5764 bool includeHiddenLayers = compositor()->inCompositingMode(); |
5546 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 5765 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
5547 if (!m_reflection || reflectionLayer() != child) | 5766 if (!m_reflection || reflectionLayer() != child) |
5548 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n
egZOrderList); | 5767 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n
egZOrderList, layerToForceAsStackingContainer); |
5549 | 5768 |
5550 // Sort the two lists. | 5769 // Sort the two lists. |
5551 if (posZOrderList) | 5770 if (posZOrderList) |
5552 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI
ndex); | 5771 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI
ndex); |
5553 | 5772 |
5554 if (negZOrderList) | 5773 if (negZOrderList) |
5555 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); | 5774 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); |
5556 | 5775 |
5557 #if ENABLE(DIALOG_ELEMENT) | 5776 #if ENABLE(DIALOG_ELEMENT) |
5558 // Append layers for top layer elements after normal layer collection, to en
sure they are on top regardless of z-indexes. | 5777 // 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... |
5583 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { | 5802 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { |
5584 if (!m_normalFlowList) | 5803 if (!m_normalFlowList) |
5585 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5804 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
5586 m_normalFlowList->append(child); | 5805 m_normalFlowList->append(child); |
5587 } | 5806 } |
5588 } | 5807 } |
5589 | 5808 |
5590 m_normalFlowListDirty = false; | 5809 m_normalFlowListDirty = false; |
5591 } | 5810 } |
5592 | 5811 |
5593 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior
behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*>
>& negBuffer) | 5812 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior
behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*>
>& negBuffer, const RenderLayer* layerToForceAsStackingContainer) |
5594 { | 5813 { |
5595 #if ENABLE(DIALOG_ELEMENT) | 5814 #if ENABLE(DIALOG_ELEMENT) |
5596 if (isInTopLayer()) | 5815 if (isInTopLayer()) |
5597 return; | 5816 return; |
5598 #endif | 5817 #endif |
5599 | 5818 |
5600 updateDescendantDependentFlags(); | 5819 updateDescendantDependentFlags(); |
5601 | 5820 |
5602 bool isStacking = behavior == StopAtStackingContexts ? isStackingContext() :
isStackingContainer(); | 5821 bool isStacking = false; |
| 5822 |
| 5823 switch (behavior) { |
| 5824 case StopAtStackingContexts: |
| 5825 isStacking = (this == layerToForceAsStackingContainer) || isStacking
Context(); |
| 5826 break; |
| 5827 |
| 5828 case StopAtStackingContainers: |
| 5829 isStacking = (this == layerToForceAsStackingContainer) || isStacking
Container(); |
| 5830 break; |
| 5831 } |
| 5832 |
5603 // Overflow layers are just painted by their enclosing layers, so they don't
get put in zorder lists. | 5833 // Overflow layers are just painted by their enclosing layers, so they don't
get put in zorder lists. |
5604 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_
hasVisibleDescendant && isStacking)); | 5834 bool includeHiddenLayer = includeHiddenLayers || (m_hasVisibleContent || (m_
hasVisibleDescendant && isStacking)); |
5605 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea
d()) { | 5835 if (includeHiddenLayer && !isNormalFlowOnly() && !isOutOfFlowRenderFlowThrea
d()) { |
5606 // Determine which buffer the child should be in. | 5836 // Determine which buffer the child should be in. |
5607 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne
gBuffer; | 5837 OwnPtr<Vector<RenderLayer*> >& buffer = (zIndex() >= 0) ? posBuffer : ne
gBuffer; |
5608 | 5838 |
5609 // Create the buffer if it doesn't exist yet. | 5839 // Create the buffer if it doesn't exist yet. |
5610 if (!buffer) | 5840 if (!buffer) |
5611 buffer = adoptPtr(new Vector<RenderLayer*>); | 5841 buffer = adoptPtr(new Vector<RenderLayer*>); |
5612 | 5842 |
5613 // Append ourselves at the end of the appropriate buffer. | 5843 // Append ourselves at the end of the appropriate buffer. |
5614 buffer->append(this); | 5844 buffer->append(this); |
5615 } | 5845 } |
5616 | 5846 |
5617 // Recur into our children to collect more layers, but only if we don't esta
blish | 5847 // Recur into our children to collect more layers, but only if we don't esta
blish |
5618 // a stacking context/container. | 5848 // a stacking context/container. |
5619 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { | 5849 if ((includeHiddenLayers || m_hasVisibleDescendant) && !isStacking) { |
5620 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { | 5850 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { |
5621 // Ignore reflections. | 5851 // Ignore reflections. |
5622 if (!m_reflection || reflectionLayer() != child) | 5852 if (!m_reflection || reflectionLayer() != child) |
5623 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer); | 5853 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer, layerToForceAsStackingContainer); |
5624 } | 5854 } |
5625 } | 5855 } |
5626 } | 5856 } |
5627 | 5857 |
5628 void RenderLayer::updateLayerListsIfNeeded() | 5858 void RenderLayer::updateLayerListsIfNeeded() |
5629 { | 5859 { |
5630 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos
itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty ||
m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | 5860 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos
itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty ||
m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
5631 updateZOrderLists(); | 5861 updateZOrderLists(); |
5632 updateNormalFlowList(); | 5862 updateNormalFlowList(); |
5633 | 5863 |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6334 } | 6564 } |
6335 } | 6565 } |
6336 | 6566 |
6337 void showLayerTree(const WebCore::RenderObject* renderer) | 6567 void showLayerTree(const WebCore::RenderObject* renderer) |
6338 { | 6568 { |
6339 if (!renderer) | 6569 if (!renderer) |
6340 return; | 6570 return; |
6341 showLayerTree(renderer->enclosingLayer()); | 6571 showLayerTree(renderer->enclosingLayer()); |
6342 } | 6572 } |
6343 #endif | 6573 #endif |
OLD | NEW |