Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / menu / menu_separator_views.cc
index affbae4..cf5a8fb 100644 (file)
@@ -22,32 +22,9 @@ namespace views {
 void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
   OnPaintAura(canvas);
 }
-
-gfx::Size MenuSeparator::GetPreferredSize() {
-  return GetPreferredSizeAura();
-}
 #endif
 
-void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) {
-  int pos = 0;
-  switch (type_) {
-    case ui::LOWER_SEPARATOR:
-      pos = height() - kSeparatorHeight;
-      break;
-    case ui::SPACING_SEPARATOR:
-      return;
-    case ui::UPPER_SEPARATOR:
-      break;
-    default:
-      pos = height() / 2;
-      break;
-  }
-  canvas->FillRect(gfx::Rect(0, pos, width(), kSeparatorHeight),
-                   GetNativeTheme()->GetSystemColor(
-                       ui::NativeTheme::kColorId_MenuSeparatorColor));
-}
-
-gfx::Size MenuSeparator::GetPreferredSizeAura() {
+gfx::Size MenuSeparator::GetPreferredSize() const {
   const MenuConfig& menu_config = parent_menu_item_->GetMenuConfig();
   int height = menu_config.separator_height;
   switch(type_) {
@@ -68,4 +45,28 @@ gfx::Size MenuSeparator::GetPreferredSizeAura() {
                    height);
 }
 
+gfx::Rect MenuSeparator::GetPaintBounds() {
+  int pos = 0;
+  switch (type_) {
+    case ui::LOWER_SEPARATOR:
+      pos = height() - kSeparatorHeight;
+      break;
+    case ui::SPACING_SEPARATOR:
+      return gfx::Rect();
+    case ui::UPPER_SEPARATOR:
+      break;
+    default:
+      pos = height() / 2;
+      break;
+  }
+
+  return gfx::Rect(0, pos, width(), kSeparatorHeight);
+}
+
+void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) {
+  canvas->FillRect(GetPaintBounds(),
+                   GetNativeTheme()->GetSystemColor(
+                       ui::NativeTheme::kColorId_MenuSeparatorColor));
+}
+
 }  // namespace views