Accessibility focus set after click on color rect
authorKwangYong Choi <ky0.choi@samsung.com>
Wed, 2 Oct 2013 05:29:00 +0000 (14:29 +0900)
committerKwangYong Choi <ky0.choi@samsung.com>
Fri, 4 Oct 2013 05:07:30 +0000 (14:07 +0900)
[Title] Accessibility focus set after click on color rect.
[Issue#] N_SE-53745
[Problem] Click on color -> press enter changes color.
[Cause] Access object does not have focus, so the enter event is fired on previous color.
[Solution] Change focus after click on color rect.

Change-Id: I6d355d67602990a7cb65ba68ea3c9da90270ab98

Source/WebKit2/UIProcess/API/efl/tizen/InputPicker.cpp
Source/WebKit2/UIProcess/API/efl/tizen/InputPicker.h

index 5db2341..80238b8 100755 (executable)
@@ -175,20 +175,6 @@ InputPicker::InputPicker(Evas_Object* ewkView)
 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
     , m_isColorPickerShown(false)
 #endif
-    , m_color1(0)
-    , m_color2(0)
-    , m_color3(0)
-    , m_color4(0)
-    , m_color5(0)
-    , m_color6(0)
-    , m_color7(0)
-    , m_color8(0)
-    , m_color9(0)
-    , m_color10(0)
-    , m_color11(0)
-    , m_color12(0)
-    , m_color13(0)
-    , m_color14(0)
 {
 }
 
@@ -451,15 +437,46 @@ static void _color_palette_changed_cb(void* data, Evas_Object* obj, void* eventI
 }
 #endif
 
+void InputPicker::colorKeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
+{
+    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
+    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
+        ColorPopupUserData* colorData = static_cast<ColorPopupUserData*>(data);
+        colorData->inputPicker->_color_selected_cb(data, 0, 0, 0);
+    }
+}
+
 void InputPicker::_color_selected_cb(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
 {
     int r = 0;
     int g = 0;
     int b = 0;
     int a = 0;
-    evas_object_color_get(obj, &r, &g, &b, &a);
 
-    evas_object_color_set(static_cast<Evas_Object*>(data), r, g, b, a);
+    ColorPopupUserData* colorData = static_cast<ColorPopupUserData*>(data);
+    evas_object_color_get(colorData->color, &r, &g, &b, &a);
+    evas_object_color_set(colorData->colorRect, r, g, b, a);
+    elm_object_focus_set(colorData->colorAccessObject, true);
+}
+
+void InputPicker::addColorRect(const char* part, int r, int g, int b, ColorPopupUserData* colorData)
+{
+    Evas_Object* color = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
+    evas_object_size_hint_weight_set(color, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_color_set(color, r, g, b, 255);
+    elm_object_part_content_set(m_pickerLayout->layout, part, color);
+    evas_object_show(color);
+
+    Evas_Object* accessObject = elm_access_object_register(color, m_pickerLayout->layout);
+    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
+
+    colorData->inputPicker = this;
+    colorData->colorRect = m_pickerLayout->colorRect;
+    colorData->color = color;
+    colorData->colorAccessObject = accessObject;
+
+    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, colorKeyDownCallback, colorData);
+    evas_object_event_callback_add(color, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, colorData);
 }
 
 void InputPicker::ewk_color_popup(int r, int g, int b)
@@ -520,174 +537,47 @@ void InputPicker::ewk_color_popup(int r, int g, int b)
 
     elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color_palette", colorPalette);
 #else
-    Evas_Object* accessObject = 0;
-    Evas_Object* color1 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color1, 128, 0, 0, 255);
-    evas_object_event_callback_add(color1, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color1", color1);
-    evas_object_show(color1);
-
-    m_color1 = color1;
-    accessObject = elm_access_object_register(color1, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color1KeyDownCallback, this);
-
-    Evas_Object* color2 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color2, 255, 0, 128, 255);
-    evas_object_event_callback_add(color2, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color2", color2);
-    evas_object_show(color2);
-
-    m_color2 = color2;
-    accessObject = elm_access_object_register(color2, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color2KeyDownCallback, this);
-
-    Evas_Object* color3 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color3, 255, 0, 0, 255);
-    evas_object_event_callback_add(color3, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color3", color3);
-    evas_object_show(color3);
-
-    m_color3 = color3;
-    accessObject = elm_access_object_register(color3, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color3KeyDownCallback, this);
-
-    Evas_Object* color4 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color4, 255, 127, 39, 255);
-    evas_object_event_callback_add(color4, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color4", color4);
-    evas_object_show(color4);
-
-    m_color4 = color4;
-    accessObject = elm_access_object_register(color4, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color4KeyDownCallback, this);
-
-    Evas_Object* color5 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color5, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color5, 255, 255, 0, 255);
-    evas_object_event_callback_add(color5, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color5", color5);
-    evas_object_show(color5);
+    static ColorPopupUserData color1Data;
+    addColorRect("elm.swallow.color1", 128, 0, 0, &color1Data);
 
-    m_color5 = color5;
-    accessObject = elm_access_object_register(color5, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color5KeyDownCallback, this);
-
-    Evas_Object* color6 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color6, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color6, 0, 255, 0, 255);
-    evas_object_event_callback_add(color6, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color6", color6);
-    evas_object_show(color6);
+    static ColorPopupUserData color2Data;
+    addColorRect("elm.swallow.color2", 255, 0, 128, &color2Data);
 
-    m_color6 = color6;
-    accessObject = elm_access_object_register(color6, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color6KeyDownCallback, this);
+    static ColorPopupUserData color3Data;
+    addColorRect("elm.swallow.color3", 255, 0, 0, &color3Data);
 
-    Evas_Object* color7 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color7, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color7, 0, 255, 255, 255);
-    evas_object_event_callback_add(color7, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color7", color7);
-    evas_object_show(color7);
+    static ColorPopupUserData color4Data;
+    addColorRect("elm.swallow.color4", 255, 127, 39, &color4Data);
 
-    m_color7 = color7;
-    accessObject = elm_access_object_register(color7, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color7KeyDownCallback, this);
+    static ColorPopupUserData color5Data;
+    addColorRect("elm.swallow.color5", 255, 255, 0, &color5Data);
 
-    Evas_Object* color8 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color8, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color8, 0, 0, 255, 255);
-    evas_object_event_callback_add(color8, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color8", color8);
-    evas_object_show(color8);
+    static ColorPopupUserData color6Data;
+    addColorRect("elm.swallow.color6", 0, 255, 0, &color6Data);
 
-    m_color8 = color8;
-    accessObject = elm_access_object_register(color8, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color8KeyDownCallback, this);
+    static ColorPopupUserData color7Data;
+    addColorRect("elm.swallow.color7", 0, 255, 255, &color7Data);
 
-    Evas_Object* color9 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color9, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color9, 0, 0, 128, 255);
-    evas_object_event_callback_add(color9, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color9", color9);
-    evas_object_show(color9);
+    static ColorPopupUserData color8Data;
+    addColorRect("elm.swallow.color8", 0, 0, 255, &color8Data);
 
-    m_color9 = color9;
-    accessObject = elm_access_object_register(color9, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color9KeyDownCallback, this);
+    static ColorPopupUserData color9Data;
+    addColorRect("elm.swallow.color9", 0, 0, 128, &color9Data);
 
-    Evas_Object* color10 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color10, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color10, 64, 0, 64, 255);
-    evas_object_event_callback_add(color10, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color10", color10);
-    evas_object_show(color10);
+    static ColorPopupUserData color10Data;
+    addColorRect("elm.swallow.color10", 64, 0, 64, &color10Data);
 
-    m_color10 = color10;
-    accessObject = elm_access_object_register(color10, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color10KeyDownCallback, this);
+    static ColorPopupUserData color11Data;
+    addColorRect("elm.swallow.color11", 153, 217, 234, &color11Data);
 
-    Evas_Object* color11 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color11, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color11, 153, 217, 234, 255);
-    evas_object_event_callback_add(color11, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color11", color11);
-    evas_object_show(color11);
+    static ColorPopupUserData color12Data;
+    addColorRect("elm.swallow.color12", 128, 128, 128, &color12Data);
 
-    m_color11 = color11;
-    accessObject = elm_access_object_register(color11, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color11KeyDownCallback, this);
+    static ColorPopupUserData color13Data;
+    addColorRect("elm.swallow.color13", 0, 0, 0, &color13Data);
 
-    Evas_Object* color12 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color12, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color12, 128, 128, 128, 255);
-    evas_object_event_callback_add(color12, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color12", color12);
-    evas_object_show(color12);
-
-    m_color12 = color12;
-    accessObject = elm_access_object_register(color12, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color12KeyDownCallback, this);
-
-    Evas_Object* color13 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color13, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color13, 0, 0, 0, 255);
-    evas_object_event_callback_add(color13, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color13", color13);
-    evas_object_show(color13);
-
-    m_color13 = color13;
-    accessObject = elm_access_object_register(color13, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color13KeyDownCallback, this);
-
-    Evas_Object* color14 = evas_object_rectangle_add(evas_object_evas_get(m_pickerLayout->layout));
-    evas_object_size_hint_weight_set(color14, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_color_set(color14, 255, 255, 255, 255);
-    evas_object_event_callback_add(color14, EVAS_CALLBACK_MOUSE_DOWN, _color_selected_cb, m_pickerLayout->colorRect);
-    elm_object_part_content_set(m_pickerLayout->layout, "elm.swallow.color14", color14);
-    evas_object_show(color14);
-
-    m_color14 = color14;
-    accessObject = elm_access_object_register(color14, m_pickerLayout->layout);
-    elm_object_focus_custom_chain_append(m_pickerLayout->layout, accessObject, NULL);
-    evas_object_event_callback_add(accessObject, EVAS_CALLBACK_KEY_DOWN, color14KeyDownCallback, this);
+    static ColorPopupUserData color14Data;
+    addColorRect("elm.swallow.color14", 255, 255, 255, &color14Data);
 #endif
     m_pickerLayout->okButton = elm_button_add(m_pickerLayout->popup);
     elm_object_style_set(m_pickerLayout->okButton, "popup");
@@ -713,133 +603,6 @@ void InputPicker::_color_popup_response_cb(void* data,  Evas_Object* obj, void*
     inputPicker->hideColorPicker();
 }
 
-void InputPicker::color1KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color1, 0);
-    }
-}
-
-void InputPicker::color2KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color2, 0);
-    }
-}
-
-void InputPicker::color3KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color3, 0);
-    }
-}
-
-void InputPicker::color4KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color4, 0);
-    }
-}
-
-void InputPicker::color5KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color5, 0);
-    }
-}
-
-void InputPicker::color6KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color6, 0);
-    }
-}
-
-void InputPicker::color7KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color7, 0);
-    }
-}
-
-void InputPicker::color8KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color8, 0);
-    }
-}
-
-void InputPicker::color9KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color9, 0);
-    }
-}
-
-void InputPicker::color10KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color10, 0);
-    }
-}
-
-void InputPicker::color11KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color11, 0);
-    }
-}
-
-void InputPicker::color12KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color12, 0);
-    }
-}
-
-void InputPicker::color13KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color13, 0);
-    }
-}
-
-void InputPicker::color14KeyDownCallback(void* data, Evas* evas, Evas_Object* obj, void* eventInfo)
-{
-    Evas_Event_Key_Down *event = (Evas_Event_Key_Down *)eventInfo;
-    if (!strncmp("Return", event->keyname, 6) || !strncmp("space", event->keyname, 5)) {
-        InputPicker* inputPicker = static_cast<InputPicker*>(data);
-        inputPicker->_color_selected_cb(inputPicker->m_pickerLayout->colorRect, 0, inputPicker->m_color14, 0);
-    }
-}
-
-
 #if ENABLE(TIZEN_HW_MORE_BACK_KEY)
 void InputPicker::_color_back_cb(void* data,  Evas_Object* obj, void* event_info)
 {
index a5f911e..29e7603 100644 (file)
@@ -54,6 +54,14 @@ public:
 
 namespace WebKit {
 
+class InputPicker;
+struct ColorPopupUserData {
+    InputPicker* inputPicker;
+    Evas_Object* colorRect;
+    Evas_Object* color;
+    Evas_Object* colorAccessObject;
+};
+
 class InputPicker {
 public:
     InputPicker(Evas_Object*);
@@ -83,6 +91,7 @@ private:
     void createDatetimePopup(const char*, struct tm*);
     Evas_Object* parentWindow();
     void deletePopupLayout();
+    void addColorRect(const char*, int, int, int, ColorPopupUserData*);
 
     static void _date_popup_response_cb(void*, Evas_Object*, void*);
     static void _time_popup_response_cb(void*, Evas_Object*, void*);
@@ -94,21 +103,7 @@ private:
     static void _data_list_popup_response_cancel_cb(void*, Evas_Object*, void*);
     static void _data_list_selected_cb(void*, Evas_Object*, void*);
     static void _color_selected_cb(void*, Evas*, Evas_Object*, void*);
-
-    static void color1KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color2KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color3KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color4KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color5KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color6KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color7KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color8KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color9KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color10KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color11KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color12KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color13KeyDownCallback(void*, Evas*, Evas_Object*, void*);
-    static void color14KeyDownCallback(void*, Evas*, Evas_Object*, void*);
+    static void colorKeyDownCallback(void*, Evas*, Evas_Object*, void*);
 
 #if ENABLE(TIZEN_HW_MORE_BACK_KEY)
     static void _color_back_cb(void*, Evas_Object*, void*);
@@ -121,20 +116,6 @@ private:
 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
     bool m_isColorPickerShown;
 #endif
-    Evas_Object* m_color1;
-    Evas_Object* m_color2;
-    Evas_Object* m_color3;
-    Evas_Object* m_color4;
-    Evas_Object* m_color5;
-    Evas_Object* m_color6;
-    Evas_Object* m_color7;
-    Evas_Object* m_color8;
-    Evas_Object* m_color9;
-    Evas_Object* m_color10;
-    Evas_Object* m_color11;
-    Evas_Object* m_color12;
-    Evas_Object* m_color13;
-    Evas_Object* m_color14;
 };
 
 } // namespace WebKit