0

Revert "zoom-for-dsf,FindInPage: Account for dsf when sending selection."

This reverts commit 0ebb95dd3e.

Reason for revert: crbug.com/1285351.

Original change's description:
> zoom-for-dsf,FindInPage: Account for dsf when sending selection.
>
> When use-zoom-for-dsf is enabled, the web contents computes selection
> rects in physical pixels. However, the code in find bar that checks
> intersection of selection with findbar is expecting DIPs. The patch
> is to convert from physical to dips when we send the selection rect
> to the browser
>
> R=​sky@chromium.org
>
> Bug: 1234683
> Change-Id: Ie14e5899ee2db5b5f0be72d1ecf9d5d8b88d5ea8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3365829
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Vladimir Levin <vmpstr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#956266}

Bug: 1234683
Change-Id: Ie48e5a0ef0865b194fa2689272c15b4e08aef69d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373362
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Xi Han <hanxi@chromium.org>
Owners-Override: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#956564}
This commit is contained in:
Xi Han
2022-01-07 17:51:00 +00:00
committed by Chromium LUCI CQ
parent 1ecbca7430
commit 73edf0016a

@ -40,7 +40,6 @@
#include "third_party/blink/renderer/core/editing/finder/text_finder.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
@ -343,23 +342,13 @@ void FindInPage::ReportFindInPageMatchCount(int request_id,
: mojom::blink::FindMatchUpdateType::kMoreUpdatesComing);
}
void FindInPage::ReportFindInPageSelection(
int request_id,
int active_match_ordinal,
const gfx::Rect& local_selection_rect,
bool final_update) {
void FindInPage::ReportFindInPageSelection(int request_id,
int active_match_ordinal,
const gfx::Rect& selection_rect,
bool final_update) {
// In tests, |client_| might not be set.
if (!client_)
return;
float device_scale_factor = 1.f;
if (LocalFrame* local_frame = frame_->GetFrame()) {
device_scale_factor =
local_frame->GetPage()->GetChromeClient().WindowToViewportScalar(
local_frame, 1.0f);
}
auto selection_rect = gfx::ScaleToEnclosingRect(local_selection_rect,
1.f / device_scale_factor);
client_->SetActiveMatch(
request_id, selection_rect, active_match_ordinal,
final_update ? mojom::blink::FindMatchUpdateType::kFinalUpdate