0

Remove unnecessary methods from Blink's WebView public API

This is a follow-up CL for crrevc.com/c/2403260 to remove the methods
SetMouseOverURL() and SetKeyboardFocusURL() from Blink::WebView, since
they are no longer used from //content/renderer, but simply internally
from Blink's chrome_client_impl.cc and WebViewImpl.

Bug: 993189, 1047464
Change-Id: I377a03939773b276c0a94704fb36ebd230b121ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403264
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#805801}
This commit is contained in:
Mario Sanchez Prada
2020-09-10 16:58:59 +00:00
committed by Commit Bot
parent 8796b6cb8a
commit 42ca0becfb
4 changed files with 19 additions and 20 deletions
third_party/blink

@ -282,12 +282,6 @@ class WebView {
// Asks the browser process to activate this web view.
virtual void Focus() = 0;
// Called when hovering over an anchor with the given URL.
virtual void SetMouseOverURL(const WebURL&) {}
// Called when keyboard focus switches to an anchor with the given URL.
virtual void SetKeyboardFocusURL(const WebURL&) {}
// Sets the ratio as computed by computePageScaleConstraints.
// TODO(oshima): Remove this once the device scale factor implementation is
// fully migrated to use zooming mechanism.

@ -1521,6 +1521,16 @@ void WebViewImpl::SetMainFrameWidgetBase(WebViewFrameWidget* widget) {
web_widget_ = widget;
}
void WebViewImpl::SetMouseOverURL(const KURL& url) {
mouse_over_url_ = url;
UpdateTargetURL(mouse_over_url_, focus_url_);
}
void WebViewImpl::SetKeyboardFocusURL(const KURL& url) {
focus_url_ = url;
UpdateTargetURL(focus_url_, mouse_over_url_);
}
WebFrameWidgetBase* WebViewImpl::MainFrameWidgetBase() {
return web_widget_;
}
@ -2939,16 +2949,6 @@ void WebViewImpl::Focus() {
}
}
void WebViewImpl::SetMouseOverURL(const WebURL& url) {
mouse_over_url_ = KURL(url);
UpdateTargetURL(mouse_over_url_, focus_url_);
}
void WebViewImpl::SetKeyboardFocusURL(const WebURL& url) {
focus_url_ = KURL(url);
UpdateTargetURL(focus_url_, mouse_over_url_);
}
void WebViewImpl::UpdateTargetURL(const WebURL& url,
const WebURL& fallback_url) {
KURL latest_url = KURL(url.IsEmpty() ? fallback_url : url);

@ -189,8 +189,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void UpdatePreferredSize() override;
void EnablePreferredSizeChangedMode() override;
void Focus() override;
void SetMouseOverURL(const WebURL& url) override;
void SetKeyboardFocusURL(const WebURL& url) override;
void SetDeviceScaleFactor(float) override;
void SetZoomFactorForDeviceScaleFactor(float) override;
float ZoomFactorForDeviceScaleFactor() override {
@ -454,6 +452,12 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void SetMainFrameWidgetBase(WebViewFrameWidget* widget);
WebFrameWidgetBase* MainFrameWidgetBase();
// Called when hovering over an anchor with the given URL.
void SetMouseOverURL(const KURL&);
// Called when keyboard focus switches to an anchor with the given URL.
void SetKeyboardFocusURL(const KURL&);
private:
FRIEND_TEST_ALL_PREFIXES(WebFrameTest, DivScrollIntoEditableTest);
FRIEND_TEST_ALL_PREFIXES(WebFrameTest,

@ -106,6 +106,7 @@
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/widget/frame_widget.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
@ -224,7 +225,7 @@ void ChromeClientImpl::TakeFocus(mojom::blink::FocusType type) {
}
void ChromeClientImpl::SetKeyboardFocusURL(Element* new_focus_element) {
WebURL focus_url;
KURL focus_url;
if (new_focus_element && new_focus_element->IsLiveLink() &&
new_focus_element->ShouldHaveFocusAppearance())
focus_url = new_focus_element->HrefURL();
@ -544,7 +545,7 @@ void ChromeClientImpl::ShowMouseOverURL(const HitTestResult& result) {
if (!web_view_->Client())
return;
WebURL url;
KURL url;
// Ignore URL if hitTest include scrollbar since we might have both a
// scrollbar and an element in the case of overlay scrollbars.