Commit 03eb8f05 authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Commit Bot

Remove WebLocalFrame::ReportFindInPage{MatchCount,Selection}

WebLocalFrame::ReportFindInPageMatchCount and ReportFindInPageSelection
are only called by plugin code. This CL changes the plugin code to call
those functions on FindInPage directly and removes the functions.

Bug: 819919
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I5df288ac6ce934ec0f6b27b47c17025005a73bad
Reviewed-on: https://chromium-review.googlesource.com/1176898Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583877}
parent cbd95975
......@@ -2655,20 +2655,19 @@ void PepperPluginInstanceImpl::NumberOfFindResultsChanged(
// them.
if (find_identifier_ == -1)
return;
if (render_frame_) {
render_frame_->GetWebFrame()->ReportFindInPageMatchCount(
find_identifier_, total, PP_ToBool(final_result));
}
if (!container_)
return;
container_->ReportFindInPageMatchCount(find_identifier_, total,
PP_ToBool(final_result));
}
void PepperPluginInstanceImpl::SelectedFindResultChanged(PP_Instance instance,
int32_t index) {
if (find_identifier_ == -1)
return;
if (render_frame_ && render_frame_->GetWebFrame()) {
render_frame_->GetWebFrame()->ReportFindInPageSelection(
find_identifier_, index + 1, blink::WebRect(), false /* final_update*/);
}
if (!container_)
return;
container_->ReportFindInPageSelection(find_identifier_, index + 1);
}
void PepperPluginInstanceImpl::SetTickmarks(PP_Instance instance,
......
......@@ -679,30 +679,6 @@ class WebLocalFrame : public WebFrame {
// default behavior will be restored.
virtual void SetTickmarks(const WebVector<WebRect>&) = 0;
// Notifies how many matches have been found in this frame so far, for a
// given identifier. |final_update| specifies whether this is the last
// update for this frame.
// TODO(rakina): Make WebPluginContainer call FindInPage directly and remove
// this.
virtual void ReportFindInPageMatchCount(int identifier,
int count,
bool final_update) = 0;
// Notifies what tick-mark rect is currently selected. The given
// identifier lets the client know which request this message belongs
// to, so that it can choose to ignore the message if it has moved on
// to other things. The selection rect is expected to have coordinates
// relative to the top left corner of the web page area and represent
// where on the screen the selection rect is currently located.
// |final_update| specifies whether this is the last update for this
// frame.
// TODO(rakina): Make WebPluginContainer call FindInPage directly and remove
// this.
virtual void ReportFindInPageSelection(int identifier,
int active_match_ordinal,
const WebRect& selection,
bool final_update) = 0;
// Context menu -----------------------------------------------------------
// Returns the node that the context menu opened over.
......
......@@ -138,6 +138,11 @@ class WebPluginContainer {
// Sets |this| as find handler for the associated frame.
virtual void UsePluginAsFindHandler() = 0;
virtual void ReportFindInPageMatchCount(int identifier,
int total,
bool final_update) = 0;
virtual void ReportFindInPageSelection(int identifier, int index) = 0;
virtual float DeviceScaleFactor() = 0;
virtual float PageScaleFactor() = 0;
virtual float PageZoomFactor() = 0;
......
......@@ -51,6 +51,7 @@
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/find_in_page.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
......@@ -597,7 +598,7 @@ void TextFinder::IncreaseMatchCount(int identifier, int count) {
total_match_count_ += count;
// Update the UI with the latest findings.
OwnerFrame().ReportFindInPageMatchCount(
OwnerFrame().GetFindInPage()->ReportFindInPageMatchCount(
identifier, total_match_count_, !frame_scoping_ || !total_match_count_);
}
......@@ -605,9 +606,9 @@ void TextFinder::ReportFindInPageSelection(const WebRect& selection_rect,
int active_match_ordinal,
int identifier) {
// Update the UI with the latest selection rect.
OwnerFrame().ReportFindInPageSelection(identifier, active_match_ordinal,
selection_rect,
false /* final_update */);
OwnerFrame().GetFindInPage()->ReportFindInPageSelection(
identifier, active_match_ordinal, selection_rect,
false /* final_update */);
// Update accessibility too, so if the user commits to this query
// we can move accessibility focus to this result.
ReportFindInPageResultToAccessibility(identifier);
......
......@@ -310,8 +310,30 @@ void WebPluginContainerImpl::SetPlugin(WebPlugin* plugin) {
void WebPluginContainerImpl::UsePluginAsFindHandler() {
WebLocalFrameImpl* frame =
WebLocalFrameImpl::FromFrame(element_->GetDocument().GetFrame());
if (frame)
frame->GetFindInPage()->SetPluginFindHandler(this);
if (!frame)
return;
frame->GetFindInPage()->SetPluginFindHandler(this);
}
void WebPluginContainerImpl::ReportFindInPageMatchCount(int identifier,
int total,
bool final_update) {
WebLocalFrameImpl* frame =
WebLocalFrameImpl::FromFrame(element_->GetDocument().GetFrame());
if (!frame)
return;
frame->GetFindInPage()->ReportFindInPageMatchCount(identifier, total,
final_update);
}
void WebPluginContainerImpl::ReportFindInPageSelection(int identifier,
int index) {
WebLocalFrameImpl* frame =
WebLocalFrameImpl::FromFrame(element_->GetDocument().GetFrame());
if (!frame)
return;
frame->GetFindInPage()->ReportFindInPageSelection(
identifier, index, blink::WebRect(), false /* final_update */);
}
float WebPluginContainerImpl::DeviceScaleFactor() {
......
......@@ -148,6 +148,10 @@ class CORE_EXPORT WebPluginContainerImpl final
void SetPlugin(WebPlugin*) override;
void UsePluginAsFindHandler() override;
void ReportFindInPageMatchCount(int identifier,
int total,
bool final_update) override;
void ReportFindInPageSelection(int identifier, int index) override;
float DeviceScaleFactor() override;
float PageScaleFactor() override;
......
......@@ -321,12 +321,6 @@ void FindInPage::ContextDestroyed(ExecutionContext* context) {
binding_.Close();
}
void WebLocalFrameImpl::ReportFindInPageMatchCount(int request_id,
int count,
bool final_update) {
find_in_page_->ReportFindInPageMatchCount(request_id, count, final_update);
}
void FindInPage::ReportFindInPageMatchCount(int request_id,
int count,
bool final_update) {
......@@ -339,15 +333,6 @@ void FindInPage::ReportFindInPageMatchCount(int request_id,
: mojom::blink::FindMatchUpdateType::kMoreUpdatesComing);
}
void WebLocalFrameImpl::ReportFindInPageSelection(
int request_id,
int active_match_ordinal,
const blink::WebRect& selection_rect,
bool final_update) {
find_in_page_->ReportFindInPageSelection(request_id, active_match_ordinal,
selection_rect, final_update);
}
void FindInPage::ReportFindInPageSelection(int request_id,
int active_match_ordinal,
const blink::WebRect& selection_rect,
......
......@@ -312,13 +312,6 @@ class CORE_EXPORT WebLocalFrameImpl final
bool* active_now = nullptr) override;
void StopFindingForTesting(mojom::StopFindAction) override;
void SetTickmarks(const WebVector<WebRect>&) override;
void ReportFindInPageMatchCount(int identifier,
int count,
bool final_update) override;
void ReportFindInPageSelection(int identifier,
int active_match_ordinal,
const WebRect& selection,
bool final_update) override;
WebNode ContextMenuNode() const override;
WebFrameWidget* FrameWidget() const override;
void CopyImageAt(const WebPoint&) override;
......
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