OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 | 436 |
437 text_button_->SetVisible(true); | 437 text_button_->SetVisible(true); |
438 arrow_button_->SetVisible(true); | 438 arrow_button_->SetVisible(true); |
439 AddChildView(text_button_); | 439 AddChildView(text_button_); |
440 AddChildView(arrow_button_); | 440 AddChildView(arrow_button_); |
441 | 441 |
442 // A layer is applied to make sure that canvas bounds are snapped to pixel | 442 // A layer is applied to make sure that canvas bounds are snapped to pixel |
443 // boundaries (for the sake of drawing the arrow). | 443 // boundaries (for the sake of drawing the arrow). |
444 if (UseMd()) { | 444 if (UseMd()) { |
445 SetPaintToLayer(true); | 445 SetPaintToLayer(); |
446 layer()->SetFillsBoundsOpaquely(false); | 446 layer()->SetFillsBoundsOpaquely(false); |
447 } else { | 447 } else { |
448 arrow_image_ = PlatformStyle::CreateComboboxArrow(enabled(), style); | 448 arrow_image_ = PlatformStyle::CreateComboboxArrow(enabled(), style); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 Combobox::~Combobox() { | 452 Combobox::~Combobox() { |
453 if (GetInputMethod() && selector_.get()) { | 453 if (GetInputMethod() && selector_.get()) { |
454 // Combobox should have been blurred before destroy. | 454 // Combobox should have been blurred before destroy. |
455 DCHECK(selector_.get() != GetInputMethod()->GetTextInputClient()); | 455 DCHECK(selector_.get() != GetInputMethod()->GetTextInputClient()); |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 const int kMdPaddingWidth = 8; | 1009 const int kMdPaddingWidth = 8; |
1010 int arrow_pad = UseMd() ? kMdPaddingWidth | 1010 int arrow_pad = UseMd() ? kMdPaddingWidth |
1011 : PlatformStyle::kComboboxNormalArrowPadding; | 1011 : PlatformStyle::kComboboxNormalArrowPadding; |
1012 int padding = style_ == STYLE_NORMAL | 1012 int padding = style_ == STYLE_NORMAL |
1013 ? arrow_pad * 2 | 1013 ? arrow_pad * 2 |
1014 : kActionLeftPadding + kActionRightPadding; | 1014 : kActionLeftPadding + kActionRightPadding; |
1015 return ArrowSize().width() + padding; | 1015 return ArrowSize().width() + padding; |
1016 } | 1016 } |
1017 | 1017 |
1018 } // namespace views | 1018 } // namespace views |
OLD | NEW |