| 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     OwnPtrWillBePersistent<PaintLayerScrollableArea> scrollableArea; | 105     OwnPtrWillBePersistent<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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 166     , m_hasNonIsolatedDescendantWithBlendMode(false) | 166     , m_hasNonIsolatedDescendantWithBlendMode(false) | 
| 167     , m_hasAncestorWithClipPath(false) | 167     , m_hasAncestorWithClipPath(false) | 
| 168     , m_layoutObject(layoutObject) | 168     , m_layoutObject(layoutObject) | 
| 169     , m_parent(0) | 169     , m_parent(0) | 
| 170     , m_previous(0) | 170     , m_previous(0) | 
| 171     , m_next(0) | 171     , m_next(0) | 
| 172     , m_first(0) | 172     , m_first(0) | 
| 173     , m_last(0) | 173     , m_last(0) | 
| 174     , m_staticInlinePosition(0) | 174     , m_staticInlinePosition(0) | 
| 175     , m_staticBlockPosition(0) | 175     , m_staticBlockPosition(0) | 
|  | 176     , m_ancestorOverflowLayer(nullptr) | 
| 176 { | 177 { | 
| 177     updateStackingNode(); | 178     updateStackingNode(); | 
| 178 | 179 | 
| 179     m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 180     m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 
| 180 | 181 | 
| 181     if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 182     if (!layoutObject->slowFirstChild() && layoutObject->style()) { | 
| 182         m_visibleContentStatusDirty = false; | 183         m_visibleContentStatusDirty = false; | 
| 183         m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; | 184         m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE; | 
| 184     } | 185     } | 
| 185 | 186 | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 345         // in this case, there is no need to dirty our ancestors further. | 346         // in this case, there is no need to dirty our ancestors further. | 
| 346         if (layer->isSelfPaintingLayer()) { | 347         if (layer->isSelfPaintingLayer()) { | 
| 347             ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty 
      || parent()->m_hasSelfPaintingLayerDescendant); | 348             ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty 
      || parent()->m_hasSelfPaintingLayerDescendant); | 
| 348             break; | 349             break; | 
| 349         } | 350         } | 
| 350     } | 351     } | 
| 351 } | 352 } | 
| 352 | 353 | 
| 353 bool PaintLayer::scrollsWithViewport() const | 354 bool PaintLayer::scrollsWithViewport() const | 
| 354 { | 355 { | 
| 355     return layoutObject()->style()->position() == FixedPosition && layoutObject(
      )->containerForFixedPosition() == layoutObject()->view(); | 356     return (layoutObject()->style()->position() == FixedPosition && layoutObject
      ()->containerForFixedPosition() == layoutObject()->view()) | 
|  | 357         || (layoutObject()->style()->position() == StickyPosition && !ancestorSc
      rollingLayer()); | 
| 356 } | 358 } | 
| 357 | 359 | 
| 358 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const | 360 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const | 
| 359 { | 361 { | 
| 360     if (scrollsWithViewport() != other->scrollsWithViewport()) | 362     if (scrollsWithViewport() != other->scrollsWithViewport()) | 
| 361         return true; | 363         return true; | 
| 362     return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 364     return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 
| 363 } | 365 } | 
| 364 | 366 | 
| 365 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
      lDelta) | 367 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
      lDelta) | 
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 743     } | 745     } | 
| 744 | 746 | 
| 745     // If we live in a 3d hierarchy, then the layer at the root of that hierarch
      y needs | 747     // If we live in a 3d hierarchy, then the layer at the root of that hierarch
      y needs | 
