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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2235283003: Track composition range and character bounds on the browser side (Mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to fix some crashing tests Created 4 years, 4 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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1483 }
1484 1484
1485 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( 1485 bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(
1486 uint32_t index, 1486 uint32_t index,
1487 gfx::Rect* rect) const { 1487 gfx::Rect* rect) const {
1488 DCHECK(rect); 1488 DCHECK(rect);
1489 1489
1490 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget()) 1490 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
1491 return false; 1491 return false;
1492 1492
1493 const std::vector<gfx::Rect>* composition_character_bounds = 1493 const TextInputManager::CompositionRangeInfo* composition_range_info =
1494 text_input_manager_->GetCompositionCharacterBounds(); 1494 text_input_manager_->GetCompositionRangeInfo();
1495 if (index >= composition_character_bounds->size()) 1495
1496 if (index >= composition_range_info->character_bounds.size())
1496 return false; 1497 return false;
1497 *rect = ConvertRectToScreen(composition_character_bounds->at(index)); 1498 *rect = ConvertRectToScreen(composition_range_info->character_bounds[index]);
1498 return true; 1499 return true;
1499 } 1500 }
1500 1501
1501 bool RenderWidgetHostViewAura::HasCompositionText() const { 1502 bool RenderWidgetHostViewAura::HasCompositionText() const {
1502 return has_composition_text_; 1503 return has_composition_text_;
1503 } 1504 }
1504 1505
1505 bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const { 1506 bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const {
1506 if (!text_input_manager_) 1507 if (!text_input_manager_)
1507 return false; 1508 return false;
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 return; 3053 return;
3053 } 3054 }
3054 3055
3055 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 3056 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
3056 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); 3057 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
3057 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); 3058 clipboard_writer.WriteText(text_selection->text.substr(pos, n));
3058 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 3059 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
3059 } 3060 }
3060 3061
3061 } // namespace content 3062 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698