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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 740 } |
741 curr = curr->parent(); | 741 curr = curr->parent(); |
742 } | 742 } |
743 if (curr->isBox() && curr->isTableRow()) { | 743 if (curr->isBox() && curr->isTableRow()) { |
744 // Put ourselves into the row coordinate space. | 744 // Put ourselves into the row coordinate space. |
745 localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation()); | 745 localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation()); |
746 } | 746 } |
747 } | 747 } |
748 | 748 |
749 // Subtract our parent's scroll offset. | 749 // Subtract our parent's scroll offset. |
750 if (PaintLayer* positionedParent = layoutObject()->isOutOfFlowPositioned() ?
enclosingPositionedAncestor() : nullptr) { | 750 if (PaintLayer* positionedParent = layoutObject()->isOutOfFlowPositioned() ?
enclosingPositionedOrContainedAncestor() : nullptr) { |
751 // For positioned layers, we subtract out the enclosing positioned layer
's scroll offset. | 751 // For positioned layers, we subtract out the enclosing positioned layer
's scroll offset. |
752 if (positionedParent->layoutObject()->hasOverflowClip()) { | 752 if (positionedParent->layoutObject()->hasOverflowClip()) { |
753 IntSize offset = positionedParent->layoutBox()->scrolledContentOffse
t(); | 753 IntSize offset = positionedParent->layoutBox()->scrolledContentOffse
t(); |
754 localPoint -= offset; | 754 localPoint -= offset; |
755 } | 755 } |
756 | 756 |
757 if (positionedParent->layoutObject()->isInFlowPositioned() && positioned
Parent->layoutObject()->isLayoutInline()) { | 757 if (positionedParent->layoutObject()->isInFlowPositioned() && positioned
Parent->layoutObject()->isLayoutInline()) { |
758 LayoutSize offset = toLayoutInline(positionedParent->layoutObject())
->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); | 758 LayoutSize offset = toLayoutInline(positionedParent->layoutObject())
->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); |
759 localPoint += offset; | 759 localPoint += offset; |
760 } | 760 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 const ComputedStyle& style = layoutObject()->styleRef(); | 811 const ComputedStyle& style = layoutObject()->styleRef(); |
812 | 812 |
813 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.
width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he
ight().toFloat())); | 813 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.
width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he
ight().toFloat())); |
814 } | 814 } |
815 | 815 |
816 static inline bool isFixedPositionedContainer(PaintLayer* layer) | 816 static inline bool isFixedPositionedContainer(PaintLayer* layer) |
817 { | 817 { |
818 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); | 818 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); |
819 } | 819 } |
820 | 820 |
821 PaintLayer* PaintLayer::enclosingPositionedAncestor(const PaintLayer* ancestor,
bool* skippedAncestor) const | 821 PaintLayer* PaintLayer::enclosingPositionedOrContainedAncestor(const PaintLayer*
ancestor, bool* skippedAncestor) const |
822 { | 822 { |
823 ASSERT(!ancestor || skippedAncestor); // If we have specified an ancestor, s
urely the caller needs to know whether we skipped it. | 823 ASSERT(!ancestor || skippedAncestor); // If we have specified an ancestor, s
urely the caller needs to know whether we skipped it. |
824 if (skippedAncestor) | 824 if (skippedAncestor) |
825 *skippedAncestor = false; | 825 *skippedAncestor = false; |
826 if (layoutObject()->style()->position() == FixedPosition) { | 826 if (layoutObject()->style()->position() == FixedPosition) { |
827 PaintLayer* curr = parent(); | 827 PaintLayer* curr = parent(); |
828 while (curr && !isFixedPositionedContainer(curr)) { | 828 while (curr && !isFixedPositionedContainer(curr)) { |
829 if (skippedAncestor && curr == ancestor) | 829 if (skippedAncestor && curr == ancestor) |
830 *skippedAncestor = true; | 830 *skippedAncestor = true; |
831 curr = curr->parent(); | 831 curr = curr->parent(); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling | 1265 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling |
1266 // localToAbsolute() on the LayoutView. | 1266 // localToAbsolute() on the LayoutView. |
1267 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed)
; | 1267 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed)
; |
1268 location += LayoutSize(absPos.x(), absPos.y()); | 1268 location += LayoutSize(absPos.x(), absPos.y()); |
1269 return ancestorLayer; | 1269 return ancestorLayer; |
1270 } | 1270 } |
1271 | 1271 |
1272 PaintLayer* parentLayer; | 1272 PaintLayer* parentLayer; |
1273 if (position == AbsolutePosition || position == FixedPosition) { | 1273 if (position == AbsolutePosition || position == FixedPosition) { |
1274 bool foundAncestorFirst; | 1274 bool foundAncestorFirst; |
1275 parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAn
cestorFirst); | 1275 parentLayer = layer->enclosingPositionedOrContainedAncestor(ancestorLaye
r, &foundAncestorFirst); |
1276 | 1276 |
1277 if (foundAncestorFirst) { | 1277 if (foundAncestorFirst) { |
1278 // Found ancestorLayer before the container of the out-of-flow objec
t, so compute offset | 1278 // Found ancestorLayer before the container of the out-of-flow objec
t, so compute offset |
1279 // of both relative to the container and subtract. | 1279 // of both relative to the container and subtract. |
1280 | 1280 |
1281 LayoutPoint thisCoords; | 1281 LayoutPoint thisCoords; |
1282 layer->convertToLayerCoords(parentLayer, thisCoords); | 1282 layer->convertToLayerCoords(parentLayer, thisCoords); |
1283 | 1283 |
1284 LayoutPoint ancestorCoords; | 1284 LayoutPoint ancestorCoords; |
1285 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); | 1285 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 if (m_stackingNode->zOrderListsDirty()) | 2351 if (m_stackingNode->zOrderListsDirty()) |
2352 return false; | 2352 return false; |
2353 | 2353 |
2354 // FIXME: We currently only check the immediate layoutObject, | 2354 // FIXME: We currently only check the immediate layoutObject, |
2355 // which will miss many cases. | 2355 // which will miss many cases. |
2356 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) | 2356 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) |
2357 return true; | 2357 return true; |
2358 | 2358 |
2359 // We can't consult child layers if we clip, since they might cover | 2359 // We can't consult child layers if we clip, since they might cover |
2360 // parts of the rect that are clipped out. | 2360 // parts of the rect that are clipped out. |
2361 if (layoutObject()->hasOverflowClip()) | 2361 if (layoutObject()->hasOverflowClip() || layoutObject()->style()->containsPa
int()) |
2362 return false; | 2362 return false; |
2363 | 2363 |
2364 return childBackgroundIsKnownToBeOpaqueInRect(localRect); | 2364 return childBackgroundIsKnownToBeOpaqueInRect(localRect); |
2365 } | 2365 } |
2366 | 2366 |
2367 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const | 2367 bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const |
2368 { | 2368 { |
2369 PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Posi
tiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); | 2369 PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, Posi
tiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren); |
2370 while (PaintLayerStackingNode* child = revertseIterator.next()) { | 2370 while (PaintLayerStackingNode* child = revertseIterator.next()) { |
2371 const PaintLayer* childLayer = child->layer(); | 2371 const PaintLayer* childLayer = child->layer(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 | 2780 |
2781 void showLayerTree(const blink::LayoutObject* layoutObject) | 2781 void showLayerTree(const blink::LayoutObject* layoutObject) |
2782 { | 2782 { |
2783 if (!layoutObject) { | 2783 if (!layoutObject) { |
2784 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2784 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2785 return; | 2785 return; |
2786 } | 2786 } |
2787 showLayerTree(layoutObject->enclosingLayer()); | 2787 showLayerTree(layoutObject->enclosingLayer()); |
2788 } | 2788 } |
2789 #endif | 2789 #endif |
OLD | NEW |