| 746     // the m_has3DTransformedDescendant set. | 748     // the m_has3DTransformedDescendant set. | 
| 747     if (preserves3D()) | 749     if (preserves3D()) | 
| 748         return has3DTransform() || m_has3DTransformedDescendant; | 750         return has3DTransform() || m_has3DTransformedDescendant; | 
| 749 | 751 | 
| 750     return has3DTransform(); | 752     return has3DTransform(); | 
| 751 } | 753 } | 
| 752 | 754 | 
| 753 bool PaintLayer::updateLayerPosition() | 755 void PaintLayer::updateLayerPosition() | 
| 754 { | 756 { | 
| 755     LayoutPoint localPoint; | 757     LayoutPoint localPoint; | 
| 756     LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
       for inlines, so we need to subtract it out when done. | 758     LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
       for inlines, so we need to subtract it out when done. | 
| 757 | 759 | 
| 758     if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 760     if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 
| 759         LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 761         LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 
| 760         IntRect lineBox = inlineFlow->linesBoundingBox(); | 762         IntRect lineBox = inlineFlow->linesBoundingBox(); | 
| 761         m_size = lineBox.size(); | 763         m_size = lineBox.size(); | 
| 762         inlineBoundingBoxOffset = lineBox.location(); | 764         inlineBoundingBoxOffset = lineBox.location(); | 
| 763         localPoint.moveBy(inlineBoundingBoxOffset); | 765         localPoint.moveBy(inlineBoundingBoxOffset); | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 794 | 796 | 
| 795         if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
      ayer->layoutObject()->isLayoutInline()) { | 797         if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
      ayer->layoutObject()->isLayoutInline()) { | 
| 796             LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
      >offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 798             LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
      >offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 
| 797             localPoint += offset; | 799             localPoint += offset; | 
| 798         } | 800         } | 
| 799     } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | 801     } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | 
| 800         IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | 802         IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | 
| 801         localPoint -= scrollOffset; | 803         localPoint -= scrollOffset; | 
| 802     } | 804     } | 
| 803 | 805 | 
| 804     bool positionOrOffsetChanged = false; |  | 
| 805     if (layoutObject()->isInFlowPositioned()) { | 806     if (layoutObject()->isInFlowPositioned()) { | 
| 806         LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); | 807         LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); | 
| 807         positionOrOffsetChanged = newOffset != offsetForInFlowPosition(); |  | 
| 808         if (m_rareData || !newOffset.isZero()) | 808         if (m_rareData || !newOffset.isZero()) | 
| 809             ensureRareData().offsetForInFlowPosition = newOffset; | 809             ensureRareData().offsetForInFlowPosition = newOffset; | 
| 810         localPoint.move(newOffset); | 810         localPoint.move(newOffset); | 
| 811     } else if (m_rareData) { | 811     } else if (m_rareData) { | 
| 812         m_rareData->offsetForInFlowPosition = LayoutSize(); | 812         m_rareData->offsetForInFlowPosition = LayoutSize(); | 
| 813     } | 813     } | 
| 814 | 814 | 
| 815     // FIXME: We'd really like to just get rid of the concept of a layer rectang
      le and rely on the layoutObjects. | 815     // FIXME: We'd really like to just get rid of the concept of a layer rectang
      le and rely on the layoutObjects. | 
