| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // in this case, there is no need to dirty our ancestors further. | 315 // in this case, there is no need to dirty our ancestors further. |
| 316 if (layer->isSelfPaintingLayer()) { | 316 if (layer->isSelfPaintingLayer()) { |
| 317 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); | 317 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); |
| 318 break; | 318 break; |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 bool PaintLayer::scrollsWithViewport() const | 323 bool PaintLayer::scrollsWithViewport() const |
| 324 { | 324 { |
| 325 return layoutObject()->style()->position() == FixedPosition && layoutObject(
)->containerForFixedPosition() == layoutObject()->view(); | 325 return (layoutObject()->style()->position() == FixedPosition && layoutObject
()->containerForFixedPosition() == layoutObject()->view()) |
| 326 || (layoutObject()->style()->position() == StickyPosition && !ancestorSc
rollingLayer()); |
| 326 } | 327 } |
| 327 | 328 |
| 328 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const | 329 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const |
| 329 { | 330 { |
| 330 if (scrollsWithViewport() != other->scrollsWithViewport()) | 331 if (scrollsWithViewport() != other->scrollsWithViewport()) |
| 331 return true; | 332 return true; |
| 332 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 333 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
lDelta) | 336 void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrol
lDelta) |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 } | 714 } |
| 714 | 715 |
| 715 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs | 716 // If we live in a 3d hierarchy, then the layer at the root of that hierarch
y needs |
| 716 // the m_has3DTransformedDescendant set. | 717 // the m_has3DTransformedDescendant set. |
| 717 if (preserves3D()) | 718 if (preserves3D()) |
| 718 return has3DTransform() || m_has3DTransformedDescendant; | 719 return has3DTransform() || m_has3DTransformedDescendant; |
| 719 | 720 |
| 720 return has3DTransform(); | 721 return has3DTransform(); |
| 721 } | 722 } |
| 722 | 723 |
| 723 bool PaintLayer::updateLayerPosition() | 724 void PaintLayer::updateLayerPosition() |
| 724 { | 725 { |
| 725 LayoutPoint localPoint; | 726 LayoutPoint localPoint; |
| 726 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. | 727 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. |
| 727 | 728 |
| 728 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 729 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
| 729 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 730 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); |
| 730 IntRect lineBox = inlineFlow->linesBoundingBox(); | 731 IntRect lineBox = inlineFlow->linesBoundingBox(); |
| 731 m_size = lineBox.size(); | 732 m_size = lineBox.size(); |
| 732 inlineBoundingBoxOffset = lineBox.location(); | 733 inlineBoundingBoxOffset = lineBox.location(); |
| 733 localPoint.moveBy(inlineBoundingBoxOffset); | 734 localPoint.moveBy(inlineBoundingBoxOffset); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 764 | 765 |
| 765 if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
ayer->layoutObject()->isLayoutInline()) { | 766 if (containingLayer->layoutObject()->isInFlowPositioned() && containingL
ayer->layoutObject()->isLayoutInline()) { |
| 766 LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
>offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 767 LayoutSize offset = toLayoutInline(containingLayer->layoutObject())-
>offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); |
| 767 localPoint += offset; | 768 localPoint += offset; |
| 768 } | 769 } |
| 769 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | 770 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { |
| 770 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | 771 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(); |
| 771 localPoint -= scrollOffset; | 772 localPoint -= scrollOffset; |
| 772 } | 773 } |
| 773 | 774 |
| 774 bool positionOrOffsetChanged = false; | |
| 775 if (layoutObject()->isInFlowPositioned()) { | 775 if (layoutObject()->isInFlowPositioned()) { |
| 776 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); | 776 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); |
| 777 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; | |
| 778 m_offsetForInFlowPosition = newOffset; | 777 m_offsetForInFlowPosition = newOffset; |
| 779 localPoint.move(m_offsetForInFlowPosition); | 778 localPoint.move(m_offsetForInFlowPosition); |
| 780 } else { | 779 } else { |
| 781 m_offsetForInFlowPosition = LayoutSize(); | 780 m_offsetForInFlowPosition = LayoutSize(); |
| 782 } | 781 } |
| 783 | 782 |
| 784 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. | 783 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the layoutObjects. |
| 785 localPoint.moveBy(-inlineBoundingBoxOffset); | 784 localPoint.moveBy(-inlineBoundingBoxOffset); |
| 786 | 785 |
| 787 if (m_location != localPoint) { | 786 if (m_location != localPoint) { |
| 788 positionOrOffsetChanged = true; | |
| 789 setNeedsRepaint(); | 787 setNeedsRepaint(); |
| 790 } | 788 } |
| 791 m_location = localPoint; | 789 m_location = localPoint; |
| 792 | 790 |
| 793 #if ENABLE(ASSERT) | 791 #if ENABLE(ASSERT) |
| 794 m_needsPositionUpdate = false; | 792 m_needsPositionUpdate = false; |
| 795 #endif | 793 #endif |
| 796 return positionOrOffsetChanged; | |
| 797 } | 794 } |
| 798 | 795 |
| 799 TransformationMatrix PaintLayer::perspectiveTransform() const | 796 TransformationMatrix PaintLayer::perspectiveTransform() const |
| 800 { | 797 { |
| 801 if (!layoutObject()->hasTransformRelatedProperty()) | 798 if (!layoutObject()->hasTransformRelatedProperty()) |
| 802 return TransformationMatrix(); | 799 return TransformationMatrix(); |
| 803 | 800 |
| 804 const ComputedStyle& style = layoutObject()->styleRef(); | 801 const ComputedStyle& style = layoutObject()->styleRef(); |
| 805 if (!style.hasPerspective()) | 802 if (!style.hasPerspective()) |
| 806 return TransformationMatrix(); | 803 return TransformationMatrix(); |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 | 2829 |
| 2833 void showLayerTree(const blink::LayoutObject* layoutObject) | 2830 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2834 { | 2831 { |
| 2835 if (!layoutObject) { | 2832 if (!layoutObject) { |
| 2836 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2833 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2837 return; | 2834 return; |
| 2838 } | 2835 } |
| 2839 showLayerTree(layoutObject->enclosingLayer()); | 2836 showLayerTree(layoutObject->enclosingLayer()); |
| 2840 } | 2837 } |
| 2841 #endif | 2838 #endif |
| OLD | NEW |