Skip to content

Commit

Permalink
[Region Capture] fix blue border in iframes
Browse files Browse the repository at this point in the history
This patch changes the FSVCI to no longer output a region_capture_rect
whenever the region under capture is embedded in a separate renderer.
This effectively resolves a bug where the blue border is drawn in the
wrong location in this case.

Bug: 1327560
Change-Id: I99a2154f9f455e86df2aaa7151f84178e5202c1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3699030
Reviewed-by: Elad Alon <eladalon@chromium.org>
Commit-Queue: Jordan Bayles <jophba@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014101}
  • Loading branch information
baylesj authored and Chromium LUCI CQ committed Jun 14, 2022
1 parent 758e618 commit 684d14c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,17 @@ void FrameSinkVideoCapturerImpl::MaybeCaptureFrame(
return;
}

if (absl::holds_alternative<RegionCaptureCropId>(target_->sub_target)) {
// If the target is in a different renderer than the root renderer (indicated
// by having a different frame sink ID), we currently cannot provide
// reasonable metadata about the region capture rect. For more context, see
// https://crbug.com/1327560.
//
// TODO(https://crbug.com/1335175): Provide accurate bounds for elements
// embedded in different renderers.
const bool is_same_frame_sink_as_requested =
resolved_target_->GetFrameSinkId() == target_->frame_sink_id;
if (absl::holds_alternative<RegionCaptureCropId>(target_->sub_target) &&
is_same_frame_sink_as_requested) {
const float scale_factor = frame_metadata.device_scale_factor;
metadata.region_capture_rect =
scale_factor ? ScaleToEnclosingRect(capture_region, 1.0f / scale_factor)
Expand Down
4 changes: 4 additions & 0 deletions media/base/video_frame_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ struct MEDIA_EXPORT VideoFrameMetadata {
// If cropping was applied due to Region Capture to produce this frame,
// then this reflects where the frame's contents originate from in the
// original uncropped frame.
//
// NOTE: May also be nullopt if region capture is enabled but the capture rect
// is in a different coordinate space. For more info, see
// https://crbug.com/1327560.
absl::optional<gfx::Rect> region_capture_rect;

// Whenever cropTo() is called, Blink increments the crop_version and records
Expand Down

0 comments on commit 684d14c

Please sign in to comment.