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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 #include "core/page/Settings.h" | 68 #include "core/page/Settings.h" |
| 69 #include "core/page/UseCounter.h" | 69 #include "core/page/UseCounter.h" |
| 70 #include "core/page/animation/AnimationController.h" | 70 #include "core/page/animation/AnimationController.h" |
| 71 #include "core/page/scrolling/ScrollingCoordinator.h" | 71 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 72 #include "core/platform/FloatConversion.h" | 72 #include "core/platform/FloatConversion.h" |
| 73 #include "core/platform/HistogramSupport.h" | 73 #include "core/platform/HistogramSupport.h" |
| 74 #include "core/platform/PlatformMouseEvent.h" | 74 #include "core/platform/PlatformMouseEvent.h" |
| 75 #include "core/platform/ScrollAnimator.h" | 75 #include "core/platform/ScrollAnimator.h" |
| 76 #include "core/platform/Scrollbar.h" | 76 #include "core/platform/Scrollbar.h" |
| 77 #include "core/platform/ScrollbarTheme.h" | 77 #include "core/platform/ScrollbarTheme.h" |
| 78 #include "core/platform/chromium/TraceEvent.h" | |
| 78 #include "core/platform/graphics/FloatPoint3D.h" | 79 #include "core/platform/graphics/FloatPoint3D.h" |
| 79 #include "core/platform/graphics/FloatRect.h" | 80 #include "core/platform/graphics/FloatRect.h" |
| 80 #include "core/platform/graphics/Gradient.h" | 81 #include "core/platform/graphics/Gradient.h" |
| 81 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 82 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
| 82 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" | 83 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" |
| 83 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" | 84 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" |
| 84 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" | 85 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" |
| 85 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h " | 86 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h " |
| 86 #include "core/platform/graphics/filters/FEColorMatrix.h" | 87 #include "core/platform/graphics/filters/FEColorMatrix.h" |
| 87 #include "core/platform/graphics/filters/FEMerge.h" | 88 #include "core/platform/graphics/filters/FEMerge.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 : m_inResizeMode(false) | 141 : m_inResizeMode(false) |
| 141 , m_scrollDimensionsDirty(true) | 142 , m_scrollDimensionsDirty(true) |
| 142 , m_normalFlowListDirty(true) | 143 , m_normalFlowListDirty(true) |
| 143 , m_hasSelfPaintingLayerDescendant(false) | 144 , m_hasSelfPaintingLayerDescendant(false) |
| 144 , m_hasSelfPaintingLayerDescendantDirty(false) | 145 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 145 , m_hasOutOfFlowPositionedDescendant(false) | 146 , m_hasOutOfFlowPositionedDescendant(false) |
| 146 , m_hasOutOfFlowPositionedDescendantDirty(true) | 147 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 147 , m_hasUnclippedDescendant(false) | 148 , m_hasUnclippedDescendant(false) |
| 148 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) | 149 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) |
| 149 , m_needsCompositedScrolling(false) | 150 , m_needsCompositedScrolling(false) |
| 150 , m_descendantsAreContiguousInStackingOrder(false) | 151 , m_canBePromotedToStackingContainer(false) |
| 151 , m_descendantsAreContiguousInStackingOrderDirty(true) | 152 , m_canBePromotedToStackingContainerDirty(true) |
| 152 , m_isRootLayer(renderer->isRenderView()) | 153 , m_isRootLayer(renderer->isRenderView()) |
| 153 , m_usedTransparency(false) | 154 , m_usedTransparency(false) |
| 154 , m_paintingInsideReflection(false) | 155 , m_paintingInsideReflection(false) |
| 155 , m_inOverflowRelayout(false) | 156 , m_inOverflowRelayout(false) |
| 156 , m_repaintStatus(NeedsNormalRepaint) | 157 , m_repaintStatus(NeedsNormalRepaint) |
| 157 , m_visibleContentStatusDirty(true) | 158 , m_visibleContentStatusDirty(true) |
| 158 , m_hasVisibleContent(false) | 159 , m_hasVisibleContent(false) |
| 159 , m_visibleDescendantStatusDirty(false) | 160 , m_visibleDescendantStatusDirty(false) |
| 160 , m_hasVisibleDescendant(false) | 161 , m_hasVisibleDescendant(false) |
| 161 , m_isPaginated(false) | 162 , m_isPaginated(false) |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 } | 510 } |
| 510 } | 511 } |
| 511 | 512 |
| 512 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 513 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
| 513 { | 514 { |
| 514 return renderer()->frame() | 515 return renderer()->frame() |
| 515 && renderer()->frame()->page() | 516 && renderer()->frame()->page() |
| 516 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); | 517 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); |
| 517 } | 518 } |
| 518 | 519 |
| 519 // If we are a stacking container, then this function will determine if our | 520 enum StackingOrderDirection { FromBackground, FromForeground }; |
| 520 // descendants for a contiguous block in stacking order. This is required in | 521 |
| 521 // order for an element to be safely promoted to a stacking container. It is saf e | 522 // We'd like to be able to iterate through a single paint order list, but for |
| 522 // to become a stacking container if this change would not alter the stacking | 523 // efficiency's sake, we hang onto two lists instead (namely, the pos and neg |
| 523 // order of layers on the page. That can only happen if a non-descendant appear | 524 // z-order lists produced by CollectLayers). This function allows us to index |
| 524 // between us and our descendants in stacking order. Here's an example: | 525 // into these two lists as if they were one. It also allows us to index into |
| 526 // this virtual list either from the start or from the end (i.e., in either | |
| 527 // stacking order direction). | |
|
esprehn
2013/05/07 00:49:16
This comment is not needed.
hartmanng
2013/05/13 17:44:18
Done.
| |
| 528 static const RenderLayer* getStackingOrderElementAt(const Vector<RenderLayer*>* posZOrderList, const Vector<RenderLayer*>* negZOrderList, const StackingOrderDir ection direction, const size_t index) | |
|
esprehn
2013/05/07 00:49:16
I'd prefer you remove this method. It just makes t
hartmanng
2013/05/13 17:44:18
Done.
| |
| 529 { | |
| 530 const size_t negZOrderListSize = negZOrderList ? negZOrderList->size() : 0; | |
| 531 | |
| 532 if (direction == FromBackground) { | |
| 533 if (index < negZOrderListSize) | |
| 534 return negZOrderList->at(index); | |
| 535 | |
| 536 return posZOrderList->at(index - negZOrderListSize); | |
| 537 } | |
| 538 | |
| 539 const size_t posZOrderListSize = posZOrderList ? posZOrderList->size() : 0; | |
| 540 | |
| 541 if (index < posZOrderListSize) | |
| 542 return posZOrderList->at(posZOrderListSize - index - 1); | |
| 543 | |
| 544 return negZOrderList->at(negZOrderListSize - (index - posZOrderListSize) - 1 ); | |
| 545 } | |
| 546 | |
| 547 // After promotion, the paint order consists of | |
| 548 // a) the non-descendants which precede the promoted layer, | |
| 549 // b) the promoted layer, and | |
| 550 // c) the non-descendants which succeed the promoted layer. | |
| 525 // | 551 // |
| 526 // this | 552 // If the current layer's descendants form a contiguous block in paint order |
| 527 // / | \. | 553 // before promotion, the paint order will consist of |
| 528 // A B C | 554 // a) the non-descendants which precede the current layer and its descendants, |
| 529 // /\ | /\. | 555 // b) the current layer and its descendants |
| 530 // 0 -8 D 2 7 | 556 // c) The non-descendants which succeed the current layer and its descendants. |
| 531 // | | |
| 532 // 5 | |
| 533 // | 557 // |
| 534 // I've labeled our normal flow descendants A, B, C, and D, our stacking | 558 // Sub-lists (a) and (c) should be identical in both paint order lists if |
| 535 // container descendants with their z indices, and us with 'this' (we're a | 559 // and only if the descendants form a contiguous block. In fact, this is the |
| 536 // stacking container and our zIndex doesn't matter here). These nodes appear in | 560 // only check we need to perform since the order of the descendants with |
| 537 // three lists: posZOrder, negZOrder, and normal flow (keep in mind that normal | 561 // respect to each other cannot be affected by promotion (i.e., we don't |
| 538 // flow layers don't overlap). So if we arrange these lists in order we get our | 562 // need to worry about sub-list (b)). |
| 539 // stacking order: | |
| 540 // | 563 // |
| 541 // [-8], [A-D], [0, 2, 5, 7]--> pos z-order. | 564 // Some examples: |
| 542 // | | | 565 // C = currentLayer |
| 543 // Neg z-order. <-+ +--> Normal flow descendants. | 566 // - = negative z-order child of currentLayer |
| 567 // + = positive z-order child of currentLayer | |
| 568 // P = positioned ancestor of currentLayer | |
| 569 // x = any other RenderLayer in the list | |
| 544 // | 570 // |
| 545 // We can then assign new, 'stacking' order indices to these elements as follows : | 571 // original | zOrderListBeforePromote | zOrderLi stAfterPromote |
| 572 // zOrderListBeforePromote | after inserting C as above | | |
| 573 // ------------------------------------------------------------------------- -------------- | |
| 574 // (1) x---+++x | x---C+++x | xCx | |
| 575 // (2) x---+P++x | x---+PC++x | xPCx | |
| 576 // (3) x-x--+++x | x-x--C+++x | xxCx | |
| 577 // (4) xxP++x | xxPC++x | xxPCx | |
| 546 // | 578 // |
| 547 // [-8], [A-D], [0, 2, 5, 7] | 579 // In example (1), we compare sub-list (a) by marching from the left of both |
| 548 // 'Stacking' indices: -1 0 1 2 3 4 | 580 // lists (zOrderListBeforePromote after inserting C and |
| 581 // zOrderListAfterPromote). The first mismatch is at index 1 when we hit '-' | |
| 582 // and 'C'. That means we have neg z-order descendants. This is a problem if | |
| 583 // we have a background. Before promotion, this bg would get painted with | |
| 584 // the current layer (i.e., after the neg z-order descendants), but after | |
| 585 // promotion the bg would get painted before them. This is a stacking order | |
| 586 // violation and we can't promote. However, if we don't have a background, | |
| 587 // we would continue on to the second pass. When comparing from the right, | |
| 588 // we mismatch on '+' and 'C'. Since we hit 'C' on zOrderListAfterPromote, | |
| 589 // we know that the children are contiguous, and we will promote. | |
| 549 // | 590 // |
| 550 // Note that the normal flow descendants can share an index because they don't | 591 // In example (2), when marching from the left, we'll hit a mismatch again |
| 551 // stack/overlap. Now our problem becomes very simple: a layer can safely become | 592 // on the second element we look at. This time, since this element is a 'P' |
| 552 // a stacking container if the stacking-order indices of it and its descendants | 593 // in zOrderListAfterPromote, this indicates that there is an extra layer |
| 553 // appear in a contiguous block in the list of stacking indices. This problem | 594 // (the 'P') mixed in with the children. This could cause a change in paint |
| 554 // can be solved very efficiently by calculating the min/max stacking indices in | 595 // order if we promote, so we decide not to and break out of the loop. Note |
| 555 // the subtree, and the number stacking container descendants. Once we have this | 596 // that if the current layer has a background, this would provide a second |
| 556 // information, we know that the subtree's indices form a contiguous block if: | 597 // reason not to opt in, since again we have negative z-order children who |
| 598 // would change paint order with respect to our background if we promoted. | |
| 557 // | 599 // |
| 558 // maxStackIndex - minStackIndex == numSCDescendants | 600 // In example (3), the discontiguity of the negative z-order children causes |
| 601 // us to fail early in our "FromBackground" pass when we try to compare '-' | |
| 602 // from zOrderListBeforePromote with 'x' in zOrderListAfterPromote. | |
| 559 // | 603 // |
| 560 // So for node A in the example above we would have: | 604 // Finally in example (4), we would match 'xxPC' from the left, then stop |
| 561 // maxStackIndex = 1 | 605 // since we hit 'C'. Then we would match 'x' from the right, and mismatch |
| 562 // minStackIndex = -1 | 606 // on '+' and 'C'. Since we're at 'C' on the zOrderListAfterPromote, we |
| 563 // numSCDecendants = 2 | 607 // conclude that all the children are contiguous. Since there are no |
| 608 // negative z-order children, a background layer is irrelevant in this case. | |
| 609 // We will opt in, keeping paint order constant. | |
|
esprehn
2013/05/07 00:49:16
I'd prefer if you created a much shorter and simpl
hartmanng
2013/05/13 17:44:18
Done.
| |
| 610 static bool compareLayerListsBeforeAndAfterPromote(const RenderLayer* currentLay er, | |
| 611 const Vector<RenderLayer*>* posZOrderListBeforePromote, | |
| 612 const Vector<RenderLayer*>* negZOrderListBeforePromote, | |
| 613 const Vector<RenderLayer*>* posZOrderListAfterPromote, | |
| 614 const Vector<RenderLayer*>* negZOrderListAfterPromote, | |
| 615 const StackingOrderDirection direction) | |
| 616 { | |
| 617 const size_t sizeBeforePromote = (posZOrderListBeforePromote ? posZOrderList BeforePromote->size() : 0) + (negZOrderListBeforePromote ? negZOrderListBeforePr omote->size() : 0); | |
| 618 const size_t sizeAfterPromote = (posZOrderListAfterPromote ? posZOrderListAf terPromote->size() : 0) + (negZOrderListAfterPromote ? negZOrderListAfterPromote ->size() : 0); | |
| 619 for (size_t index = 0; index < sizeBeforePromote && index < sizeAfterPromote ; index++) { | |
|
esprehn
2013/05/07 00:49:16
Use two separate loops please. Get rid of that com
hartmanng
2013/05/13 17:44:18
Done.
| |
| 620 const RenderLayer* layerBeforePromote = getStackingOrderElementAt(posZOr derListBeforePromote, negZOrderListBeforePromote, direction, index); | |
| 621 const RenderLayer* layerAfterPromote = getStackingOrderElementAt(posZOrd erListAfterPromote, negZOrderListAfterPromote, direction, index); | |
| 622 | |
| 623 if (layerBeforePromote != layerAfterPromote) { | |
| 624 // If we find a mismatch, the only situation where we haven't | |
| 625 // necessarily changed paint order yet is if layerAfterPromote | |
| 626 // is currentLayer. | |
| 627 if (layerAfterPromote != currentLayer) | |
| 628 return false; | |
| 629 | |
| 630 // Also, if the current layer has a background, then any | |
| 631 // negative z-order children will get between the background | |
| 632 // and the rest of the layer. | |
| 633 if (direction == FromBackground && currentLayer->renderer()->hasBack ground()) | |
| 634 return false; | |
| 635 } | |
| 636 | |
| 637 // To compare the sub-lists (a) and (c) from the comment above, we only | |
| 638 // need to march until we hit the currentLayer in the | |
| 639 // zOrderListAfterPromote from each direction. | |
|
esprehn
2013/05/07 00:49:16
Remove this comment. Comments that reference other
hartmanng
2013/05/13 17:44:18
Done.
| |
| 640 if (layerAfterPromote == currentLayer) | |
| 641 break; | |
| 642 } | |
| 643 | |
| 644 return true; | |
| 645 } | |
| 646 | |
| 647 // Determine whether the current layer can be promoted to a stacking container, | |
| 648 // given its closest stacking context ancestor. We do this by computing what | |
| 649 // positive and negative z-order lists would look like before and after | |
| 650 // promotion, and ensuring that proper stacking order is preserved between the | |
| 651 // two sets of lists. | |
| 564 // | 652 // |
| 565 // and so, | 653 // For more details on how the lists will be compared, see the comment and |
| 566 // maxStackIndex - minStackIndex == numSCDescendants | 654 // examples for compareLayerListsBeforeAndAfterPromote(). |
|
esprehn
2013/05/07 00:49:16
Same deal, don't reference across doc comments lik
hartmanng
2013/05/13 17:44:18
Done.
| |
| 567 // ===> 1 - (-1) == 2 | 655 void RenderLayer::updateCanBeStackingContainer() |
| 568 // ===> 2 == 2 | |
| 569 // | |
| 570 // Since this is true, A can safely become a stacking container. | |
| 571 // Now, for node C we have: | |
| 572 // | |
| 573 // maxStackIndex = 4 | |
| 574 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 575 // numSCDecendants = 2 | |
| 576 // | |
| 577 // and so, | |
| 578 // maxStackIndex - minStackIndex == numSCDescendants | |
| 579 // ===> 4 - 0 == 2 | |
| 580 // ===> 4 == 2 | |
| 581 // | |
| 582 // Since this is false, C cannot be safely promoted to a stacking container. Thi s | |
| 583 // happened because of the elements with z-index 5 and 0. Now if 5 had been a | |
| 584 // child of C rather than D, and A had no child with Z index 0, we would have ha d: | |
| 585 // | |
| 586 // maxStackIndex = 3 | |
| 587 // minStackIndex = 0 <-- because C has stacking index 0. | |
| 588 // numSCDecendants = 3 | |
| 589 // | |
| 590 // and so, | |
| 591 // maxStackIndex - minStackIndex == numSCDescendants | |
| 592 // ===> 3 - 0 == 3 | |
| 593 // ===> 3 == 3 | |
| 594 // | |
| 595 // And we would conclude that C could be promoted. | |
| 596 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | |
| 597 { | 656 { |
| 598 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled()) | 657 TRACE_EVENT0("blink_rendering", "RenderLayer::updateCanBeStackingContainer") ; |
| 658 | |
| 659 if (isStackingContext() || !m_canBePromotedToStackingContainerDirty || !acce leratedCompositingForOverflowScrollEnabled()) | |
| 599 return; | 660 return; |
| 600 | 661 |
| 601 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 662 FrameView* frameView = renderer()->view()->frameView(); |
| 602 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 663 if (!frameView || !frameView->containsScrollableArea(this)) |
| 603 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 664 return; |
| 604 | 665 |
| 605 // Create a reverse lookup. | 666 RenderLayer* ancestorStackingContext = this->ancestorStackingContext(); |
| 606 HashMap<const RenderLayer*, int> lookup; | 667 if (!ancestorStackingContext) |
| 668 return; | |
| 607 | 669 |
| 608 if (negZOrderList) { | 670 OwnPtr<Vector<RenderLayer*> > posZOrderListBeforePromote; |
| 609 int stackingOrderIndex = -1; | 671 OwnPtr<Vector<RenderLayer*> > negZOrderListBeforePromote; |
| 610 size_t listSize = negZOrderList->size(); | 672 OwnPtr<Vector<RenderLayer*> > posZOrderListAfterPromote; |
| 611 for (size_t i = 0; i < listSize; ++i) { | 673 OwnPtr<Vector<RenderLayer*> > negZOrderListAfterPromote; |
| 612 RenderLayer* currentLayer = negZOrderList->at(listSize - i - 1); | |
| 613 if (!currentLayer->isStackingContext()) | |
| 614 continue; | |
| 615 lookup.set(currentLayer, stackingOrderIndex--); | |
| 616 } | |
| 617 } | |
| 618 | 674 |
| 619 if (posZOrderList) { | 675 collectBeforePromotionZOrderList(ancestorStackingContext, posZOrderListBefor ePromote, negZOrderListBeforePromote); |
| 620 size_t listSize = posZOrderList->size(); | 676 collectAfterPromotionZOrderList(ancestorStackingContext, posZOrderListAfterP romote, negZOrderListAfterPromote); |
| 621 int stackingOrderIndex = 1; | |
| 622 for (size_t i = 0; i < listSize; ++i) { | |
| 623 RenderLayer* currentLayer = posZOrderList->at(i); | |
| 624 if (!currentLayer->isStackingContext()) | |
| 625 continue; | |
| 626 lookup.set(currentLayer, stackingOrderIndex++); | |
| 627 } | |
| 628 } | |
| 629 | 677 |
| 630 int minIndex = 0; | 678 size_t sizeBeforePromote = 0; |
| 631 int maxIndex = 0; | 679 if (posZOrderListBeforePromote) |
| 632 int count = 0; | 680 sizeBeforePromote += posZOrderListBeforePromote->size(); |
| 633 bool firstIteration = true; | 681 if (negZOrderListBeforePromote) |
| 634 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); | 682 sizeBeforePromote += negZOrderListBeforePromote->size(); |
|
esprehn
2013/05/07 00:49:16
This size variable is unused. These two if blocks
hartmanng
2013/05/13 17:44:18
Done.
| |
| 635 | 683 |
| 636 m_descendantsAreContiguousInStackingOrderDirty = false; | 684 size_t sizeAfterPromote = 0; |
| 637 } | 685 if (posZOrderListAfterPromote) |
| 686 sizeAfterPromote += posZOrderListAfterPromote->size(); | |
| 687 if (negZOrderListAfterPromote) | |
| 688 sizeAfterPromote += negZOrderListAfterPromote->size(); | |
|
esprehn
2013/05/07 00:49:16
This size variable is unused. Please remove the co
hartmanng
2013/05/13 17:44:18
Done.
| |
| 638 | 689 |
| 639 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) | 690 m_canBePromotedToStackingContainerDirty = false; |
| 640 { | 691 |
| 641 if (isStackingContext() && !firstIteration) { | 692 m_canBePromotedToStackingContainer = compareLayerListsBeforeAndAfterPromote( this, posZOrderListBeforePromote.get(), negZOrderListBeforePromote.get(), posZOr derListAfterPromote.get(), negZOrderListAfterPromote.get(), FromBackground); |
| 642 if (lookup.contains(this)) { | 693 |
| 643 minIndex = std::min(minIndex, lookup.get(this)); | 694 // No need to do the second check. |
| 644 maxIndex = std::max(maxIndex, lookup.get(this)); | 695 if (!m_canBePromotedToStackingContainer) |
| 645 count++; | |
| 646 } | |
| 647 return; | 696 return; |
| 648 } | |
| 649 | 697 |
| 650 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { | 698 m_canBePromotedToStackingContainer = compareLayerListsBeforeAndAfterPromote( this, posZOrderListBeforePromote.get(), negZOrderListBeforePromote.get(), posZOr derListAfterPromote.get(), negZOrderListAfterPromote.get(), FromForeground); |
| 651 int childMinIndex = 0; | |
| 652 int childMaxIndex = 0; | |
| 653 int childCount = 0; | |
| 654 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); | |
| 655 if (childCount) { | |
| 656 count += childCount; | |
| 657 minIndex = std::min(minIndex, childMinIndex); | |
| 658 maxIndex = std::max(maxIndex, childMaxIndex); | |
| 659 } | |
| 660 } | |
| 661 | |
| 662 if (!isStackingContext()) { | |
| 663 m_descendantsAreContiguousInStackingOrder = (maxIndex - minIndex) == cou nt; | |
| 664 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 665 } | |
| 666 } | 699 } |
| 667 | 700 |
| 668 static inline bool isPositionedContainer(const RenderLayer* layer) | 701 static inline bool isPositionedContainer(const RenderLayer* layer) |
| 669 { | 702 { |
| 670 // FIXME: This is not in sync with containingBlock. | 703 // FIXME: This is not in sync with containingBlock. |
| 671 // RenderObject::canContainFixedPositionedObject() should probably be used | 704 // RenderObject::canContainFixedPositionedObject() should probably be used |
| 672 // instead. | 705 // instead. |
| 673 RenderLayerModelObject* layerRenderer = layer->renderer(); | 706 RenderLayerModelObject* layerRenderer = layer->renderer(); |
| 674 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | 707 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); |
| 675 } | 708 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 if (curr == ancestorStackingContainer) | 1116 if (curr == ancestorStackingContainer) |
| 1084 return; | 1117 return; |
| 1085 } | 1118 } |
| 1086 } | 1119 } |
| 1087 | 1120 |
| 1088 bool RenderLayer::canBeStackingContainer() const | 1121 bool RenderLayer::canBeStackingContainer() const |
| 1089 { | 1122 { |
| 1090 if (isStackingContext() || !ancestorStackingContainer()) | 1123 if (isStackingContext() || !ancestorStackingContainer()) |
| 1091 return true; | 1124 return true; |
| 1092 | 1125 |
| 1093 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); | 1126 ASSERT(!m_canBePromotedToStackingContainerDirty); |
| 1094 return m_descendantsAreContiguousInStackingOrder; | 1127 return m_canBePromotedToStackingContainer; |
| 1095 } | 1128 } |
| 1096 | 1129 |
| 1097 void RenderLayer::setHasVisibleContent() | 1130 void RenderLayer::setHasVisibleContent() |
| 1098 { | 1131 { |
| 1099 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 1132 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
| 1100 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 1133 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
| 1101 return; | 1134 return; |
| 1102 } | 1135 } |
| 1103 | 1136 |
| 1104 m_visibleContentStatusDirty = false; | 1137 m_visibleContentStatusDirty = false; |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2079 return true; | 2112 return true; |
| 2080 case ForceCompositedScrollingOff: | 2113 case ForceCompositedScrollingOff: |
| 2081 return false; | 2114 return false; |
| 2082 } | 2115 } |
| 2083 | 2116 |
| 2084 return m_needsCompositedScrolling; | 2117 return m_needsCompositedScrolling; |
| 2085 } | 2118 } |
| 2086 | 2119 |
| 2087 void RenderLayer::updateNeedsCompositedScrolling() | 2120 void RenderLayer::updateNeedsCompositedScrolling() |
| 2088 { | 2121 { |
| 2089 if (RenderLayer* ancestor = ancestorStackingContext()) | 2122 updateCanBeStackingContainer(); |
| 2090 ancestor->updateDescendantsAreContiguousInStackingOrder(); | |
| 2091 | 2123 |
| 2092 bool needsCompositedScrolling = false; | 2124 bool needsCompositedScrolling = false; |
| 2125 updateDescendantDependentFlags(); | |
| 2093 | 2126 |
| 2094 FrameView* frameView = renderer()->view()->frameView(); | 2127 ASSERT(renderer()->view()->frameView() && renderer()->view()->frameView()->c ontainsScrollableArea(this)); |
| 2095 if (frameView && frameView->containsScrollableArea(this)) { | 2128 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScrollEn abled() |
| 2096 updateDescendantDependentFlags(); | 2129 && canBeStackingContainer() |
| 2097 | 2130 && !hasUnclippedDescendant(); |
| 2098 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() | |
| 2099 && canBeStackingContainer() | |
| 2100 && !hasUnclippedDescendant(); | |
| 2101 | 2131 |
| 2102 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 2132 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 2103 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); | 2133 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->style( )->useTouchOverflowScrolling(); |
| 2104 #else | 2134 #else |
| 2105 needsCompositedScrolling = forceUseCompositedScrolling; | 2135 needsCompositedScrolling = forceUseCompositedScrolling; |
| 2106 #endif | 2136 #endif |
| 2107 // We gather a boolean value for use with Google UMA histograms to | 2137 // We gather a boolean value for use with Google UMA histograms to |
| 2108 // quantify the actual effects of a set of patches attempting to | 2138 // quantify the actual effects of a set of patches attempting to |
| 2109 // relax composited scrolling requirements, thereby increasing the | 2139 // relax composited scrolling requirements, thereby increasing the |
| 2110 // number of composited overflow divs. | 2140 // number of composited overflow divs. |
| 2111 if (acceleratedCompositingForOverflowScrollEnabled()) | 2141 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 2112 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); | 2142 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); |
| 2113 } | |
| 2114 | 2143 |
| 2115 setNeedsCompositedScrolling(needsCompositedScrolling); | 2144 setNeedsCompositedScrolling(needsCompositedScrolling); |
| 2116 } | 2145 } |
| 2117 | 2146 |
| 2118 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) | 2147 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) |
| 2119 { | 2148 { |
| 2120 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2149 if (m_needsCompositedScrolling == needsCompositedScrolling) |
| 2121 return; | 2150 return; |
| 2122 | 2151 |
| 2123 m_needsCompositedScrolling = needsCompositedScrolling; | 2152 m_needsCompositedScrolling = needsCompositedScrolling; |
| (...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5634 { | 5663 { |
| 5635 ASSERT(m_layerListMutationAllowed); | 5664 ASSERT(m_layerListMutationAllowed); |
| 5636 ASSERT(isStackingContainer()); | 5665 ASSERT(isStackingContainer()); |
| 5637 | 5666 |
| 5638 if (m_posZOrderList) | 5667 if (m_posZOrderList) |
| 5639 m_posZOrderList->clear(); | 5668 m_posZOrderList->clear(); |
| 5640 if (m_negZOrderList) | 5669 if (m_negZOrderList) |
| 5641 m_negZOrderList->clear(); | 5670 m_negZOrderList->clear(); |
| 5642 m_zOrderListsDirty = true; | 5671 m_zOrderListsDirty = true; |
| 5643 | 5672 |
| 5644 m_descendantsAreContiguousInStackingOrderDirty = true; | 5673 m_canBePromotedToStackingContainerDirty = true; |
| 5645 | 5674 |
| 5646 if (!renderer()->documentBeingDestroyed()) { | 5675 if (!renderer()->documentBeingDestroyed()) { |
| 5647 compositor()->setNeedsUpdateCompositingRequirementsState(); | 5676 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 5648 compositor()->setCompositingLayersNeedRebuild(); | 5677 compositor()->setCompositingLayersNeedRebuild(); |
| 5649 if (acceleratedCompositingForOverflowScrollEnabled()) | 5678 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5650 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5679 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5651 } | 5680 } |
| 5652 } | 5681 } |
| 5653 | 5682 |
| 5654 void RenderLayer::dirtyStackingContainerZOrderLists() | 5683 void RenderLayer::dirtyStackingContainerZOrderLists() |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6464 } | 6493 } |
| 6465 } | 6494 } |
| 6466 | 6495 |
| 6467 void showLayerTree(const WebCore::RenderObject* renderer) | 6496 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6468 { | 6497 { |
| 6469 if (!renderer) | 6498 if (!renderer) |
| 6470 return; | 6499 return; |
| 6471 showLayerTree(renderer->enclosingLayer()); | 6500 showLayerTree(renderer->enclosingLayer()); |
| 6472 } | 6501 } |
| 6473 #endif | 6502 #endif |
| OLD | NEW |