Fix the text_box sticking out from combo_box.
[framework/web/webkit-efl.git] / Source / WebCore / platform / efl / RenderThemeEfl.cpp
index 0046419..2035729 100755 (executable)
@@ -962,15 +962,29 @@ void RenderThemeEfl::adjustMenuListStyle(StyleResolver* styleResolver, RenderSty
         static_cast<RenderThemeEfl*>(element->document()->page()->theme())->adjustMenuListStyle(styleResolver, style, element);
         return;
     }
-    /* EFL theme should set a maximum control size for text inside input elements like combo box beyond which the
-       default theme will not get applied correctly ,in Tizen's case its 12 px,Hence this workaround patch. */
 #if ENABLE(TIZEN_THEME_STYLE_WORKAROUND)
-    if (style->fontSize() >= RENDER_THEME_EFL_CONTROL_FONT_SIZE) {
-        const struct ThemePartDesc* desc = m_partDescs + (size_t)ComboBox;
-        style->setPaddingLeft(desc->padding.left());
-        style->setPaddingRight(desc->padding.right());
-    } else
+/*If the computed height becomes greater than 12px, applying top padding causes the clipping of the text
+ This is just a workaround patch,this needs to be fixed with customized padding for different scenarios
+like other ports win/safari do,as part of EFL Rendertheme refactoring. */
+
+    if(style->fontMetrics().height() >= RENDER_THEME_EFL_CONTROL_FONT_SIZE || style->appearance() == MenulistPart)
+      {    
+          const struct ThemePartDesc* desc = m_partDescs + (size_t)ComboBox;
+          style->setPaddingTop(Length(0,Fixed));
+          style->setPaddingLeft(style->paddingLeft());
+       //We need some amount of Right padding so that combo box arrow doesnt overlap the text
+       //if content doesnt set any right padding set EFL theme padding.
+       //Calculate the minimum right padding to avoid arrow overlapping with text.
+          int stylePaddingRight = style->paddingRight().intValue();
+          int themePaddingRight = desc->padding.right().intValue();
+          if(stylePaddingRight > themePaddingRight)
+              style->setPaddingRight(style->paddingRight());
+          else 
+              style->setPaddingRight(desc->padding.right());
+          style->setPaddingBottom(Length(1,Fixed));
+      } else
 #endif
+
     adjustSizeConstraints(style, ComboBox);
     style->resetBorder();
     style->setWhiteSpace(PRE);