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

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

Issue 454173002: Fixed BubbleBorder sizing problems & added unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified BubbleBorderTests. Created 6 years, 4 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/tray_bubble_view.h" 5 #include "ui/views/bubble/tray_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Detects any mouse movement. This is needed to detect mouse movements by the 52 // Detects any mouse movement. This is needed to detect mouse movements by the
53 // user over the bubble if the bubble got created underneath the cursor. 53 // user over the bubble if the bubble got created underneath the cursor.
54 class MouseMoveDetectorHost : public MouseWatcherHost { 54 class MouseMoveDetectorHost : public MouseWatcherHost {
55 public: 55 public:
56 MouseMoveDetectorHost(); 56 MouseMoveDetectorHost();
57 virtual ~MouseMoveDetectorHost(); 57 virtual ~MouseMoveDetectorHost();
58 58
59 virtual bool Contains(const gfx::Point& screen_point, 59 virtual bool Contains(const gfx::Point& screen_point,
60 MouseEventType type) OVERRIDE; 60 MouseEventType type) OVERRIDE;
61 private: 61 private:
62
63 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); 62 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost);
64 }; 63 };
65 64
66 MouseMoveDetectorHost::MouseMoveDetectorHost() { 65 MouseMoveDetectorHost::MouseMoveDetectorHost() {
67 } 66 }
68 67
69 MouseMoveDetectorHost::~MouseMoveDetectorHost() { 68 MouseMoveDetectorHost::~MouseMoveDetectorHost() {
70 } 69 }
71 70
72 bool MouseMoveDetectorHost::Contains(const gfx::Point& screen_point, 71 bool MouseMoveDetectorHost::Contains(const gfx::Point& screen_point,
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (preferred_width_ == width) 373 if (preferred_width_ == width)
375 return; 374 return;
376 preferred_width_ = width; 375 preferred_width_ = width;
377 if (GetWidget()) 376 if (GetWidget())
378 SizeToContents(); 377 SizeToContents();
379 } 378 }
380 379
381 void TrayBubbleView::SetArrowPaintType( 380 void TrayBubbleView::SetArrowPaintType(
382 views::BubbleBorder::ArrowPaintType paint_type) { 381 views::BubbleBorder::ArrowPaintType paint_type) {
383 bubble_border_->set_paint_arrow(paint_type); 382 bubble_border_->set_paint_arrow(paint_type);
383 UpdateBubble();
384 } 384 }
385 385
386 gfx::Insets TrayBubbleView::GetBorderInsets() const { 386 gfx::Insets TrayBubbleView::GetBorderInsets() const {
387 return bubble_border_->GetInsets(); 387 return bubble_border_->GetInsets();
388 } 388 }
389 389
390 void TrayBubbleView::Init() { 390 void TrayBubbleView::Init() {
391 BoxLayout* layout = new BottomAlignedBoxLayout(this); 391 BoxLayout* layout = new BottomAlignedBoxLayout(this);
392 layout->SetDefaultFlex(1); 392 layout->SetDefaultFlex(1);
393 SetLayoutManager(layout); 393 SetLayoutManager(layout);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 void TrayBubbleView::ViewHierarchyChanged( 500 void TrayBubbleView::ViewHierarchyChanged(
501 const ViewHierarchyChangedDetails& details) { 501 const ViewHierarchyChangedDetails& details) {
502 if (details.is_add && details.child == this) { 502 if (details.is_add && details.child == this) {
503 details.parent->SetPaintToLayer(true); 503 details.parent->SetPaintToLayer(true);
504 details.parent->SetFillsBoundsOpaquely(true); 504 details.parent->SetFillsBoundsOpaquely(true);
505 details.parent->layer()->SetMasksToBounds(true); 505 details.parent->layer()->SetMasksToBounds(true);
506 } 506 }
507 } 507 }
508 508
509 } // namespace views 509 } // namespace views
OLDNEW
« ui/views/bubble/bubble_border_unittest.cc ('K') | « ui/views/bubble/bubble_border_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698