Commit 493222fd authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Fix DevTools eyedropper when device scale factor is not 1

FrameSinkVideoCapturer returns a full-resolution snapshot of the page,
but DevToolsEyeDropper expects the snapshot to be scaled to the page's
dip size. This is problematic for the current configuration of
FrameSinkVideoCapturer if device scale factor is anything other than 1.
Make sure FrameSinkVideoCaptuerer also scales the snapshot to the
expected size.

TBR=caseq@chromium.org

Bug: 813929
Change-Id: I324c6dccfd7db69e07d2283f826a613946c0bf07
Reviewed-on: https://chromium-review.googlesource.com/986291
Commit-Queue: Saman Sami <samans@chromium.org>
Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548312}
parent 8f34677d
...@@ -65,9 +65,8 @@ void DevToolsEyeDropper::AttachToHost(content::RenderWidgetHost* host) { ...@@ -65,9 +65,8 @@ void DevToolsEyeDropper::AttachToHost(content::RenderWidgetHost* host) {
// Create and configure the video capturer. // Create and configure the video capturer.
video_capturer_ = host_->GetView()->CreateVideoCapturer(); video_capturer_ = host_->GetView()->CreateVideoCapturer();
video_capturer_->SetResolutionConstraints( video_capturer_->SetResolutionConstraints(
gfx::Size(1, 1), host_->GetView()->GetViewBounds().size(),
gfx::Size(media::limits::kMaxDimension, media::limits::kMaxDimension), host_->GetView()->GetViewBounds().size(), true);
false);
video_capturer_->SetAutoThrottlingEnabled(false); video_capturer_->SetAutoThrottlingEnabled(false);
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta()); video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB, video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
...@@ -317,6 +316,13 @@ void DevToolsEyeDropper::OnFrameCaptured( ...@@ -317,6 +316,13 @@ void DevToolsEyeDropper::OnFrameCaptured(
const gfx::Rect& update_rect, const gfx::Rect& update_rect,
const gfx::Rect& content_rect, const gfx::Rect& content_rect,
viz::mojom::FrameSinkVideoConsumerFrameCallbacksPtr callbacks) { viz::mojom::FrameSinkVideoConsumerFrameCallbacksPtr callbacks) {
gfx::Size view_size = host_->GetView()->GetViewBounds().size();
if (view_size != content_rect.size()) {
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
video_capturer_->RequestRefreshFrame();
return;
}
if (!buffer.is_valid()) { if (!buffer.is_valid()) {
callbacks->Done(); callbacks->Done();
return; return;
......
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