Commit 7c194f47 authored by alexst@chromium.org's avatar alexst@chromium.org

Move webview size information into RWHVGuest.

Managing size information via the platform view has undesirable side effects.

For instance in aura, calls to SetBounds cause the platform view to take
resize locks, which are not needed for something that is displayed indirectly.

BUG=


Review URL: https://chromiumcodereview.appspot.com/13647006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192626 0039d316-1c4b-4281-b951-d872f2087c98
parent 5085668f
......@@ -76,11 +76,12 @@ void RenderWidgetHostViewGuest::WasHidden() {
}
void RenderWidgetHostViewGuest::SetSize(const gfx::Size& size) {
platform_view_->SetSize(size);
size_ = size;
host_->WasResized();
}
gfx::Rect RenderWidgetHostViewGuest::GetBoundsInRootWindow() {
return platform_view_->GetBoundsInRootWindow();
return gfx::Rect(size_);
}
gfx::GLSurfaceHandle RenderWidgetHostViewGuest::GetCompositingSurface() {
......@@ -124,7 +125,7 @@ bool RenderWidgetHostViewGuest::IsShowing() {
}
gfx::Rect RenderWidgetHostViewGuest::GetViewBounds() const {
return platform_view_->GetViewBounds();
return gfx::Rect(size_);
}
void RenderWidgetHostViewGuest::RenderViewGone(base::TerminationStatus status,
......@@ -178,7 +179,7 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
}
void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) {
platform_view_->SetBounds(rect);
SetSize(rect.size());
}
bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) {
......
......@@ -205,6 +205,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest
BrowserPluginGuest *guest_;
bool is_hidden_;
gfx::Size size_;
// The platform view for this RenderWidgetHostView.
// RenderWidgetHostViewGuest mostly only cares about stuff related to
// compositing, the rest are directly forwared to this |platform_view_|.
......
......@@ -51,11 +51,14 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const {
}
void WebContentsViewGuest::GetContainerBounds(gfx::Rect* out) const {
platform_view_->GetContainerBounds(out);
out->SetRect(0, 0, size_.width(), size_.height());
}
void WebContentsViewGuest::SizeContents(const gfx::Size& size) {
platform_view_->SizeContents(size);
size_ = size;
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
}
void WebContentsViewGuest::SetInitialFocus() {
......@@ -63,7 +66,7 @@ void WebContentsViewGuest::SetInitialFocus() {
}
gfx::Rect WebContentsViewGuest::GetViewBounds() const {
return platform_view_->GetViewBounds();
return gfx::Rect(size_);
}
#if defined(OS_MACOSX)
......@@ -75,6 +78,7 @@ void WebContentsViewGuest::SetAllowOverlappingViews(bool overlapping) {
void WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
gfx::NativeView context) {
platform_view_->CreateView(initial_size, context);
size_ = initial_size;
}
RenderWidgetHostView* WebContentsViewGuest::CreateViewForWidget(
......
......@@ -97,6 +97,7 @@ class CONTENT_EXPORT WebContentsViewGuest
// The platform dependent view backing this WebContentsView.
// Calls to this WebContentsViewGuest are forwarded to |platform_view_|.
WebContentsViewPort* platform_view_;
gfx::Size size_;
DISALLOW_COPY_AND_ASSIGN(WebContentsViewGuest);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment