Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: sky/engine/core/rendering/RenderLayerScrollableArea.h

Issue 689283003: Remove scroll corners and resizers. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
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 #include "platform/scroll/ScrollableArea.h" 47 #include "platform/scroll/ScrollableArea.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 enum ResizerHitTestType {
52 ResizerForPointer,
53 ResizerForTouch
54 };
55
56 class PlatformEvent; 51 class PlatformEvent;
57 class RenderBox; 52 class RenderBox;
58 class RenderLayer; 53 class RenderLayer;
59 54
60 class RenderLayerScrollableArea final : public ScrollableArea { 55 class RenderLayerScrollableArea final : public ScrollableArea {
61 public: 56 public:
62 // FIXME: We should pass in the RenderBox but this opens a window 57 // FIXME: We should pass in the RenderBox but this opens a window
63 // for crashers during RenderLayer setup (see crbug.com/368062). 58 // for crashers during RenderLayer setup (see crbug.com/368062).
64 RenderLayerScrollableArea(RenderLayer&); 59 RenderLayerScrollableArea(RenderLayer&);
65 virtual ~RenderLayerScrollableArea(); 60 virtual ~RenderLayerScrollableArea();
66 61
67 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); } 62 bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
68 bool hasVerticalScrollbar() const { return verticalScrollbar(); } 63 bool hasVerticalScrollbar() const { return verticalScrollbar(); }
69 64
70 virtual Scrollbar* horizontalScrollbar() const override { return m_hBar.get( ); } 65 virtual Scrollbar* horizontalScrollbar() const override { return m_hBar.get( ); }
71 virtual Scrollbar* verticalScrollbar() const override { return m_vBar.get(); } 66 virtual Scrollbar* verticalScrollbar() const override { return m_vBar.get(); }
72 67
73 virtual HostWindow* hostWindow() const override; 68 virtual HostWindow* hostWindow() const override;
74 69
75 virtual GraphicsLayer* layerForScrolling() const override; 70 virtual GraphicsLayer* layerForScrolling() const override;
76 virtual GraphicsLayer* layerForHorizontalScrollbar() const override; 71 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
77 virtual GraphicsLayer* layerForVerticalScrollbar() const override; 72 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
78 virtual GraphicsLayer* layerForScrollCorner() const override;
79 virtual bool usesCompositedScrolling() const override; 73 virtual bool usesCompositedScrolling() const override;
80 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; 74 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
81 virtual void invalidateScrollCornerRect(const IntRect&) override;
82 virtual bool isActive() const override; 75 virtual bool isActive() const override;
83 virtual bool isScrollCornerVisible() const override; 76 IntRect scrollCornerRect() const;
84 virtual IntRect scrollCornerRect() const override;
85 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override; 77 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override;
86 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override; 78 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override;
87 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const override; 79 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const override;
88 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const override; 80 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const override;
89 virtual int scrollSize(ScrollbarOrientation) const override; 81 virtual int scrollSize(ScrollbarOrientation) const override;
90 virtual void setScrollOffset(const IntPoint&) override; 82 virtual void setScrollOffset(const IntPoint&) override;
91 virtual IntPoint scrollPosition() const override; 83 virtual IntPoint scrollPosition() const override;
92 virtual IntPoint minimumScrollPosition() const override; 84 virtual IntPoint minimumScrollPosition() const override;
93 virtual IntPoint maximumScrollPosition() const override; 85 virtual IntPoint maximumScrollPosition() const override;
94 virtual IntRect visibleContentRect(IncludeScrollbarsInRect) const override; 86 virtual IntRect visibleContentRect(IncludeScrollbarsInRect) const override;
(...skipping 20 matching lines...) Expand all
115 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } 107 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); }
116 108
117 void updateAfterLayout(); 109 void updateAfterLayout();
118 void updateAfterStyleChange(const RenderStyle*); 110 void updateAfterStyleChange(const RenderStyle*);
119 void updateAfterOverflowRecalc(); 111 void updateAfterOverflowRecalc();
120 112
121 virtual bool updateAfterCompositingChange() override; 113 virtual bool updateAfterCompositingChange() override;
122 114
123 bool hasScrollbar() const { return m_hBar || m_vBar; } 115 bool hasScrollbar() const { return m_hBar || m_vBar; }
124 116
125 void resize(const PlatformEvent&, const LayoutSize&);
126 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
127
128 bool inResizeMode() const { return m_inResizeMode; }
129 void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; }
130
131 IntRect touchResizerCornerRect(const IntRect& bounds) const
132 {
133 return resizerCornerRect(bounds, ResizerForTouch);
134 }
135
136 LayoutUnit scrollWidth() const; 117 LayoutUnit scrollWidth() const;
137 LayoutUnit scrollHeight() const; 118 LayoutUnit scrollHeight() const;
138 int pixelSnappedScrollWidth() const; 119 int pixelSnappedScrollWidth() const;
139 int pixelSnappedScrollHeight() const; 120 int pixelSnappedScrollHeight() const;
140 121
141 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const; 122 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const;
142 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const; 123 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const;
143 124
144 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol lYOffset()); } 125 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol lYOffset()); }
145 126
146 void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRe ct& damageRect);
147 void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, co nst IntRect& damageRect, bool paintingOverlayControls); 127 void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, co nst IntRect& damageRect, bool paintingOverlayControls);
148 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam ageRect);
149
150 void positionOverflowControls(const IntSize& offsetFromRoot); 128 void positionOverflowControls(const IntSize& offsetFromRoot);
151 129
152 // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
153 // area.
154 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp e) const;
155 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
156
157 bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation& ) const;
158
159 LayoutRect exposeRect(const LayoutRect&, const ScrollAlignment& alignX, cons t ScrollAlignment& alignY); 130 LayoutRect exposeRect(const LayoutRect&, const ScrollAlignment& alignX, cons t ScrollAlignment& alignY);
160 131
161 // Returns true our scrollable area is in the FrameView's collection of scro llable areas. This can 132 // Returns true our scrollable area is in the FrameView's collection of scro llable areas. This can
162 // only happen if we're both scrollable, and we do in fact overflow. This me ans that overflow: hidden 133 // only happen if we're both scrollable, and we do in fact overflow. This me ans that overflow: hidden
163 // layers never get added to the FrameView's collection. 134 // layers never get added to the FrameView's collection.
164 bool scrollsOverflow() const { return m_scrollsOverflow; } 135 bool scrollsOverflow() const { return m_scrollsOverflow; }
165 136
166 // Rectangle encompassing the scroll corner and resizer rect.
167 IntRect scrollCornerAndResizerRect() const;
168
169 void updateNeedsCompositedScrolling(); 137 void updateNeedsCompositedScrolling();
170 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; } 138 bool needsCompositedScrolling() const { return m_needsCompositedScrolling; }
171 139
172 // These are used during compositing updates to determine if the overflow 140 // These are used during compositing updates to determine if the overflow
173 // controls need to be repositioned in the GraphicsLayer tree. 141 // controls need to be repositioned in the GraphicsLayer tree.
174 void setTopmostScrollChild(RenderLayer*); 142 void setTopmostScrollChild(RenderLayer*);
175 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; } 143 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; }
176 144
177 private: 145 private:
178 bool hasHorizontalOverflow() const; 146 bool hasHorizontalOverflow() const;
(...skipping 12 matching lines...) Expand all
191 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; 159 LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
192 LayoutUnit horizontalScrollbarStart(int minX) const; 160 LayoutUnit horizontalScrollbarStart(int minX) const;
193 IntSize scrollbarOffset(const Scrollbar*) const; 161 IntSize scrollbarOffset(const Scrollbar*) const;
194 162
195 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); 163 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
196 void destroyScrollbar(ScrollbarOrientation); 164 void destroyScrollbar(ScrollbarOrientation);
197 165
198 void setHasHorizontalScrollbar(bool hasScrollbar); 166 void setHasHorizontalScrollbar(bool hasScrollbar);
199 void setHasVerticalScrollbar(bool hasScrollbar); 167 void setHasVerticalScrollbar(bool hasScrollbar);
200 168
201 // See comments on isPointInResizeControl.
202 IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const;
203 bool overflowControlsIntersectRect(const IntRect& localRect) const; 169 bool overflowControlsIntersectRect(const IntRect& localRect) const;
204 void updateResizerAreaSet();
205 void drawPlatformResizerImage(GraphicsContext*, IntRect resizerCornerRect);
206 170
207 RenderBox& box() const; 171 RenderBox& box() const;
208 RenderLayer* layer() const; 172 RenderLayer* layer() const;
209 173
210 void updateScrollableAreaSet(bool hasOverflow); 174 void updateScrollableAreaSet(bool hasOverflow);
211 175
212 void updateCompositingLayersAfterScroll(); 176 void updateCompositingLayersAfterScroll();
213 177
214 RenderLayer& m_layer; 178 RenderLayer& m_layer;
215 179
216 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop.
217 unsigned m_inResizeMode : 1;
218 unsigned m_scrollsOverflow : 1; 180 unsigned m_scrollsOverflow : 1;
219 181
220 unsigned m_scrollDimensionsDirty : 1; 182 unsigned m_scrollDimensionsDirty : 1;
221 unsigned m_inOverflowRelayout : 1; 183 unsigned m_inOverflowRelayout : 1;
222 184
223 RenderLayer* m_nextTopmostScrollChild; 185 RenderLayer* m_nextTopmostScrollChild;
224 RenderLayer* m_topmostScrollChild; 186 RenderLayer* m_topmostScrollChild;
225 187
226 // FIXME: once cc can handle composited scrolling with clip paths, we will 188 // FIXME: once cc can handle composited scrolling with clip paths, we will
227 // no longer need this bit. 189 // no longer need this bit.
228 unsigned m_needsCompositedScrolling : 1; 190 unsigned m_needsCompositedScrolling : 1;
229 191
230 // The width/height of our scrolled area. 192 // The width/height of our scrolled area.
231 LayoutRect m_overflowRect; 193 LayoutRect m_overflowRect;
232 194
233 // This is the (scroll) offset from scrollOrigin(). 195 // This is the (scroll) offset from scrollOrigin().
234 IntSize m_scrollOffset; 196 IntSize m_scrollOffset;
235 197
236 IntPoint m_cachedOverlayScrollbarOffset; 198 IntPoint m_cachedOverlayScrollbarOffset;
237 199
238 // For areas with overflow, we have a pair of scrollbars. 200 // For areas with overflow, we have a pair of scrollbars.
239 RefPtr<Scrollbar> m_hBar; 201 RefPtr<Scrollbar> m_hBar;
240 RefPtr<Scrollbar> m_vBar; 202 RefPtr<Scrollbar> m_vBar;
241 }; 203 };
242 204
243 } // namespace blink 205 } // namespace blink
244 206
245 #endif // RenderLayerScrollableArea_h 207 #endif // RenderLayerScrollableArea_h
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.cpp ('k') | sky/engine/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698