Merge pull request #9440 from brenca/osr-fixes

Additional small OSR fixes
This commit is contained in:
Cheng Zhao 2017-05-17 17:14:27 +09:00 committed by GitHub
commit 9bed0ffdbf
4 changed files with 28 additions and 8 deletions

View file

@ -1660,6 +1660,18 @@ void WebContents::Invalidate() {
}
}
gfx::Size WebContents::GetSizeForNewRenderView(
content::WebContents* wc) const {
if (IsOffScreen() && wc == web_contents()) {
auto relay = NativeWindowRelay::FromWebContents(web_contents());
if (relay) {
return relay->window->GetSize();
}
}
return gfx::Size();
}
void WebContents::SetZoomLevel(double level) {
zoom_controller_->SetZoomLevel(level);
}

View file

@ -185,6 +185,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetFrameRate(int frame_rate);
int GetFrameRate() const;
void Invalidate();
gfx::Size GetSizeForNewRenderView(content::WebContents*) const override;
// Methods for zoom handling.
void SetZoomLevel(double level);

View file

@ -858,6 +858,8 @@ std::unique_ptr<cc::SoftwareOutputDevice>
DCHECK(!copy_frame_generator_);
DCHECK(!software_output_device_);
ResizeRootLayer();
software_output_device_ = new OffScreenOutputDevice(
transparent_,
base::Bind(&OffScreenRenderWidgetHostView::OnPaint,
@ -1127,8 +1129,8 @@ void OffScreenRenderWidgetHostView::InvalidateBounds(const gfx::Rect& bounds) {
void OffScreenRenderWidgetHostView::ResizeRootLayer() {
SetupFrameRate(false);
const float orgScaleFactor = scale_factor_;
const bool scaleFactorDidChange = (orgScaleFactor != scale_factor_);
const float compositorScaleFactor = GetCompositor()->device_scale_factor();
const bool scaleFactorDidChange = (compositorScaleFactor != scale_factor_);
gfx::Size size;
if (!IsPopupWidget())