summaryrefslogtreecommitdiffstats
path: root/chrome/views/widget_win.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 17:52:08 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 17:52:08 +0000
commitc42974c96b9dff2d42f5f8a49012e150ab73eb33 (patch)
treeef07ae1e22910dd939bceb0f53a565506a53c40e /chrome/views/widget_win.cc
parent9559b4f8127d66640a54a3d0f5f423c3bfc5171b (diff)
downloadchromium_src-c42974c96b9dff2d42f5f8a49012e150ab73eb33.zip
chromium_src-c42974c96b9dff2d42f5f8a49012e150ab73eb33.tar.gz
chromium_src-c42974c96b9dff2d42f5f8a49012e150ab73eb33.tar.bz2
Fixes info bubble painting bug. This was happening because we were
using layered windows incorrectly. According to the docs if you invoke SetLayeredWindowAttributes, then you shouldn't invoke UpdateLayeredWindow (unless you remove then add the WS_EX_LAYERED style bit). My approach here is to disable the backing buffer for the info bubble. I had problems toggling the WS_EX_LAYERED at the end up the animation. The text field would not paint when I did this... BUG=5351 TEST=bookmark a page. When the bubble appears press shift-tab and make sure you see a focus rect around the remove link. Review URL: http://codereview.chromium.org/14131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/widget_win.cc')
-rw-r--r--chrome/views/widget_win.cc31
1 files changed, 25 insertions, 6 deletions
diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc
index cd0e913..31f7a47 100644
--- a/chrome/views/widget_win.cc
+++ b/chrome/views/widget_win.cc
@@ -120,7 +120,7 @@ WidgetWin::WidgetWin()
toplevel_(false),
window_style_(0),
window_ex_style_(kWindowDefaultExStyle),
- layered_(false),
+ use_layered_buffer_(true),
layered_alpha_(255),
delete_on_destroy_(true),
can_update_layered_window_(true),
@@ -144,7 +144,8 @@ void WidgetWin::Init(HWND parent, const gfx::Rect& bounds,
// See if the style has been overridden.
opaque_ = !(window_ex_style_ & WS_EX_TRANSPARENT);
- layered_ = !!(window_ex_style_ & WS_EX_LAYERED);
+ use_layered_buffer_ = (use_layered_buffer_ &&
+ !!(window_ex_style_ & WS_EX_LAYERED));
// Force creation of the RootView if it hasn't been created yet.
GetRootView();
@@ -246,7 +247,7 @@ HWND WidgetWin::GetHWND() const {
}
void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
- if (layered_) {
+ if (use_layered_buffer_) {
PaintLayeredWindow();
} else if (root_view_->NeedsPainting(false) && IsWindow()) {
if (!opaque_ && GetParent()) {
@@ -302,6 +303,24 @@ void WidgetWin::SetLayeredAlpha(BYTE layered_alpha) {
// UpdateWindowFromContents(contents_->getTopPlatformDevice().getBitmapDC());
}
+void WidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) {
+ if (use_layered_buffer_ == use_layered_buffer)
+ return;
+
+ use_layered_buffer_ = use_layered_buffer;
+ if (!hwnd_)
+ return;
+
+ if (use_layered_buffer_) {
+ // Force creation of the buffer at the right size.
+ RECT wr;
+ GetWindowRect(&wr);
+ ChangeSize(0, CSize(wr.right - wr.left, wr.bottom - wr.top));
+ } else {
+ contents_.reset(NULL);
+ }
+}
+
static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM l_param) {
RootView* root_view =
reinterpret_cast<RootView*>(GetProp(hwnd, kRootViewWindowProperty));
@@ -799,7 +818,7 @@ void WidgetWin::AdjustWindowToFitScreenSize() {
void WidgetWin::ChangeSize(UINT size_param, const CSize& size) {
CRect rect;
- if (layered_) {
+ if (use_layered_buffer_) {
GetWindowRect(&rect);
SizeContents(rect);
} else {
@@ -812,7 +831,7 @@ void WidgetWin::ChangeSize(UINT size_param, const CSize& size) {
root_view_->Layout();
root_view_->SchedulePaint();
- if (layered_)
+ if (use_layered_buffer_)
PaintNow(gfx::Rect(rect));
}
@@ -844,7 +863,7 @@ void WidgetWin::PaintLayeredWindow() {
}
void WidgetWin::UpdateWindowFromContents(HDC dib_dc) {
- DCHECK(layered_);
+ DCHECK(use_layered_buffer_);
if (can_update_layered_window_) {
CRect wr;
GetWindowRect(&wr);