| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "ui/aura/client/screen_position_client.h" | 66 #include "ui/aura/client/screen_position_client.h" |
| 67 #include "ui/aura/client/window_tree_client.h" | 67 #include "ui/aura/client/window_tree_client.h" |
| 68 #include "ui/aura/env.h" | 68 #include "ui/aura/env.h" |
| 69 #include "ui/aura/window.h" | 69 #include "ui/aura/window.h" |
| 70 #include "ui/aura/window_event_dispatcher.h" | 70 #include "ui/aura/window_event_dispatcher.h" |
| 71 #include "ui/aura/window_observer.h" | 71 #include "ui/aura/window_observer.h" |
| 72 #include "ui/aura/window_tree_host.h" | 72 #include "ui/aura/window_tree_host.h" |
| 73 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 73 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 74 #include "ui/base/hit_test.h" | 74 #include "ui/base/hit_test.h" |
| 75 #include "ui/base/ime/input_method.h" | 75 #include "ui/base/ime/input_method.h" |
| 76 #include "ui/base/ui_base_switches.h" |
| 76 #include "ui/base/ui_base_types.h" | 77 #include "ui/base/ui_base_types.h" |
| 77 #include "ui/compositor/compositor_vsync_manager.h" | 78 #include "ui/compositor/compositor_vsync_manager.h" |
| 78 #include "ui/compositor/dip_util.h" | 79 #include "ui/compositor/dip_util.h" |
| 79 #include "ui/display/display.h" | 80 #include "ui/display/display.h" |
| 80 #include "ui/display/screen.h" | 81 #include "ui/display/screen.h" |
| 81 #include "ui/events/blink/blink_event_util.h" | 82 #include "ui/events/blink/blink_event_util.h" |
| 82 #include "ui/events/event.h" | 83 #include "ui/events/event.h" |
| 83 #include "ui/events/event_utils.h" | 84 #include "ui/events/event_utils.h" |
| 84 #include "ui/events/gesture_detection/gesture_configuration.h" | 85 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 85 #include "ui/events/gestures/gesture_recognizer.h" | 86 #include "ui/events/gestures/gesture_recognizer.h" |
| (...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 size_t before, size_t after) { | 1605 size_t before, size_t after) { |
| 1605 RenderFrameHostImpl* rfh = GetFocusedFrame(); | 1606 RenderFrameHostImpl* rfh = GetFocusedFrame(); |
| 1606 if (rfh) | 1607 if (rfh) |
| 1607 rfh->ExtendSelectionAndDelete(before, after); | 1608 rfh->ExtendSelectionAndDelete(before, after); |
| 1608 } | 1609 } |
| 1609 | 1610 |
| 1610 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) { | 1611 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) { |
| 1611 gfx::Rect intersected_rect( | 1612 gfx::Rect intersected_rect( |
| 1612 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); | 1613 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); |
| 1613 | 1614 |
| 1614 if (intersected_rect.IsEmpty()) | 1615 if (!intersected_rect.IsEmpty()) |
| 1616 host_->ScrollFocusedEditableNodeIntoRect( |
| 1617 ConvertRectFromScreen(intersected_rect)); |
| 1618 |
| 1619 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1620 ::switches::kUseNewVKWindowBehavior)) |
| 1615 return; | 1621 return; |
| 1616 | 1622 |
| 1617 host_->ScrollFocusedEditableNodeIntoRect( | 1623 display::Screen* screen = display::Screen::GetScreen(); |
| 1618 ConvertRectFromScreen(intersected_rect)); | 1624 if (screen->GetPrimaryDisplay().id() != |
| 1625 screen->GetDisplayNearestWindow(window_).id()) |
| 1626 return; |
| 1627 |
| 1628 aura::Window* top_level_window = window_->GetToplevelWindow(); |
| 1629 |
| 1630 if (top_level_window->GetProperty(aura::client::kVKNewBoundsKey)) { |
| 1631 top_level_window->ClearProperty(aura::client::kVKNewBoundsKey); |
| 1632 } else if (rect != screen->GetPrimaryDisplay().bounds()) { |
| 1633 gfx::Rect window_bounds = top_level_window->GetBoundsInRootWindow(); |
| 1634 int vertical_displacement = |
| 1635 std::max(0, window_bounds.bottom() - rect.bottom()); |
| 1636 int shift = std::min(vertical_displacement, window_bounds.y()); |
| 1637 |
| 1638 if (shift > 0) { |
| 1639 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift); |
| 1640 top_level_window->SetProperty( |
| 1641 aura::client::kVKNewBoundsKey, |
| 1642 new gfx::Rect(origin, window_bounds.size())); |
| 1643 } |
| 1644 } |
| 1619 } | 1645 } |
| 1620 | 1646 |
| 1621 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled( | 1647 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled( |
| 1622 ui::TextEditCommand command) const { | 1648 ui::TextEditCommand command) const { |
| 1623 return false; | 1649 return false; |
| 1624 } | 1650 } |
| 1625 | 1651 |
| 1626 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent( | 1652 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent( |
| 1627 ui::TextEditCommand command) {} | 1653 ui::TextEditCommand command) {} |
| 1628 | 1654 |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 return; | 3078 return; |
| 3053 } | 3079 } |
| 3054 | 3080 |
| 3055 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3081 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3056 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3082 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3057 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); | 3083 clipboard_writer.WriteText(text_selection->text.substr(pos, n)); |
| 3058 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3084 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3059 } | 3085 } |
| 3060 | 3086 |
| 3061 } // namespace content | 3087 } // namespace content |
| OLD | NEW |