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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 | 147 |
| 148 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 148 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
| 149 : m_inResizeMode(false) | 149 : m_inResizeMode(false) |
| 150 , m_scrollDimensionsDirty(true) | 150 , m_scrollDimensionsDirty(true) |
| 151 , m_normalFlowListDirty(true) | 151 , m_normalFlowListDirty(true) |
| 152 , m_hasSelfPaintingLayerDescendant(false) | 152 , m_hasSelfPaintingLayerDescendant(false) |
| 153 , m_hasSelfPaintingLayerDescendantDirty(false) | 153 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 154 , m_hasOutOfFlowPositionedDescendant(false) | 154 , m_hasOutOfFlowPositionedDescendant(false) |
| 155 , m_hasOutOfFlowPositionedDescendantDirty(true) | 155 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 156 , m_needsCompositedScrolling(false) | 156 , m_needsCompositedScrolling(false) |
| 157 , m_descendantsAreContiguousInStackingOrder(false) | 157 , m_canBePromotedToStackingContainer(false) |
| 158 , m_isRootLayer(renderer->isRenderView()) | 158 , m_isRootLayer(renderer->isRenderView()) |
| 159 , m_usedTransparency(false) | 159 , m_usedTransparency(false) |
| 160 , m_paintingInsideReflection(false) | 160 , m_paintingInsideReflection(false) |
| 161 , m_inOverflowRelayout(false) | 161 , m_inOverflowRelayout(false) |
| 162 , m_repaintStatus(NeedsNormalRepaint) | 162 , m_repaintStatus(NeedsNormalRepaint) |
| 163 , m_visibleContentStatusDirty(true) | 163 , m_visibleContentStatusDirty(true) |
| 164 , m_hasVisibleContent(false) | 164 , m_hasVisibleContent(false) |
| 165 , m_visibleDescendantStatusDirty(false) | 165 , m_visibleDescendantStatusDirty(false) |
| 166 , m_hasVisibleDescendant(false) | 166 , m_hasVisibleDescendant(false) |
| 167 , m_isPaginated(false) | 167 , m_isPaginated(false) |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 518 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
| 519 { | 519 { |
| 520 return renderer()->frame() | 520 return renderer()->frame() |
| 521 && renderer()->frame()->page() | 521 && renderer()->frame()->page() |
| 522 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); | 522 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 // If we are a stacking container, then this function will determine if our | |
| 526 // descendants for a contiguous block in stacking order. This is required in | |
| 527 // order for an element to be safely promoted to a stacking container. It is saf e | |
| 528 // to become a stacking container if this change would not alter the stacking | |
| 529 // order of layers on the page. That can only happen if a non-descendant appear | |
| 530 // between us and our descendants in stacking order. Here's an example: | |
| 531 // | |
| 532 // this | |
| 533 // / | \. | |
| 534 // A B C | |
| 535 // /\ | /\. | |
| 536 // 0 -8 D 2 7 | |
| 537 // | | |
| 538 // 5 | |
| 539 // | |
| 540 // I've labeled our normal flow descendants A, B, C, and D, our stacking | |
| 541 // container descendants with their z indices, and us with 'this' (we're a | |
| 542 // stacking container and our zIndex doesn't matter here). These nodes appear in | |
| 543 // three lists: posZOrder, negZOrder, and normal flow (keep in mind that normal | |
| 544 // flow layers don't overlap). So if we arrange these lists in order we get our | |
| 545 // stacking order: | |
| 546 // | |
| 547 // [-8], [A-D], [0, 2, 5, 7]--> pos z-order. | |
| 548 // | | | |
| 549 // Neg z-order. <-+ +--> Normal flow descendants. | |
| 550 // | |
| 551 // We can then assign new, 'stacking' order indices to these elements as follows : | |
| 552 // | |
| 553 // [-8], [A-D], [0, 2, 5, 7] | |
| 554 // 'Stacking' indices: -1 0 1 2 3 4 | |
| 555 // | |
| 556 // Note that the normal flow descendants can share an index because they don't | |
| 557 // stack/overlap. Now our problem becomes very simple: a layer can safely become | |
| 558 // a stacking container if the stacking-order indices of it and its descendants | |
| 559 // appear in a contiguous block in the list of stacking indices. This problem | |
| 560 // can be solved very efficiently by calculating the min/max stacking indices in | |
| 561 // the subtree, and the number stacking container descendants. Once we have this | |
| 562 // information, we know that the subtree's indices form a contiguous block if: | |
| 563 // | |
| 564 // maxStackIndex - minStackIndex == numSCDescendants | |
| 565 // | |
| 566 // So for node A in the example above we would have: | |
| 567 // maxStackIndex = 1 | |
| 568 // minStackIndex = -1 | |
| 569 // numSCDecendants = 2 | |
| 570 // | |
| 571 // and so, | |
| 572 // maxStackIndex - minStackIndex == numSCDescendants | |
| 573 // ===> 1 - (-1) == 2 | |
| 574 // ===> 2 == 2 | |
| 575 // | |
| 576 // Since this is true, A can safely become a stacking container. | |
| 577 // Now, for node C we have: | |
| 578 // | |
| 579 // maxStackIndex = 4 | |
| 580 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 581 // numSCDecendants = 2 | |
| 582 // | |
| 583 // and so, | |
| 584 // maxStackIndex - minStackIndex == numSCDescendants | |
| 585 // ===> 4 - 0 == 2 | |
| 586 // ===> 4 == 2 | |
| 587 // | |
| 588 // Since this is false, C cannot be safely promoted to a stacking container. Thi s | |
| 589 // happened because of the elements with z-index 5 and 0. Now if 5 had been a | |
| 590 // child of C rather than D, and A had no child with Z index 0, we would have ha d: | |
| 591 // | |
| 592 // maxStackIndex = 3 | |
| 593 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 594 // numSCDecendants = 3 | |
| 595 // | |
| 596 // and so, | |
| 597 // maxStackIndex - minStackIndex == numSCDescendants | |
| 598 // ===> 3 - 0 == 3 | |
| 599 // ===> 3 == 3 | |
| 600 // | |
| 601 // And we would conclude that C could be promoted. | |
| 602 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | |
| 603 { | |
| 604 if (!isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled( )) | |
| 605 return; | |
| 606 | |
| 607 ASSERT(!m_normalFlowListDirty); | |
| 608 ASSERT(!m_zOrderListsDirty); | |
| 609 | |
| 610 OwnPtr<Vector<RenderLayer*> > posZOrderList; | |
| 611 OwnPtr<Vector<RenderLayer*> > negZOrderList; | |
| 612 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | |
| 613 | |
| 614 // Create a reverse lookup. | |
| 615 HashMap<const RenderLayer*, int> lookup; | |
| 616 | |
| 617 if (negZOrderList) { | |
| 618 int stackingOrderIndex = -1; | |
| 619 size_t listSize = negZOrderList->size(); | |
| 620 for (size_t i = 0; i < listSize; ++i) { | |
| 621 RenderLayer* currentLayer = negZOrderList->at(listSize - i - 1); | |
| 622 if (!currentLayer->isStackingContext()) | |
| 623 continue; | |
| 624 lookup.set(currentLayer, stackingOrderIndex--); | |
| 625 } | |
| 626 } | |
| 627 | |
| 628 if (posZOrderList) { | |
| 629 size_t listSize = posZOrderList->size(); | |
| 630 int stackingOrderIndex = 1; | |
| 631 for (size_t i = 0; i < listSize; ++i) { | |
| 632 RenderLayer* currentLayer = posZOrderList->at(i); | |
| 633 if (!currentLayer->isStackingContext()) | |
| 634 continue; | |
| 635 lookup.set(currentLayer, stackingOrderIndex++); | |
| 636 } | |
| 637 } | |
| 638 | |
| 639 int minIndex = 0; | |
| 640 int maxIndex = 0; | |
| 641 int count = 0; | |
| 642 bool firstIteration = true; | |
| 643 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); | |
| 644 } | |
| 645 | |
| 646 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) | |
| 647 { | |
| 648 if (isStackingContext() && !firstIteration) { | |
| 649 if (lookup.contains(this)) { | |
| 650 minIndex = std::min(minIndex, lookup.get(this)); | |
| 651 maxIndex = std::max(maxIndex, lookup.get(this)); | |
| 652 count++; | |
| 653 } | |
| 654 return; | |
| 655 } | |
| 656 | |
| 657 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { | |
| 658 int childMinIndex = 0; | |
| 659 int childMaxIndex = 0; | |
| 660 int childCount = 0; | |
| 661 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); | |
| 662 if (childCount) { | |
| 663 count += childCount; | |
| 664 minIndex = std::min(minIndex, childMinIndex); | |
| 665 maxIndex = std::max(maxIndex, childMaxIndex); | |
| 666 } | |
| 667 } | |
| 668 | |
| 669 if (!isStackingContext()) { | |
| 670 bool newValue = maxIndex - minIndex == count; | |
| 671 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | |
| 672 m_descendantsAreContiguousInStackingOrder = newValue; | |
| 673 if (didUpdate) | |
| 674 updateNeedsCompositedScrolling(); | |
| 675 } | |
| 676 } | |
| 677 | |
| 678 static inline bool isPositionedContainer(const RenderLayer* layer) | 525 static inline bool isPositionedContainer(const RenderLayer* layer) |
| 679 { | 526 { |
| 680 // FIXME: This is not in sync with containingBlock. | 527 // FIXME: This is not in sync with containingBlock. |
| 681 // RenderObject::canContainFixedPositionedObject() should probably be used | 528 // RenderObject::canContainFixedPositionedObject() should probably be used |
| 682 // instead. | 529 // instead. |
| 683 RenderLayerModelObject* layerRenderer = layer->renderer(); | 530 RenderLayerModelObject* layerRenderer = layer->renderer(); |
| 684 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | 531 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); |
| 685 } | 532 } |
| 686 | 533 |
| 687 enum StackingOrderDirection { FromBackground, FromForeground }; | 534 enum StackingOrderDirection { FromBackground, FromForeground }; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 812 if (posZOrderListBeforePromote->at(index) == positionedAncestor) { | 659 if (posZOrderListBeforePromote->at(index) == positionedAncestor) { |
| 813 posZOrderListBeforePromote->insert(index + 1, this); | 660 posZOrderListBeforePromote->insert(index + 1, this); |
| 814 posZOrderListSizeBeforePromote++; | 661 posZOrderListSizeBeforePromote++; |
| 815 break; | 662 break; |
| 816 } | 663 } |
| 817 } | 664 } |
| 818 } | 665 } |
| 819 } | 666 } |
| 820 } | 667 } |
| 821 | 668 |
| 669 // After promotion, the paint order consists of | |
| 670 // a) the non-descendants which precede the promoted layer, | |
| 671 // b) the promoted layer, and | |
| 672 // c) the non-descendants which succeed the promoted layer. | |
| 673 // | |
| 674 // If the current layer's descendants form a contiguous block in paint order | |
| 675 // before promotion, the paint order will consist of | |
| 676 // a) the non-descendants which precede the current layer and its descendants, | |
| 677 // b) the current layer and its descendants | |
| 678 // c) The non-descendants which succeed the current layer and its descendants. | |
| 679 // | |
| 680 // Sub-lists (a) and (c) should be identical in both paint order lists if | |
| 681 // and only if the descendants form a contiguous block. In fact, this is the | |
| 682 // only check we need to perform since the order of the descendants with | |
| 683 // respect to each other cannot be affected by promotion (i.e., we don't | |
| 684 // need to worry about sub-list (b)). | |
| 685 // | |
| 686 // Some examples: | |
| 687 // C = currentLayer | |
| 688 // - = negative z-order child of currentLayer | |
| 689 // + = positive z-order child of currentLayer | |
| 690 // A = positioned ancestor of currentLayer | |
| 691 // x = any other RenderLayer in the list | |
| 692 // | |
| 693 // original | zOrderListBeforePromote | zOrderLi stAfterPromote | |
| 694 // zOrderListBeforePromote | after inserting C as above | | |
| 695 // ------------------------------------------------------------------------- -------------- | |
| 696 // (1) x---+++x | x---C+++x | xCx | |
| 697 // (2) x---+A++x | x---+AC++x | xACx | |
| 698 // (3) x-x--+++x | x-x--C+++x | xxCx | |
| 699 // (4) xxA++x | xxAC++x | xxACx | |
| 700 // | |
| 701 // In example (1), we compare sub-list (a) by marching from the left of both | |
| 702 // lists (zOrderListBeforePromote after inserting C and | |
| 703 // zOrderListAfterPromote). The first mismatch is at index 1 when we hit '-' | |
| 704 // and 'C'. That means we have neg z-order descendants. This is a problem if | |
| 705 // we have a background. Before promotion, this bg would get painted with | |
| 706 // the current layer (i.e., after the neg z-order descendants), but after | |
| 707 // promotion the bg would get painted before them. This is a stacking order | |
| 708 // violation and we can't promote. However, if we don't have a background, | |
| 709 // we would continue on to the second pass. When comparing from the right, | |
| 710 // we mismatch on '+' and 'C'. Since we hit 'C' on zOrderListAfterPromote, | |
| 711 // we know that the children are contiguous, and we will promote. | |
| 712 // | |
| 713 // In example (2), when marching from the left, we'll hit a mismatch again | |
| 714 // on the second element we look at. This time, since this element is an 'A' | |
| 715 // in zOrderListAfterPromote, this indicates that there is an extra layer | |
| 716 // (the 'A') mixed in with the children. This could cause a change in paint | |
| 717 // order if we promote, so we decide not to and break out of the loop. Note | |
| 718 // that if the current layer has a background, this would provide a second | |
| 719 // reason not to opt in, since again we have negative z-order children who | |
| 720 // would change paint order with respect to our background if we promoted. | |
| 721 // | |
| 722 // In example (3), the discontiguity of the negative z-order children causes | |
| 723 // us to fail early in our "FromBackground" pass when we try to compare '-' | |
| 724 // from zOrderListBeforePromote with 'x' in zOrderListAfterPromote. | |
| 725 // | |
| 726 // Finally in example (4), we would match 'xxAC' from the left, then stop | |
| 727 // since we hit 'C'. Then we would match 'x' from the right, and mismatch | |
| 728 // on '+' and 'C'. Since we're at 'C' on the zOrderListAfterPromote, we | |
| 729 // conclude that all the children are contiguous. Since there are no | |
| 730 // negative z-order children, a background layer is irrelevant in this case. | |
| 731 // We will opt in, keeping paint order constant. | |
| 732 static bool compareLayerListsBeforeAndAfterPromote(const RenderLayer* currentLay er, | |
| 733 const Vector<RenderLayer*>* posZOrderListBeforePromote, | |
| 734 const Vector<RenderLayer*>* negZOrderListBeforePromote, | |
| 735 const Vector<RenderLayer*>* posZOrderListAfterPromote, | |
| 736 const Vector<RenderLayer*>* negZOrderListAfterPromote, | |
| 737 const size_t sizeBeforePromote, | |
| 738 const size_t sizeAfterPromote, | |
| 739 const StackingOrderDirection direction) | |
| 740 { | |
| 741 for (size_t index = 0; index < sizeBeforePromote && index < sizeAfterPromote ; index++) { | |
| 742 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote, negZOrderListBeforePromote, direction, index); | |
| 743 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote, negZOrderListAfterPromote, direction, index); | |
| 744 | |
| 745 if (layerBeforePromote != layerAfterPromote) { | |
| 746 // If we find a mismatch, the only situation where we haven't | |
| 747 // necessarily changed paint order yet is if layerAfterPromote | |
| 748 // is currentLayer. | |
| 749 if (layerAfterPromote != currentLayer) | |
| 750 return false; | |
| 751 | |
| 752 // Also, if the current layer has a background, then any | |
| 753 // negative z-order children will get between the background | |
| 754 // and the rest of the layer. | |
| 755 if (direction == FromBackground && currentLayer->renderer()->hasBack ground()) | |
| 756 return false; | |
| 757 } | |
| 758 | |
| 759 // To compare the sub-lists (a) and (c) from the comment above, we only | |
| 760 // need to march until we hit the currentLayer in the | |
| 761 // zOrderListAfterPromote from each direction. | |
| 762 if (layerAfterPromote == currentLayer) | |
| 763 break; | |
| 764 } | |
| 765 | |
| 766 return true; | |
| 767 } | |
| 768 | |
| 769 // Determine whether the current layer can be promoted to a stacking container, | |
| 770 // given its closest stacking context ancestor. We do this by computing what | |
| 771 // positive and negative z-order lists would look like before and after | |
| 772 // promotion, and ensuring that proper stacking order is preserved between the | |
| 773 // two sets of lists. | |
| 774 // | |
| 775 // For more details on how the lists will be compared, see the comment and | |
| 776 // examples for compareLayerListsBeforeAndAfterPromote(). | |
| 777 void RenderLayer::updateCanBeStackingContainer(RenderLayer* ancestorStackingCont ext) | |
| 778 { | |
| 779 ASSERT(!isStackingContext()); | |
| 780 | |
| 781 // FIXME: We can early-out of this function more | |
| 782 // often if we maintain a dirty bit for the | |
| 783 // m_canBePromotedToStackingContainer property | |
| 784 // (https://bugs.webkit.org/show_bug.cgi?id=109966) | |
|
Ian Vollick
2013/04/16 19:24:33
That patch is a prereq for this, so we don't need
hartmanng
2013/04/17 20:21:53
Done.
| |
| 785 | |
| 786 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
| 787 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
| 788 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
| 789 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
| 790 | |
| 791 getPaintOrderLists(ancestorStackingContext, | |
| 792 posZOrderListBeforePromote, negZOrderListBeforePromote, | |
| 793 posZOrderListAfterPromote, negZOrderListAfterPromote); | |
| 794 | |
| 795 size_t posZOrderListSizeBeforePromote = posZOrderListBeforePromote ? posZOrd erListBeforePromote->size() : 0; | |
| 796 size_t negZOrderListSizeBeforePromote = negZOrderListBeforePromote ? negZOrd erListBeforePromote->size() : 0; | |
| 797 size_t posZOrderListSizeAfterPromote = posZOrderListAfterPromote ? posZOrder ListAfterPromote->size() : 0; | |
| 798 size_t negZOrderListSizeAfterPromote = negZOrderListAfterPromote ? negZOrder ListAfterPromote->size() : 0; | |
| 799 | |
| 800 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
| 801 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
| 802 | |
| 803 bool canPromote = compareLayerListsBeforeAndAfterPromote(this, posZOrderList BeforePromote.get(), negZOrderListBeforePromote.get(), | |
| 804 posZOrderListAfterPromote.get(), negZOrderListAfterPromote.get(), | |
| 805 sizeBeforePromote, sizeAfterPromote, FromBackground) | |
| 806 && compareLayerListsBeforeAndAfterPromote(this, posZOrderListBeforePromo te.get(), negZOrderListBeforePromote.get(), | |
| 807 posZOrderListAfterPromote.get(), negZOrderListAfterPromote.get(), | |
| 808 sizeBeforePromote, sizeAfterPromote, FromForeground); | |
| 809 | |
| 810 #if USE(ACCELERATED_COMPOSITING) | |
|
Ian Vollick
2013/04/16 19:24:33
These guards can go now.
hartmanng
2013/04/17 20:21:53
Done.
| |
| 811 bool didUpdate = (canPromote != m_canBePromotedToStackingContainer); | |
| 812 #endif | |
| 813 | |
| 814 m_canBePromotedToStackingContainer = canPromote; | |
| 815 | |
| 816 #if USE(ACCELERATED_COMPOSITING) | |
| 817 if (didUpdate) | |
| 818 updateNeedsCompositedScrolling(); | |
| 819 #endif | |
| 820 } | |
| 821 | |
| 822 void RenderLayer::updateCanBeStackingContainerRecursively(RenderLayer* ancestorS tackingContext) | |
| 823 { | |
| 824 if (this != ancestorStackingContext) { | |
| 825 if (isStackingContext()) | |
| 826 return; | |
| 827 | |
| 828 updateCanBeStackingContainer(ancestorStackingContext); | |
| 829 } | |
| 830 | |
| 831 if (m_hasVisibleDescendant) { | |
| 832 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | |
| 833 // Ignore reflections. | |
| 834 if (!m_reflection || reflectionLayer() != child) | |
| 835 child->updateCanBeStackingContainerRecursively(ancestorStackingC ontext); | |
| 836 } | |
| 837 } | |
| 838 } | |
| 839 | |
| 822 String RenderLayer::paintOrderListsAsText() | 840 String RenderLayer::paintOrderListsAsText() |
| 823 { | 841 { |
| 824 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | 842 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; |
| 825 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | 843 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; |
| 826 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | 844 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; |
| 827 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | 845 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; |
| 828 | 846 |
| 829 RenderLayer* ancestorStackingContext = this; | 847 RenderLayer* ancestorStackingContext = this; |
| 830 | 848 |
| 831 while (ancestorStackingContext) { | 849 while (ancestorStackingContext) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1210 if (curr == ancestorStackingContainer) | 1228 if (curr == ancestorStackingContainer) |
| 1211 return; | 1229 return; |
| 1212 } | 1230 } |
| 1213 } | 1231 } |
| 1214 | 1232 |
| 1215 bool RenderLayer::canBeStackingContainer() const | 1233 bool RenderLayer::canBeStackingContainer() const |
| 1216 { | 1234 { |
| 1217 if (isStackingContext() || !stackingContainer()) | 1235 if (isStackingContext() || !stackingContainer()) |
| 1218 return true; | 1236 return true; |
| 1219 | 1237 |
| 1220 return m_descendantsAreContiguousInStackingOrder; | 1238 return m_canBePromotedToStackingContainer; |
| 1221 } | 1239 } |
| 1222 | 1240 |
| 1223 void RenderLayer::setHasVisibleContent() | 1241 void RenderLayer::setHasVisibleContent() |
| 1224 { | 1242 { |
| 1225 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 1243 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
| 1226 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 1244 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
| 1227 return; | 1245 return; |
| 1228 } | 1246 } |
| 1229 | 1247 |
| 1230 m_visibleContentStatusDirty = false; | 1248 m_visibleContentStatusDirty = false; |
| (...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5889 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5907 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 5890 // Ignore reflections. | 5908 // Ignore reflections. |
| 5891 if (!m_reflection || reflectionLayer() != child) | 5909 if (!m_reflection || reflectionLayer() != child) |
| 5892 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContext); | 5910 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContext); |
| 5893 } | 5911 } |
| 5894 } | 5912 } |
| 5895 } | 5913 } |
| 5896 | 5914 |
| 5897 void RenderLayer::updateLayerListsIfNeeded() | 5915 void RenderLayer::updateLayerListsIfNeeded() |
| 5898 { | 5916 { |
| 5899 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); | 5917 bool shouldUpdateCanBeStackingContainer = acceleratedCompositingForOverflowS crollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowList Dirty); |
| 5900 updateZOrderLists(); | 5918 updateZOrderLists(); |
| 5901 updateNormalFlowList(); | 5919 updateNormalFlowList(); |
| 5902 | 5920 |
| 5903 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5921 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
| 5904 reflectionLayer->updateZOrderLists(); | 5922 reflectionLayer->updateZOrderLists(); |
| 5905 reflectionLayer->updateNormalFlowList(); | 5923 reflectionLayer->updateNormalFlowList(); |
| 5906 } | 5924 } |
| 5907 | 5925 |
| 5908 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | 5926 if (shouldUpdateCanBeStackingContainer) { |
| 5909 updateDescendantsAreContiguousInStackingOrder(); | 5927 // call UpdateCanBeStackingContainer for all descendants, |
| 5928 // passing self in as ancestor stacking context. | |
| 5929 updateCanBeStackingContainerRecursively(this); | |
| 5930 | |
| 5910 // The above function can cause us to update m_needsCompositedScrolling | 5931 // The above function can cause us to update m_needsCompositedScrolling |
| 5911 // and dirty our layer lists. Refresh them if necessary. | 5932 // and dirty our layer lists. Refresh them if necessary. |
| 5912 updateZOrderLists(); | 5933 updateZOrderLists(); |
| 5913 updateNormalFlowList(); | 5934 updateNormalFlowList(); |
| 5914 } | 5935 } |
| 5915 } | 5936 } |
| 5916 | 5937 |
| 5917 void RenderLayer::updateCompositingAndLayerListsIfNeeded() | 5938 void RenderLayer::updateCompositingAndLayerListsIfNeeded() |
| 5918 { | 5939 { |
| 5919 if (compositor()->inCompositingMode()) { | 5940 if (compositor()->inCompositingMode()) { |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6599 } | 6620 } |
| 6600 } | 6621 } |
| 6601 | 6622 |
| 6602 void showLayerTree(const WebCore::RenderObject* renderer) | 6623 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6603 { | 6624 { |
| 6604 if (!renderer) | 6625 if (!renderer) |
| 6605 return; | 6626 return; |
| 6606 showLayerTree(renderer->enclosingLayer()); | 6627 showLayerTree(renderer->enclosingLayer()); |
| 6607 } | 6628 } |
| 6608 #endif | 6629 #endif |
| OLD | NEW |