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/separator.h" | 5 #include "ui/views/controls/separator.h" |
6 | 6 |
7 #include "ui/accessibility/ax_view_state.h" | 7 #include "ui/accessibility/ax_view_state.h" |
8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
(...skipping 26 matching lines...) Expand all Loading... | |
37 if (size != size_) { | 37 if (size != size_) { |
38 size_ = size; | 38 size_ = size; |
39 PreferredSizeChanged(); | 39 PreferredSizeChanged(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 //////////////////////////////////////////////////////////////////////////////// | 43 //////////////////////////////////////////////////////////////////////////////// |
44 // Separator, View overrides: | 44 // Separator, View overrides: |
45 | 45 |
46 gfx::Size Separator::GetPreferredSize() const { | 46 gfx::Size Separator::GetPreferredSize() const { |
47 if (orientation_ == HORIZONTAL) | 47 gfx::Size size = |
48 return gfx::Size(width(), size_); | 48 orientation_ == HORIZONTAL ? gfx::Size(1, size_) : gfx::Size(size_, 1); |
49 return gfx::Size(size_, height()); | 49 gfx::Insets insets = GetInsets(); |
50 size.Enlarge(insets.width(), insets.height()); | |
sky
2015/08/05 00:06:01
Your change here looks right, but how about landin
Evan Stade
2015/08/05 19:04:25
Done.
| |
51 return size; | |
50 } | 52 } |
51 | 53 |
52 void Separator::GetAccessibleState(ui::AXViewState* state) { | 54 void Separator::GetAccessibleState(ui::AXViewState* state) { |
53 state->role = ui::AX_ROLE_SPLITTER; | 55 state->role = ui::AX_ROLE_SPLITTER; |
54 } | 56 } |
55 | 57 |
56 void Separator::OnPaint(gfx::Canvas* canvas) { | 58 void Separator::OnPaint(gfx::Canvas* canvas) { |
57 canvas->FillRect(GetContentsBounds(), color_); | 59 canvas->FillRect(GetContentsBounds(), color_); |
58 } | 60 } |
59 | 61 |
60 const char* Separator::GetClassName() const { | 62 const char* Separator::GetClassName() const { |
61 return kViewClassName; | 63 return kViewClassName; |
62 } | 64 } |
63 | 65 |
64 } // namespace views | 66 } // namespace views |
OLD | NEW |