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 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 delta.setHeight(0); | 2151 delta.setHeight(0); |
2152 | 2152 |
2153 scrollByRecursively(adjustedScrollDelta(delta), ScrollOffsetClamped); | 2153 scrollByRecursively(adjustedScrollDelta(delta), ScrollOffsetClamped); |
2154 } | 2154 } |
2155 | 2155 |
2156 void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping
clamp) | 2156 void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping
clamp) |
2157 { | 2157 { |
2158 if (delta.isZero()) | 2158 if (delta.isZero()) |
2159 return; | 2159 return; |
2160 | 2160 |
2161 bool restrictedByLineClamp = false; | 2161 if (renderer()->hasOverflowClip()) { |
2162 if (renderer()->parent()) | |
2163 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); | |
2164 | |
2165 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { | |
2166 IntSize newScrollOffset = adjustedScrollOffset() + delta; | 2162 IntSize newScrollOffset = adjustedScrollOffset() + delta; |
2167 m_scrollableArea->scrollToOffset(newScrollOffset, clamp); | 2163 m_scrollableArea->scrollToOffset(newScrollOffset, clamp); |
2168 | 2164 |
2169 // If this layer can't do the scroll we ask the next layer up that can s
croll to try | 2165 // If this layer can't do the scroll we ask the next layer up that can s
croll to try |
2170 IntSize remainingScrollOffset = newScrollOffset - adjustedScrollOffset()
; | 2166 IntSize remainingScrollOffset = newScrollOffset - adjustedScrollOffset()
; |
2171 if (!remainingScrollOffset.isZero() && renderer()->parent()) { | 2167 if (!remainingScrollOffset.isZero() && renderer()->parent()) { |
2172 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) | 2168 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) |
2173 scrollableLayer->scrollByRecursively(remainingScrollOffset, clam
p); | 2169 scrollableLayer->scrollByRecursively(remainingScrollOffset, clam
p); |
2174 | 2170 |
2175 Frame* frame = renderer()->frame(); | 2171 Frame* frame = renderer()->frame(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 if (!page) | 2203 if (!page) |
2208 return false; | 2204 return false; |
2209 return !page->autoscrollInProgress(); | 2205 return !page->autoscrollInProgress(); |
2210 } | 2206 } |
2211 | 2207 |
2212 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm
ent& alignX, const ScrollAlignment& alignY) | 2208 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm
ent& alignX, const ScrollAlignment& alignY) |
2213 { | 2209 { |
2214 RenderLayer* parentLayer = 0; | 2210 RenderLayer* parentLayer = 0; |
2215 LayoutRect newRect = rect; | 2211 LayoutRect newRect = rect; |
2216 | 2212 |
2217 bool restrictedByLineClamp = false; | 2213 if (renderer()->parent()) |
2218 if (renderer()->parent()) { | |
2219 parentLayer = renderer()->parent()->enclosingLayer(); | 2214 parentLayer = renderer()->parent()->enclosingLayer(); |
2220 restrictedByLineClamp = !renderer()->parent()->style()->lineClamp().isNo
ne(); | |
2221 } | |
2222 | 2215 |
2223 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { | 2216 if (renderer()->hasOverflowClip()) { |
2224 // Don't scroll to reveal an overflow layer that is restricted by the -w
ebkit-line-clamp property. | |
2225 // This will prevent us from revealing text hidden by the slider in Safa
ri RSS. | |
2226 RenderBox* box = renderBox(); | 2217 RenderBox* box = renderBox(); |
2227 ASSERT(box); | 2218 ASSERT(box); |
2228 LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(
rect)), UseTransforms).boundingBox()); | 2219 LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(
rect)), UseTransforms).boundingBox()); |
2229 LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight()); | 2220 LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight()); |
2230 LayoutRect r = getRectToExpose(layerBounds, localExposeRect, alignX, ali
gnY); | 2221 LayoutRect r = getRectToExpose(layerBounds, localExposeRect, alignX, ali
gnY); |
2231 | 2222 |
2232 IntSize clampedScrollOffset = m_scrollableArea->clampScrollOffset(adjust
edScrollOffset() + toIntSize(roundedIntRect(r).location())); | 2223 IntSize clampedScrollOffset = m_scrollableArea->clampScrollOffset(adjust
edScrollOffset() + toIntSize(roundedIntRect(r).location())); |
2233 if (clampedScrollOffset != adjustedScrollOffset()) { | 2224 if (clampedScrollOffset != adjustedScrollOffset()) { |
2234 IntSize oldScrollOffset = adjustedScrollOffset(); | 2225 IntSize oldScrollOffset = adjustedScrollOffset(); |
2235 m_scrollableArea->scrollToOffset(clampedScrollOffset); | 2226 m_scrollableArea->scrollToOffset(clampedScrollOffset); |
(...skipping 3340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5576 } | 5567 } |
5577 } | 5568 } |
5578 | 5569 |
5579 void showLayerTree(const WebCore::RenderObject* renderer) | 5570 void showLayerTree(const WebCore::RenderObject* renderer) |
5580 { | 5571 { |
5581 if (!renderer) | 5572 if (!renderer) |
5582 return; | 5573 return; |
5583 showLayerTree(renderer->enclosingLayer()); | 5574 showLayerTree(renderer->enclosingLayer()); |
5584 } | 5575 } |
5585 #endif | 5576 #endif |
OLD | NEW |