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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
932 } | 932 } |
933 | 933 |
934 IntSize LayoutBox::scrolledContentOffset() const | 934 IntSize LayoutBox::scrolledContentOffset() const |
935 { | 935 { |
936 ASSERT(hasOverflowClip()); | 936 ASSERT(hasOverflowClip()); |
937 ASSERT(hasLayer()); | 937 ASSERT(hasLayer()); |
938 // FIXME: Return DoubleSize here. crbug.com/414283. | 938 // FIXME: Return DoubleSize here. crbug.com/414283. |
939 return flooredIntSize(layer()->scrollableArea()->scrollOffset()); | 939 return flooredIntSize(layer()->scrollableArea()->scrollOffset()); |
940 } | 940 } |
941 | 941 |
942 void LayoutBox::applyCachedScrollOffsetForPaintInvalidation(LayoutRect& paintRec t) const | 942 void LayoutBox::applyOverflowClipAndScrollOffsetForPaintInvalidationIfNeeded(Lay outRect& rect) const |
943 { | 943 { |
944 ASSERT(hasLayer()); | 944 ASSERT(hasLayer()); |
945 ASSERT(hasOverflowClip()); | 945 ASSERT(hasOverflowClip()); |
946 | 946 |
947 LayoutSize offset = LayoutSize(-scrolledContentOffset()); | 947 LayoutSize offset = LayoutSize(-scrolledContentOffset()); |
948 if (UNLIKELY(hasFlippedBlocksWritingMode())) { | 948 if (UNLIKELY(hasFlippedBlocksWritingMode())) { |
949 if (isHorizontalWritingMode()) | 949 if (isHorizontalWritingMode()) |
950 offset.setHeight(-offset.height()); | 950 offset.setHeight(-offset.height()); |
951 else | 951 else |
952 offset.setWidth(-offset.width()); | 952 offset.setWidth(-offset.width()); |
953 } | 953 } |
954 paintRect.move(offset); | 954 rect.move(offset); |
955 } | |
956 | 955 |
957 void LayoutBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p aintRect) const | 956 if (isPaintInvalidationContainer()) |
szager1
2015/12/18 18:49:21
This doesn't work for the IntersectionObserver use
Xianzhu
2015/12/18 19:30:51
Oh I didn't notice that this patch is to fix a rec
| |
958 { | 957 return; |
959 ASSERT(hasLayer()); | |
960 ASSERT(hasOverflowClip()); | |
961 | 958 |
962 applyCachedScrollOffsetForPaintInvalidation(paintRect); | 959 flipForWritingMode(rect); |
963 flipForWritingMode(paintRect); | |
964 | 960 |
965 // size() is inaccurate if we're in the middle of a layout of this LayoutBox , so use the | 961 // size() is inaccurate if we're in the middle of a layout of this LayoutBox , so use the |
966 // layer's size instead. Even if the layer's size is wrong, the layer itself will issue paint invalidations | 962 // layer's size instead. Even if the layer's size is wrong, the layer itself will issue paint invalidations |
967 // anyway if its size does change. | 963 // anyway if its size does change. |
968 LayoutRect clipRect(LayoutPoint(), LayoutSize(layer()->size())); | 964 LayoutRect clipRect(LayoutPoint(), LayoutSize(layer()->size())); |
969 paintRect = intersection(paintRect, clipRect); | 965 rect = intersection(rect, clipRect); |
970 flipForWritingMode(paintRect); | 966 flipForWritingMode(rect); |
971 } | 967 } |
972 | 968 |
973 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const | 969 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou tUnit& maxLogicalWidth) const |
974 { | 970 { |
975 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); | 971 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); |
976 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); | 972 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth( ); |
977 } | 973 } |
978 | 974 |
979 LayoutUnit LayoutBox::minPreferredLogicalWidth() const | 975 LayoutUnit LayoutBox::minPreferredLogicalWidth() const |
980 { | 976 { |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1949 // is translated, but the layout box isn't, so we need to do this to get the | 1945 // is translated, but the layout box isn't, so we need to do this to get the |
1950 // right dirty rect. Since this is called from LayoutObject::setStyle, the relative position | 1946 // right dirty rect. Since this is called from LayoutObject::setStyle, the relative position |
1951 // flag on the LayoutObject has been cleared, so use the one on the styl e(). | 1947 // flag on the LayoutObject has been cleared, so use the one on the styl e(). |
1952 topLeft += layer()->offsetForInFlowPosition(); | 1948 topLeft += layer()->offsetForInFlowPosition(); |
1953 } | 1949 } |
1954 | 1950 |
1955 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout, | 1951 // FIXME: We ignore the lightweight clipping rect that controls use, since i f |o| is in mid-layout, |
1956 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. | 1952 // its controlClipRect will be wrong. For overflow clip we use the values ca ched by the layer. |
1957 rect.setLocation(topLeft); | 1953 rect.setLocation(topLeft); |
1958 if (o->hasOverflowClip()) { | 1954 if (o->hasOverflowClip()) { |
1959 LayoutBox* containerBox = toLayoutBox(o); | 1955 toLayoutBox(o)->applyOverflowClipAndScrollOffsetForPaintInvalidationIfNe eded(rect); |
1960 if (o == paintInvalidationContainer) | |
1961 containerBox->applyCachedScrollOffsetForPaintInvalidation(rect); | |
1962 else | |
1963 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rec t); | |
1964 if (rect.isEmpty()) | 1956 if (rect.isEmpty()) |
1965 return; | 1957 return; |
1966 } | 1958 } |
1967 | 1959 |
1968 if (containerSkipped) { | 1960 if (containerSkipped) { |
1969 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. | 1961 // If the paintInvalidationContainer is below o, then we need to map the rect into paintInvalidationContainer's coordinates. |
1970 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o); | 1962 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces torContainer(o); |
1971 rect.move(-containerOffset); | 1963 rect.move(-containerOffset); |
1972 // If the paintInvalidationContainer is fixed, then the rect is already in its coordinates so doesn't need viewport-adjusting. | 1964 // If the paintInvalidationContainer is fixed, then the rect is already in its coordinates so doesn't need viewport-adjusting. |
1973 if (paintInvalidationContainer->style()->position() != FixedPosition && o->isLayoutView()) | 1965 if (paintInvalidationContainer->style()->position() != FixedPosition && o->isLayoutView()) |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4885 } | 4877 } |
4886 | 4878 |
4887 void LayoutBox::clearPreviousPaintInvalidationRects() | 4879 void LayoutBox::clearPreviousPaintInvalidationRects() |
4888 { | 4880 { |
4889 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); | 4881 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); |
4890 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4882 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) |
4891 scrollableArea->clearPreviousPaintInvalidationRects(); | 4883 scrollableArea->clearPreviousPaintInvalidationRects(); |
4892 } | 4884 } |
4893 | 4885 |
4894 } // namespace blink | 4886 } // namespace blink |
OLD | NEW |