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

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: Add missing USE_AURA check Created 7 years, 8 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
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..63dcac14bf70d0f98731d24a80081fb88f121abf 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,42 @@ 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 = {border_insets.left() - kBorderStrokeSize,
+ border_insets.top() - kBorderStrokeSize,
+ size.width() - border_insets.right() + kBorderStrokeSize,
+ size.height() - border_insets.bottom() + kBorderStrokeSize};
+
+ // Approximate rounded corners matching the border.
+ SkPoint polygon[] = {
+ {rect.left() + 2, rect.top()},
+ {rect.left() + 1, rect.top() + 1},
+ {rect.left(), rect.top() + 2},
+
+ {rect.left(), rect.bottom() - 3},
+ {rect.left() + 1, rect.bottom() - 2},
+ {rect.left() + 2, rect.bottom()},
+
+ {rect.right() - 3, rect.bottom()},
+ {rect.right() - 1, rect.bottom() - 2},
+ {rect.right(), rect.bottom() - 3},
+
+ {rect.right(), rect.top() + 2},
+ {rect.right() - 1, rect.top() + 1},
+ {rect.right() - 2, rect.top()}
+ };
+
+ window_mask->addPoly(polygon, sizeof(polygon)/sizeof(polygon[0]), true);
+}
void BubbleFrameView::ResetWindowControls() {}

Powered by Google App Engine
This is Rietveld 408576698