summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 21:12:23 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 21:12:23 +0000
commitd91960f680f67f05360172af59dd10c5442052d0 (patch)
treecec2b06aa280e0a3b4b84d5d7c1ce787eb182af5
parent6a7d26d96e6eca65cc5ccf46a58bc64ea1a10166 (diff)
downloadchromium_src-d91960f680f67f05360172af59dd10c5442052d0.zip
chromium_src-d91960f680f67f05360172af59dd10c5442052d0.tar.gz
chromium_src-d91960f680f67f05360172af59dd10c5442052d0.tar.bz2
Revert "Fix submenu arrow position for RTL"
This reverts commit 37d4bc610b675ab94dd1d696fbdd474cbfc46208. TBR=dmazzoni@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/6462006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74173 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc18
-rw-r--r--views/controls/menu/radio_button_image_gtk.cc (renamed from views/controls/menu/menu_image_util_gtk.cc)26
-rw-r--r--views/controls/menu/radio_button_image_gtk.h (renamed from views/controls/menu/menu_image_util_gtk.h)11
-rw-r--r--views/views.gyp4
4 files changed, 16 insertions, 43 deletions
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index 182d68b..e912964 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,14 +69,11 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
} else if (type_ == RADIO) {
const SkBitmap* image =
GetRadioButtonImage(GetDelegate()->IsItemChecked(GetCommand()));
- gfx::Rect radio_bounds(icon_x,
- top_margin +
- (height() - top_margin - bottom_margin -
- image->height()) / 2,
- image->width(),
- image->height());
- AdjustBoundsForRTLUI(&radio_bounds);
- canvas->DrawBitmapInt(*image, radio_bounds.x(), radio_bounds.y());
+ canvas->DrawBitmapInt(*image,
+ icon_x,
+ top_margin +
+ (height() - top_margin - bottom_margin -
+ image->height()) / 2);
}
// Render the foreground.
@@ -120,7 +117,8 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
config.arrow_width) / 2,
config.arrow_width, height());
AdjustBoundsForRTLUI(&arrow_bounds);
- canvas->DrawBitmapInt(*GetSubmenuArrowImage(),
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ canvas->DrawBitmapInt(*rb.GetBitmapNamed(IDR_MENU_ARROW),
arrow_bounds.x(), arrow_bounds.y());
}
}
diff --git a/views/controls/menu/menu_image_util_gtk.cc b/views/controls/menu/radio_button_image_gtk.cc
index b59d666..e22fbc8 100644
--- a/views/controls/menu/menu_image_util_gtk.cc
+++ b/views/controls/menu/radio_button_image_gtk.cc
@@ -1,13 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "views/controls/menu/menu_image_util_gtk.h"
+#include "views/controls/menu/radio_button_image_gtk.h"
-#include "base/i18n/rtl.h"
-#include "grit/app_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia.h"
namespace {
@@ -82,19 +79,6 @@ SkBitmap* CreateRadioButtonImage(bool selected) {
return new SkBitmap(canvas.ExtractBitmap());
}
-SkBitmap* GetRtlSubmenuArrowImage() {
- static SkBitmap* kRtlArrow = NULL;
- if (!kRtlArrow) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- SkBitmap* r = rb.GetBitmapNamed(IDR_MENU_ARROW);
- gfx::CanvasSkia canvas(r->width(), r->height(), false);
- canvas.ScaleInt(-1, 1);
- canvas.DrawBitmapInt(*r, - r->width(), 0);
- kRtlArrow = new SkBitmap(canvas.ExtractBitmap());
- }
- return kRtlArrow;
-}
-
} // namespace
namespace views {
@@ -106,10 +90,4 @@ const SkBitmap* GetRadioButtonImage(bool selected) {
return selected ? kRadioOn : kRadioOff;
}
-const SkBitmap* GetSubmenuArrowImage() {
- return base::i18n::IsRTL() ?
- GetRtlSubmenuArrowImage() :
- ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_MENU_ARROW);
-}
-
} // namespace views;
diff --git a/views/controls/menu/menu_image_util_gtk.h b/views/controls/menu/radio_button_image_gtk.h
index f4c0ead..b606c34 100644
--- a/views/controls/menu/menu_image_util_gtk.h
+++ b/views/controls/menu/radio_button_image_gtk.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef VIEWS_CONTROLS_MENU_MENU_IMAGE_UTIL_GTK_H_
-#define VIEWS_CONTROLS_MENU_MENU_IMAGE_UTIL_GTK_H_
+#ifndef VIEWS_CONTROLS_MENU_RADIO_BUTTON_IMAGE_H_
+#define VIEWS_CONTROLS_MENU_RADIO_BUTTON_IMAGE_H_
#pragma once
#include "third_party/skia/include/core/SkBitmap.h"
@@ -16,9 +16,6 @@ namespace views {
// The returned image is global object and should not be freed.
const SkBitmap* GetRadioButtonImage(bool selected);
-// Returns the image for submenu arrow for current RTL setting.
-const SkBitmap* GetSubmenuArrowImage();
-
} // namespace views
-#endif // VIEWS_CONTROLS_MENU_MENU_IMAGE_UTIL_GTK_H_
+#endif // VIEWS_CONTROLS_MENU_RADIO_BUTTON_IMAGE_H_
diff --git a/views/views.gyp b/views/views.gyp
index d180468..01bea92 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -165,8 +165,8 @@
'controls/menu/native_menu_x.h',
'controls/menu/nested_dispatcher_gtk.cc',
'controls/menu/nested_dispatcher_gtk.h',
- 'controls/menu/menu_image_util_gtk.cc',
- 'controls/menu/menu_image_util_gtk.h',
+ 'controls/menu/radio_button_image_gtk.cc',
+ 'controls/menu/radio_button_image_gtk.h',
'controls/menu/submenu_view.cc',
'controls/menu/submenu_view.h',
'controls/menu/view_menu_delegate.h',