LEFT | RIGHT |
(no file at all) | |
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-2010, 2015 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005-2010, 2015 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 return layer()->scrollPosition(); | 960 return layer()->scrollPosition(); |
961 } | 961 } |
962 | 962 |
963 LayoutSize RenderBox::cachedSizeForOverflowClip() const | 963 LayoutSize RenderBox::cachedSizeForOverflowClip() const |
964 { | 964 { |
965 ASSERT(hasOverflowClip()); | 965 ASSERT(hasOverflowClip()); |
966 ASSERT(hasLayer()); | 966 ASSERT(hasLayer()); |
967 return layer()->size(); | 967 return layer()->size(); |
968 } | 968 } |
969 | 969 |
970 void RenderBox::applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect
) const | 970 void RenderBox::applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect
, bool useInclusiveIntersection, bool* intersects) const |
971 { | 971 { |
972 flipForWritingMode(paintRect); | 972 flipForWritingMode(paintRect); |
973 paintRect.moveBy(-scrollPosition()); // For overflow:auto/scroll/hidden. | 973 paintRect.moveBy(-scrollPosition()); // For overflow:auto/scroll/hidden. |
974 | 974 |
975 // Do not clip scroll layer contents to reduce the number of repaints while
scrolling. | 975 // Do not clip scroll layer contents to reduce the number of repaints while
scrolling. |
976 if (usesCompositedScrolling()) { | 976 if (usesCompositedScrolling()) { |
977 flipForWritingMode(paintRect); | 977 flipForWritingMode(paintRect); |
978 return; | 978 return; |
979 } | 979 } |
980 | 980 |
981 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the | 981 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the |
982 // layer's size instead. Even if the layer's size is wrong, the layer itself
will repaint | 982 // layer's size instead. Even if the layer's size is wrong, the layer itself
will repaint |
983 // anyway if its size does change. | 983 // anyway if its size does change. |
984 LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip()); | 984 LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip()); |
985 paintRect = intersection(paintRect, clipRect); | 985 if (useInclusiveIntersection) |
| 986 *intersects = paintRect.inclusiveIntersect(clipRect); |
| 987 else |
| 988 paintRect = intersection(paintRect, clipRect); |
986 flipForWritingMode(paintRect); | 989 flipForWritingMode(paintRect); |
987 } | 990 } |
988 | 991 |
989 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const | 992 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const |
990 { | 993 { |
991 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 994 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
992 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 995 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
993 } | 996 } |
994 | 997 |
995 LayoutUnit RenderBox::minPreferredLogicalWidth() const | 998 LayoutUnit RenderBox::minPreferredLogicalWidth() const |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 | 2157 |
2155 if (layer() && layer()->transform()) | 2158 if (layer() && layer()->transform()) |
2156 adjustedRect = LayoutRect(encloseRectToDevicePixels(layer()->transfo
rm()->mapRect(adjustedRect), document().deviceScaleFactor())); | 2159 adjustedRect = LayoutRect(encloseRectToDevicePixels(layer()->transfo
rm()->mapRect(adjustedRect), document().deviceScaleFactor())); |
2157 | 2160 |
2158 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. | 2161 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. |
2159 if (styleToUse.hasInFlowPosition() && layer()) | 2162 if (styleToUse.hasInFlowPosition() && layer()) |
2160 adjustedRect.move(layer()->offsetForInFlowPosition()); | 2163 adjustedRect.move(layer()->offsetForInFlowPosition()); |
2161 | 2164 |
2162 adjustedRect.moveBy(location()); | 2165 adjustedRect.moveBy(location()); |
2163 adjustedRect.move(layoutState->paintOffset()); | 2166 adjustedRect.move(layoutState->paintOffset()); |
2164 if (layoutState->isClipped()) | 2167 if (layoutState->isClipped()) { |
2165 adjustedRect.intersect(layoutState->clipRect()); | 2168 if (context.m_useInclusiveIntersection) |
| 2169 *context.m_intersects = adjustedRect.inclusiveIntersect(layoutSt
ate->clipRect()); |
| 2170 else |
| 2171 adjustedRect.intersect(layoutState->clipRect()); |
| 2172 } |
2166 return adjustedRect; | 2173 return adjustedRect; |
2167 } | 2174 } |
2168 | 2175 |
2169 if (hasReflection()) | 2176 if (hasReflection()) |
2170 adjustedRect.unite(reflectedRect(adjustedRect)); | 2177 adjustedRect.unite(reflectedRect(adjustedRect)); |
2171 | 2178 |
2172 if (repaintContainer == this) { | 2179 if (repaintContainer == this) { |
2173 if (repaintContainer->style().isFlippedBlocksWritingMode()) | 2180 if (repaintContainer->style().isFlippedBlocksWritingMode()) |
2174 flipForWritingMode(adjustedRect); | 2181 flipForWritingMode(adjustedRect); |
2175 return adjustedRect; | 2182 return adjustedRect; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 2253 // flag on the RenderObject has been cleared, so use the one on the styl
e(). |
2247 topLeft += layer()->offsetForInFlowPosition(); | 2254 topLeft += layer()->offsetForInFlowPosition(); |
2248 } | 2255 } |
2249 | 2256 |
2250 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 2257 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
2251 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 2258 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
2252 adjustedRect.setLocation(topLeft); | 2259 adjustedRect.setLocation(topLeft); |
2253 if (container->hasOverflowClip()) { | 2260 if (container->hasOverflowClip()) { |
2254 RenderBox& containerBox = downcast<RenderBox>(*container); | 2261 RenderBox& containerBox = downcast<RenderBox>(*container); |
2255 if (containerBox.shouldApplyClipAndScrollPositionForRepaint(repaintConta
iner)) { | 2262 if (containerBox.shouldApplyClipAndScrollPositionForRepaint(repaintConta
iner)) { |
2256 containerBox.applyCachedClipAndScrollPositionForRepaint(adjustedRect
); | 2263 bool intersects = true; |
2257 if (adjustedRect.isEmpty()) | 2264 containerBox.applyCachedClipAndScrollPositionForRepaint(adjustedRect
, context.m_useInclusiveIntersection, &intersects); |
| 2265 if (context.m_useInclusiveIntersection) |
| 2266 *context.m_intersects = intersects; |
| 2267 else |
| 2268 intersects = !adjustedRect.isEmpty(); |
| 2269 if (!intersects) |
2258 return adjustedRect; | 2270 return adjustedRect; |
2259 } | 2271 } |
2260 } | 2272 } |
2261 | 2273 |
2262 if (repaintContainerIsSkipped) { | 2274 if (repaintContainerIsSkipped) { |
2263 // If the repaintContainer is below container, then we need to map the r
ect into repaintContainer's coordinates. | 2275 // If the repaintContainer is below container, then we need to map the r
ect into repaintContainer's coordinates. |
2264 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(*container); | 2276 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(*container); |
2265 adjustedRect.move(-containerOffset); | 2277 adjustedRect.move(-containerOffset); |
2266 return adjustedRect; | 2278 return adjustedRect; |
2267 } | 2279 } |
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4928 return &candidate; | 4940 return &candidate; |
4929 } | 4941 } |
4930 // If all parent elements are not overflow scrollable, check the body. | 4942 // If all parent elements are not overflow scrollable, check the body. |
4931 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) | 4943 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) |
4932 return document().body()->renderBox(); | 4944 return document().body()->renderBox(); |
4933 ···· | 4945 ···· |
4934 return nullptr; | 4946 return nullptr; |
4935 } | 4947 } |
4936 | 4948 |
4937 } // namespace WebCore | 4949 } // namespace WebCore |
LEFT | RIGHT |