| 816     localPoint.moveBy(-inlineBoundingBoxOffset); | 816     localPoint.moveBy(-inlineBoundingBoxOffset); | 
| 817 | 817 | 
| 818     if (m_location != localPoint) { | 818     if (m_location != localPoint) { | 
| 819         positionOrOffsetChanged = true; |  | 
| 820         setNeedsRepaint(); | 819         setNeedsRepaint(); | 
| 821     } | 820     } | 
| 822     m_location = localPoint; | 821     m_location = localPoint; | 
| 823 | 822 | 
| 824 #if ENABLE(ASSERT) | 823 #if ENABLE(ASSERT) | 
| 825     m_needsPositionUpdate = false; | 824     m_needsPositionUpdate = false; | 
| 826 #endif | 825 #endif | 
| 827     return positionOrOffsetChanged; |  | 
| 828 } | 826 } | 
| 829 | 827 | 
| 830 TransformationMatrix PaintLayer::perspectiveTransform() const | 828 TransformationMatrix PaintLayer::perspectiveTransform() const | 
| 831 { | 829 { | 
| 832     if (!layoutObject()->hasTransformRelatedProperty()) | 830     if (!layoutObject()->hasTransformRelatedProperty()) | 
| 833         return TransformationMatrix(); | 831         return TransformationMatrix(); | 
| 834 | 832 | 
| 835     const ComputedStyle& style = layoutObject()->styleRef(); | 833     const ComputedStyle& style = layoutObject()->styleRef(); | 
| 836     if (!style.hasPerspective()) | 834     if (!style.hasPerspective()) | 
| 837         return TransformationMatrix(); | 835         return TransformationMatrix(); | 
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1180     if (beforeChild) { | 1178     if (beforeChild) { | 
| 1181         beforeChild->setPreviousSibling(child); | 1179         beforeChild->setPreviousSibling(child); | 
| 1182         child->setNextSibling(beforeChild); | 1180         child->setNextSibling(beforeChild); | 
| 1183         ASSERT(beforeChild != child); | 1181         ASSERT(beforeChild != child); | 
| 1184     } else { | 1182     } else { | 
| 1185         setLastChild(child); | 1183         setLastChild(child); | 
| 1186     } | 1184     } | 
| 1187 | 1185 | 
| 1188     child->m_parent = this; | 1186     child->m_parent = this; | 
| 1189 | 1187 | 
|  | 1188     // The ancestor overflow layer is calculated during compositing inputs updat
      e and should not be set yet. | 
|  | 1189     ASSERT(!child->ancestorOverflowLayer()); | 
|  | 1190 | 
| 1190     setNeedsCompositingInputsUpdate(); | 1191     setNeedsCompositingInputsUpdate(); | 
| 1191 | 1192 | 
| 1192     if (!child->stackingNode()->isStacked() && !layoutObject()->documentBeingDes
      troyed()) | 1193     if (!child->stackingNode()->isStacked() && !layoutObject()->documentBeingDes
      troyed()) | 
| 1193         compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 1194         compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 
| 1194 | 1195 | 
| 1195     if (child->stackingNode()->isStacked() || child->firstChild()) { | 1196     if (child->stackingNode()->isStacked() || child->firstChild()) { | 
| 1196         // Dirty the z-order list in which we are contained. The ancestorStackin
      gContextNode() can be null in the | 1197         // Dirty the z-order list in which we are contained. The ancestorStackin
      gContextNode() can be null in the | 
| 1197         // case where we're building up generated content layers. This is ok, si
      nce the lists will start | 1198         // case where we're building up generated content layers. This is ok, si
      nce the lists will start | 
| 1198         // off dirty in that case anyway. | 1199         // off dirty in that case anyway. | 
| 1199         child->stackingNode()->dirtyStackingContextZOrderLists(); | 1200         child->stackingNode()->dirtyStackingContextZOrderLists(); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1233         // |stackingContext| value. | 1234         // |stackingContext| value. | 
| 1234         oldChild->stackingNode()->dirtyStackingContextZOrderLists(); | 1235         oldChild->stackingNode()->dirtyStackingContextZOrderLists(); | 
| 1235     } | 1236     } | 
| 1236 | 1237 | 
| 1237     if (layoutObject()->style()->visibility() != VISIBLE) | 1238     if (layoutObject()->style()->visibility() != VISIBLE) | 
| 1238         dirtyVisibleContentStatus(); | 1239         dirtyVisibleContentStatus(); | 
| 1239 | 1240 | 
| 1240     oldChild->setPreviousSibling(0); | 1241     oldChild->setPreviousSibling(0); | 
| 1241     oldChild->setNextSibling(0); | 1242     oldChild->setNextSibling(0); | 
| 1242     oldChild->m_parent = 0; | 1243     oldChild->m_parent = 0; | 
|  | 1244     if (oldChild->ancestorOverflowLayer()) | 
|  | 1245         oldChild->ancestorOverflowLayer()->getScrollableArea()->invalidateSticky
      ConstraintsFor(oldChild); | 
|  | 1246     oldChild->updateAncestorOverflowLayer(nullptr); | 
| 1243 | 1247 | 
| 1244     dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1248     dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 
| 1245 | 1249 | 
| 1246     oldChild->updateDescendantDependentFlags(); | 1250     oldChild->updateDescendantDependentFlags(); | 
| 1247 | 1251 | 
| 1248     if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1252     if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 
| 1249         dirtyAncestorChainVisibleDescendantStatus(); | 1253         dirtyAncestorChainVisibleDescendantStatus(); | 
| 1250 | 1254 | 
| 1251     if (oldChild->enclosingPaginationLayer()) | 1255     if (oldChild->enclosingPaginationLayer()) | 
| 1252         oldChild->clearPaginationRecursive(); | 1256         oldChild->clearPaginationRecursive(); | 
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2814 | 2818 | 
| 2815 void showLayerTree(const blink::LayoutObject* layoutObject) | 2819 void showLayerTree(const blink::LayoutObject* layoutObject) | 
| 2816 { | 2820 { | 
| 2817     if (!layoutObject) { | 2821     if (!layoutObject) { | 
| 2818         fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2822         fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 
| 2819         return; | 2823         return; | 
| 2820     } | 2824     } | 
| 2821     showLayerTree(layoutObject->enclosingLayer()); | 2825     showLayerTree(layoutObject->enclosingLayer()); | 
| 2822 } | 2826 } | 
| 2823 #endif | 2827 #endif | 
| OLD | NEW | 
|---|