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

Side by Side Diff: sky/engine/platform/scroll/ScrollableArea.h

Issue 842113005: Delete a bunch of noop paint invalidation code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix comment Created 5 years, 11 months 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // This getter will return null if the ScrollAnimator hasn't been created ye t. 108 // This getter will return null if the ScrollAnimator hasn't been created ye t.
109 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim ators->scrollAnimator.get() : 0; } 109 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim ators->scrollAnimator.get() : 0; }
110 110
111 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 111 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
112 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 112 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
113 113
114 // FIXME(bokan): Meaningless name, rename to isActiveFocus 114 // FIXME(bokan): Meaningless name, rename to isActiveFocus
115 virtual bool isActive() const = 0; 115 virtual bool isActive() const = 0;
116 virtual int scrollSize(ScrollbarOrientation) const = 0; 116 virtual int scrollSize(ScrollbarOrientation) const = 0;
117 void invalidateScrollbar(Scrollbar*, const IntRect&);
118 117
119 // Convert points and rects between the scrollbar and its containing view. 118 // Convert points and rects between the scrollbar and its containing view.
120 // The client needs to implement these in order to be aware of layout effect s 119 // The client needs to implement these in order to be aware of layout effect s
121 // like CSS transforms. 120 // like CSS transforms.
122 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const = 0; 121 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const = 0;
123 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const = 0; 122 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const = 0;
124 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const = 0; 123 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const = 0;
125 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const = 0; 124 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const = 0;
126 125
127 virtual Scrollbar* horizontalScrollbar() const = 0; 126 virtual Scrollbar* horizontalScrollbar() const = 0;
(...skipping 23 matching lines...) Expand all
151 virtual bool updateAfterCompositingChange() = 0; 150 virtual bool updateAfterCompositingChange() = 0;
152 151
153 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 152 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
154 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 153 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
155 154
156 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } 155 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); }
157 int minimumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPositio n().y(); } 156 int minimumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? minimumScrollPosition().x() : minimumScrollPositio n().y(); }
158 int maximumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPositio n().y(); } 157 int maximumScrollPosition(ScrollbarOrientation orientation) { return orienta tion == HorizontalScrollbar ? maximumScrollPosition().x() : maximumScrollPositio n().y(); }
159 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPositi on(orientation)); } 158 int clampScrollPosition(ScrollbarOrientation orientation, int pos) { return std::max(std::min(pos, maximumScrollPosition(orientation)), minimumScrollPositi on(orientation)); }
160 159
161 bool hasVerticalBarDamage() const { return !m_verticalBarDamage.isEmpty(); }
162 bool hasHorizontalBarDamage() const { return !m_horizontalBarDamage.isEmpty( ); }
163 const IntRect& verticalBarDamage() const { return m_verticalBarDamage; }
164 const IntRect& horizontalBarDamage() const { return m_horizontalBarDamage; }
165
166 void addScrollbarDamage(Scrollbar* scrollbar, const IntRect& rect)
167 {
168 if (scrollbar == horizontalScrollbar())
169 m_horizontalBarDamage.unite(rect);
170 else
171 m_verticalBarDamage.unite(rect);
172 }
173
174 void resetScrollbarDamage()
175 {
176 m_verticalBarDamage = IntRect();
177 m_horizontalBarDamage = IntRect();
178 }
179
180 protected: 160 protected:
181 ScrollableArea(); 161 ScrollableArea();
182 virtual ~ScrollableArea(); 162 virtual ~ScrollableArea();
183 163
184 void setScrollOrigin(const IntPoint&); 164 void setScrollOrigin(const IntPoint&);
185 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 165 void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
186 166
187 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
188
189 private: 167 private:
190 void scrollPositionChanged(const IntPoint&); 168 void scrollPositionChanged(const IntPoint&);
191 169
192 // NOTE: Only called from the ScrollAnimator. 170 // NOTE: Only called from the ScrollAnimator.
193 friend class ScrollAnimator; 171 friend class ScrollAnimator;
194 void setScrollOffsetFromAnimation(const IntPoint&); 172 void setScrollOffsetFromAnimation(const IntPoint&);
195 173
196 // This function should be overriden by subclasses to perform the actual 174 // This function should be overriden by subclasses to perform the actual
197 // scroll of the content. 175 // scroll of the content.
198 virtual void setScrollOffset(const IntPoint&) = 0; 176 virtual void setScrollOffset(const IntPoint&) = 0;
199 177
200 int lineStep(ScrollbarOrientation) const; 178 int lineStep(ScrollbarOrientation) const;
201 int documentStep(ScrollbarOrientation) const; 179 int documentStep(ScrollbarOrientation) const;
202 virtual int pageStep(ScrollbarOrientation) const = 0; 180 virtual int pageStep(ScrollbarOrientation) const = 0;
203 float pixelStep(ScrollbarOrientation) const; 181 float pixelStep(ScrollbarOrientation) const;
204 182
205 // Stores the paint invalidations for the scrollbars during layout.
206 IntRect m_horizontalBarDamage;
207 IntRect m_verticalBarDamage;
208
209 struct ScrollableAreaAnimators { 183 struct ScrollableAreaAnimators {
210 OwnPtr<ScrollAnimator> scrollAnimator; 184 OwnPtr<ScrollAnimator> scrollAnimator;
211 }; 185 };
212 186
213 mutable OwnPtr<ScrollableAreaAnimators> m_animators; 187 mutable OwnPtr<ScrollableAreaAnimators> m_animators;
214 unsigned m_constrainsScrollingToContentEdge : 1; 188 unsigned m_constrainsScrollingToContentEdge : 1;
215 189
216 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity 190 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity
217 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity 191 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity
218 192
(...skipping 11 matching lines...) Expand all
230 // vertical-lr / ltr NO NO 204 // vertical-lr / ltr NO NO
231 // vertical-lr / rtl NO YES 205 // vertical-lr / rtl NO YES
232 // vertical-rl / ltr YES NO 206 // vertical-rl / ltr YES NO
233 // vertical-rl / rtl YES YES 207 // vertical-rl / rtl YES YES
234 IntPoint m_scrollOrigin; 208 IntPoint m_scrollOrigin;
235 }; 209 };
236 210
237 } // namespace blink 211 } // namespace blink
238 212
239 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLABLEAREA_H_ 213 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLABLEAREA_H_
OLDNEW
« no previous file with comments | « sky/engine/platform/graphics/ImageBufferSurface.h ('k') | sky/engine/platform/scroll/ScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698