summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 23:04:48 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 23:04:48 +0000
commit7deaa81460cae8f40cbd3408a611527b2299c354 (patch)
treedf5bd337270d024838b2b83595c970156e741f85 /chrome/browser/views
parent12a7aa885e5067665577bb86b20f004f0e8c57cb (diff)
downloadchromium_src-7deaa81460cae8f40cbd3408a611527b2299c354.zip
chromium_src-7deaa81460cae8f40cbd3408a611527b2299c354.tar.gz
chromium_src-7deaa81460cae8f40cbd3408a611527b2299c354.tar.bz2
Fix several painting glitches for toolstrips.
* Reset HWND size when HWNDHtmlView changes size. The two should always be in sync. * Race: We might already have frames when RenderWidget receives a new background, need to set these to transparent too. * Race: Toolstrip background not always available by the time ExtensionToolstrip is constucted * Make images line up correctly for toolstrip buttons. Review URL: http://codereview.chromium.org/99042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc13
-rw-r--r--chrome/browser/views/hwnd_html_view.cc22
-rw-r--r--chrome/browser/views/hwnd_html_view.h9
3 files changed, 37 insertions, 7 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 34c4f9b..d9ebbd6 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -1432,16 +1432,17 @@ bool BookmarkBarView::AddExtensionToolstrips(const ExtensionList* extensions) {
bool added_toolstrip = false;
for (ExtensionList::const_iterator extension = extensions->begin();
extension != extensions->end(); ++extension) {
- for (std::vector<std::string>::const_iterator toolstrip =
+ for (std::vector<std::string>::const_iterator toolstrip_path =
(*extension)->toolstrips().begin();
- toolstrip != (*extension)->toolstrips().end(); ++toolstrip) {
- ExtensionToolstrip* view =
+ toolstrip_path != (*extension)->toolstrips().end(); ++toolstrip_path) {
+ ExtensionToolstrip* toolstrip =
new ExtensionToolstrip(*extension,
- (*extension)->GetResourceURL(*toolstrip),
+ (*extension)->GetResourceURL(*toolstrip_path),
browser_);
int index = GetBookmarkButtonCount() + num_extension_toolstrips_;
- view->view()->SetBackground(toolstrip_background_);
- AddChildView(index, view);
+ if (!toolstrip_background_.empty())
+ toolstrip->view()->SetBackground(toolstrip_background_);
+ AddChildView(index, toolstrip);
added_toolstrip = true;
++num_extension_toolstrips_;
}
diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc
index a0174d6..6856f57 100644
--- a/chrome/browser/views/hwnd_html_view.cc
+++ b/chrome/browser/views/hwnd_html_view.cc
@@ -32,6 +32,28 @@ HWNDHtmlView::~HWNDHtmlView() {
}
}
+void HWNDHtmlView::SetVisible(bool is_visible) {
+ HWNDView::SetVisible(is_visible);
+
+ // Also tell RenderWidgetHostView the new visibility. Despite its name, it is
+ // not part of the View heirarchy and does not know about the change unless we
+ // tell it.
+ if (render_view_host() && render_view_host()->view()) {
+ if (is_visible)
+ render_view_host()->view()->Show();
+ else
+ render_view_host()->view()->Hide();
+ }
+}
+
+void HWNDHtmlView::DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current) {
+ // Propagate the new size to RenderWidgetHostView.
+ // We can't send size zero because RenderWidget DCHECKs that.
+ if (render_view_host() && render_view_host()->view() && !current.IsEmpty())
+ render_view_host()->view()->SetSize(gfx::Size(width(), height()));
+}
+
void HWNDHtmlView::SetBackground(const SkBitmap& background) {
if (initialized_) {
DCHECK(render_view_host_);
diff --git a/chrome/browser/views/hwnd_html_view.h b/chrome/browser/views/hwnd_html_view.h
index 49e2c88..275c891 100644
--- a/chrome/browser/views/hwnd_html_view.h
+++ b/chrome/browser/views/hwnd_html_view.h
@@ -22,6 +22,13 @@ class HWNDHtmlView : public views::HWNDView {
bool allow_dom_ui_bindings, SiteInstance* instance);
virtual ~HWNDHtmlView();
+ // View
+ virtual void SetVisible(bool is_visible);
+
+ virtual void DidChangeBounds(const gfx::Rect& previous,
+ const gfx::Rect& current);
+
+ // HWNDHtmlView
RenderViewHost* render_view_host() { return render_view_host_; }
// Initialize the view without a parent window. Used for extensions that
@@ -29,7 +36,7 @@ class HWNDHtmlView : public views::HWNDView {
void InitHidden();
// Set a custom background for the view. The background will be tiled.
- void SetBackground(const SkBitmap& background);
+ virtual void SetBackground(const SkBitmap& background);
protected:
// View overrides.