Merge pull request #7062 from MaxWhere/osr-sizing-fix

Offscreen invalidate and sizing fix
This commit is contained in:
Cheng Zhao 2016-09-19 15:38:11 +09:00 committed by GitHub
commit a260647b4f
5 changed files with 43 additions and 6 deletions

View file

@ -1418,6 +1418,15 @@ int WebContents::GetFrameRate() const {
return osr_rwhv ? osr_rwhv->GetFrameRate() : 0;
}
void WebContents::Invalidate() {
if (!IsOffScreen())
return;
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
web_contents()->GetRenderWidgetHostView());
if (osr_rwhv)
osr_rwhv->Invalidate();
}
v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
WebContentsPreferences* web_preferences =
@ -1527,6 +1536,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("isPainting", &WebContents::IsPainting)
.SetMethod("setFrameRate", &WebContents::SetFrameRate)
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
.SetMethod("invalidate", &WebContents::Invalidate)
.SetMethod("getType", &WebContents::GetType)
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)

View file

@ -164,6 +164,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
bool IsPainting() const;
void SetFrameRate(int frame_rate);
int GetFrameRate() const;
void Invalidate();
// Callback triggered on permission response.
void OnEnterFullscreenModeForTab(content::WebContents* source,