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

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 14742002: Render opaque border with no shadow for web contents modal dialogs under Views/Win32 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS build failure Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view.cc
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index c1ae46d55422c8b9ba96b89ec370c80d70adc0c9..07a8208a42cfa6c065b299e343514437f0346308 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -9,6 +9,7 @@
#include "grit/ui_resources.h"
#include "ui/base/hit_test.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/path.h"
#include "ui/gfx/screen.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/button/label_button.h"
@@ -96,7 +97,44 @@ int BubbleFrameView::NonClientHitTest(const gfx::Point& point) {
}
void BubbleFrameView::GetWindowMask(const gfx::Size& size,
- gfx::Path* window_mask) {}
+ gfx::Path* window_mask) {
+ if (bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER)
+ return;
+
+ // Use a window mask roughly matching the border in the image assets.
+
+ // Stroke size in pixels of borders in image assets.
+ static const int kBorderStrokeSize = 1;
+
+ gfx::Insets border_insets = bubble_border_->GetInsets();
+ SkRect rect = {SkIntToScalar(border_insets.left() - kBorderStrokeSize),
+ SkIntToScalar(border_insets.top() - kBorderStrokeSize),
+ SkIntToScalar(size.width() - border_insets.right() +
+ kBorderStrokeSize),
+ SkIntToScalar(size.height() - border_insets.bottom() +
+ kBorderStrokeSize)};
+
+ // Approximate rounded corners matching the border.
+ SkPoint polygon[] = {
+ {rect.left() + SkIntToScalar(2), rect.top()},
+ {rect.left() + SkIntToScalar(1), rect.top() + SkIntToScalar(1)},
+ {rect.left(), rect.top() + SkIntToScalar(2)},
+
+ {rect.left(), rect.bottom() - SkIntToScalar(3)},
+ {rect.left() + SkIntToScalar(1), rect.bottom() - SkIntToScalar(2)},
+ {rect.left() + SkIntToScalar(2), rect.bottom()},
+
+ {rect.right() - SkIntToScalar(3), rect.bottom()},
+ {rect.right() - SkIntToScalar(1), rect.bottom() - SkIntToScalar(2)},
+ {rect.right(), rect.bottom() - SkIntToScalar(3)},
+
+ {rect.right(), rect.top() + SkIntToScalar(2)},
+ {rect.right() - SkIntToScalar(1), rect.top() + SkIntToScalar(1)},
+ {rect.right() - SkIntToScalar(2), rect.top()}
+ };
+
+ window_mask->addPoly(polygon, sizeof(polygon)/sizeof(polygon[0]), true);
+}
void BubbleFrameView::ResetWindowControls() {}
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698