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

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

Issue 1013303004: Fix issue on <select> style change when popup is visible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed test expectation Created 5 years, 8 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // PopupListBox methods 126 // PopupListBox methods
127 127
128 bool handleMouseDownEvent(const PlatformMouseEvent&); 128 bool handleMouseDownEvent(const PlatformMouseEvent&);
129 bool handleMouseMoveEvent(const PlatformMouseEvent&); 129 bool handleMouseMoveEvent(const PlatformMouseEvent&);
130 bool handleMouseReleaseEvent(const PlatformMouseEvent&); 130 bool handleMouseReleaseEvent(const PlatformMouseEvent&);
131 bool handleWheelEvent(const PlatformWheelEvent&); 131 bool handleWheelEvent(const PlatformWheelEvent&);
132 bool handleKeyEvent(const PlatformKeyboardEvent&); 132 bool handleKeyEvent(const PlatformKeyboardEvent&);
133 bool handleTouchEvent(const PlatformTouchEvent&); 133 bool handleTouchEvent(const PlatformTouchEvent&);
134 bool handleGestureEvent(const PlatformGestureEvent&); 134 bool handleGestureEvent(const PlatformGestureEvent&);
135 135
136 // Closes the popup 136 // Closes the popup without accepting a selection.
137 void abandon(); 137 void cancel();
138 138
139 // Updates our internal list to match the client. 139 // Updates our internal list to match the client.
140 void updateFromElement(); 140 void updateFromElement();
141 141
142 // Sets the index of the option that is displayed in the <select> widget in the page 142 // Sets the index of the option that is displayed in the popup.
143 void setOriginalIndex(int); 143 void setSelectedIndex(int index) { m_selectedIndex = index; }
144 144
145 // Gets the index of the item that the user is currently moused over or has 145 // Gets the index of the item that the user is currently moused over or has
146 // selected with the keyboard. This is not the same as the original index, 146 // selected with the keyboard. This is not the same as the element value,
147 // since the user has not yet accepted this input. 147 // since the user has not yet accepted this input.
148 int selectedIndex() const { return m_selectedIndex; } 148 int selectedIndex() const { return m_selectedIndex; }
149 149
150 // Moves selection down/up the given number of items, scrolling if necessary . 150 // Moves selection down/up the given number of items, scrolling if necessary .
151 // Positive is down. The resulting index will be clamped to the range 151 // Positive is down. The resulting index will be clamped to the range
152 // [0, numItems), and non-option items will be skipped. 152 // [0, numItems), and non-option items will be skipped.
153 void adjustSelectedIndex(int delta); 153 void adjustSelectedIndex(int delta);
154 154
155 // Returns the number of items in the list. 155 // Returns the number of items in the list.
156 int numItems() const { return static_cast<int>(m_items.size()); } 156 int numItems() const { return static_cast<int>(m_items.size()); }
(...skipping 28 matching lines...) Expand all
185 protected: 185 protected:
186 virtual void invalidateScrollCornerRect(const IntRect&) override { } 186 virtual void invalidateScrollCornerRect(const IntRect&) override { }
187 187
188 private: 188 private:
189 friend class PopupContainer; 189 friend class PopupContainer;
190 friend class RefCounted<PopupListBox>; 190 friend class RefCounted<PopupListBox>;
191 191
192 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*); 192 PopupListBox(PopupMenuClient*, bool deviceSupportsTouch, PopupContainer*);
193 virtual ~PopupListBox(); 193 virtual ~PopupListBox();
194 194
195 // Hides the popup. Other classes should not call this. Use abandon instead. 195 // Hides the popup. Other classes should not call this. Use cancel instead.
196 void hidePopup(); 196 void hidePopup();
197 197
198 // Returns true if the selection can be changed to index. 198 // Returns true if the selection can be changed to index.
199 // Disabled items, or labels cannot be selected. 199 // Disabled items, or labels cannot be selected.
200 bool isSelectableItem(int index); 200 bool isSelectableItem(int index);
201 201
202 // Select an index in the list, scrolling if necessary. 202 // Select an index in the list, scrolling if necessary.
203 void selectIndex(int index); 203 void selectIndex(int index);
204 204
205 // Accepts the selected index as the value to be displayed in the <select> 205 // Accepts the selected index as the value to be displayed in the <select>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 IntRect contentsToWindow(const IntRect&) const; 248 IntRect contentsToWindow(const IntRect&) const;
249 void setContentsSize(const IntSize&); 249 void setContentsSize(const IntSize&);
250 void adjustScrollbarExistence(); 250 void adjustScrollbarExistence();
251 void updateScrollbarGeometry(); 251 void updateScrollbarGeometry();
252 IntRect windowClipRect() const; 252 IntRect windowClipRect() const;
253 253
254 // If the device is a touch screen we increase the height of menu items 254 // If the device is a touch screen we increase the height of menu items
255 // to make it easier to unambiguously touch them. 255 // to make it easier to unambiguously touch them.
256 bool m_deviceSupportsTouch; 256 bool m_deviceSupportsTouch;
257 257
258 // This is the index of the item marked as "selected" - i.e. displayed in
259 // the widget on the page.
260 int m_originalIndex;
261
262 // This is the index of the item that the user is hovered over or has 258 // This is the index of the item that the user is hovered over or has
263 // selected using the keyboard in the list. They have not confirmed this 259 // selected using the keyboard in the list. They have not confirmed this
264 // selection by clicking or pressing enter yet however. 260 // selection by clicking or pressing enter yet however.
265 int m_selectedIndex; 261 int m_selectedIndex;
266 262
267 // If >= 0, this is the index we should accept if the popup is "abandoned".
268 // This is used for keyboard navigation, where we want the
269 // selection to change immediately, and is only used if the settings
270 // acceptOnAbandon field is true.
271 int m_acceptedIndexOnAbandon;
272
273 // This is the number of rows visible in the popup. The maximum number 263 // This is the number of rows visible in the popup. The maximum number
274 // visible at a time is defined as being kMaxVisibleRows. For a scrolled 264 // visible at a time is defined as being kMaxVisibleRows. For a scrolled
275 // popup, this can be thought of as the page size in data units. 265 // popup, this can be thought of as the page size in data units.
276 int m_visibleRows; 266 int m_visibleRows;
277 267
278 // Our suggested width, not including scrollbar. 268 // Our suggested width, not including scrollbar.
279 int m_baseWidth; 269 int m_baseWidth;
280 270
281 // The maximum height we can be without being off-screen. 271 // The maximum height we can be without being off-screen.
282 int m_maxHeight; 272 int m_maxHeight;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 RawPtrWillBeMember<PopupContainer> m_container; 305 RawPtrWillBeMember<PopupContainer> m_container;
316 306
317 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar; 307 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar;
318 IntSize m_contentsSize; 308 IntSize m_contentsSize;
319 IntPoint m_scrollOffset; 309 IntPoint m_scrollOffset;
320 }; 310 };
321 311
322 } // namespace blink 312 } // namespace blink
323 313
324 #endif 314 #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