| 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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 if (abs(delta.width()) <= ScrollView::noPanScrollRadius) // at the center we
let the space for the icon | 2147 if (abs(delta.width()) <= ScrollView::noPanScrollRadius) // at the center we
let the space for the icon |
| 2148 delta.setWidth(0); | 2148 delta.setWidth(0); |
| 2149 if (abs(delta.height()) <= ScrollView::noPanScrollRadius) | 2149 if (abs(delta.height()) <= ScrollView::noPanScrollRadius) |
| 2150 delta.setHeight(0); | 2150 delta.setHeight(0); |
| 2151 | 2151 |
| 2152 scrollByRecursively(adjustedScrollDelta(delta), ScrollOffsetClamped); | 2152 scrollByRecursively(adjustedScrollDelta(delta), ScrollOffsetClamped); |
| 2153 } | 2153 } |
| 2154 | 2154 |
| 2155 void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping
clamp) | 2155 void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping
clamp) |
| 2156 { | 2156 { |
| 2157 scrollBy(delta, clamp, ShouldPropagateScroll); |
| 2158 } |
| 2159 |
| 2160 bool RenderLayer::scrollBy(const IntSize& delta, ScrollOffsetClamping clamp, Scr
ollPropagation shouldPropagate) |
| 2161 { |
| 2157 if (delta.isZero()) | 2162 if (delta.isZero()) |
| 2158 return; | 2163 return false; |
| 2159 | 2164 |
| 2160 bool restrictedByLineClamp = false; | 2165 bool restrictedByLineClamp = false; |
| 2161 if (renderer()->parent()) | 2166 if (renderer()->parent()) |
| 2162 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); | 2167 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); |
| 2163 | 2168 |
| 2164 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { | 2169 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { |
| 2165 IntSize newScrollOffset = adjustedScrollOffset() + delta; | 2170 IntSize newScrollOffset = adjustedScrollOffset() + delta; |
| 2166 scrollToOffset(newScrollOffset, clamp); | 2171 scrollToOffset(newScrollOffset, clamp); |
| 2167 | 2172 |
| 2173 if (shouldPropagate == DontPropagateScroll) |
| 2174 return true; |
| 2175 |
| 2168 // If this layer can't do the scroll we ask the next layer up that can s
croll to try | 2176 // If this layer can't do the scroll we ask the next layer up that can s
croll to try |
| 2169 IntSize remainingScrollOffset = newScrollOffset - adjustedScrollOffset()
; | 2177 IntSize remainingScrollOffset = newScrollOffset - adjustedScrollOffset()
; |
| 2178 bool didScroll = true; |
| 2170 if (!remainingScrollOffset.isZero() && renderer()->parent()) { | 2179 if (!remainingScrollOffset.isZero() && renderer()->parent()) { |
| 2171 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) | 2180 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) |
| 2172 scrollableLayer->scrollByRecursively(remainingScrollOffset); | 2181 didScroll = scrollableLayer->scrollBy(remainingScrollOffset, cla
mp, shouldPropagate); |
| 2173 | 2182 |
| 2174 Frame* frame = renderer()->frame(); | 2183 Frame* frame = renderer()->frame(); |
| 2175 if (frame) | 2184 if (frame) |
| 2176 frame->eventHandler()->updateAutoscrollRenderer(); | 2185 frame->eventHandler()->updateAutoscrollRenderer(); |
| 2177 } | 2186 } |
| 2187 return didScroll; |
| 2178 } else if (renderer()->view()->frameView()) { | 2188 } else if (renderer()->view()->frameView()) { |
| 2179 // If we are here, we were called on a renderer that can be programmatic
ally scrolled, but doesn't | 2189 // If we are here, we were called on a renderer that can be programmatic
ally scrolled, but doesn't |
| 2180 // have an overflow clip. Which means that it is a document node that ca
n be scrolled. | 2190 // have an overflow clip. Which means that it is a document node that ca
n be scrolled. |
| 2181 renderer()->view()->frameView()->scrollBy(delta); | 2191 FrameView* view = renderer()->view()->frameView(); |
| 2192 IntPoint scrollPositionBefore = view->scrollPosition(); |
| 2193 if (view->isScrollable()) |
| 2194 view->scrollBy(delta); |
| 2195 IntPoint scrollPositionAfter = view->scrollPosition(); |
| 2196 return scrollPositionBefore != scrollPositionAfter; |
| 2182 | 2197 |
| 2183 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? | 2198 // FIXME: If we didn't scroll the whole way, do we want to try looking a
t the frames ownerElement? |
| 2184 // https://bugs.webkit.org/show_bug.cgi?id=28237 | 2199 // https://bugs.webkit.org/show_bug.cgi?id=28237 |
| 2185 } | 2200 } |
| 2201 |
| 2202 return false; |
| 2186 } | 2203 } |
| 2187 | 2204 |
| 2188 IntSize RenderLayer::clampScrollOffset(const IntSize& scrollOffset) const | 2205 IntSize RenderLayer::clampScrollOffset(const IntSize& scrollOffset) const |
| 2189 { | 2206 { |
| 2190 RenderBox* box = renderBox(); | 2207 RenderBox* box = renderBox(); |
| 2191 ASSERT(box); | 2208 ASSERT(box); |
| 2192 | 2209 |
| 2193 int maxX = scrollWidth() - box->pixelSnappedClientWidth(); | 2210 int maxX = scrollWidth() - box->pixelSnappedClientWidth(); |
| 2194 int maxY = scrollHeight() - box->pixelSnappedClientHeight(); | 2211 int maxY = scrollHeight() - box->pixelSnappedClientHeight(); |
| 2195 | 2212 |
| (...skipping 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6488 } | 6505 } |
| 6489 } | 6506 } |
| 6490 | 6507 |
| 6491 void showLayerTree(const WebCore::RenderObject* renderer) | 6508 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6492 { | 6509 { |
| 6493 if (!renderer) | 6510 if (!renderer) |
| 6494 return; | 6511 return; |
| 6495 showLayerTree(renderer->enclosingLayer()); | 6512 showLayerTree(renderer->enclosingLayer()); |
| 6496 } | 6513 } |
| 6497 #endif | 6514 #endif |
| OLD | NEW |