Chromium Code Reviews| 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_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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 if (root) { | 550 if (root) { |
| 551 aura::client::CursorClient* cursor_client = | 551 aura::client::CursorClient* cursor_client = |
| 552 aura::client::GetCursorClient(root); | 552 aura::client::GetCursorClient(root); |
| 553 if (cursor_client) | 553 if (cursor_client) |
| 554 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 554 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 555 } | 555 } |
| 556 | 556 |
| 557 delegated_frame_host_->WasShown(browser_latency_info); | 557 delegated_frame_host_->WasShown(browser_latency_info); |
| 558 | 558 |
| 559 #if defined(OS_WIN) | 559 #if defined(OS_WIN) |
| 560 if (legacy_render_widget_host_HWND_) { | 560 if (legacy_render_widget_host_HWND_) { |
|
ananta
2016/05/20 23:54:09
Can we unify this with UpdateLegacyWin()?
dmazzoni
2016/05/23 22:45:49
Done.
| |
| 561 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | 561 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent |
| 562 // window before reparenting any plugins. This ensures that the plugin | 562 // window before reparenting any plugins. This ensures that the plugin |
| 563 // windows stay on top of the child Zorder in the parent and receive | 563 // windows stay on top of the child Zorder in the parent and receive |
| 564 // mouse events, etc. | 564 // mouse events, etc. |
| 565 legacy_render_widget_host_HWND_->UpdateParent( | 565 legacy_render_widget_host_HWND_->UpdateParent( |
| 566 GetNativeView()->GetHost()->GetAcceleratedWidget()); | 566 GetNativeView()->GetHost()->GetAcceleratedWidget()); |
| 567 legacy_render_widget_host_HWND_->SetBounds( | 567 legacy_render_widget_host_HWND_->SetBounds( |
| 568 window_->GetBoundsInRootWindow()); | 568 window_->GetBoundsInRootWindow()); |
| 569 legacy_render_widget_host_HWND_->Show(); | 569 legacy_render_widget_host_HWND_->Show(); |
| 570 } | 570 } |
| (...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2491 | 2491 |
| 2492 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { | 2492 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |
| 2493 SnapToPhysicalPixelBoundary(); | 2493 SnapToPhysicalPixelBoundary(); |
| 2494 // Don't recursively call SetBounds if this bounds update is the result of | 2494 // Don't recursively call SetBounds if this bounds update is the result of |
| 2495 // a Window::SetBoundsInternal call. | 2495 // a Window::SetBoundsInternal call. |
| 2496 if (!in_bounds_changed_) | 2496 if (!in_bounds_changed_) |
| 2497 window_->SetBounds(rect); | 2497 window_->SetBounds(rect); |
| 2498 host_->WasResized(); | 2498 host_->WasResized(); |
| 2499 delegated_frame_host_->WasResized(); | 2499 delegated_frame_host_->WasResized(); |
| 2500 #if defined(OS_WIN) | 2500 #if defined(OS_WIN) |
| 2501 // Create the legacy dummy window which corresponds to the bounds of the | 2501 UpdateLegacyWin(); |
| 2502 // webcontents. It is needed for accessibility and for scrolling to work in | |
| 2503 // legacy drivers for trackpoints/trackpads, etc. | |
| 2504 if (!legacy_window_destroyed_ && GetHostWindowHWND()) { | |
| 2505 if (!legacy_render_widget_host_HWND_) { | |
| 2506 legacy_render_widget_host_HWND_ = | |
| 2507 LegacyRenderWidgetHostHWND::Create(GetHostWindowHWND()); | |
| 2508 } | |
| 2509 if (legacy_render_widget_host_HWND_) { | |
| 2510 legacy_render_widget_host_HWND_->set_host(this); | |
| 2511 legacy_render_widget_host_HWND_->SetBounds( | |
| 2512 window_->GetBoundsInRootWindow()); | |
| 2513 // There are cases where the parent window is created, made visible and | |
| 2514 // the associated RenderWidget is also visible before the | |
| 2515 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
| 2516 // here. | |
| 2517 if (!host_->is_hidden()) | |
| 2518 legacy_render_widget_host_HWND_->Show(); | |
| 2519 } | |
| 2520 } | |
| 2521 | 2502 |
| 2522 if (mouse_locked_) | 2503 if (mouse_locked_) |
| 2523 UpdateMouseLockRegion(); | 2504 UpdateMouseLockRegion(); |
| 2524 #endif | 2505 #endif |
| 2525 } | 2506 } |
| 2526 | 2507 |
| 2508 #if defined(OS_WIN) | |
| 2509 void RenderWidgetHostViewAura::UpdateLegacyWin() { | |
| 2510 if (legacy_window_destroyed_ || | |
| 2511 !GetHostWindowHWND() || | |
| 2512 window_->GetBoundsInRootWindow().IsEmpty()) { | |
| 2513 return; | |
| 2514 } | |
| 2515 | |
| 2516 if (!legacy_render_widget_host_HWND_) { | |
| 2517 legacy_render_widget_host_HWND_ = | |
| 2518 LegacyRenderWidgetHostHWND::Create(GetHostWindowHWND()); | |
| 2519 } | |
| 2520 | |
| 2521 if (legacy_render_widget_host_HWND_) { | |
| 2522 legacy_render_widget_host_HWND_->set_host(this); | |
| 2523 legacy_render_widget_host_HWND_->UpdateParent(GetHostWindowHWND()); | |
| 2524 legacy_render_widget_host_HWND_->SetBounds( | |
| 2525 window_->GetBoundsInRootWindow()); | |
| 2526 // There are cases where the parent window is created, made visible and | |
| 2527 // the associated RenderWidget is also visible before the | |
| 2528 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
| 2529 // here. | |
| 2530 if (!host_->is_hidden()) | |
| 2531 legacy_render_widget_host_HWND_->Show(); | |
| 2532 } | |
| 2533 } | |
| 2534 #endif | |
| 2535 | |
| 2527 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2536 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
| 2528 const gfx::Rect& rect, | 2537 const gfx::Rect& rect, |
| 2529 const gfx::Rect& clip) { | 2538 const gfx::Rect& clip) { |
| 2530 if (!clip.IsEmpty()) { | 2539 if (!clip.IsEmpty()) { |
| 2531 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); | 2540 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); |
| 2532 if (!to_paint.IsEmpty()) | 2541 if (!to_paint.IsEmpty()) |
| 2533 window_->SchedulePaintInRect(to_paint); | 2542 window_->SchedulePaintInRect(to_paint); |
| 2534 } else { | 2543 } else { |
| 2535 window_->SchedulePaintInRect(rect); | 2544 window_->SchedulePaintInRect(rect); |
| 2536 } | 2545 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 2558 cursor_client->AddObserver(this); | 2567 cursor_client->AddObserver(this); |
| 2559 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 2568 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 2560 } | 2569 } |
| 2561 if (HasFocus()) { | 2570 if (HasFocus()) { |
| 2562 ui::InputMethod* input_method = GetInputMethod(); | 2571 ui::InputMethod* input_method = GetInputMethod(); |
| 2563 if (input_method) | 2572 if (input_method) |
| 2564 input_method->SetFocusedTextInputClient(this); | 2573 input_method->SetFocusedTextInputClient(this); |
| 2565 } | 2574 } |
| 2566 | 2575 |
| 2567 #if defined(OS_WIN) | 2576 #if defined(OS_WIN) |
| 2568 // The parent may have changed here. Ensure that the legacy window is | 2577 UpdateLegacyWin(); |
| 2569 // reparented accordingly. | |
| 2570 if (legacy_render_widget_host_HWND_) | |
| 2571 legacy_render_widget_host_HWND_->UpdateParent(GetHostWindowHWND()); | |
| 2572 #endif | 2578 #endif |
| 2573 | 2579 |
| 2574 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor()); | 2580 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor()); |
| 2575 } | 2581 } |
| 2576 | 2582 |
| 2577 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2583 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
| 2578 aura::client::CursorClient* cursor_client = | 2584 aura::client::CursorClient* cursor_client = |
| 2579 aura::client::GetCursorClient(window_->GetRootWindow()); | 2585 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2580 if (cursor_client) | 2586 if (cursor_client) |
| 2581 cursor_client->RemoveObserver(this); | 2587 cursor_client->RemoveObserver(this); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2865 | 2871 |
| 2866 //////////////////////////////////////////////////////////////////////////////// | 2872 //////////////////////////////////////////////////////////////////////////////// |
| 2867 // RenderWidgetHostViewBase, public: | 2873 // RenderWidgetHostViewBase, public: |
| 2868 | 2874 |
| 2869 // static | 2875 // static |
| 2870 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2876 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2871 GetScreenInfoForWindow(results, NULL); | 2877 GetScreenInfoForWindow(results, NULL); |
| 2872 } | 2878 } |
| 2873 | 2879 |
| 2874 } // namespace content | 2880 } // namespace content |
| OLD | NEW |