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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 | 141 |
| 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
| 143 : m_inResizeMode(false) | 143 : m_inResizeMode(false) |
| 144 , m_scrollDimensionsDirty(true) | 144 , m_scrollDimensionsDirty(true) |
| 145 , m_normalFlowListDirty(true) | 145 , m_normalFlowListDirty(true) |
| 146 , m_hasSelfPaintingLayerDescendant(false) | 146 , m_hasSelfPaintingLayerDescendant(false) |
| 147 , m_hasSelfPaintingLayerDescendantDirty(false) | 147 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 148 , m_hasOutOfFlowPositionedDescendant(false) | 148 , m_hasOutOfFlowPositionedDescendant(false) |
| 149 , m_hasOutOfFlowPositionedDescendantDirty(true) | 149 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 150 , m_needsCompositedScrolling(false) | 150 , m_needsCompositedScrolling(false) |
| 151 , m_descendantsAreContiguousInStackingOrder(false) | 151 , m_canBePromotedToStackingContainer(false) |
| 152 , m_descendantsAreContiguousInStackingOrderDirty(true) | 152 , m_canBePromotedToStackingContainerDirty(true) |
| 153 , m_isRootLayer(renderer->isRenderView()) | 153 , m_isRootLayer(renderer->isRenderView()) |
| 154 , m_usedTransparency(false) | 154 , m_usedTransparency(false) |
| 155 , m_paintingInsideReflection(false) | 155 , m_paintingInsideReflection(false) |
| 156 , m_inOverflowRelayout(false) | 156 , m_inOverflowRelayout(false) |
| 157 , m_repaintStatus(NeedsNormalRepaint) | 157 , m_repaintStatus(NeedsNormalRepaint) |
| 158 , m_visibleContentStatusDirty(true) | 158 , m_visibleContentStatusDirty(true) |
| 159 , m_hasVisibleContent(false) | 159 , m_hasVisibleContent(false) |
| 160 , m_visibleDescendantStatusDirty(false) | 160 , m_visibleDescendantStatusDirty(false) |
| 161 , m_hasVisibleDescendant(false) | 161 , m_hasVisibleDescendant(false) |
| 162 , m_isPaginated(false) | 162 , m_isPaginated(false) |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 481 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
| 482 { | 482 { |
| 483 return renderer()->frame() | 483 return renderer()->frame() |
| 484 && renderer()->frame()->page() | 484 && renderer()->frame()->page() |
| 485 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); | 485 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 // If we are a stacking container, then this function will determine if our | |
| 489 // descendants for a contiguous block in stacking order. This is required in | |
| 490 // order for an element to be safely promoted to a stacking container. It is saf e | |
| 491 // to become a stacking container if this change would not alter the stacking | |
| 492 // order of layers on the page. That can only happen if a non-descendant appear | |
| 493 // between us and our descendants in stacking order. Here's an example: | |
| 494 // | |
| 495 // this | |
| 496 // / | \. | |
| 497 // A B C | |
| 498 // /\ | /\. | |
| 499 // 0 -8 D 2 7 | |
| 500 // | | |
| 501 // 5 | |
| 502 // | |
| 503 // I've labeled our normal flow descendants A, B, C, and D, our stacking | |
| 504 // container descendants with their z indices, and us with 'this' (we're a | |
| 505 // stacking container and our zIndex doesn't matter here). These nodes appear in | |
| 506 // three lists: posZOrder, negZOrder, and normal flow (keep in mind that normal | |
| 507 // flow layers don't overlap). So if we arrange these lists in order we get our | |
| 508 // stacking order: | |
| 509 // | |
| 510 // [-8], [A-D], [0, 2, 5, 7]--> pos z-order. | |
| 511 // | | | |
| 512 // Neg z-order. <-+ +--> Normal flow descendants. | |
| 513 // | |
| 514 // We can then assign new, 'stacking' order indices to these elements as follows : | |
| 515 // | |
| 516 // [-8], [A-D], [0, 2, 5, 7] | |
| 517 // 'Stacking' indices: -1 0 1 2 3 4 | |
| 518 // | |
| 519 // Note that the normal flow descendants can share an index because they don't | |
| 520 // stack/overlap. Now our problem becomes very simple: a layer can safely become | |
| 521 // a stacking container if the stacking-order indices of it and its descendants | |
| 522 // appear in a contiguous block in the list of stacking indices. This problem | |
| 523 // can be solved very efficiently by calculating the min/max stacking indices in | |
| 524 // the subtree, and the number stacking container descendants. Once we have this | |
| 525 // information, we know that the subtree's indices form a contiguous block if: | |
| 526 // | |
| 527 // maxStackIndex - minStackIndex == numSCDescendants | |
| 528 // | |
| 529 // So for node A in the example above we would have: | |
| 530 // maxStackIndex = 1 | |
| 531 // minStackIndex = -1 | |
| 532 // numSCDecendants = 2 | |
| 533 // | |
| 534 // and so, | |
| 535 // maxStackIndex - minStackIndex == numSCDescendants | |
| 536 // ===> 1 - (-1) == 2 | |
| 537 // ===> 2 == 2 | |
| 538 // | |
| 539 // Since this is true, A can safely become a stacking container. | |
| 540 // Now, for node C we have: | |
| 541 // | |
| 542 // maxStackIndex = 4 | |
| 543 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 544 // numSCDecendants = 2 | |
| 545 // | |
| 546 // and so, | |
| 547 // maxStackIndex - minStackIndex == numSCDescendants | |
| 548 // ===> 4 - 0 == 2 | |
| 549 // ===> 4 == 2 | |
| 550 // | |
| 551 // Since this is false, C cannot be safely promoted to a stacking container. Thi s | |
| 552 // happened because of the elements with z-index 5 and 0. Now if 5 had been a | |
| 553 // child of C rather than D, and A had no child with Z index 0, we would have ha d: | |
| 554 // | |
| 555 // maxStackIndex = 3 | |
| 556 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 557 // numSCDecendants = 3 | |
| 558 // | |
| 559 // and so, | |
| 560 // maxStackIndex - minStackIndex == numSCDescendants | |
| 561 // ===> 3 - 0 == 3 | |
| 562 // ===> 3 == 3 | |
| 563 // | |
| 564 // And we would conclude that C could be promoted. | |
| 565 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | |
| 566 { | |
| 567 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled()) | |
| 568 return; | |
| 569 | |
| 570 ASSERT(!m_normalFlowListDirty); | |
| 571 ASSERT(!m_zOrderListsDirty); | |
| 572 | |
| 573 OwnPtr<Vector<RenderLayer*> > posZOrderList; | |
| 574 OwnPtr<Vector<RenderLayer*> > negZOrderList; | |
| 575 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | |
| 576 | |
| 577 // Create a reverse lookup. | |
| 578 HashMap<const RenderLayer*, int> lookup; | |
| 579 | |
| 580 if (negZOrderList) { | |
| 581 int stackingOrderIndex = -1; | |
| 582 size_t listSize = negZOrderList->size(); | |
| 583 for (size_t i = 0; i < listSize; ++i) { | |
| 584 RenderLayer* currentLayer = negZOrderList->at(listSize - i - 1); | |
| 585 if (!currentLayer->isStackingContext()) | |
| 586 continue; | |
| 587 lookup.set(currentLayer, stackingOrderIndex--); | |
| 588 } | |
| 589 } | |
| 590 | |
| 591 if (posZOrderList) { | |
| 592 size_t listSize = posZOrderList->size(); | |
| 593 int stackingOrderIndex = 1; | |
| 594 for (size_t i = 0; i < listSize; ++i) { | |
| 595 RenderLayer* currentLayer = posZOrderList->at(i); | |
| 596 if (!currentLayer->isStackingContext()) | |
| 597 continue; | |
| 598 lookup.set(currentLayer, stackingOrderIndex++); | |
| 599 } | |
| 600 } | |
| 601 | |
| 602 int minIndex = 0; | |
| 603 int maxIndex = 0; | |
| 604 int count = 0; | |
| 605 bool firstIteration = true; | |
| 606 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); | |
| 607 | |
| 608 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 609 } | |
| 610 | |
| 611 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) | |
| 612 { | |
| 613 if (isStackingContext() && !firstIteration) { | |
| 614 if (lookup.contains(this)) { | |
| 615 minIndex = std::min(minIndex, lookup.get(this)); | |
| 616 maxIndex = std::max(maxIndex, lookup.get(this)); | |
| 617 count++; | |
| 618 } | |
| 619 return; | |
| 620 } | |
| 621 | |
| 622 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { | |
| 623 int childMinIndex = 0; | |
| 624 int childMaxIndex = 0; | |
| 625 int childCount = 0; | |
| 626 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); | |
| 627 if (childCount) { | |
| 628 count += childCount; | |
| 629 minIndex = std::min(minIndex, childMinIndex); | |
| 630 maxIndex = std::max(maxIndex, childMaxIndex); | |
| 631 } | |
| 632 } | |
| 633 | |
| 634 if (!isStackingContext()) { | |
| 635 bool newValue = maxIndex - minIndex == count; | |
| 636 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | |
| 637 m_descendantsAreContiguousInStackingOrder = newValue; | |
| 638 if (didUpdate) | |
| 639 updateNeedsCompositedScrolling(); | |
| 640 } | |
| 641 } | |
| 642 | |
| 643 static inline bool isPositionedContainer(const RenderLayer* layer) | 488 static inline bool isPositionedContainer(const RenderLayer* layer) |
| 644 { | 489 { |
| 645 // FIXME: This is not in sync with containingBlock. | 490 // FIXME: This is not in sync with containingBlock. |
| 646 // RenderObject::canContainFixedPositionedObject() should probably be used | 491 // RenderObject::canContainFixedPositionedObject() should probably be used |
| 647 // instead. | 492 // instead. |
| 648 RenderLayerModelObject* layerRenderer = layer->renderer(); | 493 RenderLayerModelObject* layerRenderer = layer->renderer(); |
| 649 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | 494 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); |
| 650 } | 495 } |
| 651 | 496 |
| 652 enum StackingOrderDirection { FromBackground, FromForeground }; | 497 enum StackingOrderDirection { FromBackground, FromForeground }; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 669 } | 514 } |
| 670 | 515 |
| 671 size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; | 516 size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; |
| 672 | 517 |
| 673 if (index < posZOrderListSize) | 518 if (index < posZOrderListSize) |
| 674 return posZOrderList->at(posZOrderListSize - index - 1); | 519 return posZOrderList->at(posZOrderListSize - index - 1); |
| 675 | 520 |
| 676 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); | 521 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); |
| 677 } | 522 } |
| 678 | 523 |
| 524 | |
| 525 // After promotion, the paint order consists of | |
| 526 // a) the non-descendants which precede the promoted layer, | |
| 527 // b) the promoted layer, and | |
| 528 // c) the non-descendants which succeed the promoted layer. | |
| 529 // | |
| 530 // If the current layer's descendants form a contiguous block in paint order | |
| 531 // before promotion, the paint order will consist of | |
| 532 // a) the non-descendants which precede the current layer and its descendants, | |
| 533 // b) the current layer and its descendants | |
| 534 // c) The non-descendants which succeed the current layer and its descendants. | |
| 535 // | |
| 536 // Sub-lists (a) and (c) should be identical in both paint order lists if | |
| 537 // and only if the descendants form a contiguous block. In fact, this is the | |
| 538 // only check we need to perform since the order of the descendants with | |
| 539 // respect to each other cannot be affected by promotion (i.e., we don't | |
| 540 // need to worry about sub-list (b)). | |
| 541 // | |
| 542 // Some examples: | |
| 543 // C = currentLayer | |
| 544 // - = negative z-order child of currentLayer | |
| 545 // + = positive z-order child of currentLayer | |
| 546 // A = positioned ancestor of currentLayer | |
|
Julien - ping for review
2013/04/25 21:09:04
A as in Positioned?
hartmanng
2013/05/06 21:41:52
Done.
| |
| 547 // x = any other RenderLayer in the list | |
| 548 // | |
| 549 // original | zOrderListBeforePromote | zOrderLi stAfterPromote | |
| 550 // zOrderListBeforePromote | after inserting C as above | | |
| 551 // ------------------------------------------------------------------------- -------------- | |
| 552 // (1) x---+++x | x---C+++x | xCx | |
| 553 // (2) x---+A++x | x---+AC++x | xACx | |
| 554 // (3) x-x--+++x | x-x--C+++x | xxCx | |
| 555 // (4) xxA++x | xxAC++x | xxACx | |
| 556 // | |
| 557 // In example (1), we compare sub-list (a) by marching from the left of both | |
| 558 // lists (zOrderListBeforePromote after inserting C and | |
| 559 // zOrderListAfterPromote). The first mismatch is at index 1 when we hit '-' | |
| 560 // and 'C'. That means we have neg z-order descendants. This is a problem if | |
| 561 // we have a background. Before promotion, this bg would get painted with | |
| 562 // the current layer (i.e., after the neg z-order descendants), but after | |
| 563 // promotion the bg would get painted before them. This is a stacking order | |
| 564 // violation and we can't promote. However, if we don't have a background, | |
| 565 // we would continue on to the second pass. When comparing from the right, | |
| 566 // we mismatch on '+' and 'C'. Since we hit 'C' on zOrderListAfterPromote, | |
| 567 // we know that the children are contiguous, and we will promote. | |
| 568 // | |
| 569 // In example (2), when marching from the left, we'll hit a mismatch again | |
| 570 // on the second element we look at. This time, since this element is an 'A' | |
| 571 // in zOrderListAfterPromote, this indicates that there is an extra layer | |
| 572 // (the 'A') mixed in with the children. This could cause a change in paint | |
| 573 // order if we promote, so we decide not to and break out of the loop. Note | |
| 574 // that if the current layer has a background, this would provide a second | |
| 575 // reason not to opt in, since again we have negative z-order children who | |
| 576 // would change paint order with respect to our background if we promoted. | |
| 577 // | |
| 578 // In example (3), the discontiguity of the negative z-order children causes | |
| 579 // us to fail early in our "FromBackground" pass when we try to compare '-' | |
| 580 // from zOrderListBeforePromote with 'x' in zOrderListAfterPromote. | |
| 581 // | |
| 582 // Finally in example (4), we would match 'xxAC' from the left, then stop | |
| 583 // since we hit 'C'. Then we would match 'x' from the right, and mismatch | |
| 584 // on '+' and 'C'. Since we're at 'C' on the zOrderListAfterPromote, we | |
| 585 // conclude that all the children are contiguous. Since there are no | |
| 586 // negative z-order children, a background layer is irrelevant in this case. | |
| 587 // We will opt in, keeping paint order constant. | |
| 588 static bool compareLayerListsBeforeAndAfterPromote(const RenderLayer* currentLay er, | |
| 589 const Vector<RenderLayer*>* posZOrderListBeforePromote, | |
| 590 const Vector<RenderLayer*>* negZOrderListBeforePromote, | |
| 591 const Vector<RenderLayer*>* posZOrderListAfterPromote, | |
| 592 const Vector<RenderLayer*>* negZOrderListAfterPromote, | |
| 593 const size_t sizeBeforePromote, | |
| 594 const size_t sizeAfterPromote, | |
| 595 const StackingOrderDirection direction) | |
| 596 { | |
| 597 for (size_t index = 0; index < sizeBeforePromote && index < sizeAfterPromote ; index++) { | |
| 598 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote, negZOrderListBeforePromote, direction, index); | |
| 599 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote, negZOrderListAfterPromote, direction, index); | |
| 600 | |
| 601 if (layerBeforePromote != layerAfterPromote) { | |
| 602 // If we find a mismatch, the only situation where we haven't | |
| 603 // necessarily changed paint order yet is if layerAfterPromote | |
| 604 // is currentLayer. | |
| 605 if (layerAfterPromote != currentLayer) | |
| 606 return false; | |
| 607 | |
| 608 // Also, if the current layer has a background, then any | |
| 609 // negative z-order children will get between the background | |
| 610 // and the rest of the layer. | |
| 611 if (direction == FromBackground && currentLayer->renderer()->hasBack ground()) | |
| 612 return false; | |
| 613 } | |
| 614 | |
| 615 // To compare the sub-lists (a) and (c) from the comment above, we only | |
| 616 // need to march until we hit the currentLayer in the | |
| 617 // zOrderListAfterPromote from each direction. | |
| 618 if (layerAfterPromote == currentLayer) | |
| 619 break; | |
| 620 } | |
| 621 | |
| 622 return true; | |
| 623 } | |
| 624 | |
| 625 // Determine whether the current layer can be promoted to a stacking container, | |
| 626 // given its closest stacking context ancestor. We do this by computing what | |
| 627 // positive and negative z-order lists would look like before and after | |
| 628 // promotion, and ensuring that proper stacking order is preserved between the | |
| 629 // two sets of lists. | |
| 630 // | |
| 631 // For more details on how the lists will be compared, see the comment and | |
| 632 // examples for compareLayerListsBeforeAndAfterPromote(). | |
| 633 void RenderLayer::updateCanBeStackingContainer(RenderLayer* ancestorStackingCont ext) | |
| 634 { | |
| 635 ASSERT(!isStackingContext()); | |
| 636 | |
| 637 if (!m_canBePromotedToStackingContainerDirty || !acceleratedCompositingForOv erflowScrollEnabled()) | |
| 638 return; | |
| 639 | |
| 640 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; | |
| 641 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; | |
| 642 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; | |
| 643 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; | |
| 644 size_t posZOrderListSizeBeforePromote, negZOrderListSizeBeforePromote, posZO rderListSizeAfterPromote, negZOrderListSizeAfterPromote; | |
|
Julien - ping for review
2013/04/25 21:09:04
It's not really in the style guide but it's usuall
hartmanng
2013/05/06 21:41:52
Removed these variables, no longer relevant.
| |
| 645 | |
| 646 collectBeforePromotionZOrderList(ancestorStackingContext, posZOrderListBefor ePromote, negZOrderListBeforePromote, posZOrderListSizeBeforePromote, negZOrderL istSizeBeforePromote); | |
| 647 collectAfterPromotionZOrderList(ancestorStackingContext, posZOrderListAfterP romote, negZOrderListAfterPromote, posZOrderListSizeAfterPromote, negZOrderListS izeAfterPromote); | |
| 648 | |
| 649 size_t sizeBeforePromote = posZOrderListSizeBeforePromote + negZOrderListSiz eBeforePromote; | |
| 650 size_t sizeAfterPromote = posZOrderListSizeAfterPromote + negZOrderListSizeA fterPromote; | |
| 651 | |
| 652 bool canPromote = compareLayerListsBeforeAndAfterPromote(this, posZOrderList BeforePromote.get(), negZOrderListBeforePromote.get(), | |
| 653 posZOrderListAfterPromote.get(), negZOrderListAfterPromote.get(), | |
| 654 sizeBeforePromote, sizeAfterPromote, FromBackground) | |
| 655 && compareLayerListsBeforeAndAfterPromote(this, posZOrderListBeforePromo te.get(), negZOrderListBeforePromote.get(), | |
| 656 posZOrderListAfterPromote.get(), negZOrderListAfterPromote.get(), | |
| 657 sizeBeforePromote, sizeAfterPromote, FromForeground); | |
| 658 | |
| 659 bool didUpdate = (canPromote != m_canBePromotedToStackingContainer); | |
|
Julien - ping for review
2013/04/25 21:09:04
You changed tense here which makes it hard to see.
hartmanng
2013/05/06 21:41:52
Done.
| |
| 660 | |
| 661 m_canBePromotedToStackingContainer = canPromote; | |
| 662 | |
| 663 if (didUpdate) | |
| 664 updateNeedsCompositedScrolling(); | |
| 665 | |
| 666 m_canBePromotedToStackingContainerDirty = false; | |
| 667 } | |
| 668 | |
| 669 void RenderLayer::updateCanBeStackingContainerRecursively(RenderLayer* ancestorS tackingContext) | |
| 670 { | |
| 671 if (this != ancestorStackingContext) { | |
| 672 if (isStackingContext()) | |
| 673 return; | |
| 674 | |
| 675 updateCanBeStackingContainer(ancestorStackingContext); | |
| 676 } | |
| 677 | |
| 678 if (m_hasVisibleDescendant) { | |
| 679 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | |
| 680 // Ignore reflections. | |
| 681 if (!m_reflection || reflectionLayer() != child) | |
| 682 child->updateCanBeStackingContainerRecursively(ancestorStackingC ontext); | |
| 683 } | |
| 684 } | |
| 685 } | |
| 686 | |
| 679 // Compute what positive and negative z-order lists would look like before and | 687 // 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 | 688 // after promotion, so we can later ensure that proper stacking order is |
| 681 // preserved between the two sets of lists. | 689 // preserved between the two sets of lists. |
| 682 // | 690 // |
| 683 // A few examples: | 691 // A few examples: |
| 684 // c = currentLayer | 692 // c = currentLayer |
| 685 // - = negative z-order child of currentLayer | 693 // - = negative z-order child of currentLayer |
| 686 // + = positive z-order child of currentLayer | 694 // + = positive z-order child of currentLayer |
| 687 // a = positioned ancestor of currentLayer | 695 // a = positioned ancestor of currentLayer |
| 688 // x = any other RenderLayer in the list | 696 // x = any other RenderLayer in the list |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 if (curr == ancestorStackingContainer) | 1167 if (curr == ancestorStackingContainer) |
| 1160 return; | 1168 return; |
| 1161 } | 1169 } |
| 1162 } | 1170 } |
| 1163 | 1171 |
| 1164 bool RenderLayer::canBeStackingContainer() const | 1172 bool RenderLayer::canBeStackingContainer() const |
| 1165 { | 1173 { |
| 1166 if (isStackingContext() || !ancestorStackingContainer()) | 1174 if (isStackingContext() || !ancestorStackingContainer()) |
| 1167 return true; | 1175 return true; |
| 1168 | 1176 |
| 1169 return m_descendantsAreContiguousInStackingOrder; | 1177 return m_canBePromotedToStackingContainer; |
|
Julien - ping for review
2013/04/25 21:09:04
ASSERT(!m_canBePromotedToStackingContainerDirty);
hartmanng
2013/05/06 21:41:52
Done.
| |
| 1170 } | 1178 } |
| 1171 | 1179 |
| 1172 void RenderLayer::setHasVisibleContent() | 1180 void RenderLayer::setHasVisibleContent() |
| 1173 { | 1181 { |
| 1174 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 1182 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
| 1175 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 1183 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
| 1176 return; | 1184 return; |
| 1177 } | 1185 } |
| 1178 | 1186 |
| 1179 m_visibleContentStatusDirty = false; | 1187 m_visibleContentStatusDirty = false; |
| (...skipping 4524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5704 { | 5712 { |
| 5705 ASSERT(m_layerListMutationAllowed); | 5713 ASSERT(m_layerListMutationAllowed); |
| 5706 ASSERT(isStackingContainer()); | 5714 ASSERT(isStackingContainer()); |
| 5707 | 5715 |
| 5708 if (m_posZOrderList) | 5716 if (m_posZOrderList) |
| 5709 m_posZOrderList->clear(); | 5717 m_posZOrderList->clear(); |
| 5710 if (m_negZOrderList) | 5718 if (m_negZOrderList) |
| 5711 m_negZOrderList->clear(); | 5719 m_negZOrderList->clear(); |
| 5712 m_zOrderListsDirty = true; | 5720 m_zOrderListsDirty = true; |
| 5713 | 5721 |
| 5714 m_descendantsAreContiguousInStackingOrderDirty = true; | 5722 m_canBePromotedToStackingContainerDirty = true; |
| 5715 | 5723 |
| 5716 if (!renderer()->documentBeingDestroyed()) { | 5724 if (!renderer()->documentBeingDestroyed()) { |
| 5717 compositor()->setCompositingLayersNeedRebuild(); | 5725 compositor()->setCompositingLayersNeedRebuild(); |
| 5718 if (acceleratedCompositingForOverflowScrollEnabled()) | 5726 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5719 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5727 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5720 } | 5728 } |
| 5721 } | 5729 } |
| 5722 | 5730 |
| 5723 void RenderLayer::dirtyStackingContainerZOrderLists() | 5731 void RenderLayer::dirtyStackingContainerZOrderLists() |
| 5724 { | 5732 { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5850 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5858 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 5851 // Ignore reflections. | 5859 // Ignore reflections. |
| 5852 if (!m_reflection || reflectionLayer() != child) | 5860 if (!m_reflection || reflectionLayer() != child) |
| 5853 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); | 5861 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); |
| 5854 } | 5862 } |
| 5855 } | 5863 } |
| 5856 } | 5864 } |
| 5857 | 5865 |
| 5858 void RenderLayer::updateLayerListsIfNeeded() | 5866 void RenderLayer::updateLayerListsIfNeeded() |
| 5859 { | 5867 { |
| 5860 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | 5868 bool shouldUpdateCanBeStackingContainer = acceleratedCompositingForOverflowS crollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowList Dirty) && m_canBePromotedToStackingContainerDirty; |
| 5861 updateZOrderLists(); | 5869 updateZOrderLists(); |
| 5862 updateNormalFlowList(); | 5870 updateNormalFlowList(); |
| 5863 | 5871 |
| 5864 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5872 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
| 5865 reflectionLayer->updateZOrderLists(); | 5873 reflectionLayer->updateZOrderLists(); |
| 5866 reflectionLayer->updateNormalFlowList(); | 5874 reflectionLayer->updateNormalFlowList(); |
| 5867 } | 5875 } |
| 5868 | 5876 |
| 5869 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | 5877 if (shouldUpdateCanBeStackingContainer) { |
| 5870 updateDescendantsAreContiguousInStackingOrder(); | 5878 // call UpdateCanBeStackingContainer for all descendants, |
|
Julien - ping for review
2013/04/25 21:09:04
Sentences start with a capital so "Call ..."
hartmanng
2013/05/06 21:41:52
Done.
| |
| 5879 // passing self in as ancestor stacking context. | |
| 5880 updateCanBeStackingContainerRecursively(this); | |
| 5881 | |
| 5871 // The above function can cause us to update m_needsCompositedScrolling | 5882 // The above function can cause us to update m_needsCompositedScrolling |
| 5872 // and dirty our layer lists. Refresh them if necessary. | 5883 // and dirty our layer lists. Refresh them if necessary. |
| 5873 updateZOrderLists(); | 5884 updateZOrderLists(); |
| 5874 updateNormalFlowList(); | 5885 updateNormalFlowList(); |
| 5875 } | 5886 } |
| 5876 } | 5887 } |
| 5877 | 5888 |
| 5878 void RenderLayer::repaintIncludingDescendants() | 5889 void RenderLayer::repaintIncludingDescendants() |
| 5879 { | 5890 { |
| 5880 renderer()->repaint(); | 5891 renderer()->repaint(); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6564 } | 6575 } |
| 6565 } | 6576 } |
| 6566 | 6577 |
| 6567 void showLayerTree(const WebCore::RenderObject* renderer) | 6578 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6568 { | 6579 { |
| 6569 if (!renderer) | 6580 if (!renderer) |
| 6570 return; | 6581 return; |
| 6571 showLayerTree(renderer->enclosingLayer()); | 6582 showLayerTree(renderer->enclosingLayer()); |
| 6572 } | 6583 } |
| 6573 #endif | 6584 #endif |
| OLD | NEW |