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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 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
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_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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 758
759 void RenderWidgetHostViewWin::SelectionBoundsChanged( 759 void RenderWidgetHostViewWin::SelectionBoundsChanged(
760 const gfx::Rect& start_rect, 760 const gfx::Rect& start_rect,
761 WebKit::WebTextDirection start_direction, 761 WebKit::WebTextDirection start_direction,
762 const gfx::Rect& end_rect, 762 const gfx::Rect& end_rect,
763 WebKit::WebTextDirection end_direction) { 763 WebKit::WebTextDirection end_direction) {
764 bool is_enabled = (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE && 764 bool is_enabled = (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE &&
765 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD); 765 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD);
766 // Only update caret position if the input method is enabled. 766 // Only update caret position if the input method is enabled.
767 if (is_enabled) { 767 if (is_enabled) {
768 caret_rect_ = start_rect.Union(end_rect); 768 caret_rect_ = start_rect;
769 caret_rect_.Union(end_rect);
769 ime_input_.UpdateCaretRect(m_hWnd, caret_rect_); 770 ime_input_.UpdateCaretRect(m_hWnd, caret_rect_);
770 } 771 }
771 } 772 }
772 773
773 void RenderWidgetHostViewWin::ImeCancelComposition() { 774 void RenderWidgetHostViewWin::ImeCancelComposition() {
774 ime_input_.CancelIME(m_hWnd); 775 ime_input_.CancelIME(m_hWnd);
775 } 776 }
776 777
777 void RenderWidgetHostViewWin::ImeCompositionRangeChanged( 778 void RenderWidgetHostViewWin::ImeCompositionRangeChanged(
778 const ui::Range& range, 779 const ui::Range& range,
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 // Grabbing the damaged regions failed, fake with the whole rect. 1345 // Grabbing the damaged regions failed, fake with the whole rect.
1345 data_size = sizeof(RGNDATAHEADER) + sizeof(RECT); 1346 data_size = sizeof(RGNDATAHEADER) + sizeof(RECT);
1346 region_data_buf.reset(new char[data_size]); 1347 region_data_buf.reset(new char[data_size]);
1347 region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get()); 1348 region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get());
1348 region_rects = reinterpret_cast<RECT*>(region_data->Buffer); 1349 region_rects = reinterpret_cast<RECT*>(region_data->Buffer);
1349 region_data->rdh.nCount = 1; 1350 region_data->rdh.nCount = 1;
1350 region_rects[0] = damaged_rect.ToRECT(); 1351 region_rects[0] = damaged_rect.ToRECT();
1351 } 1352 }
1352 1353
1353 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { 1354 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) {
1354 gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i])); 1355 gfx::Rect paint_rect = bitmap_rect;
1356 paint_rect.Intersect(gfx::Rect(region_rects[i]));
1355 if (!paint_rect.IsEmpty()) { 1357 if (!paint_rect.IsEmpty()) {
1356 BitBlt(paint_dc.m_hDC, 1358 BitBlt(paint_dc.m_hDC,
1357 paint_rect.x(), 1359 paint_rect.x(),
1358 paint_rect.y(), 1360 paint_rect.y(),
1359 paint_rect.width(), 1361 paint_rect.width(),
1360 paint_rect.height(), 1362 paint_rect.height(),
1361 backing_store->hdc(), 1363 backing_store->hdc(),
1362 paint_rect.x(), 1364 paint_rect.x(),
1363 paint_rect.y(), 1365 paint_rect.y(),
1364 SRCCOPY); 1366 SRCCOPY);
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 // receive a focus change in the context of a pointer down message, it means 3093 // receive a focus change in the context of a pointer down message, it means
3092 // that the pointer down message occurred on the edit field and we should 3094 // that the pointer down message occurred on the edit field and we should
3093 // display the on screen keyboard 3095 // display the on screen keyboard
3094 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 3096 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
3095 DisplayOnScreenKeyboardIfNeeded(); 3097 DisplayOnScreenKeyboardIfNeeded();
3096 received_focus_change_after_pointer_down_ = false; 3098 received_focus_change_after_pointer_down_ = false;
3097 pointer_down_context_ = false; 3099 pointer_down_context_ = false;
3098 } 3100 }
3099 3101
3100 } // namespace content 3102 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/common/gpu/image_transport_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698