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

Side by Side Diff: Source/web/PopupListBox.h

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase upto and resolve r182737 conflict. Created 6 years, 2 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) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 int yOffset; // y offset of this item, relative to the top of the popup. 80 int yOffset; // y offset of this item, relative to the top of the popup.
81 TextDirection textDirection; 81 TextDirection textDirection;
82 bool hasTextDirectionOverride; 82 bool hasTextDirectionOverride;
83 bool enabled; 83 bool enabled;
84 bool displayNone; 84 bool displayNone;
85 }; 85 };
86 86
87 // This class manages the scrollable content inside a <select> popup. 87 // This class manages the scrollable content inside a <select> popup.
88 class PopupListBox FINAL : public Widget, public ScrollableArea, public PopupCon tent { 88 class PopupListBox FINAL : public Widget, public ScrollableArea, public PopupCon tent {
89 public: 89 public:
90 static PassRefPtr<PopupListBox> create(PopupMenuClient* client, bool deviceS upportsTouch, PopupContainer* container) 90 static PassRefPtrWillBeRawPtr<PopupListBox> create(PopupMenuClient* client, bool deviceSupportsTouch, PopupContainer* container)
91 { 91 {
92 return adoptRef(new PopupListBox(client, deviceSupportsTouch, container) ); 92 return adoptRefWillBeNoop(new PopupListBox(client, deviceSupportsTouch, container));
93 } 93 }
94 94
95 // Widget 95 // Widget
96 virtual void invalidateRect(const IntRect&) OVERRIDE; 96 virtual void invalidateRect(const IntRect&) OVERRIDE;
97 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE; 97 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE;
98 virtual HostWindow* hostWindow() const OVERRIDE; 98 virtual HostWindow* hostWindow() const OVERRIDE;
99 virtual void setFrameRect(const IntRect&) OVERRIDE; 99 virtual void setFrameRect(const IntRect&) OVERRIDE;
100 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co nst OVERRIDE; 100 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co nst OVERRIDE;
101 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint&) co nst OVERRIDE; 101 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint&) co nst OVERRIDE;
102 102
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 virtual void setMaxWidthAndLayout(int) OVERRIDE; 173 virtual void setMaxWidthAndLayout(int) OVERRIDE;
174 174
175 void disconnectClient() { m_popupClient = 0; } 175 void disconnectClient() { m_popupClient = 0; }
176 176
177 const Vector<PopupItem*>& items() const { return m_items; } 177 const Vector<PopupItem*>& items() const { return m_items; }
178 178
179 virtual int popupContentHeight() const OVERRIDE; 179 virtual int popupContentHeight() const OVERRIDE;
180 180
181 static const int defaultMaxHeight; 181 static const int defaultMaxHeight;
182 182
183 void trace(Visitor*) OVERRIDE;
184
183 protected: 185 protected:
184 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } 186 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { }
185 187
186 private: 188 private:
187 friend class PopupContainer; 189 friend class PopupContainer;
188 friend class RefCounted<PopupListBox>; 190 friend class RefCounted<PopupListBox>;
189 191
190 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*); 192 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*);
191 virtual ~PopupListBox(); 193 virtual ~PopupListBox();
192 194
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // popup, this can be thought of as the page size in data units. 275 // popup, this can be thought of as the page size in data units.
274 int m_visibleRows; 276 int m_visibleRows;
275 277
276 // Our suggested width, not including scrollbar. 278 // Our suggested width, not including scrollbar.
277 int m_baseWidth; 279 int m_baseWidth;
278 280
279 // The maximum height we can be without being off-screen. 281 // The maximum height we can be without being off-screen.
280 int m_maxHeight; 282 int m_maxHeight;
281 283
282 // A list of the options contained within the <select> 284 // A list of the options contained within the <select>
283 Vector<PopupItem*> m_items; 285 Vector<PopupItem*> m_items;
haraken 2014/09/26 09:19:25 Not related to this CL: We should use Vector<OwnPt
284 286
285 // The <select> PopupMenuClient that opened us. 287 // The <select> PopupMenuClient that opened us.
286 PopupMenuClient* m_popupClient; 288 PopupMenuClient* m_popupClient;
287 289
288 // The scrollbar which has mouse capture. Mouse events go straight to this 290 // The scrollbar which has mouse capture. Mouse events go straight to this
289 // if not null. 291 // if not null.
290 RefPtr<Scrollbar> m_capturingScrollbar; 292 RefPtrWillBeMember<Scrollbar> m_capturingScrollbar;
291 293
292 // The last scrollbar that the mouse was over. Used for mouseover highlights . 294 // The last scrollbar that the mouse was over. Used for mouseover highlights .
293 RefPtr<Scrollbar> m_lastScrollbarUnderMouse; 295 RefPtrWillBeMember<Scrollbar> m_lastScrollbarUnderMouse;
294 296
295 // The string the user has typed so far into the popup. Used for typeAheadFi nd. 297 // The string the user has typed so far into the popup. Used for typeAheadFi nd.
296 String m_typedString; 298 String m_typedString;
297 299
298 // The char the user has hit repeatedly. Used for typeAheadFind. 300 // The char the user has hit repeatedly. Used for typeAheadFind.
299 UChar m_repeatingChar; 301 UChar m_repeatingChar;
300 302
301 // The last time the user hit a key. Used for typeAheadFind. 303 // The last time the user hit a key. Used for typeAheadFind.
302 TimeStamp m_lastCharTime; 304 TimeStamp m_lastCharTime;
303 305
304 // If width exeeds screen width, we have to clip it. 306 // If width exeeds screen width, we have to clip it.
305 int m_maxWindowWidth; 307 int m_maxWindowWidth;
306 308
307 // To forward last mouse release event. 309 // To forward last mouse release event.
308 RefPtrWillBePersistent<Element> m_focusedElement; 310 RefPtrWillBeMember<Element> m_focusedElement;
309 311
310 PopupContainer* m_container; 312 // Oilpan: the container owns/wraps this listbox. A (strong)
313 // Member can be used for the back reference without extending the
314 // container's lifetime; the two objects live equally long.
315 RawPtrWillBeMember<PopupContainer> m_container;
311 316
312 RefPtr<Scrollbar> m_verticalScrollbar; 317 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar;
313 IntSize m_contentsSize; 318 IntSize m_contentsSize;
314 IntPoint m_scrollOffset; 319 IntPoint m_scrollOffset;
315 }; 320 };
316 321
317 } // namespace blink 322 } // namespace blink
318 323
319 #endif 324 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698