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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 SetBrowserAccessibilityManager( | 530 SetBrowserAccessibilityManager( |
531 BrowserAccessibilityManager::CreateEmptyDocument( | 531 BrowserAccessibilityManager::CreateEmptyDocument( |
532 m_hWnd, busy_state, this)); | 532 m_hWnd, busy_state, this)); |
533 } | 533 } |
534 | 534 |
535 return GetBrowserAccessibilityManager()->GetRoot()-> | 535 return GetBrowserAccessibilityManager()->GetRoot()-> |
536 ToBrowserAccessibilityWin(); | 536 ToBrowserAccessibilityWin(); |
537 } | 537 } |
538 | 538 |
539 void RenderWidgetHostViewWin::MovePluginWindows( | 539 void RenderWidgetHostViewWin::MovePluginWindows( |
540 const gfx::Point& scroll_offset, | 540 const gfx::Vector2d& scroll_offset, |
541 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { | 541 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) { |
542 MovePluginWindowsHelper(m_hWnd, plugin_window_moves); | 542 MovePluginWindowsHelper(m_hWnd, plugin_window_moves); |
543 } | 543 } |
544 | 544 |
545 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { | 545 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { |
546 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); | 546 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); |
547 vector->push_back(hwnd); | 547 vector->push_back(hwnd); |
548 return TRUE; | 548 return TRUE; |
549 } | 549 } |
550 | 550 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // have animations or fairly expensive layout (e.g., google maps). | 706 // have animations or fairly expensive layout (e.g., google maps). |
707 // | 707 // |
708 // We paint this window synchronously, however child windows (i.e. plugins) | 708 // We paint this window synchronously, however child windows (i.e. plugins) |
709 // are painted asynchronously. By avoiding synchronous cross-process window | 709 // are painted asynchronously. By avoiding synchronous cross-process window |
710 // message dispatching we allow scrolling to be smooth, and also avoid the | 710 // message dispatching we allow scrolling to be smooth, and also avoid the |
711 // browser process locking up if the plugin process is hung. | 711 // browser process locking up if the plugin process is hung. |
712 // | 712 // |
713 RedrawWindow(NULL, damage_region, RDW_UPDATENOW | RDW_NOCHILDREN); | 713 RedrawWindow(NULL, damage_region, RDW_UPDATENOW | RDW_NOCHILDREN); |
714 | 714 |
715 // Send the invalid rect in screen coordinates. | 715 // Send the invalid rect in screen coordinates. |
716 gfx::Rect screen_rect = GetViewBounds(); | |
717 gfx::Rect invalid_screen_rect(damage_bounds); | 716 gfx::Rect invalid_screen_rect(damage_bounds); |
718 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | 717 invalid_screen_rect.Offset(GetViewBounds().OffsetFromOrigin()); |
719 | 718 |
720 PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect); | 719 PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect); |
721 } | 720 } |
722 | 721 |
723 void RenderWidgetHostViewWin::DidUpdateBackingStore( | 722 void RenderWidgetHostViewWin::DidUpdateBackingStore( |
724 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 723 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
725 const std::vector<gfx::Rect>& copy_rects) { | 724 const std::vector<gfx::Rect>& copy_rects) { |
726 if (is_hidden_) | 725 if (is_hidden_) |
727 return; | 726 return; |
728 | 727 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 if (whiteout_start_time_.is_null()) | 1319 if (whiteout_start_time_.is_null()) |
1321 whiteout_start_time_ = TimeTicks::Now(); | 1320 whiteout_start_time_ = TimeTicks::Now(); |
1322 } | 1321 } |
1323 } | 1322 } |
1324 | 1323 |
1325 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, | 1324 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, |
1326 CPaintDC* dc) { | 1325 CPaintDC* dc) { |
1327 if (!background_.empty()) { | 1326 if (!background_.empty()) { |
1328 gfx::Rect dirty_area(dirty_rect); | 1327 gfx::Rect dirty_area(dirty_rect); |
1329 gfx::Canvas canvas(dirty_area.size(), ui::SCALE_FACTOR_100P, true); | 1328 gfx::Canvas canvas(dirty_area.size(), ui::SCALE_FACTOR_100P, true); |
1330 canvas.Translate(gfx::Point().Subtract(dirty_area.origin())); | 1329 canvas.Translate(-dirty_area.OffsetFromOrigin()); |
1331 | 1330 |
1332 gfx::Rect dc_rect(dc->m_ps.rcPaint); | 1331 gfx::Rect dc_rect(dc->m_ps.rcPaint); |
1333 // TODO(pkotwicz): Fix |background_| such that it is an ImageSkia. | 1332 // TODO(pkotwicz): Fix |background_| such that it is an ImageSkia. |
1334 canvas.TileImageInt(gfx::ImageSkia(background_), | 1333 canvas.TileImageInt(gfx::ImageSkia(background_), |
1335 0, 0, dc_rect.width(), dc_rect.height()); | 1334 0, 0, dc_rect.width(), dc_rect.height()); |
1336 | 1335 |
1337 skia::DrawToNativeContext(canvas.sk_canvas(), *dc, dirty_area.x(), | 1336 skia::DrawToNativeContext(canvas.sk_canvas(), *dc, dirty_area.x(), |
1338 dirty_area.y(), NULL); | 1337 dirty_area.y(), NULL); |
1339 } else { | 1338 } else { |
1340 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); | 1339 HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 // receive a focus change in the context of a pointer down message, it means | 3013 // receive a focus change in the context of a pointer down message, it means |
3015 // that the pointer down message occurred on the edit field and we should | 3014 // that the pointer down message occurred on the edit field and we should |
3016 // display the on screen keyboard | 3015 // display the on screen keyboard |
3017 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3016 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
3018 DisplayOnScreenKeyboardIfNeeded(); | 3017 DisplayOnScreenKeyboardIfNeeded(); |
3019 received_focus_change_after_pointer_down_ = false; | 3018 received_focus_change_after_pointer_down_ = false; |
3020 pointer_down_context_ = false; | 3019 pointer_down_context_ = false; |
3021 } | 3020 } |
3022 | 3021 |
3023 } // namespace content | 3022 } // namespace content |
OLD | NEW |