| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 namespace blink { | 93 namespace blink { |
| 94 | 94 |
| 95 namespace { | 95 namespace { |
| 96 | 96 |
| 97 static CompositingQueryMode gCompositingQueryMode = | 97 static CompositingQueryMode gCompositingQueryMode = |
| 98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; | 98 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; |
| 99 | 99 |
| 100 struct SameSizeAsPaintLayer : DisplayItemClient { | 100 struct SameSizeAsPaintLayer : DisplayItemClient { |
| 101 int bitFields; | 101 int bitFields; |
| 102 void* pointers[9]; | 102 void* pointers[10]; |
| 103 LayoutUnit layoutUnits[4]; | 103 LayoutUnit layoutUnits[4]; |
| 104 IntSize size; | 104 IntSize size; |
| 105 Persistent<PaintLayerScrollableArea> scrollableArea; | 105 Persistent<PaintLayerScrollableArea> scrollableArea; |
| 106 struct { | 106 struct { |
| 107 IntRect rect; | 107 IntRect rect; |
| 108 void* pointers[2]; | 108 void* pointers[2]; |
| 109 } ancestorCompositingInputs; | 109 } ancestorCompositingInputs; |
| 110 struct { | 110 struct { |
| 111 IntSize size; | 111 IntSize size; |
| 112 void* pointer; | 112 void* pointer; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 , m_hasNonIsolatedDescendantWithBlendMode(false) | 165 , m_hasNonIsolatedDescendantWithBlendMode(false) |
| 166 , m_hasAncestorWithClipPath(false) | 166 , m_hasAncestorWithClipPath(false) |
| 167 , m_layoutObject(layoutObject) | 167 , m_layoutObject(layoutObject) |
| 168 , m_parent(0) | 168 , m_parent(0) |
| 169 , m_previous(0) | 169 , m_previous(0) |
| 170 , m_next(0) | 170 , m_next(0) |
| 171 , m_first(0) | 171 , m_first(0) |
| 172 , m_last(0) | 172 , m_last(0) |
| 173 , m_staticInlinePosition(0) | 173 , m_staticInlinePosition(0) |
| 174 , m_staticBlockPosition(0) | 174 , m_staticBlockPosition(0) |
| 175 , m_ancestorOverflowLayer(nullptr) |
| 175 { | 176 { |
| 176 updateStackingNode(); | 177 updateStackingNode(); |
| 177 | 178 |
| 178 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 179 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
| 179 | 180 |
| 180 if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 181 if (!layoutObject->slowFirstChild() && layoutObject->style()) { |
| 181 m_visibleContentStatusDirty = false; | 182 m_visibleContentStatusDirty = false; |
| 182 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; | 183 m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; |
| 183 } | 184 } |
| 184 | 185 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // in this case, there is no need to dirty our ancestors further. | 343 // in this case, there is no need to dirty our ancestors further. |
| 343 if (layer->isSelfPaintingLayer()) { | 344 if (layer->isSelfPaintingLayer()) { |
| 344 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); | 345 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); |
| 345 break; | 346 break; |
| 346 } | 347 } |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 | 350 |
| 350 bool PaintLayer::scrollsWithViewport() const | 351 bool PaintLayer::scrollsWithViewport() const |
| 351 { | 352 { |
| 352 return layoutObject()->style()->position() == FixedPosition && layoutObject(
)->containerForFixedPosition() == layoutObject()->view(); | 353 return (layoutObject()->style()->position() == FixedPosition && layoutObject
()->containerForFixedPosition() == layoutObject()->view()) |
| 354 || (layoutObject()->style()->position() == StickyPosition && !ancestorSc
rollingLayer()); |
| 353 } | 355 } |
| 354 | 356 |
| 355 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const | 357 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const |
| 356 { | 358 { |
| 357 if (scrollsWithViewport() != other->scrollsWithViewport()) | 359 if (scrollsWithViewport() != other->scrollsWithViewport()) |
| 358 return true; | 360 return true; |
| 359 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 361 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); |
| 360 } | 362 } |
| 361 | 363 |
| 362 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
lDelta) | 364 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
lDelta) |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 742 } |
| 741 | 743 |
| 742 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs | 744 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs |
| 743 // the m_has3DTransformedDescendant set. | 745 // the m_has3DTransformedDescendant set. |
| 744 if (preserves3D()) | 746 if (preserves3D()) |
| 745 return has3DTransform() || m_has3DTransformedDescendant; | 747 return has3DTransform() || m_has3DTransformedDescendant; |
| 746 | 748 |
| 747 return has3DTransform(); | 749 return has3DTransform(); |
| 748 } | 750 } |
| 749 | 751 |
| 750 bool PaintLayer::updateLayerPosition() | 752 void PaintLayer::updateLayerPosition() |
| 751 { | 753 { |
| 752 LayoutPoint localPoint; | 754 LayoutPoint localPoint; |
| 753 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. | 755 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. |
| 754 | 756 |
| 755 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 757 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
| 756 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 758 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); |
| 757 IntRect lineBox = inlineFlow->linesBoundingBox(); | 759 IntRect lineBox = inlineFlow->linesBoundingBox(); |
| 758 m_size = lineBox.size(); | 760 m_size = lineBox.size(); |
| 759 inlineBoundingBoxOffset = lineBox.location(); | 761 inlineBoundingBoxOffset = lineBox.location(); |
| 760 localPoint.moveBy(inlineBoundingBoxOffset); | 762 localPoint.moveBy(inlineBoundingBoxOffset); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 791 | 793 |
| 792 if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
ayer->layoutObject()->isLayoutInline()) { | 794 if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
ayer->layoutObject()->isLayoutInline()) { |
| 793 LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
>offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 795 LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
>offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); |
| 794 localPoint += offset; | 796 localPoint += offset; |
| 795 } | 797 } |
| 796 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | 798 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { |
| 797 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | 799 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); |
| 798 localPoint -= scrollOffset; | 800 localPoint -= scrollOffset; |
| 799 } | 801 } |
| 800 | 802 |
| 801 bool positionOrOffsetChanged = false; | |
| 802 if (layoutObject()->isInFlowPositioned()) { | 803 if (layoutObject()->isInFlowPositioned()) { |
| 803 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); | 804 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); |
| 804 positionOrOffsetChanged = newOffset != offsetForInFlowPosition(); | |
| 805 if (m_rareData || !newOffset.isZero()) | 805 if (m_rareData || !newOffset.isZero()) |
| 806 ensureRareData().offsetForInFlowPosition = newOffset; | 806 ensureRareData().offsetForInFlowPosition = newOffset; |
| 807 localPoint.move(newOffset); | 807 localPoint.move(newOffset); |
| 808 } else if (m_rareData) { | 808 } else if (m_rareData) { |
| 809 m_rareData->offsetForInFlowPosition = LayoutSize(); | 809 m_rareData->offsetForInFlowPosition = LayoutSize(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. | 812 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. |
| 813 localPoint.moveBy(-inlineBoundingBoxOffset); | 813 localPoint.moveBy(-inlineBoundingBoxOffset); |
| 814 | 814 |
| 815 if (m_location != localPoint) { | 815 if (m_location != localPoint) { |
| 816 positionOrOffsetChanged = true; | |
| 817 setNeedsRepaint(); | 816 setNeedsRepaint(); |
| 818 } | 817 } |
| 819 m_location = localPoint; | 818 m_location = localPoint; |
| 820 | 819 |
| 821 #if ENABLE(ASSERT) | 820 #if ENABLE(ASSERT) |
| 822 m_needsPositionUpdate = false; | 821 m_needsPositionUpdate = false; |
| 823 #endif | 822 #endif |
| 824 return positionOrOffsetChanged; | |
| 825 } | 823 } |
| 826 | 824 |
| 827 TransformationMatrix PaintLayer::perspectiveTransform() const | 825 TransformationMatrix PaintLayer::perspectiveTransform() const |
| 828 { | 826 { |
| 829 if (!layoutObject()->hasTransformRelatedProperty()) | 827 if (!layoutObject()->hasTransformRelatedProperty()) |
| 830 return TransformationMatrix(); | 828 return TransformationMatrix(); |
| 831 | 829 |
| 832 const ComputedStyle& style = layoutObject()->styleRef(); | 830 const ComputedStyle& style = layoutObject()->styleRef(); |
| 833 if (!style.hasPerspective()) | 831 if (!style.hasPerspective()) |
| 834 return TransformationMatrix(); | 832 return TransformationMatrix(); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 if (beforeChild) { | 1173 if (beforeChild) { |
| 1176 beforeChild->setPreviousSibling(child); | 1174 beforeChild->setPreviousSibling(child); |
| 1177 child->setNextSibling(beforeChild); | 1175 child->setNextSibling(beforeChild); |
| 1178 ASSERT(beforeChild != child); | 1176 ASSERT(beforeChild != child); |
| 1179 } else { | 1177 } else { |
| 1180 setLastChild(child); | 1178 setLastChild(child); |
| 1181 } | 1179 } |
| 1182 | 1180 |
| 1183 child->m_parent = this; | 1181 child->m_parent = this; |
| 1184 | 1182 |
| 1183 // The ancestor overflow layer is calculated during compositing inputs updat
e and should not be set yet. |
| 1184 ASSERT(!child->ancestorOverflowLayer()); |
| 1185 |
| 1185 setNeedsCompositingInputsUpdate(); | 1186 setNeedsCompositingInputsUpdate(); |
| 1186 | 1187 |
| 1187 if (!child->stackingNode()->isStacked() && !layoutObject()->documentBeingDes
troyed()) | 1188 if (!child->stackingNode()->isStacked() && !layoutObject()->documentBeingDes
troyed()) |
| 1188 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 1189 compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
| 1189 | 1190 |
| 1190 if (child->stackingNode()->isStacked() || child->firstChild()) { | 1191 if (child->stackingNode()->isStacked() || child->firstChild()) { |
| 1191 // Dirty the z-order list in which we are contained. The ancestorStackin
gContextNode() can be null in the | 1192 // Dirty the z-order list in which we are contained. The ancestorStackin
gContextNode() can be null in the |
| 1192 // case where we're building up generated content layers. This is ok, si
nce the lists will start | 1193 // case where we're building up generated content layers. This is ok, si
nce the lists will start |
| 1193 // off dirty in that case anyway. | 1194 // off dirty in that case anyway. |
| 1194 child->stackingNode()->dirtyStackingContextZOrderLists(); | 1195 child->stackingNode()->dirtyStackingContextZOrderLists(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); | 1230 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); |
| 1230 } | 1231 } |
| 1231 | 1232 |
| 1232 if (layoutObject()->style()->visibility() != VISIBLE) | 1233 if (layoutObject()->style()->visibility() != VISIBLE) |
| 1233 dirtyVisibleContentStatus(); | 1234 dirtyVisibleContentStatus(); |
| 1234 | 1235 |
| 1235 oldChild->setPreviousSibling(0); | 1236 oldChild->setPreviousSibling(0); |
| 1236 oldChild->setNextSibling(0); | 1237 oldChild->setNextSibling(0); |
| 1237 oldChild->m_parent = 0; | 1238 oldChild->m_parent = 0; |
| 1238 | 1239 |
| 1240 // Remove any ancestor overflow layers which descended into the removed chil
d. |
| 1241 if (oldChild->ancestorOverflowLayer()) |
| 1242 oldChild->removeAncestorOverflowLayer(oldChild->ancestorOverflowLayer())
; |
| 1243 |
| 1239 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1244 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1240 | 1245 |
| 1241 oldChild->updateDescendantDependentFlags(); | 1246 oldChild->updateDescendantDependentFlags(); |
| 1242 | 1247 |
| 1243 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1248 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
| 1244 dirtyAncestorChainVisibleDescendantStatus(); | 1249 dirtyAncestorChainVisibleDescendantStatus(); |
| 1245 | 1250 |
| 1246 if (oldChild->enclosingPaginationLayer()) | 1251 if (oldChild->enclosingPaginationLayer()) |
| 1247 oldChild->clearPaginationRecursive(); | 1252 oldChild->clearPaginationRecursive(); |
| 1248 | 1253 |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 } | 2684 } |
| 2680 | 2685 |
| 2681 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo() | 2686 PaintLayerFilterInfo& PaintLayer::ensureFilterInfo() |
| 2682 { | 2687 { |
| 2683 PaintLayerRareData& rareData = ensureRareData(); | 2688 PaintLayerRareData& rareData = ensureRareData(); |
| 2684 if (!rareData.filterInfo) | 2689 if (!rareData.filterInfo) |
| 2685 rareData.filterInfo = adoptPtr(new PaintLayerFilterInfo(this)); | 2690 rareData.filterInfo = adoptPtr(new PaintLayerFilterInfo(this)); |
| 2686 return *rareData.filterInfo; | 2691 return *rareData.filterInfo; |
| 2687 } | 2692 } |
| 2688 | 2693 |
| 2694 void PaintLayer::removeAncestorOverflowLayer(const PaintLayer* removedLayer) |
| 2695 { |
| 2696 // If the current ancestor overflow layer does not match the removed layer |
| 2697 // the ancestor overflow layer has changed so we can stop searching. |
| 2698 if (ancestorOverflowLayer() && ancestorOverflowLayer() != removedLayer) |
| 2699 return; |
| 2700 |
| 2701 if (ancestorOverflowLayer()) |
| 2702 ancestorOverflowLayer()->getScrollableArea()->invalidateStickyConstraint
sFor(this); |
| 2703 updateAncestorOverflowLayer(nullptr); |
| 2704 PaintLayer* current = m_first; |
| 2705 while (current) { |
| 2706 current->removeAncestorOverflowLayer(removedLayer); |
| 2707 current = current->nextSibling(); |
| 2708 } |
| 2709 } |
| 2710 |
| 2689 void PaintLayer::updateOrRemoveFilterClients() | 2711 void PaintLayer::updateOrRemoveFilterClients() |
| 2690 { | 2712 { |
| 2691 const auto& filter = layoutObject()->style()->filter(); | 2713 const auto& filter = layoutObject()->style()->filter(); |
| 2692 if (filter.isEmpty() && m_rareData) { | 2714 if (filter.isEmpty() && m_rareData) { |
| 2693 m_rareData->filterInfo = nullptr; | 2715 m_rareData->filterInfo = nullptr; |
| 2694 } else if (filter.hasReferenceFilter()) { | 2716 } else if (filter.hasReferenceFilter()) { |
| 2695 ensureFilterInfo().updateReferenceFilterClients(filter); | 2717 ensureFilterInfo().updateReferenceFilterClients(filter); |
| 2696 } else if (filterInfo()) { | 2718 } else if (filterInfo()) { |
| 2697 filterInfo()->clearFilterReferences(); | 2719 filterInfo()->clearFilterReferences(); |
| 2698 } | 2720 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 | 2929 |
| 2908 void showLayerTree(const blink::LayoutObject* layoutObject) | 2930 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2909 { | 2931 { |
| 2910 if (!layoutObject) { | 2932 if (!layoutObject) { |
| 2911 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2933 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2912 return; | 2934 return; |
| 2913 } | 2935 } |
| 2914 showLayerTree(layoutObject->enclosingLayer()); | 2936 showLayerTree(layoutObject->enclosingLayer()); |
| 2915 } | 2937 } |
| 2916 #endif | 2938 #endif |
| OLD | NEW |