Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1781873002: content: Rename virtual method on RenderView to not (ab)use blink style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renderwidget-overrides Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 focus_url_ = GURL(url); 1951 focus_url_ = GURL(url);
1952 UpdateTargetURL(focus_url_, mouse_over_url_); 1952 UpdateTargetURL(focus_url_, mouse_over_url_);
1953 } 1953 }
1954 1954
1955 void RenderViewImpl::startDragging(WebLocalFrame* frame, 1955 void RenderViewImpl::startDragging(WebLocalFrame* frame,
1956 const WebDragData& data, 1956 const WebDragData& data,
1957 WebDragOperationsMask mask, 1957 WebDragOperationsMask mask,
1958 const WebImage& image, 1958 const WebImage& image,
1959 const WebPoint& webImageOffset) { 1959 const WebPoint& webImageOffset) {
1960 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0); 1960 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0);
1961 convertViewportToWindow(&offset_in_window); 1961 ConvertViewportToWindowViaWidget(&offset_in_window);
1962 DropData drop_data(DropDataBuilder::Build(data)); 1962 DropData drop_data(DropDataBuilder::Build(data));
1963 drop_data.referrer_policy = frame->document().referrerPolicy(); 1963 drop_data.referrer_policy = frame->document().referrerPolicy();
1964 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y); 1964 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y);
1965 Send(new DragHostMsg_StartDragging(routing_id(), drop_data, mask, 1965 Send(new DragHostMsg_StartDragging(routing_id(), drop_data, mask,
1966 image.getSkBitmap(), imageOffset, 1966 image.getSkBitmap(), imageOffset,
1967 possible_drag_event_info_)); 1967 possible_drag_event_info_));
1968 } 1968 }
1969 1969
1970 bool RenderViewImpl::acceptsLoadDrops() { 1970 bool RenderViewImpl::acceptsLoadDrops() {
1971 return renderer_preferences_.can_accept_load_drops; 1971 return renderer_preferences_.can_accept_load_drops;
(...skipping 10 matching lines...) Expand all
1982 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement. 1982 // TODO(esprehn): Blink only ever passes Elements, this should take WebElement.
1983 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode, 1983 void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode,
1984 const WebNode& toNode) { 1984 const WebNode& toNode) {
1985 has_scrolled_focused_editable_node_into_rect_ = false; 1985 has_scrolled_focused_editable_node_into_rect_ = false;
1986 1986
1987 gfx::Rect node_bounds; 1987 gfx::Rect node_bounds;
1988 bool is_editable = false; 1988 bool is_editable = false;
1989 if (!toNode.isNull() && toNode.isElementNode()) { 1989 if (!toNode.isNull() && toNode.isElementNode()) {
1990 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>(); 1990 WebElement element = const_cast<WebNode&>(toNode).to<WebElement>();
1991 blink::WebRect rect = element.boundsInViewport(); 1991 blink::WebRect rect = element.boundsInViewport();
1992 convertViewportToWindow(&rect); 1992 ConvertViewportToWindowViaWidget(&rect);
1993 node_bounds = gfx::Rect(rect); 1993 node_bounds = gfx::Rect(rect);
1994 is_editable = element.isEditable(); 1994 is_editable = element.isEditable();
1995 } 1995 }
1996 Send(new ViewHostMsg_FocusedNodeChanged(routing_id(), is_editable, 1996 Send(new ViewHostMsg_FocusedNodeChanged(routing_id(), is_editable,
1997 node_bounds)); 1997 node_bounds));
1998 1998
1999 // TODO(estade): remove. 1999 // TODO(estade): remove.
2000 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode)); 2000 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(toNode));
2001 2001
2002 RenderFrameImpl* previous_frame = nullptr; 2002 RenderFrameImpl* previous_frame = nullptr;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 2180
2181 SSLStatus result; 2181 SSLStatus result;
2182 CHECK(DeserializeSecurityInfo(security_info, &result)); 2182 CHECK(DeserializeSecurityInfo(security_info, &result));
2183 return result; 2183 return result;
2184 } 2184 }
2185 2185
2186 const std::string& RenderViewImpl::GetAcceptLanguages() const { 2186 const std::string& RenderViewImpl::GetAcceptLanguages() const {
2187 return renderer_preferences_.accept_languages; 2187 return renderer_preferences_.accept_languages;
2188 } 2188 }
2189 2189
2190 void RenderViewImpl::convertViewportToWindow(blink::WebRect* rect) { 2190 void RenderViewImpl::ConvertViewportToWindowViaWidget(blink::WebRect* rect) {
2191 RenderWidget::convertViewportToWindow(rect); 2191 convertViewportToWindow(rect);
danakj 2016/03/09 23:17:24 In future, this could be GetWidget()->convert...()
2192 } 2192 }
2193 2193
2194 gfx::RectF RenderViewImpl::ElementBoundsInWindow( 2194 gfx::RectF RenderViewImpl::ElementBoundsInWindow(
2195 const blink::WebElement& element) { 2195 const blink::WebElement& element) {
2196 blink::WebRect bounding_box_in_window = element.boundsInViewport(); 2196 blink::WebRect bounding_box_in_window = element.boundsInViewport();
2197 convertViewportToWindow(&bounding_box_in_window); 2197 ConvertViewportToWindowViaWidget(&bounding_box_in_window);
2198 return gfx::RectF(bounding_box_in_window); 2198 return gfx::RectF(bounding_box_in_window);
2199 } 2199 }
2200 2200
2201 float RenderViewImpl::GetDeviceScaleFactorForTest() const { 2201 float RenderViewImpl::GetDeviceScaleFactorForTest() const {
2202 return device_scale_factor_; 2202 return device_scale_factor_;
2203 } 2203 }
2204 2204
2205 gfx::Point RenderViewImpl::ConvertWindowPointToViewport( 2205 gfx::Point RenderViewImpl::ConvertWindowPointToViewport(
2206 const gfx::Point& point) { 2206 const gfx::Point& point) {
2207 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0); 2207 blink::WebFloatRect point_in_viewport(point.x(), point.y(), 0, 0);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 } 3069 }
3070 3070
3071 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { 3071 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
3072 #if defined(ENABLE_PLUGINS) 3072 #if defined(ENABLE_PLUGINS)
3073 if (focused_pepper_plugin_) { 3073 if (focused_pepper_plugin_) {
3074 // TODO(kinaba) http://crbug.com/101101 3074 // TODO(kinaba) http://crbug.com/101101
3075 // Current Pepper IME API does not handle selection bounds. So we simply 3075 // Current Pepper IME API does not handle selection bounds. So we simply
3076 // use the caret position as an empty range for now. It will be updated 3076 // use the caret position as an empty range for now. It will be updated
3077 // after Pepper API equips features related to surrounding text retrieval. 3077 // after Pepper API equips features related to surrounding text retrieval.
3078 blink::WebRect caret(focused_pepper_plugin_->GetCaretBounds()); 3078 blink::WebRect caret(focused_pepper_plugin_->GetCaretBounds());
3079 convertViewportToWindow(&caret); 3079 ConvertViewportToWindowViaWidget(&caret);
3080 *start = caret; 3080 *start = caret;
3081 *end = caret; 3081 *end = caret;
3082 return; 3082 return;
3083 } 3083 }
3084 #endif 3084 #endif
3085 RenderWidget::GetSelectionBounds(start, end); 3085 RenderWidget::GetSelectionBounds(start, end);
3086 } 3086 }
3087 3087
3088 void RenderViewImpl::GetCompositionCharacterBounds( 3088 void RenderViewImpl::GetCompositionCharacterBounds(
3089 std::vector<gfx::Rect>* bounds_in_window) { 3089 std::vector<gfx::Rect>* bounds_in_window) {
(...skipping 20 matching lines...) Expand all
3110 return; 3110 return;
3111 3111
3112 bounds_in_window->reserve(character_count); 3112 bounds_in_window->reserve(character_count);
3113 blink::WebRect webrect; 3113 blink::WebRect webrect;
3114 for (size_t i = 0; i < character_count; ++i) { 3114 for (size_t i = 0; i < character_count; ++i) {
3115 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) { 3115 if (!frame->firstRectForCharacterRange(start_offset + i, 1, webrect)) {
3116 DLOG(ERROR) << "Could not retrieve character rectangle at " << i; 3116 DLOG(ERROR) << "Could not retrieve character rectangle at " << i;
3117 bounds_in_window->clear(); 3117 bounds_in_window->clear();
3118 return; 3118 return;
3119 } 3119 }
3120 convertViewportToWindow(&webrect); 3120 ConvertViewportToWindowViaWidget(&webrect);
3121 bounds_in_window->push_back(webrect); 3121 bounds_in_window->push_back(webrect);
3122 } 3122 }
3123 } 3123 }
3124 3124
3125 void RenderViewImpl::GetCompositionRange(gfx::Range* range) { 3125 void RenderViewImpl::GetCompositionRange(gfx::Range* range) {
3126 #if defined(ENABLE_PLUGINS) 3126 #if defined(ENABLE_PLUGINS)
3127 if (focused_pepper_plugin_) { 3127 if (focused_pepper_plugin_) {
3128 return; 3128 return;
3129 } 3129 }
3130 #endif 3130 #endif
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 if (IsUseZoomForDSFEnabled()) { 3540 if (IsUseZoomForDSFEnabled()) {
3541 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3541 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3542 } else { 3542 } else {
3543 webview()->setDeviceScaleFactor(device_scale_factor_); 3543 webview()->setDeviceScaleFactor(device_scale_factor_);
3544 } 3544 }
3545 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3545 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3546 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3546 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3547 } 3547 }
3548 3548
3549 } // namespace content 3549 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698