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

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

Issue 398673003: Rename WebCore namespace to blink in bindings and web (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/PopupContainer.cpp ('k') | Source/web/PopupListBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef PopupListBox_h 31 #ifndef PopupListBox_h
32 #define PopupListBox_h 32 #define PopupListBox_h
33 33
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 #include "platform/scroll/FramelessScrollView.h" 35 #include "platform/scroll/FramelessScrollView.h"
36 #include "platform/text/TextDirection.h" 36 #include "platform/text/TextDirection.h"
37 #include "wtf/text/WTFString.h" 37 #include "wtf/text/WTFString.h"
38 38
39 namespace WebCore { 39 namespace blink {
40 class Font; 40 class Font;
41 class GraphicsContext; 41 class GraphicsContext;
42 class IntRect; 42 class IntRect;
43 class PlatformKeyboardEvent; 43 class PlatformKeyboardEvent;
44 class PlatformMouseEvent; 44 class PlatformMouseEvent;
45 class PlatformGestureEvent; 45 class PlatformGestureEvent;
46 class PlatformTouchEvent; 46 class PlatformTouchEvent;
47 class PlatformWheelEvent; 47 class PlatformWheelEvent;
48 class PopupMenuClient; 48 class PopupMenuClient;
49 } 49 }
(...skipping 22 matching lines...) Expand all
72 72
73 PopupItem(const String& label, Type type) 73 PopupItem(const String& label, Type type)
74 : label(label) 74 : label(label)
75 , type(type) 75 , type(type)
76 , yOffset(0) 76 , yOffset(0)
77 { 77 {
78 } 78 }
79 String label; 79 String label;
80 Type type; 80 Type type;
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 WebCore::TextDirection textDirection; 82 blink::TextDirection textDirection;
83 bool hasTextDirectionOverride; 83 bool hasTextDirectionOverride;
84 bool enabled; 84 bool enabled;
85 }; 85 };
86 86
87 // This class uses WebCore code to paint and handle events for a drop-down list 87 // This class uses WebCore code to paint and handle events for a drop-down list
88 // box ("combobox" on Windows). 88 // box ("combobox" on Windows).
89 class PopupListBox FINAL : public WebCore::FramelessScrollView, public PopupCont ent { 89 class PopupListBox FINAL : public blink::FramelessScrollView, public PopupConten t {
90 public: 90 public:
91 static PassRefPtr<PopupListBox> create(WebCore::PopupMenuClient* client, boo l deviceSupportsTouch) 91 static PassRefPtr<PopupListBox> create(blink::PopupMenuClient* client, bool deviceSupportsTouch)
92 { 92 {
93 return adoptRef(new PopupListBox(client, deviceSupportsTouch)); 93 return adoptRef(new PopupListBox(client, deviceSupportsTouch));
94 } 94 }
95 95
96 // FramelessScrollView 96 // FramelessScrollView
97 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERR IDE; 97 virtual void paint(blink::GraphicsContext*, const blink::IntRect&) OVERRIDE;
98 virtual bool handleMouseDownEvent(const WebCore::PlatformMouseEvent&) OVERRI DE; 98 virtual bool handleMouseDownEvent(const blink::PlatformMouseEvent&) OVERRIDE ;
99 virtual bool handleMouseMoveEvent(const WebCore::PlatformMouseEvent&) OVERRI DE; 99 virtual bool handleMouseMoveEvent(const blink::PlatformMouseEvent&) OVERRIDE ;
100 virtual bool handleMouseReleaseEvent(const WebCore::PlatformMouseEvent&) OVE RRIDE; 100 virtual bool handleMouseReleaseEvent(const blink::PlatformMouseEvent&) OVERR IDE;
101 virtual bool handleWheelEvent(const WebCore::PlatformWheelEvent&) OVERRIDE; 101 virtual bool handleWheelEvent(const blink::PlatformWheelEvent&) OVERRIDE;
102 virtual bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&) OVERRIDE; 102 virtual bool handleKeyEvent(const blink::PlatformKeyboardEvent&) OVERRIDE;
103 virtual bool handleTouchEvent(const WebCore::PlatformTouchEvent&) OVERRIDE; 103 virtual bool handleTouchEvent(const blink::PlatformTouchEvent&) OVERRIDE;
104 virtual bool handleGestureEvent(const WebCore::PlatformGestureEvent&) OVERRI DE; 104 virtual bool handleGestureEvent(const blink::PlatformGestureEvent&) OVERRIDE ;
105 105
106 // ScrollView 106 // ScrollView
107 virtual WebCore::HostWindow* hostWindow() const OVERRIDE; 107 virtual blink::HostWindow* hostWindow() const OVERRIDE;
108 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE; 108 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE;
109 109
110 // PopupListBox methods 110 // PopupListBox methods
111 111
112 // Closes the popup 112 // Closes the popup
113 void abandon(); 113 void abandon();
114 114
115 // Updates our internal list to match the client. 115 // Updates our internal list to match the client.
116 void updateFromElement(); 116 void updateFromElement();
117 117
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 const Vector<PopupItem*>& items() const { return m_items; } 156 const Vector<PopupItem*>& items() const { return m_items; }
157 157
158 virtual int popupContentHeight() const OVERRIDE; 158 virtual int popupContentHeight() const OVERRIDE;
159 159
160 static const int defaultMaxHeight; 160 static const int defaultMaxHeight;
161 161
162 private: 162 private:
163 friend class PopupContainer; 163 friend class PopupContainer;
164 friend class RefCounted<PopupListBox>; 164 friend class RefCounted<PopupListBox>;
165 165
166 PopupListBox(WebCore::PopupMenuClient*, bool deviceSupportsTouch); 166 PopupListBox(blink::PopupMenuClient*, bool deviceSupportsTouch);
167 167
168 virtual ~PopupListBox() 168 virtual ~PopupListBox()
169 { 169 {
170 clear(); 170 clear();
171 } 171 }
172 172
173 // Hides the popup. Other classes should not call this. Use abandon instead. 173 // Hides the popup. Other classes should not call this. Use abandon instead.
174 void hidePopup(); 174 void hidePopup();
175 175
176 // Returns true if the selection can be changed to index. 176 // Returns true if the selection can be changed to index.
(...skipping 12 matching lines...) Expand all
189 void clearSelection(); 189 void clearSelection();
190 190
191 // Scrolls to reveal the given index. 191 // Scrolls to reveal the given index.
192 void scrollToRevealRow(int index); 192 void scrollToRevealRow(int index);
193 void scrollToRevealSelection() { scrollToRevealRow(m_selectedIndex); } 193 void scrollToRevealSelection() { scrollToRevealRow(m_selectedIndex); }
194 194
195 // Invalidates the row at the given index. 195 // Invalidates the row at the given index.
196 void invalidateRow(int index); 196 void invalidateRow(int index);
197 197
198 // Get the bounds of a row. 198 // Get the bounds of a row.
199 WebCore::IntRect getRowBounds(int index); 199 blink::IntRect getRowBounds(int index);
200 200
201 // Converts a point to an index of the row the point is over 201 // Converts a point to an index of the row the point is over
202 int pointToRowIndex(const WebCore::IntPoint&); 202 int pointToRowIndex(const blink::IntPoint&);
203 203
204 // Paint an individual row 204 // Paint an individual row
205 void paintRow(WebCore::GraphicsContext*, const WebCore::IntRect&, int rowInd ex); 205 void paintRow(blink::GraphicsContext*, const blink::IntRect&, int rowIndex);
206 206
207 // Test if the given point is within the bounds of the popup window. 207 // Test if the given point is within the bounds of the popup window.
208 bool isPointInBounds(const WebCore::IntPoint&); 208 bool isPointInBounds(const blink::IntPoint&);
209 209
210 // Called when the user presses a text key. Does a prefix-search of the item s. 210 // Called when the user presses a text key. Does a prefix-search of the item s.
211 void typeAheadFind(const WebCore::PlatformKeyboardEvent&); 211 void typeAheadFind(const blink::PlatformKeyboardEvent&);
212 212
213 // Returns the font to use for the given row 213 // Returns the font to use for the given row
214 WebCore::Font getRowFont(int index); 214 blink::Font getRowFont(int index);
215 215
216 // Moves the selection down/up one item, taking care of looping back to the 216 // Moves the selection down/up one item, taking care of looping back to the
217 // first/last element if m_loopSelectionNavigation is true. 217 // first/last element if m_loopSelectionNavigation is true.
218 void selectPreviousRow(); 218 void selectPreviousRow();
219 void selectNextRow(); 219 void selectNextRow();
220 220
221 // If the device is a touch screen we increase the height of menu items 221 // If the device is a touch screen we increase the height of menu items
222 // to make it easier to unambiguously touch them. 222 // to make it easier to unambiguously touch them.
223 bool m_deviceSupportsTouch; 223 bool m_deviceSupportsTouch;
224 224
(...skipping 20 matching lines...) Expand all
245 // Our suggested width, not including scrollbar. 245 // Our suggested width, not including scrollbar.
246 int m_baseWidth; 246 int m_baseWidth;
247 247
248 // The maximum height we can be without being off-screen. 248 // The maximum height we can be without being off-screen.
249 int m_maxHeight; 249 int m_maxHeight;
250 250
251 // A list of the options contained within the <select> 251 // A list of the options contained within the <select>
252 Vector<PopupItem*> m_items; 252 Vector<PopupItem*> m_items;
253 253
254 // The <select> PopupMenuClient that opened us. 254 // The <select> PopupMenuClient that opened us.
255 WebCore::PopupMenuClient* m_popupClient; 255 blink::PopupMenuClient* m_popupClient;
256 256
257 // The scrollbar which has mouse capture. Mouse events go straight to this 257 // The scrollbar which has mouse capture. Mouse events go straight to this
258 // if not null. 258 // if not null.
259 RefPtr<WebCore::Scrollbar> m_capturingScrollbar; 259 RefPtr<blink::Scrollbar> m_capturingScrollbar;
260 260
261 // The last scrollbar that the mouse was over. Used for mouseover highlights . 261 // The last scrollbar that the mouse was over. Used for mouseover highlights .
262 RefPtr<WebCore::Scrollbar> m_lastScrollbarUnderMouse; 262 RefPtr<blink::Scrollbar> m_lastScrollbarUnderMouse;
263 263
264 // The string the user has typed so far into the popup. Used for typeAheadFi nd. 264 // The string the user has typed so far into the popup. Used for typeAheadFi nd.
265 String m_typedString; 265 String m_typedString;
266 266
267 // The char the user has hit repeatedly. Used for typeAheadFind. 267 // The char the user has hit repeatedly. Used for typeAheadFind.
268 UChar m_repeatingChar; 268 UChar m_repeatingChar;
269 269
270 // The last time the user hit a key. Used for typeAheadFind. 270 // The last time the user hit a key. Used for typeAheadFind.
271 TimeStamp m_lastCharTime; 271 TimeStamp m_lastCharTime;
272 272
273 // If width exeeds screen width, we have to clip it. 273 // If width exeeds screen width, we have to clip it.
274 int m_maxWindowWidth; 274 int m_maxWindowWidth;
275 275
276 // To forward last mouse release event. 276 // To forward last mouse release event.
277 RefPtrWillBePersistent<WebCore::Element> m_focusedElement; 277 RefPtrWillBePersistent<blink::Element> m_focusedElement;
278 }; 278 };
279 279
280 } // namespace blink 280 } // namespace blink
281 281
282 #endif 282 #endif
OLDNEW
« no previous file with comments | « Source/web/PopupContainer.cpp ('k') | Source/web/PopupListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698