diff options
author | georgey@chromium.org <georgey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 22:00:04 +0000 |
---|---|---|
committer | georgey@chromium.org <georgey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 22:00:04 +0000 |
commit | c2b32631237fad9dd16c4be62304ac4f6b77b409 (patch) | |
tree | dec188a0517cc64ac5c7978d95db9c8c252becab /views | |
parent | e4e45291d22630a1efb2df489cb3749c3e232f38 (diff) | |
download | chromium_src-c2b32631237fad9dd16c4be62304ac4f6b77b409.zip chromium_src-c2b32631237fad9dd16c4be62304ac4f6b77b409.tar.gz chromium_src-c2b32631237fad9dd16c4be62304ac4f6b77b409.tar.bz2 |
Fix for UI issues on AutoFill dialog on Windows.
BUG=46525
TEST=In the bug.
Review URL: http://codereview.chromium.org/2802005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/image_button.cc | 5 | ||||
-rw-r--r-- | views/controls/button/image_button.h | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc index 1b9029a..c9de83f 100644 --- a/views/controls/button/image_button.cc +++ b/views/controls/button/image_button.cc @@ -19,7 +19,8 @@ static const int kDefaultHeight = 14; // Default button height if no theme. ImageButton::ImageButton(ButtonListener* listener) : CustomButton(listener), h_alignment_(ALIGN_LEFT), - v_alignment_(ALIGN_TOP) { + v_alignment_(ALIGN_TOP), + preferred_size_(kDefaultWidth, kDefaultHeight) { // By default, we request that the gfx::Canvas passed to our View::Paint() // implementation is flipped horizontally so that the button's bitmaps are // mirrored when the UI directionality is right-to-left. @@ -58,7 +59,7 @@ void ImageButton::SetImageAlignment(HorizontalAlignment h_align, gfx::Size ImageButton::GetPreferredSize() { if (!images_[BS_NORMAL].isNull()) return gfx::Size(images_[BS_NORMAL].width(), images_[BS_NORMAL].height()); - return gfx::Size(kDefaultWidth, kDefaultHeight); + return preferred_size_; } void ImageButton::Paint(gfx::Canvas* canvas) { diff --git a/views/controls/button/image_button.h b/views/controls/button/image_button.h index c99c77f..ffd426b 100644 --- a/views/controls/button/image_button.h +++ b/views/controls/button/image_button.h @@ -50,6 +50,12 @@ class ImageButton : public CustomButton { virtual gfx::Size GetPreferredSize(); virtual void Paint(gfx::Canvas* canvas); + // Sets preferred size, so it could be correctly positioned in layout even if + // it is NULL. + void SetPreferredSize(const gfx::Size& preferred_size) { + preferred_size_ = preferred_size; + } + protected: // Returns the image to paint. This is invoked from paint and returns a value // from images. @@ -65,6 +71,7 @@ class ImageButton : public CustomButton { // Image alignment. HorizontalAlignment h_alignment_; VerticalAlignment v_alignment_; + gfx::Size preferred_size_; DISALLOW_COPY_AND_ASSIGN(ImageButton); }; |