diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 08:10:10 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 08:10:10 +0000 |
commit | 77e346ff48a03c556e0f80810a2662b1f88a56ac (patch) | |
tree | 4d64fd2127d55cd804305eaafa1944e9203ff61e /ui/views | |
parent | a0e54b7cc76a061cda211d9d4632b5f5d75daa9e (diff) | |
download | chromium_src-77e346ff48a03c556e0f80810a2662b1f88a56ac.zip chromium_src-77e346ff48a03c556e0f80810a2662b1f88a56ac.tar.gz chromium_src-77e346ff48a03c556e0f80810a2662b1f88a56ac.tar.bz2 |
Makes events outside display region of new style dialogs fall though.
https://codereview.chromium.org/20755006/ makes new style dialogs
display the right thing, but mouse events on parts of the dialog that
are not drawn still end up going to the dialog. This patch makes it so
that we end up setting a region on the HWND so that events can fall
through too.
BUG=241653
TEST=none
R=ben@chromium.org, msw@chromium.org
Review URL: https://chromiumcodereview.appspot.com/21145002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/bubble/bubble_frame_view.cc | 29 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.cc | 7 |
2 files changed, 26 insertions, 10 deletions
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 8f63405..c2e7a5f 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc @@ -11,6 +11,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/path.h" #include "ui/gfx/screen.h" +#include "ui/gfx/skia_util.h" #include "ui/views/bubble/bubble_border.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/widget/widget.h" @@ -113,20 +114,30 @@ int BubbleFrameView::NonClientHitTest(const gfx::Point& point) { void BubbleFrameView::GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { - if (bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER) + // NOTE: this only provides implementations for the types used by dialogs. + if ((bubble_border_->arrow() != BubbleBorder::NONE && + bubble_border_->arrow() != BubbleBorder::FLOAT) || + (bubble_border_->shadow() != BubbleBorder::SMALL_SHADOW && + bubble_border_->shadow() != BubbleBorder::NO_SHADOW_OPAQUE_BORDER)) return; // Use a window mask roughly matching the border in the image assets. static const int kBorderStrokeSize = 1; static const SkScalar kCornerRadius = SkIntToScalar(6); - gfx::Insets border_insets = bubble_border_->GetInsets(); - const 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) }; - window_mask->addRoundRect(rect, kCornerRadius, kCornerRadius); + const 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) }; + if (bubble_border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER) { + window_mask->addRoundRect(rect, kCornerRadius, kCornerRadius); + } else { + static const int kBottomBorderShadowSize = 2; + rect.fBottom += SkIntToScalar(kBottomBorderShadowSize); + window_mask->addRect(rect); + } } void BubbleFrameView::ResetWindowControls() {} diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 92aa2a1..e766e20 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1086,7 +1086,12 @@ gfx::Insets HWNDMessageHandler::GetClientAreaInsets() const { void HWNDMessageHandler::ResetWindowRegion(bool force) { // A native frame uses the native window region, and we don't want to mess // with it. - if (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow()) { + // WS_EX_COMPOSITED is used instead of WS_EX_LAYERED under aura. WS_EX_LAYERED + // automatically makes clicks on transparent pixels fall through, that isn't + // the case with WS_EX_COMPOSITED. So, we route WS_EX_COMPOSITED through to + // the delegate to allow for a custom hit mask. + if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && + (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { if (force) SetWindowRgn(hwnd(), NULL, TRUE); return; |