@@ -75,23 +75,28 @@ using MD = ui::MaterialDesignController;
75
75
76
76
namespace {
77
77
78
- const int kExtraLeftPaddingToBalanceCloseButtonPadding = 2 ;
78
+ constexpr int kExtraLeftPaddingToBalanceCloseButtonPadding = 2 ;
79
79
80
80
// When a non-pinned tab becomes a pinned tab the width of the tab animates. If
81
81
// the width of a pinned tab is at least kPinnedTabExtraWidthToRenderAsNormal
82
82
// larger than the desired pinned tab width then the tab is rendered as a normal
83
83
// tab. This is done to avoid having the title immediately disappear when
84
84
// transitioning a tab from normal to pinned tab.
85
- const int kPinnedTabExtraWidthToRenderAsNormal = 30 ;
85
+ constexpr int kPinnedTabExtraWidthToRenderAsNormal = 30 ;
86
86
87
87
// How opaque to make the hover state (out of 1).
88
- const double kHoverOpacity = 0.33 ;
88
+ constexpr double kHoverOpacity = 0.33 ;
89
89
90
90
// Opacity of the active tab background painted over inactive selected tabs.
91
- const double kSelectedTabOpacity = 0.3 ;
91
+ constexpr double kSelectedTabOpacity = 0.3 ;
92
92
93
93
// Inactive selected tabs have their throb value scaled by this.
94
- const double kSelectedTabThrobScale = 0.95 - kSelectedTabOpacity ;
94
+ constexpr double kSelectedTabThrobScale = 0.95 - kSelectedTabOpacity ;
95
+
96
+ // Height of the separator painted on the left edge of the tab for the material
97
+ // refresh mode.
98
+ constexpr int kTabSeparatorHeight = 20 ;
99
+ constexpr int kTabSeparatorTouchHeight = 24 ;
95
100
96
101
// //////////////////////////////////////////////////////////////////////////////
97
102
// Drawing and utility functions
@@ -148,43 +153,47 @@ gfx::Path GetInteriorPath(float scale,
148
153
gfx::Path left_path;
149
154
if (MD::IsRefreshUi ()) {
150
155
const float radius = (endcap_width / 2 ) * scale;
151
-
152
156
const float stroke_thickness = TabStrip::ShouldDrawStrokes () ? 1 : 0 ;
153
157
154
158
// Bottom right.
155
- right_path.moveTo (right, bottom);
159
+ right_path.moveTo (right - scaled_horizontal_inset, bottom);
160
+ right_path.rLineTo (0 , stroke_thickness);
156
161
157
162
right_path.arcTo (radius, radius, 0 , SkPath::kSmall_ArcSize ,
158
- SkPath::kCW_Direction , right - radius, bottom - radius);
163
+ SkPath::kCW_Direction ,
164
+ right - radius - scaled_horizontal_inset, bottom - radius);
159
165
160
166
// Right vertical.
161
- right_path.lineTo (right - radius, radius + stroke_thickness);
167
+ right_path.lineTo (right - radius - scaled_horizontal_inset,
168
+ radius - stroke_thickness);
162
169
163
170
// Top right.
164
- right_path.arcTo (radius, radius, 0 , SkPath:: kSmall_ArcSize ,
165
- SkPath::kCCW_Direction , right - radius * 2 ,
166
- stroke_thickness);
171
+ right_path.arcTo (
172
+ radius, radius, 0 , SkPath::kSmall_ArcSize , SkPath:: kCCW_Direction ,
173
+ right - radius * 2 - scaled_horizontal_inset, stroke_thickness);
167
174
168
175
// Top edge.
169
176
right_path.lineTo (0 , stroke_thickness);
170
177
right_path.lineTo (0 , bottom);
171
178
right_path.close ();
172
179
173
180
// Top left.
174
- left_path.moveTo (radius * 2 , stroke_thickness);
181
+ left_path.moveTo (radius * 2 + scaled_horizontal_inset , stroke_thickness);
175
182
176
183
left_path.arcTo (radius, radius, 0 , SkPath::kSmall_ArcSize ,
177
- SkPath::kCCW_Direction , radius, radius + stroke_thickness);
184
+ SkPath::kCCW_Direction , radius + scaled_horizontal_inset,
185
+ radius);
178
186
179
187
// Left vertical.
180
- left_path.lineTo (radius, bottom - radius);
188
+ left_path.lineTo (radius + scaled_horizontal_inset , bottom - radius);
181
189
182
190
// Bottom left.
183
191
left_path.arcTo (radius, radius, 0 , SkPath::kSmall_ArcSize ,
184
- SkPath::kCW_Direction , 0 , bottom);
192
+ SkPath::kCW_Direction , scaled_horizontal_inset,
193
+ bottom + stroke_thickness);
185
194
186
195
// Bottom edge.
187
- left_path.lineTo (right, bottom);
196
+ left_path.lineTo (right, bottom + stroke_thickness );
188
197
left_path.lineTo (right, stroke_thickness);
189
198
left_path.close ();
190
199
} else {
@@ -237,7 +246,7 @@ gfx::Path GetBorderPath(float scale,
237
246
gfx::Path path;
238
247
239
248
path.moveTo (0 , bottom);
240
- path.rLineTo (0 , -1 );
249
+ path.rLineTo (0 , -stroke_thickness );
241
250
242
251
if (MD::IsRefreshUi ()) {
243
252
const float radius = (endcap_width / 2 ) * scale;
@@ -1205,7 +1214,9 @@ void Tab::PaintSeparator(gfx::Canvas* canvas, SkColor inactive_color) {
1205
1214
1206
1215
const int tab_height = GetContentsBounds ().height ();
1207
1216
gfx::RectF separator_bounds;
1208
- separator_bounds.set_size (gfx::SizeF (1 , 20 ));
1217
+ separator_bounds.set_size (gfx::SizeF (1 , MD::IsTouchOptimizedUiEnabled ()
1218
+ ? kTabSeparatorTouchHeight
1219
+ : kTabSeparatorHeight ));
1209
1220
separator_bounds.set_origin (gfx::PointF (
1210
1221
GetTabEndcapWidth () / 2 , (tab_height - separator_bounds.height ()) / 2 ));
1211
1222
// The following will paint the separator using an opacity that should
0 commit comments