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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 PaintLayerRareData::~PaintLayerRareData() | 131 PaintLayerRareData::~PaintLayerRareData() |
132 { | 132 { |
133 } | 133 } |
134 | 134 |
135 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) | 135 PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) |
136 : m_hasSelfPaintingLayerDescendant(false) | 136 : m_hasSelfPaintingLayerDescendant(false) |
137 , m_hasSelfPaintingLayerDescendantDirty(false) | 137 , m_hasSelfPaintingLayerDescendantDirty(false) |
138 , m_isRootLayer(layoutObject->isLayoutView()) | 138 , m_isRootLayer(layoutObject->isLayoutView()) |
139 , m_visibleContentStatusDirty(true) | 139 , m_isVisibleContentDirty(true) |
140 , m_hasVisibleContent(false) | 140 , m_hasVisibleContent(false) |
141 , m_visibleDescendantStatusDirty(false) | 141 , m_isVisibleDescendantDirty(false) |
142 , m_hasVisibleDescendant(false) | 142 , m_hasVisibleDescendant(false) |
143 #if ENABLE(ASSERT) | 143 #if ENABLE(ASSERT) |
144 , m_needsPositionUpdate(true) | 144 , m_needsPositionUpdate(true) |
145 #endif | 145 #endif |
146 , m_3DTransformedDescendantStatusDirty(true) | 146 , m_is3DTransformedDescendantDirty(true) |
147 , m_has3DTransformedDescendant(false) | 147 , m_has3DTransformedDescendant(false) |
148 , m_containsDirtyOverlayScrollbars(false) | 148 , m_containsDirtyOverlayScrollbars(false) |
149 , m_needsAncestorDependentCompositingInputsUpdate(true) | 149 , m_needsAncestorDependentCompositingInputsUpdate(true) |
150 , m_needsDescendantDependentCompositingInputsUpdate(true) | 150 , m_needsDescendantDependentCompositingInputsUpdate(true) |
151 , m_childNeedsCompositingInputsUpdate(true) | 151 , m_childNeedsCompositingInputsUpdate(true) |
152 , m_hasCompositingDescendant(false) | 152 , m_hasCompositingDescendant(false) |
153 , m_isAllScrollingContentComposited(false) | 153 , m_isAllScrollingContentComposited(false) |
154 , m_shouldIsolateCompositedDescendants(false) | 154 , m_shouldIsolateCompositedDescendants(false) |
155 , m_lostGroupedMapping(false) | 155 , m_lostGroupedMapping(false) |
156 , m_needsRepaint(false) | 156 , m_needsRepaint(false) |
(...skipping 12 matching lines...) Expand all Loading... |
169 , m_last(0) | 169 , m_last(0) |
170 , m_staticInlinePosition(0) | 170 , m_staticInlinePosition(0) |
171 , m_staticBlockPosition(0) | 171 , m_staticBlockPosition(0) |
172 , m_ancestorOverflowLayer(nullptr) | 172 , m_ancestorOverflowLayer(nullptr) |
173 { | 173 { |
174 updateStackingNode(); | 174 updateStackingNode(); |
175 | 175 |
176 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 176 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
177 | 177 |
178 if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 178 if (!layoutObject->slowFirstChild() && layoutObject->style()) { |
179 m_visibleContentStatusDirty = false; | 179 m_isVisibleContentDirty = false; |
180 m_hasVisibleContent = layoutObject->style()->visibility() == EVisibility
::Visible; | 180 m_hasVisibleContent = layoutObject->style()->visibility() == EVisibility
::Visible; |
181 } | 181 } |
182 | 182 |
183 updateScrollableArea(); | 183 updateScrollableArea(); |
184 } | 184 } |
185 | 185 |
186 PaintLayer::~PaintLayer() | 186 PaintLayer::~PaintLayer() |
187 { | 187 { |
188 if (m_rareData && m_rareData->filterInfo) | 188 if (m_rareData && m_rareData->filterInfo) |
189 m_rareData->filterInfo->clearLayer(); | 189 m_rareData->filterInfo->clearLayer(); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. | 594 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. |
595 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. | 595 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. |
596 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, rec
t); | 596 layoutObject.mapToVisualRectInAncestorSpace(&paintInvalidationContainer, rec
t); |
597 | 597 |
598 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rec
t); | 598 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rec
t); |
599 } | 599 } |
600 | 600 |
601 void PaintLayer::dirtyVisibleContentStatus() | 601 void PaintLayer::dirtyVisibleContentStatus() |
602 { | 602 { |
603 compositor()->setNeedsUpdateDescendantDependentFlags(); | 603 compositor()->setNeedsUpdateDescendantDependentFlags(); |
604 m_visibleContentStatusDirty = true; | 604 m_isVisibleContentDirty = true; |
605 if (parent()) | 605 if (parent()) |
606 parent()->dirtyAncestorChainVisibleDescendantStatus(); | 606 parent()->dirtyAncestorChainVisibleDescendantStatus(); |
607 // Non-self-painting layers paint into their ancestor layer, and count as pa
rt of the "visible contents" of the parent, so we need to dirty it. | 607 // Non-self-painting layers paint into their ancestor layer, and count as pa
rt of the "visible contents" of the parent, so we need to dirty it. |
608 if (!isSelfPaintingLayer()) | 608 if (!isSelfPaintingLayer()) |
609 parent()->dirtyVisibleContentStatus(); | 609 parent()->dirtyVisibleContentStatus(); |
610 } | 610 } |
611 | 611 |
612 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) | 612 void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility) |
613 { | 613 { |
614 if (m_visibleContentStatusDirty) | 614 if (m_isVisibleContentDirty) |
615 return; | 615 return; |
616 if (hasVisibleContent() == (visibility == EVisibility::Visible)) | 616 if (hasVisibleContent() == (visibility == EVisibility::Visible)) |
617 return; | 617 return; |
618 dirtyVisibleContentStatus(); | 618 dirtyVisibleContentStatus(); |
619 } | 619 } |
620 | 620 |
621 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() | 621 void PaintLayer::dirtyAncestorChainVisibleDescendantStatus() |
622 { | 622 { |
623 compositor()->setNeedsUpdateDescendantDependentFlags(); | 623 compositor()->setNeedsUpdateDescendantDependentFlags(); |
624 | 624 |
625 for (PaintLayer* layer = this; layer; layer = layer->parent()) { | 625 for (PaintLayer* layer = this; layer; layer = layer->parent()) { |
626 if (layer->m_visibleDescendantStatusDirty) | 626 if (layer->m_isVisibleDescendantDirty) |
627 break; | 627 break; |
628 layer->m_visibleDescendantStatusDirty = true; | 628 layer->m_isVisibleDescendantDirty = true; |
629 } | 629 } |
630 } | 630 } |
631 | 631 |
632 // FIXME: this is quite brute-force. We could be more efficient if we were to | 632 // FIXME: this is quite brute-force. We could be more efficient if we were to |
633 // track state and update it as appropriate as changes are made in the layout tr
ee. | 633 // track state and update it as appropriate as changes are made in the layout tr
ee. |
634 void PaintLayer::updateScrollingStateAfterCompositingChange() | 634 void PaintLayer::updateScrollingStateAfterCompositingChange() |
635 { | 635 { |
636 TRACE_EVENT0("blink", "PaintLayer::updateScrollingStateAfterCompositingChang
e"); | 636 TRACE_EVENT0("blink", "PaintLayer::updateScrollingStateAfterCompositingChang
e"); |
637 m_isAllScrollingContentComposited = true; | 637 m_isAllScrollingContentComposited = true; |
638 for (LayoutObject* r = layoutObject()->slowFirstChild(); r; r = r->nextSibli
ng()) { | 638 for (LayoutObject* r = layoutObject()->slowFirstChild(); r; r = r->nextSibli
ng()) { |
(...skipping 11 matching lines...) Expand all Loading... |
650 // If the child is composited, but not a stacking context, it may pa
int | 650 // If the child is composited, but not a stacking context, it may pa
int |
651 // negative z-index descendants into an ancestor's GraphicsLayer. | 651 // negative z-index descendants into an ancestor's GraphicsLayer. |
652 m_isAllScrollingContentComposited = false; | 652 m_isAllScrollingContentComposited = false; |
653 return; | 653 return; |
654 } | 654 } |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
658 void PaintLayer::updateDescendantDependentFlags() | 658 void PaintLayer::updateDescendantDependentFlags() |
659 { | 659 { |
660 if (m_visibleDescendantStatusDirty) { | 660 if (m_isVisibleDescendantDirty) { |
661 m_hasVisibleDescendant = false; | 661 m_hasVisibleDescendant = false; |
662 | 662 |
663 for (PaintLayer* child = firstChild(); child; child = child->nextSibling
()) { | 663 for (PaintLayer* child = firstChild(); child; child = child->nextSibling
()) { |
664 child->updateDescendantDependentFlags(); | 664 child->updateDescendantDependentFlags(); |
665 | 665 |
666 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) { | 666 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) { |
667 m_hasVisibleDescendant = true; | 667 m_hasVisibleDescendant = true; |
668 break; | 668 break; |
669 } | 669 } |
670 } | 670 } |
671 | 671 |
672 m_visibleDescendantStatusDirty = false; | 672 m_isVisibleDescendantDirty = false; |
673 } | 673 } |
674 | 674 |
675 if (m_visibleContentStatusDirty) { | 675 if (m_isVisibleContentDirty) { |
676 bool previouslyHasVisibleContent = m_hasVisibleContent; | 676 bool previouslyHasVisibleContent = m_hasVisibleContent; |
677 if (layoutObject()->style()->visibility() == EVisibility::Visible) { | 677 if (layoutObject()->style()->visibility() == EVisibility::Visible) { |
678 m_hasVisibleContent = true; | 678 m_hasVisibleContent = true; |
679 } else { | 679 } else { |
680 // layer may be hidden but still have some visible content, check fo
r this | 680 // layer may be hidden but still have some visible content, check fo
r this |
681 m_hasVisibleContent = false; | 681 m_hasVisibleContent = false; |
682 LayoutObject* r = layoutObject()->slowFirstChild(); | 682 LayoutObject* r = layoutObject()->slowFirstChild(); |
683 while (r) { | 683 while (r) { |
684 if (r->style()->visibility() == EVisibility::Visible && (!r->has
Layer() || !r->enclosingLayer()->isSelfPaintingLayer())) { | 684 if (r->style()->visibility() == EVisibility::Visible && (!r->has
Layer() || !r->enclosingLayer()->isSelfPaintingLayer())) { |
685 m_hasVisibleContent = true; | 685 m_hasVisibleContent = true; |
686 break; | 686 break; |
687 } | 687 } |
688 LayoutObject* layoutObjectFirstChild = r->slowFirstChild(); | 688 LayoutObject* layoutObjectFirstChild = r->slowFirstChild(); |
689 if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLa
yer()->isSelfPaintingLayer())) { | 689 if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLa
yer()->isSelfPaintingLayer())) { |
690 r = layoutObjectFirstChild; | 690 r = layoutObjectFirstChild; |
691 } else if (r->nextSibling()) { | 691 } else if (r->nextSibling()) { |
692 r = r->nextSibling(); | 692 r = r->nextSibling(); |
693 } else { | 693 } else { |
694 do { | 694 do { |
695 r = r->parent(); | 695 r = r->parent(); |
696 if (r == layoutObject()) | 696 if (r == layoutObject()) |
697 r = 0; | 697 r = 0; |
698 } while (r && !r->nextSibling()); | 698 } while (r && !r->nextSibling()); |
699 if (r) | 699 if (r) |
700 r = r->nextSibling(); | 700 r = r->nextSibling(); |
701 } | 701 } |
702 } | 702 } |
703 } | 703 } |
704 m_visibleContentStatusDirty = false; | 704 m_isVisibleContentDirty = false; |
705 | 705 |
706 if (hasVisibleContent() != previouslyHasVisibleContent) { | 706 if (hasVisibleContent() != previouslyHasVisibleContent) { |
707 setNeedsCompositingInputsUpdate(); | 707 setNeedsCompositingInputsUpdate(); |
708 // We need to tell m_layoutObject to recheck its rect because we | 708 // We need to tell m_layoutObject to recheck its rect because we |
709 // pretend that invisible LayoutObjects have 0x0 rects. Changing | 709 // pretend that invisible LayoutObjects have 0x0 rects. Changing |
710 // visibility therefore changes our rect and we need to visit | 710 // visibility therefore changes our rect and we need to visit |
711 // this LayoutObject during the invalidateTreeIfNeeded walk. | 711 // this LayoutObject during the invalidateTreeIfNeeded walk. |
712 m_layoutObject->setMayNeedPaintInvalidation(); | 712 m_layoutObject->setMayNeedPaintInvalidation(); |
713 } | 713 } |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 void PaintLayer::dirty3DTransformedDescendantStatus() | 717 void PaintLayer::dirty3DTransformedDescendantStatus() |
718 { | 718 { |
719 PaintLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingConte
xtNode(); | 719 PaintLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingConte
xtNode(); |
720 if (!stackingNode) | 720 if (!stackingNode) |
721 return; | 721 return; |
722 | 722 |
723 stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true; | 723 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; |
724 | 724 |
725 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. | 725 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. |
726 // Note that preserves3D() creates stacking context, so we can just run up t
he stacking containers. | 726 // Note that preserves3D() creates stacking context, so we can just run up t
he stacking containers. |
727 while (stackingNode && stackingNode->layer()->preserves3D()) { | 727 while (stackingNode && stackingNode->layer()->preserves3D()) { |
728 stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true; | 728 stackingNode->layer()->m_is3DTransformedDescendantDirty = true; |
729 stackingNode = stackingNode->ancestorStackingContextNode(); | 729 stackingNode = stackingNode->ancestorStackingContextNode(); |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
733 // Return true if this layer or any preserve-3d descendants have 3d. | 733 // Return true if this layer or any preserve-3d descendants have 3d. |
734 bool PaintLayer::update3DTransformedDescendantStatus() | 734 bool PaintLayer::update3DTransformedDescendantStatus() |
735 { | 735 { |
736 if (m_3DTransformedDescendantStatusDirty) { | 736 if (m_is3DTransformedDescendantDirty) { |
737 m_has3DTransformedDescendant = false; | 737 m_has3DTransformedDescendant = false; |
738 | 738 |
739 m_stackingNode->updateZOrderLists(); | 739 m_stackingNode->updateZOrderLists(); |
740 | 740 |
741 // Transformed or preserve-3d descendants can only be in the z-order lis
ts, not | 741 // Transformed or preserve-3d descendants can only be in the z-order lis
ts, not |
742 // in the normal flow list, so we only need to check those. | 742 // in the normal flow list, so we only need to check those. |
743 PaintLayerStackingNodeIterator iterator(*m_stackingNode.get(), PositiveZ
OrderChildren | NegativeZOrderChildren); | 743 PaintLayerStackingNodeIterator iterator(*m_stackingNode.get(), PositiveZ
OrderChildren | NegativeZOrderChildren); |
744 while (PaintLayerStackingNode* node = iterator.next()) | 744 while (PaintLayerStackingNode* node = iterator.next()) |
745 m_has3DTransformedDescendant |= node->layer()->update3DTransformedDe
scendantStatus(); | 745 m_has3DTransformedDescendant |= node->layer()->update3DTransformedDe
scendantStatus(); |
746 | 746 |
747 m_3DTransformedDescendantStatusDirty = false; | 747 m_is3DTransformedDescendantDirty = false; |
748 } | 748 } |
749 | 749 |
750 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs | 750 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs |
751 // the m_has3DTransformedDescendant set. | 751 // the m_has3DTransformedDescendant set. |
752 if (preserves3D()) | 752 if (preserves3D()) |
753 return has3DTransform() || m_has3DTransformedDescendant; | 753 return has3DTransform() || m_has3DTransformedDescendant; |
754 | 754 |
755 return has3DTransform(); | 755 return has3DTransform(); |
756 } | 756 } |
757 | 757 |
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2948 | 2948 |
2949 void showLayerTree(const blink::LayoutObject* layoutObject) | 2949 void showLayerTree(const blink::LayoutObject* layoutObject) |
2950 { | 2950 { |
2951 if (!layoutObject) { | 2951 if (!layoutObject) { |
2952 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2952 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2953 return; | 2953 return; |
2954 } | 2954 } |
2955 showLayerTree(layoutObject->enclosingLayer()); | 2955 showLayerTree(layoutObject->enclosingLayer()); |
2956 } | 2956 } |
2957 #endif | 2957 #endif |
OLD | NEW |