| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 *focus = focus_webrect; | 2017 *focus = focus_webrect; |
| 2018 *anchor = anchor_webrect; | 2018 *anchor = anchor_webrect; |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 void RenderWidget::UpdateSelectionBounds() { | 2021 void RenderWidget::UpdateSelectionBounds() { |
| 2022 if (!webwidget_) | 2022 if (!webwidget_) |
| 2023 return; | 2023 return; |
| 2024 if (handling_ime_event_) | 2024 if (handling_ime_event_) |
| 2025 return; | 2025 return; |
| 2026 | 2026 |
| 2027 #if defined(USE_AURA) |
| 2028 // TODO(mohsen): For now, always send explicit selection IPC notifications for |
| 2029 // Aura beucause composited selection updates are not working for webview tags |
| 2030 // which regresses IME inside webview. Remove this when composited selection |
| 2031 // updates are fixed for webviews. |
| 2032 bool send_ipc = true; |
| 2033 #else |
| 2027 // With composited selection updates, the selection bounds will be reported | 2034 // With composited selection updates, the selection bounds will be reported |
| 2028 // directly by the compositor, in which case explicit IPC selection | 2035 // directly by the compositor, in which case explicit IPC selection |
| 2029 // notifications should be suppressed. | 2036 // notifications should be suppressed. |
| 2030 if (!blink::WebRuntimeFeatures::isCompositedSelectionUpdateEnabled()) { | 2037 bool send_ipc = |
| 2038 !blink::WebRuntimeFeatures::isCompositedSelectionUpdateEnabled(); |
| 2039 #endif |
| 2040 if (send_ipc) { |
| 2031 ViewHostMsg_SelectionBounds_Params params; | 2041 ViewHostMsg_SelectionBounds_Params params; |
| 2032 GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect); | 2042 GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect); |
| 2033 if (selection_anchor_rect_ != params.anchor_rect || | 2043 if (selection_anchor_rect_ != params.anchor_rect || |
| 2034 selection_focus_rect_ != params.focus_rect) { | 2044 selection_focus_rect_ != params.focus_rect) { |
| 2035 selection_anchor_rect_ = params.anchor_rect; | 2045 selection_anchor_rect_ = params.anchor_rect; |
| 2036 selection_focus_rect_ = params.focus_rect; | 2046 selection_focus_rect_ = params.focus_rect; |
| 2037 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); | 2047 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); |
| 2038 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); | 2048 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); |
| 2039 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 2049 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
| 2040 } | 2050 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2483 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2474 video_hole_frames_.AddObserver(frame); | 2484 video_hole_frames_.AddObserver(frame); |
| 2475 } | 2485 } |
| 2476 | 2486 |
| 2477 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2487 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2478 video_hole_frames_.RemoveObserver(frame); | 2488 video_hole_frames_.RemoveObserver(frame); |
| 2479 } | 2489 } |
| 2480 #endif // defined(VIDEO_HOLE) | 2490 #endif // defined(VIDEO_HOLE) |
| 2481 | 2491 |
| 2482 } // namespace content | 2492 } // namespace content |
| OLD | NEW |