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

Unified Diff: content/renderer/render_widget.cc

Issue 186753002: Chromium plumbing to use the selection root bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 198d7d4cdfeef0e149fe91ac495c13cadc3f0f95..7325e41f8d93e136f13d005d3c3f9eded1621f56 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1499,6 +1499,7 @@ void RenderWidget::DoDeferredUpdate() {
// enable GPU acceleration so they need to be called before any painting
// is done.
UpdateTextInputType();
+ UpdateSelectionRootBounds();
UpdateSelectionBounds();
// Suppress painting if nothing is dirty. This has to be done after updating
@@ -1885,6 +1886,7 @@ void RenderWidget::willBeginCompositorFrame() {
#if defined(OS_ANDROID)
UpdateTextInputState(false, true);
#endif
+ UpdateSelectionRootBounds();
UpdateSelectionBounds();
}
@@ -2387,6 +2389,7 @@ void RenderWidget::FinishHandlingImeEvent() {
// While handling an ime event, text input state and selection bounds updates
// are ignored. These must explicitly be updated once finished handling the
// ime event.
+ UpdateSelectionRootBounds();
timvolodine 2014/03/05 19:50:46 Should this be android-only? Not sure if the selec
mlamouri (slow - plz ping) 2014/03/10 15:56:45 I was considering making it Android only but I the
UpdateSelectionBounds();
#if defined(OS_ANDROID)
UpdateTextInputState(false, false);
@@ -2506,6 +2509,25 @@ void RenderWidget::UpdateSelectionBounds() {
#endif
}
+void RenderWidget::GetSelectionRootBounds(gfx::Rect* bounds) {
+ WebRect bounds_webrect;
+ webwidget_->selectionRootBounds(bounds_webrect);
+ *bounds = bounds_webrect;
+}
+
+void RenderWidget::UpdateSelectionRootBounds() {
timvolodine 2014/03/05 19:50:46 I think we need a better name for "UpdateSelection
mlamouri (slow - plz ping) 2014/03/10 15:56:45 I would prefer to have the name reflecting what th
+ if (!webwidget_ || handling_ime_event_) {
+ return;
+ }
+
+ gfx::Rect bounds;
+ GetSelectionRootBounds(&bounds);
+ if (selection_root_rect_ != bounds) {
+ selection_root_rect_ = bounds;
+ Send(new ViewHostMsg_SelectionRootBoundsChanged(routing_id_, bounds));
+ }
+}
+
// Check blink::WebTextInputType and ui::TextInputType is kept in sync.
COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \
int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums);
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698