OLD | NEW |
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_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
10 #include <stack> | 10 #include <stack> |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 770 |
771 void RenderWidgetHostViewWin::SelectionBoundsChanged( | 771 void RenderWidgetHostViewWin::SelectionBoundsChanged( |
772 const gfx::Rect& start_rect, | 772 const gfx::Rect& start_rect, |
773 WebKit::WebTextDirection start_direction, | 773 WebKit::WebTextDirection start_direction, |
774 const gfx::Rect& end_rect, | 774 const gfx::Rect& end_rect, |
775 WebKit::WebTextDirection end_direction) { | 775 WebKit::WebTextDirection end_direction) { |
776 bool is_enabled = (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE && | 776 bool is_enabled = (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE && |
777 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD); | 777 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD); |
778 // Only update caret position if the input method is enabled. | 778 // Only update caret position if the input method is enabled. |
779 if (is_enabled) { | 779 if (is_enabled) { |
780 caret_rect_ = start_rect; | 780 caret_rect_ = gfx::UnionRects(start_rect, end_rect); |
781 caret_rect_.Union(end_rect); | |
782 ime_input_.UpdateCaretRect(m_hWnd, caret_rect_); | 781 ime_input_.UpdateCaretRect(m_hWnd, caret_rect_); |
783 } | 782 } |
784 } | 783 } |
785 | 784 |
786 void RenderWidgetHostViewWin::ImeCancelComposition() { | 785 void RenderWidgetHostViewWin::ImeCancelComposition() { |
787 ime_input_.CancelIME(m_hWnd); | 786 ime_input_.CancelIME(m_hWnd); |
788 } | 787 } |
789 | 788 |
790 void RenderWidgetHostViewWin::ImeCompositionRangeChanged( | 789 void RenderWidgetHostViewWin::ImeCompositionRangeChanged( |
791 const ui::Range& range, | 790 const ui::Range& range, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 // Grabbing the damaged regions failed, fake with the whole rect. | 1356 // Grabbing the damaged regions failed, fake with the whole rect. |
1358 data_size = sizeof(RGNDATAHEADER) + sizeof(RECT); | 1357 data_size = sizeof(RGNDATAHEADER) + sizeof(RECT); |
1359 region_data_buf.reset(new char[data_size]); | 1358 region_data_buf.reset(new char[data_size]); |
1360 region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get()); | 1359 region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get()); |
1361 region_rects = reinterpret_cast<RECT*>(region_data->Buffer); | 1360 region_rects = reinterpret_cast<RECT*>(region_data->Buffer); |
1362 region_data->rdh.nCount = 1; | 1361 region_data->rdh.nCount = 1; |
1363 region_rects[0] = damaged_rect.ToRECT(); | 1362 region_rects[0] = damaged_rect.ToRECT(); |
1364 } | 1363 } |
1365 | 1364 |
1366 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { | 1365 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { |
1367 gfx::Rect paint_rect = bitmap_rect; | 1366 gfx::Rect paint_rect = |
1368 paint_rect.Intersect(gfx::Rect(region_rects[i])); | 1367 gfx::IntersectRects(bitmap_rect, gfx::Rect(region_rects[i])); |
1369 if (!paint_rect.IsEmpty()) { | 1368 if (!paint_rect.IsEmpty()) { |
1370 BitBlt(paint_dc.m_hDC, | 1369 BitBlt(paint_dc.m_hDC, |
1371 paint_rect.x(), | 1370 paint_rect.x(), |
1372 paint_rect.y(), | 1371 paint_rect.y(), |
1373 paint_rect.width(), | 1372 paint_rect.width(), |
1374 paint_rect.height(), | 1373 paint_rect.height(), |
1375 backing_store->hdc(), | 1374 backing_store->hdc(), |
1376 paint_rect.x(), | 1375 paint_rect.x(), |
1377 paint_rect.y(), | 1376 paint_rect.y(), |
1378 SRCCOPY); | 1377 SRCCOPY); |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 // receive a focus change in the context of a pointer down message, it means | 3114 // receive a focus change in the context of a pointer down message, it means |
3116 // that the pointer down message occurred on the edit field and we should | 3115 // that the pointer down message occurred on the edit field and we should |
3117 // display the on screen keyboard | 3116 // display the on screen keyboard |
3118 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3117 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
3119 DisplayOnScreenKeyboardIfNeeded(); | 3118 DisplayOnScreenKeyboardIfNeeded(); |
3120 received_focus_change_after_pointer_down_ = false; | 3119 received_focus_change_after_pointer_down_ = false; |
3121 pointer_down_context_ = false; | 3120 pointer_down_context_ = false; |
3122 } | 3121 } |
3123 | 3122 |
3124 } // namespace content | 3123 } // namespace content |
OLD | NEW |