Changeset 105253 in webkit
- Timestamp:
- Jan 18, 2012 2:39:31 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r105250 r105253 1 2012-01-18 Jun Mukai <mukai@chromium.org> 2 3 Use RenderTheme in HTMLSelectElement instead of #defines. 4 <http://webkit.org/b/76519> 5 6 Reviewed by Kent Tamura. 7 8 Tests: no new tests because of no behavioral changes. 9 10 * html/HTMLSelectElement.cpp: 11 (WebCore::HTMLSelectElement::platformHandleKeydownEvent): 12 (WebCore::HTMLSelectElement::menuListDefaultEventHandler): 13 * platform/gtk/RenderThemeGtk.h: 14 (WebCore::RenderThemeGtk::popsMenuByArrowKeys): 15 * rendering/RenderTheme.h: 16 (WebCore::RenderTheme::popsMenuByArrowKeys): 17 (WebCore::RenderTheme::popsMenuBySpaceOrReturn): 18 * rendering/RenderThemeChromiumLinux.h: 19 (WebCore::RenderThemeChromiumLinux::popsMenuBySpaceOrReturn): 20 * rendering/RenderThemeMac.h: 21 (WebCore::RenderThemeMac::popsMenuByArrowKeys): 22 1 23 2012-01-18 Abhishek Arya <inferno@chromium.org> 2 24 -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r104864 r105253 62 62 static const unsigned maxSelectItems = 10000; 63 63 64 // Configure platform-specific behavior when focused pop-up receives arrow/space/return keystroke.65 // (PLATFORM(MAC) and PLATFORM(GTK) are always false in Chromium, hence the extra tests.)66 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))67 #define ARROW_KEYS_POP_MENU 168 #define SPACE_OR_RETURN_POP_MENU 069 #elif PLATFORM(GTK) || (PLATFORM(CHROMIUM) && OS(UNIX))70 #define ARROW_KEYS_POP_MENU 071 #define SPACE_OR_RETURN_POP_MENU 172 #else73 #define ARROW_KEYS_POP_MENU 074 #define SPACE_OR_RETURN_POP_MENU 075 #endif76 77 64 static const DOMTimeStamp typeAheadTimeout = 1000; 78 65 … … 992 979 bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event) 993 980 { 994 #if ARROW_KEYS_POP_MENU 981 const Page* page = document()->page(); 982 RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaultTheme(); 983 984 if (!renderTheme->popsMenuByArrowKeys()) 985 return false; 986 995 987 if (!isSpatialNavigationEnabled(document()->frame())) { 996 988 if (event->keyIdentifier() == "Down" || event->keyIdentifier() == "Up") { … … 1013 1005 return true; 1014 1006 } 1015 #else 1016 UNUSED_PARAM(event); 1007 1008 return false; 1009 } 1017 1010 #endif 1018 return false;1019 }1020 #endif1021 1011 1022 1012 void HTMLSelectElement::menuListDefaultEventHandler(Event* event) 1023 1013 { 1014 const Page* page = document()->page(); 1015 RefPtr<RenderTheme> renderTheme = page ? page->theme() : RenderTheme::defaultTheme(); 1016 1024 1017 if (event->type() == eventNames().keydownEvent) { 1025 1018 if (!renderer() || !event->isKeyboardEvent()) … … 1080 1073 } 1081 1074 1082 #if SPACE_OR_RETURN_POP_MENU 1083 if (keyCode == ' ' || keyCode == '\r') { 1084 focus(); 1085 1086 // Calling focus() may cause us to lose our renderer, in which case 1087 // do not want to handle the event. 1088 if (!renderer()) 1089 return; 1090 1091 // Save the selection so it can be compared to the new selection 1092 // when dispatching change events during selectOption, which 1093 // gets called from RenderMenuList::valueChanged, which gets called 1094 // after the user makes a selection from the menu. 1095 saveLastSelection(); 1096 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1097 menuList->showPopup(); 1098 handled = true; 1099 } 1100 #elif ARROW_KEYS_POP_MENU 1101 if (keyCode == ' ') { 1102 focus(); 1103 1104 // Calling focus() may cause us to lose our renderer, in which case 1105 // do not want to handle the event. 1106 if (!renderer()) 1107 return; 1108 1109 // Save the selection so it can be compared to the new selection 1110 // when dispatching change events during selectOption, which 1111 // gets called from RenderMenuList::valueChanged, which gets called 1112 // after the user makes a selection from the menu. 1113 saveLastSelection(); 1114 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1115 menuList->showPopup(); 1116 handled = true; 1117 } else if (keyCode == '\r') { 1118 if (form()) 1119 form()->submitImplicitly(event, false); 1120 dispatchChangeEventForMenuList(); 1121 handled = true; 1122 } 1123 #endif 1075 if (renderTheme->popsMenuBySpaceOrReturn()) { 1076 if (keyCode == ' ' || keyCode == '\r') { 1077 focus(); 1078 1079 // Calling focus() may cause us to lose our renderer, in which case 1080 // do not want to handle the event. 1081 if (!renderer()) 1082 return; 1083 1084 // Save the selection so it can be compared to the new selection 1085 // when dispatching change events during selectOption, which 1086 // gets called from RenderMenuList::valueChanged, which gets called 1087 // after the user makes a selection from the menu. 1088 saveLastSelection(); 1089 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1090 menuList->showPopup(); 1091 handled = true; 1092 } 1093 } else if (renderTheme->popsMenuByArrowKeys()) { 1094 if (keyCode == ' ') { 1095 focus(); 1096 1097 // Calling focus() may cause us to lose our renderer, in which case 1098 // do not want to handle the event. 1099 if (!renderer()) 1100 return; 1101 1102 // Save the selection so it can be compared to the new selection 1103 // when dispatching change events during selectOption, which 1104 // gets called from RenderMenuList::valueChanged, which gets called 1105 // after the user makes a selection from the menu. 1106 saveLastSelection(); 1107 if (RenderMenuList* menuList = toRenderMenuList(renderer())) 1108 menuList->showPopup(); 1109 handled = true; 1110 } else if (keyCode == '\r') { 1111 if (form()) 1112 form()->submitImplicitly(event, false); 1113 dispatchChangeEventForMenuList(); 1114 handled = true; 1115 } 1116 } 1117 1124 1118 if (handled) 1125 1119 event->setDefaultHandled(); -
trunk/Source/WebCore/platform/gtk/RenderThemeGtk.h
r99083 r105253 82 82 virtual void systemFont(int propId, FontDescription&) const; 83 83 virtual Color systemColor(int cssValueId) const; 84 85 virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } 84 86 85 87 #if ENABLE(VIDEO) -
trunk/Source/WebCore/rendering/RenderTheme.h
r102655 r105253 210 210 virtual bool shouldHaveSpinButton(HTMLInputElement*) const; 211 211 212 // Functions for <select> elements. 212 213 virtual bool delegatesMenuListRendering() const { return false; } 214 virtual bool popsMenuByArrowKeys() const { return false; } 215 virtual bool popsMenuBySpaceOrReturn() const { return false; } 213 216 214 217 virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed); -
trunk/Source/WebCore/rendering/RenderThemeChromiumLinux.h
r104139 r105253 75 75 virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); 76 76 77 virtual bool popsMenuBySpaceOrReturn() const OVERRIDE { return true; } 78 77 79 #if ENABLE(PROGRESS_TAG) 78 80 virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r105203 r105253 76 76 77 77 virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&); 78 79 virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } 78 80 79 81 #if ENABLE(METER_TAG)
Note: See TracChangeset
for help on using the changeset viewer.