OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 951 } |
952 | 952 |
953 IntSize LayoutBox::scrolledContentOffset() const | 953 IntSize LayoutBox::scrolledContentOffset() const |
954 { | 954 { |
955 ASSERT(hasOverflowClip()); | 955 ASSERT(hasOverflowClip()); |
956 ASSERT(hasLayer()); | 956 ASSERT(hasLayer()); |
957 // FIXME: Return DoubleSize here. crbug.com/414283. | 957 // FIXME: Return DoubleSize here. crbug.com/414283. |
958 return flooredIntSize(getScrollableArea()->scrollOffset()); | 958 return flooredIntSize(getScrollableArea()->scrollOffset()); |
959 } | 959 } |
960 | 960 |
961 void LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect) const | 961 bool LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect, ApplyOverfl
owClipFlag applyOverflowClip, VisualRectFlags visualRectFlags) const |
962 { | 962 { |
963 ASSERT(hasLayer()); | 963 if (!hasOverflowClip()) |
964 ASSERT(hasOverflowClip()); | 964 return true; |
965 | 965 |
966 LayoutSize offset = LayoutSize(-scrolledContentOffset()); | 966 LayoutSize offset = LayoutSize(-scrolledContentOffset()); |
967 if (UNLIKELY(hasFlippedBlocksWritingMode())) | 967 if (UNLIKELY(hasFlippedBlocksWritingMode())) |
968 offset.setWidth(-offset.width()); | 968 offset.setWidth(-offset.width()); |
969 rect.move(offset); | 969 rect.move(offset); |
970 } | |
971 | 970 |
972 bool LayoutBox::applyOverflowClip(LayoutRect& rect, VisualRectFlags visualRectFl
ags) const | 971 if (applyOverflowClip == ApplyNonScrollOverflowClip && scrollsOverflow()) |
973 { | 972 return true; |
974 ASSERT(hasLayer()); | |
975 ASSERT(hasOverflowClip()); | |
976 | 973 |
977 flipForWritingMode(rect); | 974 flipForWritingMode(rect); |
978 | 975 |
979 LayoutRect clipRect = overflowClipRect(LayoutPoint()); | 976 LayoutRect clipRect = overflowClipRect(LayoutPoint()); |
980 | 977 |
981 bool doesIntersect; | 978 bool doesIntersect; |
982 if (visualRectFlags & EdgeInclusive) { | 979 if (visualRectFlags & EdgeInclusive) { |
983 doesIntersect = rect.inclusiveIntersect(clipRect); | 980 doesIntersect = rect.inclusiveIntersect(clipRect); |
984 } else { | 981 } else { |
985 rect.intersect(clipRect); | 982 rect.intersect(clipRect); |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 // Apply the relative position offset when invalidating a rectangle. Th
e layer | 1976 // Apply the relative position offset when invalidating a rectangle. Th
e layer |
1980 // is translated, but the layout box isn't, so we need to do this to get
the | 1977 // is translated, but the layout box isn't, so we need to do this to get
the |
1981 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position | 1978 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position |
1982 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). | 1979 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). |
1983 topLeft += layer()->offsetForInFlowPosition(); | 1980 topLeft += layer()->offsetForInFlowPosition(); |
1984 } | 1981 } |
1985 | 1982 |
1986 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1983 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1987 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1984 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1988 rect.setLocation(topLeft); | 1985 rect.setLocation(topLeft); |
1989 if (container->hasOverflowClip()) { | 1986 |
1990 LayoutBox* containerBox = toLayoutBox(container); | 1987 if (container->isBox() && !toLayoutBox(container)->mapScrollingContentsRectT
oBoxSpace(rect, container == ancestor ? ApplyNonScrollOverflowClip : ApplyOverfl
owClip, visualRectFlags)) |
1991 containerBox->mapScrollingContentsRectToBoxSpace(rect); | 1988 return false; |
1992 if (container != ancestor && !containerBox->applyOverflowClip(rect, visu
alRectFlags)) | |
1993 return false; | |
1994 } | |
1995 | 1989 |
1996 if (ancestorSkipped) { | 1990 if (ancestorSkipped) { |
1997 // If the ancestor is below o, then we need to map the rect into ancesto
r's coordinates. | 1991 // If the ancestor is below o, then we need to map the rect into ancesto
r's coordinates. |
1998 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); | 1992 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
1999 rect.move(-containerOffset); | 1993 rect.move(-containerOffset); |
2000 // If the ancestor is fixed, then the rect is already in its coordinates
so doesn't need viewport-adjusting. | 1994 // If the ancestor is fixed, then the rect is already in its coordinates
so doesn't need viewport-adjusting. |
2001 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView() && position == FixedPosition) | 1995 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView() && position == FixedPosition) |
2002 toLayoutView(container)->adjustOffsetForFixedPosition(rect); | 1996 toLayoutView(container)->adjustOffsetForFixedPosition(rect); |
2003 return true; | 1997 return true; |
2004 } | 1998 } |
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4703 | 4697 |
4704 void LayoutBox::clearPercentHeightDescendants() | 4698 void LayoutBox::clearPercentHeightDescendants() |
4705 { | 4699 { |
4706 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4700 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
4707 if (curr->isBox()) | 4701 if (curr->isBox()) |
4708 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4702 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
4709 } | 4703 } |
4710 } | 4704 } |
4711 | 4705 |
4712 } // namespace blink | 4706 } // namespace blink |
OLD | NEW |