| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 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 26 matching lines...) Expand all Loading... |
| 37 * version of this file under the LGPL, indicate your decision by | 37 * version of this file under the LGPL, indicate your decision by |
| 38 * deletingthe provisions above and replace them with the notice and | 38 * deletingthe provisions above and replace them with the notice and |
| 39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
| 40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
| 41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
| 42 */ | 42 */ |
| 43 | 43 |
| 44 #ifndef RenderLayerScrollableArea_h | 44 #ifndef RenderLayerScrollableArea_h |
| 45 #define RenderLayerScrollableArea_h | 45 #define RenderLayerScrollableArea_h |
| 46 | 46 |
| 47 |
| 48 #include "core/rendering/LayerFragment.h" |
| 49 #include "core/rendering/RenderBox.h" |
| 50 |
| 47 #include "platform/scroll/ScrollableArea.h" | 51 #include "platform/scroll/ScrollableArea.h" |
| 48 | 52 |
| 49 namespace blink { | 53 namespace blink { |
| 50 | 54 |
| 51 enum ResizerHitTestType { | 55 enum ResizerHitTestType { |
| 52 ResizerForPointer, | 56 ResizerForPointer, |
| 53 ResizerForTouch | 57 ResizerForTouch |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 class PlatformEvent; | 60 class PlatformEvent; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void scrollToYOffset(double y, ScrollOffsetClamping clamp = ScrollOffsetUncl
amped) { scrollToOffset(DoubleSize(scrollXOffset(), y), clamp); } | 126 void scrollToYOffset(double y, ScrollOffsetClamping clamp = ScrollOffsetUncl
amped) { scrollToOffset(DoubleSize(scrollXOffset(), y), clamp); } |
| 123 | 127 |
| 124 void updateAfterLayout(); | 128 void updateAfterLayout(); |
| 125 void updateAfterStyleChange(const RenderStyle*); | 129 void updateAfterStyleChange(const RenderStyle*); |
| 126 void updateAfterOverflowRecalc(); | 130 void updateAfterOverflowRecalc(); |
| 127 | 131 |
| 128 virtual bool updateAfterCompositingChange() override; | 132 virtual bool updateAfterCompositingChange() override; |
| 129 | 133 |
| 130 bool hasScrollbar() const { return m_hBar || m_vBar; } | 134 bool hasScrollbar() const { return m_hBar || m_vBar; } |
| 131 | 135 |
| 132 // FIXME: This should be removed. | 136 RenderScrollbarPart* scrollCorner() const { return m_scrollCorner; } |
| 133 bool hasScrollCorner() const { return m_scrollCorner; } | |
| 134 | 137 |
| 135 void resize(const PlatformEvent&, const LayoutSize&); | 138 void resize(const PlatformEvent&, const LayoutSize&); |
| 136 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; | 139 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const; |
| 137 | 140 |
| 138 bool inResizeMode() const { return m_inResizeMode; } | 141 bool inResizeMode() const { return m_inResizeMode; } |
| 139 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } | 142 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; } |
| 140 | 143 |
| 141 IntRect touchResizerCornerRect(const IntRect& bounds) const | 144 IntRect touchResizerCornerRect(const IntRect& bounds) const |
| 142 { | 145 { |
| 143 return resizerCornerRect(bounds, ResizerForTouch); | 146 return resizerCornerRect(bounds, ResizerForTouch); |
| 144 } | 147 } |
| 145 | 148 |
| 146 LayoutUnit scrollWidth() const; | 149 LayoutUnit scrollWidth() const; |
| 147 LayoutUnit scrollHeight() const; | 150 LayoutUnit scrollHeight() const; |
| 148 int pixelSnappedScrollWidth() const; | 151 int pixelSnappedScrollWidth() const; |
| 149 int pixelSnappedScrollHeight() const; | 152 int pixelSnappedScrollHeight() const; |
| 150 | 153 |
| 151 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; | 154 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro
llbarSize) const; |
| 152 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; | 155 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS
crollbarSize) const; |
| 153 | 156 |
| 154 DoubleSize adjustedScrollOffset() const { return DoubleSize(scrollXOffset(),
scrollYOffset()); } | 157 DoubleSize adjustedScrollOffset() const { return DoubleSize(scrollXOffset(),
scrollYOffset()); } |
| 155 | 158 |
| 156 void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRe
ct& damageRect); | |
| 157 void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, co
nst IntRect& damageRect, bool paintingOverlayControls); | |
| 158 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam
ageRect); | |
| 159 | |
| 160 void positionOverflowControls(const IntSize& offsetFromRoot); | 159 void positionOverflowControls(const IntSize& offsetFromRoot); |
| 161 | 160 |
| 162 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control | 161 // isPointInResizeControl() is used for testing if a pointer/touch position
is in the resize control |
| 163 // area. | 162 // area. |
| 164 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e) const; | 163 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp
e) const; |
| 165 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); | 164 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); |
| 166 | 165 |
| 167 bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&
) const; | 166 bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&
) const; |
| 168 | 167 |
| 169 LayoutRect exposeRect(const LayoutRect&, const ScrollAlignment& alignX, cons
t ScrollAlignment& alignY); | 168 LayoutRect exposeRect(const LayoutRect&, const ScrollAlignment& alignX, cons
t ScrollAlignment& alignY); |
| 170 | 169 |
| 171 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can | 170 // Returns true our scrollable area is in the FrameView's collection of scro
llable areas. This can |
| 172 // only happen if we're both scrollable, and we do in fact overflow. This me
ans that overflow: hidden | 171 // only happen if we're both scrollable, and we do in fact overflow. This me
ans that overflow: hidden |
| 173 // layers never get added to the FrameView's collection. | 172 // layers never get added to the FrameView's collection. |
| 174 bool scrollsOverflow() const { return m_scrollsOverflow; } | 173 bool scrollsOverflow() const { return m_scrollsOverflow; } |
| 175 | 174 |
| 176 // Rectangle encompassing the scroll corner and resizer rect. | 175 // Rectangle encompassing the scroll corner and resizer rect. |
| 177 IntRect scrollCornerAndResizerRect() const; | 176 IntRect scrollCornerAndResizerRect() const; |
| 178 | 177 |
| 179 void updateNeedsCompositedScrolling(); | 178 void updateNeedsCompositedScrolling(); |
| 180 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } | 179 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } |
| 181 | 180 |
| 182 // These are used during compositing updates to determine if the overflow | 181 // These are used during compositing updates to determine if the overflow |
| 183 // controls need to be repositioned in the GraphicsLayer tree. | 182 // controls need to be repositioned in the GraphicsLayer tree. |
| 184 void setTopmostScrollChild(RenderLayer*); | 183 void setTopmostScrollChild(RenderLayer*); |
| 185 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } | 184 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } |
| 186 | 185 |
| 186 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; |
| 187 |
| 188 RenderBox& box() const; |
| 189 RenderLayer* layer() const; |
| 190 |
| 191 RenderScrollbarPart* resizer() { return m_resizer; } |
| 192 |
| 193 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } |
| 194 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } |
| 195 |
| 196 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
| 197 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
| 198 |
| 187 private: | 199 private: |
| 188 bool hasHorizontalOverflow() const; | 200 bool hasHorizontalOverflow() const; |
| 189 bool hasVerticalOverflow() const; | 201 bool hasVerticalOverflow() const; |
| 190 bool hasScrollableHorizontalOverflow() const; | 202 bool hasScrollableHorizontalOverflow() const; |
| 191 bool hasScrollableVerticalOverflow() const; | 203 bool hasScrollableVerticalOverflow() const; |
| 192 | 204 |
| 193 void computeScrollDimensions(); | 205 void computeScrollDimensions(); |
| 194 | 206 |
| 195 DoubleSize clampScrollOffset(const DoubleSize&) const; | 207 DoubleSize clampScrollOffset(const DoubleSize&) const; |
| 196 | 208 |
| 197 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 209 |
| 198 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | |
| 199 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; | 210 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; |
| 200 LayoutUnit horizontalScrollbarStart(int minX) const; | 211 LayoutUnit horizontalScrollbarStart(int minX) const; |
| 201 IntSize scrollbarOffset(const Scrollbar*) const; | 212 IntSize scrollbarOffset(const Scrollbar*) const; |
| 202 | 213 |
| 203 PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); | 214 PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation); |
| 204 void destroyScrollbar(ScrollbarOrientation); | 215 void destroyScrollbar(ScrollbarOrientation); |
| 205 | 216 |
| 206 void setHasHorizontalScrollbar(bool hasScrollbar); | 217 void setHasHorizontalScrollbar(bool hasScrollbar); |
| 207 void setHasVerticalScrollbar(bool hasScrollbar); | 218 void setHasVerticalScrollbar(bool hasScrollbar); |
| 208 | 219 |
| 209 void updateScrollCornerStyle(); | 220 void updateScrollCornerStyle(); |
| 210 | 221 |
| 211 // See comments on isPointInResizeControl. | 222 // See comments on isPointInResizeControl. |
| 212 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; | |
| 213 bool overflowControlsIntersectRect(const IntRect& localRect) const; | |
| 214 void updateResizerAreaSet(); | 223 void updateResizerAreaSet(); |
| 215 void updateResizerStyle(); | 224 void updateResizerStyle(); |
| 216 void drawPlatformResizerImage(GraphicsContext*, IntRect resizerCornerRect); | |
| 217 | 225 |
| 218 RenderBox& box() const; | |
| 219 RenderLayer* layer() const; | |
| 220 | 226 |
| 221 void updateScrollableAreaSet(bool hasOverflow); | 227 void updateScrollableAreaSet(bool hasOverflow); |
| 222 | 228 |
| 223 void updateCompositingLayersAfterScroll(); | 229 void updateCompositingLayersAfterScroll(); |
| 224 | 230 |
| 225 RenderLayer& m_layer; | 231 RenderLayer& m_layer; |
| 226 | 232 |
| 227 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 233 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
| 228 unsigned m_inResizeMode : 1; | 234 unsigned m_inResizeMode : 1; |
| 229 unsigned m_scrollsOverflow : 1; | 235 unsigned m_scrollsOverflow : 1; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 253 // Renderers to hold our custom scroll corner. | 259 // Renderers to hold our custom scroll corner. |
| 254 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; | 260 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; |
| 255 | 261 |
| 256 // Renderers to hold our custom resizer. | 262 // Renderers to hold our custom resizer. |
| 257 RawPtrWillBePersistent<RenderScrollbarPart> m_resizer; | 263 RawPtrWillBePersistent<RenderScrollbarPart> m_resizer; |
| 258 }; | 264 }; |
| 259 | 265 |
| 260 } // namespace blink | 266 } // namespace blink |
| 261 | 267 |
| 262 #endif // RenderLayerScrollableArea_h | 268 #endif // RenderLayerScrollableArea_h |
| OLD | NEW |