From 2a3423509e09300ff6a860f4ce1c158f1cbc8a12 Mon Sep 17 00:00:00 2001 From: huangs Date: Tue, 15 Dec 2015 08:59:24 -0800 Subject: [RenderView] Refactor: Add ElementBoundsInWindow(). Autofill has repeated code to get element's bounds in Viewport coordinates as blink::WebRect, then convert it to bounds in Window coordinates as gfx::RectF. Extracting this to a single function simplifies upcoming refactoring. Review URL: https://codereview.chromium.org/1514693012 Cr-Commit-Position: refs/heads/master@{#365268} --- content/public/renderer/render_view.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'content/public/renderer') diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h index 1f0a235..16ce47f 100644 --- a/content/public/renderer/render_view.h +++ b/content/public/renderer/render_view.h @@ -13,6 +13,7 @@ #include "content/public/common/top_controls_state.h" #include "ipc/ipc_sender.h" #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/native_widget_types.h" namespace blink { @@ -131,6 +132,12 @@ class CONTENT_EXPORT RenderView : public IPC::Sender { // becomes DSF times larger than window coordinates. virtual void convertViewportToWindow(blink::WebRect* rect) = 0; + // Returns the bounds of |element| in Window coordinates. The bounds have been + // adjusted to include any transformations, including page scale. + // This function will update the layout if required. + virtual gfx::RectF ElementBoundsInWindow(const blink::WebElement& element) + = 0; + protected: ~RenderView() override {} -- cgit v1.1