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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 8294026: Support IMM32 reconversion on Windows (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // Clamp the tooltip length to kMaxTooltipLength so that we don't 377 // Clamp the tooltip length to kMaxTooltipLength so that we don't
378 // accidentally DOS the user with a mega tooltip. 378 // accidentally DOS the user with a mega tooltip.
379 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength); 379 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength);
380 if (GetWidget()) 380 if (GetWidget())
381 GetWidget()->TooltipTextChanged(this); 381 GetWidget()->TooltipTextChanged(this);
382 } 382 }
383 383
384 void RenderWidgetHostViewViews::SelectionChanged(const string16& text, 384 void RenderWidgetHostViewViews::SelectionChanged(const string16& text,
385 size_t offset, 385 size_t offset,
386 const ui::Range& range) { 386 const ui::Range& range) {
387 selection_text_ = text; 387 RenderWidgetHostView::SelectionChanged(text, offset, range);
388 selection_text_offset_ = offset;
389 selection_range_ = range;
390
391 // TODO(anicolao): deal with the clipboard without GTK 388 // TODO(anicolao): deal with the clipboard without GTK
392 NOTIMPLEMENTED(); 389 NOTIMPLEMENTED();
393 } 390 }
394 391
395 void RenderWidgetHostViewViews::SelectionBoundsChanged( 392 void RenderWidgetHostViewViews::SelectionBoundsChanged(
396 const gfx::Rect& start_rect, 393 const gfx::Rect& start_rect,
397 const gfx::Rect& end_rect) { 394 const gfx::Rect& end_rect) {
398 views::InputMethod* input_method = GetInputMethod(); 395 views::InputMethod* input_method = GetInputMethod();
399 396
400 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) 397 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect)
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 742
746 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { 743 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() {
747 return selection_start_rect_.Union(selection_end_rect_); 744 return selection_start_rect_.Union(selection_end_rect_);
748 } 745 }
749 746
750 bool RenderWidgetHostViewViews::HasCompositionText() { 747 bool RenderWidgetHostViewViews::HasCompositionText() {
751 return has_composition_text_; 748 return has_composition_text_;
752 } 749 }
753 750
754 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { 751 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) {
755 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 752 range->set_start(selection_text_offset_);
756 NOTIMPLEMENTED(); 753 range->set_end(selection_text_offset_ + selection_text_.length());
757 return false; 754 return true;
758 } 755 }
759 756
760 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { 757 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) {
761 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 758 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
762 NOTIMPLEMENTED(); 759 NOTIMPLEMENTED();
763 return false; 760 return false;
764 } 761 }
765 762
766 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { 763 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) {
767 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 764 range->set_start(selection_range_.start());
768 NOTIMPLEMENTED(); 765 range->set_end(selection_range_.end());
769 return false; 766 return true;
770 } 767 }
771 768
772 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { 769 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) {
773 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 770 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
774 NOTIMPLEMENTED(); 771 NOTIMPLEMENTED();
775 return false; 772 return false;
776 } 773 }
777 774
778 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { 775 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) {
779 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 776 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
780 NOTIMPLEMENTED(); 777 NOTIMPLEMENTED();
781 return false; 778 return false;
782 } 779 }
783 780
784 bool RenderWidgetHostViewViews::GetTextFromRange( 781 bool RenderWidgetHostViewViews::GetTextFromRange(
785 const ui::Range& range, 782 const ui::Range& range,
786 const base::Callback<void(const string16&)>& callback) { 783 string16* text) {
787 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 784 ui::Range selection_text_range(selection_text_offset_,
788 NOTIMPLEMENTED(); 785 selection_text_offset_ + selection_text_.length());
789 return false; 786
787 if (!selection_text_range.Contains(range)) {
788 text->clear();
789 return false;
790 }
791 if (selection_text_range.EqualsIgnoringDirection(range)) {
792 // Avoid calling substr which performance is low.
793 *text = selection_text_;
794 } else {
795 *text = selection_text_.substr(
796 range.GetMin() - selection_text_offset_,
797 range.length());
798 }
799 return true;
790 } 800 }
791 801
792 void RenderWidgetHostViewViews::OnInputMethodChanged() { 802 void RenderWidgetHostViewViews::OnInputMethodChanged() {
793 if (!host_) 803 if (!host_)
794 return; 804 return;
795 805
796 DCHECK(GetInputMethod()); 806 DCHECK(GetInputMethod());
797 host_->SetInputMethodActive(GetInputMethod()->IsActive()); 807 host_->SetInputMethodActive(GetInputMethod()->IsActive());
798 808
799 // TODO(suzhe): implement the newly added “locale” property of HTML DOM 809 // TODO(suzhe): implement the newly added “locale” property of HTML DOM
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 for (std::vector< base::Callback<void(void)> >::const_iterator 1168 for (std::vector< base::Callback<void(void)> >::const_iterator
1159 it = on_compositing_ended_callbacks_.begin(); 1169 it = on_compositing_ended_callbacks_.begin();
1160 it != on_compositing_ended_callbacks_.end(); ++it) { 1170 it != on_compositing_ended_callbacks_.end(); ++it) {
1161 it->Run(); 1171 it->Run();
1162 } 1172 }
1163 on_compositing_ended_callbacks_.clear(); 1173 on_compositing_ended_callbacks_.clear();
1164 compositor->RemoveObserver(this); 1174 compositor->RemoveObserver(this);
1165 } 1175 }
1166 1176
1167 #endif 1177 #endif
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_views.h ('k') | content/browser/renderer_host/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698