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-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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 return layer()->scrollPosition(); | 964 return layer()->scrollPosition(); |
965 } | 965 } |
966 | 966 |
967 LayoutSize RenderBox::cachedSizeForOverflowClip() const | 967 LayoutSize RenderBox::cachedSizeForOverflowClip() const |
968 { | 968 { |
969 ASSERT(hasOverflowClip()); | 969 ASSERT(hasOverflowClip()); |
970 ASSERT(hasLayer()); | 970 ASSERT(hasLayer()); |
971 return layer()->size(); | 971 return layer()->size(); |
972 } | 972 } |
973 | 973 |
974 void RenderBox::applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect
) const | 974 void RenderBox::applyCachedClipAndScrollPositionForRepaint(LayoutRect& paintRect
, bool useInclusiveIntersection, bool* intersects) const |
975 { | 975 { |
976 flipForWritingMode(paintRect); | 976 flipForWritingMode(paintRect); |
977 paintRect.moveBy(-scrollPosition()); // For overflow:auto/scroll/hidden. | 977 paintRect.moveBy(-scrollPosition()); // For overflow:auto/scroll/hidden. |
978 | 978 |
979 // Do not clip scroll layer contents to reduce the number of repaints while
scrolling. | 979 // Do not clip scroll layer contents to reduce the number of repaints while
scrolling. |
980 if (usesCompositedScrolling()) { | 980 if (usesCompositedScrolling()) { |
981 flipForWritingMode(paintRect); | 981 flipForWritingMode(paintRect); |
982 return; | 982 return; |
983 } | 983 } |
984 | 984 |
985 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the | 985 // height() is inaccurate if we're in the middle of a layout of this RenderB
ox, so use the |
986 // layer's size instead. Even if the layer's size is wrong, the layer itself
will repaint | 986 // layer's size instead. Even if the layer's size is wrong, the layer itself
will repaint |
987 // anyway if its size does change. | 987 // anyway if its size does change. |
988 LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip()); | 988 LayoutRect clipRect(LayoutPoint(), cachedSizeForOverflowClip()); |
989 paintRect = intersection(paintRect, clipRect); | 989 if (useInclusiveIntersection) |
| 990 *intersects = paintRect.inclusiveIntersect(clipRect); |
| 991 else |
| 992 paintRect = intersection(paintRect, clipRect); |
990 flipForWritingMode(paintRect); | 993 flipForWritingMode(paintRect); |
991 } | 994 } |
992 | 995 |
993 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const | 996 void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const |
994 { | 997 { |
995 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 998 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
996 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 999 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
997 } | 1000 } |
998 | 1001 |
999 LayoutUnit RenderBox::minPreferredLogicalWidth() const | 1002 LayoutUnit RenderBox::minPreferredLogicalWidth() const |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 | 2149 |
2147 if (layer() && layer()->transform()) | 2150 if (layer() && layer()->transform()) |
2148 adjustedRect = LayoutRect(encloseRectToDevicePixels(layer()->transfo
rm()->mapRect(adjustedRect), document().deviceScaleFactor())); | 2151 adjustedRect = LayoutRect(encloseRectToDevicePixels(layer()->transfo
rm()->mapRect(adjustedRect), document().deviceScaleFactor())); |
2149 | 2152 |
2150 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. | 2153 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. |
2151 if (styleToUse.hasInFlowPosition() && layer()) | 2154 if (styleToUse.hasInFlowPosition() && layer()) |
2152 adjustedRect.move(layer()->offsetForInFlowPosition()); | 2155 adjustedRect.move(layer()->offsetForInFlowPosition()); |
2153 | 2156 |
2154 adjustedRect.moveBy(location()); | 2157 adjustedRect.moveBy(location()); |
2155 adjustedRect.move(layoutState->paintOffset()); | 2158 adjustedRect.move(layoutState->paintOffset()); |
2156 if (layoutState->isClipped()) | 2159 if (layoutState->isClipped()) { |
2157 adjustedRect.intersect(layoutState->clipRect()); | 2160 if (context.m_useInclusiveIntersection) |
| 2161 *context.m_intersects = adjustedRect.inclusiveIntersect(layoutSt
ate->clipRect()); |
| 2162 else |
| 2163 adjustedRect.intersect(layoutState->clipRect()); |
| 2164 } |
2158 return adjustedRect; | 2165 return adjustedRect; |
2159 } | 2166 } |
2160 | 2167 |
2161 if (hasReflection()) | 2168 if (hasReflection()) |
2162 adjustedRect.unite(reflectedRect(adjustedRect)); | 2169 adjustedRect.unite(reflectedRect(adjustedRect)); |
2163 | 2170 |
2164 if (repaintContainer == this) { | 2171 if (repaintContainer == this) { |
2165 if (repaintContainer->style().isFlippedBlocksWritingMode()) | 2172 if (repaintContainer->style().isFlippedBlocksWritingMode()) |
2166 flipForWritingMode(adjustedRect); | 2173 flipForWritingMode(adjustedRect); |
2167 return adjustedRect; | 2174 return adjustedRect; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 2245 // flag on the RenderObject has been cleared, so use the one on the styl
e(). |
2239 topLeft += layer()->offsetForInFlowPosition(); | 2246 topLeft += layer()->offsetForInFlowPosition(); |
2240 } | 2247 } |
2241 | 2248 |
2242 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 2249 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
2243 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 2250 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
2244 adjustedRect.setLocation(topLeft); | 2251 adjustedRect.setLocation(topLeft); |
2245 if (container->hasOverflowClip()) { | 2252 if (container->hasOverflowClip()) { |
2246 RenderBox& containerBox = downcast<RenderBox>(*container); | 2253 RenderBox& containerBox = downcast<RenderBox>(*container); |
2247 if (containerBox.shouldApplyClipAndScrollPositionForRepaint(repaintConta
iner)) { | 2254 if (containerBox.shouldApplyClipAndScrollPositionForRepaint(repaintConta
iner)) { |
2248 containerBox.applyCachedClipAndScrollPositionForRepaint(adjustedRect
); | 2255 bool intersects = true; |
2249 if (adjustedRect.isEmpty()) | 2256 containerBox.applyCachedClipAndScrollPositionForRepaint(adjustedRect
, context.m_useInclusiveIntersection, &intersects); |
| 2257 if (context.m_useInclusiveIntersection) |
| 2258 *context.m_intersects = intersects; |
| 2259 else |
| 2260 intersects = !adjustedRect.isEmpty(); |
| 2261 if (!intersects) |
2250 return adjustedRect; | 2262 return adjustedRect; |
2251 } | 2263 } |
2252 } | 2264 } |
2253 | 2265 |
2254 if (repaintContainerIsSkipped) { | 2266 if (repaintContainerIsSkipped) { |
2255 // If the repaintContainer is below container, then we need to map the r
ect into repaintContainer's coordinates. | 2267 // If the repaintContainer is below container, then we need to map the r
ect into repaintContainer's coordinates. |
2256 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(*container); | 2268 LayoutSize containerOffset = repaintContainer->offsetFromAncestorContain
er(*container); |
2257 adjustedRect.move(-containerOffset); | 2269 adjustedRect.move(-containerOffset); |
2258 return adjustedRect; | 2270 return adjustedRect; |
2259 } | 2271 } |
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4920 return &candidate; | 4932 return &candidate; |
4921 } | 4933 } |
4922 // If all parent elements are not overflow scrollable, check the body. | 4934 // If all parent elements are not overflow scrollable, check the body. |
4923 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) | 4935 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) |
4924 return document().body()->renderBox(); | 4936 return document().body()->renderBox(); |
4925 ···· | 4937 ···· |
4926 return nullptr; | 4938 return nullptr; |
4927 } | 4939 } |
4928 | 4940 |
4929 } // namespace WebCore | 4941 } // namespace WebCore |
OLD | NEW |