| 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 23 matching lines...) Expand all Loading... |
| 34 * applicable instead of those above. If you wish to allow use of your | 34 * applicable instead of those above. If you wish to allow use of your |
| 35 * version of this file only under the terms of one of those two | 35 * version of this file only under the terms of one of those two |
| 36 * licenses (the MPL or the GPL) and not to allow others to use your | 36 * licenses (the MPL or the GPL) and not to allow others to use your |
| 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 LayerScrollableArea_h |
| 45 #define RenderLayerScrollableArea_h | 45 #define LayerScrollableArea_h |
| 46 | 46 |
| 47 | 47 |
| 48 #include "core/rendering/LayerFragment.h" | 48 #include "core/layout/LayerFragment.h" |
| 49 #include "core/rendering/RenderBox.h" | 49 #include "core/rendering/RenderBox.h" |
| 50 | 50 |
| 51 #include "platform/scroll/ScrollableArea.h" | 51 #include "platform/scroll/ScrollableArea.h" |
| 52 | 52 |
| 53 namespace blink { | 53 namespace blink { |
| 54 | 54 |
| 55 enum ResizerHitTestType { | 55 enum ResizerHitTestType { |
| 56 ResizerForPointer, | 56 ResizerForPointer, |
| 57 ResizerForTouch | 57 ResizerForTouch |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class PlatformEvent; | 60 class PlatformEvent; |
| 61 class RenderBox; | 61 class RenderBox; |
| 62 class RenderLayer; | 62 class Layer; |
| 63 class RenderScrollbarPart; | 63 class RenderScrollbarPart; |
| 64 | 64 |
| 65 class RenderLayerScrollableArea final : public ScrollableArea { | 65 class LayerScrollableArea final : public ScrollableArea { |
| 66 friend class Internals; | 66 friend class Internals; |
| 67 | 67 |
| 68 public: | 68 public: |
| 69 // FIXME: We should pass in the RenderBox but this opens a window | 69 // FIXME: We should pass in the RenderBox but this opens a window |
| 70 // for crashers during RenderLayer setup (see crbug.com/368062). | 70 // for crashers during Layer setup (see crbug.com/368062). |
| 71 RenderLayerScrollableArea(RenderLayer&); | 71 LayerScrollableArea(Layer&); |
| 72 virtual ~RenderLayerScrollableArea(); | 72 virtual ~LayerScrollableArea(); |
| 73 | 73 |
| 74 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } | 74 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } |
| 75 bool hasVerticalScrollbar() const { return verticalScrollbar(); } | 75 bool hasVerticalScrollbar() const { return verticalScrollbar(); } |
| 76 | 76 |
| 77 virtual Scrollbar* horizontalScrollbar() const override { return m_hBar.get(
); } | 77 virtual Scrollbar* horizontalScrollbar() const override { return m_hBar.get(
); } |
| 78 virtual Scrollbar* verticalScrollbar() const override { return m_vBar.get();
} | 78 virtual Scrollbar* verticalScrollbar() const override { return m_vBar.get();
} |
| 79 | 79 |
| 80 virtual HostWindow* hostWindow() const override; | 80 virtual HostWindow* hostWindow() const override; |
| 81 | 81 |
| 82 virtual GraphicsLayer* layerForScrolling() const override; | 82 virtual GraphicsLayer* layerForScrolling() const override; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 enum LCDTextMode { | 194 enum LCDTextMode { |
| 195 ConsiderLCDText, | 195 ConsiderLCDText, |
| 196 IgnoreLCDText | 196 IgnoreLCDText |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 void updateNeedsCompositedScrolling(LCDTextMode = ConsiderLCDText); | 199 void updateNeedsCompositedScrolling(LCDTextMode = ConsiderLCDText); |
| 200 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } | 200 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } |
| 201 | 201 |
| 202 // These are used during compositing updates to determine if the overflow | 202 // These are used during compositing updates to determine if the overflow |
| 203 // controls need to be repositioned in the GraphicsLayer tree. | 203 // controls need to be repositioned in the GraphicsLayer tree. |
| 204 void setTopmostScrollChild(RenderLayer*); | 204 void setTopmostScrollChild(Layer*); |
| 205 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild);
return m_topmostScrollChild; } | 205 Layer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); retur
n m_topmostScrollChild; } |
| 206 | 206 |
| 207 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; | 207 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const; |
| 208 | 208 |
| 209 RenderBox& box() const; | 209 RenderBox& box() const; |
| 210 RenderLayer* layer() const; | 210 Layer* layer() const; |
| 211 | 211 |
| 212 RenderScrollbarPart* resizer() { return m_resizer; } | 212 RenderScrollbarPart* resizer() { return m_resizer; } |
| 213 | 213 |
| 214 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } | 214 const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrol
lbarOffset; } |
| 215 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } | 215 void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverl
ayScrollbarOffset = offset; } |
| 216 | 216 |
| 217 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; | 217 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; |
| 218 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; | 218 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; |
| 219 | 219 |
| 220 private: | 220 private: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 242 | 242 |
| 243 // See comments on isPointInResizeControl. | 243 // See comments on isPointInResizeControl. |
| 244 void updateResizerAreaSet(); | 244 void updateResizerAreaSet(); |
| 245 void updateResizerStyle(); | 245 void updateResizerStyle(); |
| 246 | 246 |
| 247 | 247 |
| 248 void updateScrollableAreaSet(bool hasOverflow); | 248 void updateScrollableAreaSet(bool hasOverflow); |
| 249 | 249 |
| 250 void updateCompositingLayersAfterScroll(); | 250 void updateCompositingLayersAfterScroll(); |
| 251 | 251 |
| 252 RenderLayer& m_layer; | 252 Layer& m_layer; |
| 253 | 253 |
| 254 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. | 254 // Keeps track of whether the layer is currently resizing, so events can cau
se resizing to start and stop. |
| 255 unsigned m_inResizeMode : 1; | 255 unsigned m_inResizeMode : 1; |
| 256 unsigned m_scrollsOverflow : 1; | 256 unsigned m_scrollsOverflow : 1; |
| 257 | 257 |
| 258 unsigned m_scrollDimensionsDirty : 1; | 258 unsigned m_scrollDimensionsDirty : 1; |
| 259 unsigned m_inOverflowRelayout : 1; | 259 unsigned m_inOverflowRelayout : 1; |
| 260 | 260 |
| 261 RenderLayer* m_nextTopmostScrollChild; | 261 Layer* m_nextTopmostScrollChild; |
| 262 RenderLayer* m_topmostScrollChild; | 262 Layer* m_topmostScrollChild; |
| 263 | 263 |
| 264 // FIXME: once cc can handle composited scrolling with clip paths, we will | 264 // FIXME: once cc can handle composited scrolling with clip paths, we will |
| 265 // no longer need this bit. | 265 // no longer need this bit. |
| 266 unsigned m_needsCompositedScrolling : 1; | 266 unsigned m_needsCompositedScrolling : 1; |
| 267 | 267 |
| 268 // The width/height of our scrolled area. | 268 // The width/height of our scrolled area. |
| 269 LayoutRect m_overflowRect; | 269 LayoutRect m_overflowRect; |
| 270 | 270 |
| 271 // This is the (scroll) offset from scrollOrigin(). | 271 // This is the (scroll) offset from scrollOrigin(). |
| 272 DoubleSize m_scrollOffset; | 272 DoubleSize m_scrollOffset; |
| 273 | 273 |
| 274 IntPoint m_cachedOverlayScrollbarOffset; | 274 IntPoint m_cachedOverlayScrollbarOffset; |
| 275 | 275 |
| 276 // For areas with overflow, we have a pair of scrollbars. | 276 // For areas with overflow, we have a pair of scrollbars. |
| 277 RefPtrWillBePersistent<Scrollbar> m_hBar; | 277 RefPtrWillBePersistent<Scrollbar> m_hBar; |
| 278 RefPtrWillBePersistent<Scrollbar> m_vBar; | 278 RefPtrWillBePersistent<Scrollbar> m_vBar; |
| 279 | 279 |
| 280 // Renderers to hold our custom scroll corner. | 280 // Renderers to hold our custom scroll corner. |
| 281 RenderScrollbarPart* m_scrollCorner; | 281 RenderScrollbarPart* m_scrollCorner; |
| 282 | 282 |
| 283 // Renderers to hold our custom resizer. | 283 // Renderers to hold our custom resizer. |
| 284 RenderScrollbarPart* m_resizer; | 284 RenderScrollbarPart* m_resizer; |
| 285 }; | 285 }; |
| 286 | 286 |
| 287 } // namespace blink | 287 } // namespace blink |
| 288 | 288 |
| 289 #endif // RenderLayerScrollableArea_h | 289 #endif // LayerScrollableArea_h |
| OLD | NEW |