OLD | NEW |
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 Loading... |
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 Loading... |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
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 |
OLD | NEW |