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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int yOffset; // y offset of this item, relative to the top of the popup. | 81 int yOffset; // y offset of this item, relative to the top of the popup. |
82 TextDirection textDirection; | 82 TextDirection textDirection; |
83 bool hasTextDirectionOverride; | 83 bool hasTextDirectionOverride; |
84 bool enabled; | 84 bool enabled; |
85 bool displayNone; | 85 bool displayNone; |
86 }; | 86 }; |
87 | 87 |
88 // This class manages the scrollable content inside a <select> popup. | 88 // This class manages the scrollable content inside a <select> popup. |
89 class PopupListBox final : public Widget, public ScrollableArea, public PopupCon
tent { | 89 class PopupListBox final : public Widget, public ScrollableArea, public PopupCon
tent { |
90 public: | 90 public: |
91 static PassRefPtr<PopupListBox> create(PopupMenuClient* client, bool deviceS
upportsTouch, PopupContainer* container) | 91 static PassRefPtrWillBeRawPtr<PopupListBox> create(PopupMenuClient* client,
bool deviceSupportsTouch, PopupContainer* container) |
92 { | 92 { |
93 return adoptRef(new PopupListBox(client, deviceSupportsTouch, container)
); | 93 return adoptRefWillBeNoop(new PopupListBox(client, deviceSupportsTouch,
container)); |
94 } | 94 } |
95 | 95 |
96 // Widget | 96 // Widget |
97 virtual void invalidateRect(const IntRect&) override; | 97 virtual void invalidateRect(const IntRect&) override; |
98 virtual void paint(GraphicsContext*, const IntRect&) override; | 98 virtual void paint(GraphicsContext*, const IntRect&) override; |
99 virtual HostWindow* hostWindow() const override; | 99 virtual HostWindow* hostWindow() const override; |
100 virtual void setFrameRect(const IntRect&) override; | 100 virtual void setFrameRect(const IntRect&) override; |
101 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co
nst override; | 101 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co
nst override; |
102 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint&) co
nst override; | 102 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint&) co
nst override; |
103 | 103 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 virtual void setMaxWidthAndLayout(int) override; | 174 virtual void setMaxWidthAndLayout(int) override; |
175 | 175 |
176 void disconnectClient() { m_popupClient = 0; } | 176 void disconnectClient() { m_popupClient = 0; } |
177 | 177 |
178 const Vector<PopupItem*>& items() const { return m_items; } | 178 const Vector<PopupItem*>& items() const { return m_items; } |
179 | 179 |
180 virtual int popupContentHeight() const override; | 180 virtual int popupContentHeight() const override; |
181 | 181 |
182 static const int defaultMaxHeight; | 182 static const int defaultMaxHeight; |
183 | 183 |
| 184 void trace(Visitor*) OVERRIDE; |
| 185 |
184 protected: | 186 protected: |
185 virtual void invalidateScrollCornerRect(const IntRect&) override { } | 187 virtual void invalidateScrollCornerRect(const IntRect&) override { } |
186 | 188 |
187 private: | 189 private: |
188 friend class PopupContainer; | 190 friend class PopupContainer; |
189 friend class RefCounted<PopupListBox>; | 191 friend class RefCounted<PopupListBox>; |
190 | 192 |
191 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*); | 193 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*); |
192 virtual ~PopupListBox(); | 194 virtual ~PopupListBox(); |
193 | 195 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 int m_maxHeight; | 283 int m_maxHeight; |
282 | 284 |
283 // A list of the options contained within the <select> | 285 // A list of the options contained within the <select> |
284 Vector<PopupItem*> m_items; | 286 Vector<PopupItem*> m_items; |
285 | 287 |
286 // The <select> PopupMenuClient that opened us. | 288 // The <select> PopupMenuClient that opened us. |
287 PopupMenuClient* m_popupClient; | 289 PopupMenuClient* m_popupClient; |
288 | 290 |
289 // The scrollbar which has mouse capture. Mouse events go straight to this | 291 // The scrollbar which has mouse capture. Mouse events go straight to this |
290 // if not null. | 292 // if not null. |
291 RefPtr<Scrollbar> m_capturingScrollbar; | 293 RefPtrWillBeMember<Scrollbar> m_capturingScrollbar; |
292 | 294 |
293 // The last scrollbar that the mouse was over. Used for mouseover highlights
. | 295 // The last scrollbar that the mouse was over. Used for mouseover highlights
. |
294 RefPtr<Scrollbar> m_lastScrollbarUnderMouse; | 296 RefPtrWillBeMember<Scrollbar> m_lastScrollbarUnderMouse; |
295 | 297 |
296 // The string the user has typed so far into the popup. Used for typeAheadFi
nd. | 298 // The string the user has typed so far into the popup. Used for typeAheadFi
nd. |
297 String m_typedString; | 299 String m_typedString; |
298 | 300 |
299 // The char the user has hit repeatedly. Used for typeAheadFind. | 301 // The char the user has hit repeatedly. Used for typeAheadFind. |
300 UChar m_repeatingChar; | 302 UChar m_repeatingChar; |
301 | 303 |
302 // The last time the user hit a key. Used for typeAheadFind. | 304 // The last time the user hit a key. Used for typeAheadFind. |
303 TimeStamp m_lastCharTime; | 305 TimeStamp m_lastCharTime; |
304 | 306 |
305 // If width exeeds screen width, we have to clip it. | 307 // If width exeeds screen width, we have to clip it. |
306 int m_maxWindowWidth; | 308 int m_maxWindowWidth; |
307 | 309 |
308 // To forward last mouse release event. | 310 // To forward last mouse release event. |
309 RefPtrWillBePersistent<Element> m_focusedElement; | 311 RefPtrWillBeMember<Element> m_focusedElement; |
310 | 312 |
311 PopupContainer* m_container; | 313 // Oilpan: the container owns/wraps this listbox. A (strong) |
| 314 // Member can be used for the back reference without extending the |
| 315 // container's lifetime; the two objects live equally long. |
| 316 RawPtrWillBeMember<PopupContainer> m_container; |
312 | 317 |
313 RefPtr<Scrollbar> m_verticalScrollbar; | 318 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar; |
314 IntSize m_contentsSize; | 319 IntSize m_contentsSize; |
315 IntPoint m_scrollOffset; | 320 IntPoint m_scrollOffset; |
316 }; | 321 }; |
317 | 322 |
318 } // namespace blink | 323 } // namespace blink |
319 | 324 |
320 #endif | 325 #endif |
OLD | NEW |