Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2174643002: [ash-md] Updates ash shelf tooltips to MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bubble/bubble_frame_view.h" 5 #include "ui/views/bubble/bubble_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return HTSYSMENU; 165 return HTSYSMENU;
166 if (point.y() < title_->bounds().bottom()) 166 if (point.y() < title_->bounds().bottom())
167 return HTCAPTION; 167 return HTCAPTION;
168 } 168 }
169 169
170 return GetWidget()->client_view()->NonClientHitTest(point); 170 return GetWidget()->client_view()->NonClientHitTest(point);
171 } 171 }
172 172
173 void BubbleFrameView::GetWindowMask(const gfx::Size& size, 173 void BubbleFrameView::GetWindowMask(const gfx::Size& size,
174 gfx::Path* window_mask) { 174 gfx::Path* window_mask) {
175 const bool no_assets = bubble_border_->shadow() == BubbleBorder::NO_ASSETS ||
176 bubble_border_->shadow() == BubbleBorder::NO_ASSETS_TOOLTIP;
175 if (bubble_border_->shadow() != BubbleBorder::SMALL_SHADOW && 177 if (bubble_border_->shadow() != BubbleBorder::SMALL_SHADOW &&
176 bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER && 178 bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER &&
177 bubble_border_->shadow() != BubbleBorder::NO_ASSETS) 179 !no_assets)
178 return; 180 return;
179 181
180 // We don't return a mask for windows with arrows unless they use 182 // We don't return a mask for windows with arrows unless they use
181 // BubbleBorder::NO_ASSETS. 183 // BubbleBorder::NO_ASSETS or BubbleBorder::NO_ASSETS_TOOLTIP.
182 if (bubble_border_->shadow() != BubbleBorder::NO_ASSETS && 184 if (!no_assets &&
183 bubble_border_->arrow() != BubbleBorder::NONE && 185 bubble_border_->arrow() != BubbleBorder::NONE &&
184 bubble_border_->arrow() != BubbleBorder::FLOAT) 186 bubble_border_->arrow() != BubbleBorder::FLOAT)
185 return; 187 return;
186 188
187 // Use a window mask roughly matching the border in the image assets. 189 // Use a window mask roughly matching the border in the image assets.
188 const int kBorderStrokeSize = 190 const int kBorderStrokeSize = no_assets ? 0 : 1;
189 bubble_border_->shadow() == BubbleBorder::NO_ASSETS ? 0 : 1;
190 const SkScalar kCornerRadius = 191 const SkScalar kCornerRadius =
191 SkIntToScalar(bubble_border_->GetBorderCornerRadius()); 192 SkIntToScalar(bubble_border_->GetBorderCornerRadius());
192 const gfx::Insets border_insets = bubble_border_->GetInsets(); 193 const gfx::Insets border_insets = bubble_border_->GetInsets();
193 SkRect rect = { 194 SkRect rect = {
194 SkIntToScalar(border_insets.left() - kBorderStrokeSize), 195 SkIntToScalar(border_insets.left() - kBorderStrokeSize),
195 SkIntToScalar(border_insets.top() - kBorderStrokeSize), 196 SkIntToScalar(border_insets.top() - kBorderStrokeSize),
196 SkIntToScalar(size.width() - border_insets.right() + kBorderStrokeSize), 197 SkIntToScalar(size.width() - border_insets.right() + kBorderStrokeSize),
197 SkIntToScalar(size.height() - border_insets.bottom() + 198 SkIntToScalar(size.height() - border_insets.bottom() +
198 kBorderStrokeSize)}; 199 kBorderStrokeSize)};
199 200
200 if (bubble_border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER || 201 if (bubble_border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER ||
201 bubble_border_->shadow() == BubbleBorder::NO_ASSETS) { 202 no_assets) {
202 window_mask->addRoundRect(rect, kCornerRadius, kCornerRadius); 203 window_mask->addRoundRect(rect, kCornerRadius, kCornerRadius);
203 } else { 204 } else {
204 static const int kBottomBorderShadowSize = 2; 205 static const int kBottomBorderShadowSize = 2;
205 rect.fBottom += SkIntToScalar(kBottomBorderShadowSize); 206 rect.fBottom += SkIntToScalar(kBottomBorderShadowSize);
206 window_mask->addRect(rect); 207 window_mask->addRect(rect);
207 } 208 }
208 gfx::Path arrow_path; 209 gfx::Path arrow_path;
209 if (bubble_border_->GetArrowPath(gfx::Rect(size), &arrow_path)) 210 if (bubble_border_->GetArrowPath(gfx::Rect(size), &arrow_path))
210 window_mask->addPath(arrow_path, 0, 0); 211 window_mask->addPath(arrow_path, 0, 0);
211 } 212 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 size.Enlarge(client_insets.width(), client_insets.height()); 515 size.Enlarge(client_insets.width(), client_insets.height());
515 size.SetToMax(gfx::Size(title_bar_width, 0)); 516 size.SetToMax(gfx::Size(title_bar_width, 0));
516 517
517 if (footnote_container_) 518 if (footnote_container_)
518 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); 519 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
519 520
520 return size; 521 return size;
521 } 522 }
522 523
523 } // namespace views 524 } // namespace views
OLDNEW
« ash/shelf/shelf_tooltip_manager.cc ('K') | « ui/views/bubble/bubble_border.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698