#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include <limits>
#include <memory>
#include <set>
#include <string_view>
#include <utility>
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/layers/layer.h"
#include "cc/trees/layer_tree_settings.h"
#include "components/input/cursor_manager.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/bad_message.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/delegated_frame_host_client_aura.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h"
#include "content/browser/renderer_host/input/touch_selection_controller_client_aura.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
#include "content/browser/renderer_host/visible_time_request_trigger.h"
#include "content/common/input/events_helper.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/device_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/page_visibility_state.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom.h"
#include "ui/accessibility/aura/aura_window_properties.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/accessibility/platform/browser_accessibility_manager.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/cursor_client_observer.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/client/transient_window_client.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tree_host.h"
#include "ui/aura_extra/window_position_in_root_monitor.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/mojom/text_input_state.mojom.h"
#include "ui/base/owned_window_anchor.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h"
#include "ui/base/ui_base_types.h"
#include "ui/display/screen.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/blink/did_overscroll_params.h"
#include "ui/events/blink/web_input_event.h"
#include "ui/events/event.h"
#include "ui/events/event_observer.h"
#include "ui/events/event_utils.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#include "ui/events/gestures/gesture_recognizer.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/touch_selection/touch_selection_controller.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/public/activation_client.h"
#include "ui/wm/public/scoped_tooltip_disabler.h"
#include "ui/wm/public/tooltip_client.h"
#if BUILDFLAG(IS_WIN)
#include "base/time/time.h"
#include "content/browser/renderer_host/legacy_render_widget_host_win.h"
#include "ui/accessibility/platform/ax_fragment_root_win.h"
#include "ui/accessibility/platform/browser_accessibility_manager_win.h"
#include "ui/accessibility/platform/browser_accessibility_win.h"
#include "ui/base/ime/virtual_keyboard_controller.h"
#include "ui/base/ime/virtual_keyboard_controller_observer.h"
#include "ui/base/ime/win/tsf_input_scope.h"
#include "ui/base/win/hidden_window.h"
#include "ui/display/win/screen_win.h"
#include "ui/gfx/gdi_util.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "ui/accessibility/platform/browser_accessibility_auralinux.h"
#include "ui/base/ime/linux/text_edit_command_auralinux.h"
#include "ui/base/ime/text_input_flags.h"
#include "ui/linux/linux_ui.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/wm/core/ime_util_chromeos.h"
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "ui/base/ime/mojom/virtual_keyboard_types.mojom.h"
#endif
RectToSkIRect;
SkIRectToRect;
WebInputEvent;
WebGestureEvent;
WebTouchEvent;
namespace content {
namespace {
BASE_FEATURE(…);
#endif
}
class RenderWidgetHostViewAura::EventObserverForPopupExit
: public ui::EventObserver { … };
void RenderWidgetHostViewAura::ApplyEventObserverForPopupExit(
const ui::LocatedEvent& event) { … }
class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver { … };
RenderWidgetHostViewAura::RenderWidgetHostViewAura(
RenderWidgetHost* widget_host)
: … { … }
void RenderWidgetHostViewAura::InitAsChild(gfx::NativeView parent_view) { … }
void RenderWidgetHostViewAura::InitAsPopup(
RenderWidgetHostView* parent_host_view,
const gfx::Rect& bounds_in_screen,
const gfx::Rect& anchor_rect) { … }
void RenderWidgetHostViewAura::Hide() { … }
void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { … }
void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { … }
gfx::NativeView RenderWidgetHostViewAura::GetNativeView() { … }
#if BUILDFLAG(IS_WIN)
HWND RenderWidgetHostViewAura::GetHostWindowHWND() const {
aura::WindowTreeHost* host = window_->GetHost();
return host ? host->GetAcceleratedWidget() : nullptr;
}
#endif
gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { … }
ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { … }
RenderFrameHostImpl* RenderWidgetHostViewAura::GetFocusedFrame() const { … }
void RenderWidgetHostViewAura::HandleBoundsInRootChanged() { … }
void RenderWidgetHostViewAura::ParentHierarchyChanged() { … }
void RenderWidgetHostViewAura::Focus() { … }
bool RenderWidgetHostViewAura::HasFocus() { … }
bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() { … }
void RenderWidgetHostViewAura::EnsureSurfaceSynchronizedForWebTest() { … }
bool RenderWidgetHostViewAura::IsShowing() { … }
void RenderWidgetHostViewAura::WasUnOccluded() { … }
void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { … }
void RenderWidgetHostViewAura::EnsurePlatformVisibility(
PageVisibilityState page_visibility) { … }
void RenderWidgetHostViewAura::NotifyHostAndDelegateOnWasShown(
blink::mojom::RecordContentToVisibleTimeRequestPtr tab_switch_start_state) { … }
void RenderWidgetHostViewAura::HideImpl() { … }
void RenderWidgetHostViewAura::WasOccluded() { … }
void RenderWidgetHostViewAura::
RequestSuccessfulPresentationTimeFromHostOrDelegate(
blink::mojom::RecordContentToVisibleTimeRequestPtr
visible_time_request) { … }
void RenderWidgetHostViewAura::
CancelSuccessfulPresentationTimeRequestForHostAndDelegate() { … }
viz::SurfaceId RenderWidgetHostViewAura::GetFallbackSurfaceIdForTesting()
const { … }
bool RenderWidgetHostViewAura::ShouldSkipCursorUpdate() const { … }
bool RenderWidgetHostViewAura::ShouldShowStaleContentOnEviction() { … }
gfx::Rect RenderWidgetHostViewAura::GetViewBounds() { … }
void RenderWidgetHostViewAura::UpdateBackgroundColor() { … }
#if BUILDFLAG(IS_WIN)
void RenderWidgetHostViewAura::ObserveDevicePosturePlatformProvider() {
if (device_posture_observation_.IsObserving()) {
return;
}
DevicePosturePlatformProvider* platform_provider =
GetDevicePosturePlatformProvider();
if (!platform_provider) {
return;
}
device_posture_observation_.Observe(platform_provider);
OnDisplayFeatureBoundsChanged(platform_provider->GetDisplayFeatureBounds());
}
#endif
void RenderWidgetHostViewAura::OnDisplayFeatureBoundsChanged(
const gfx::Rect& display_feature_bounds) { … }
void RenderWidgetHostViewAura::ComputeDisplayFeature() { … }
std::optional<DisplayFeature> RenderWidgetHostViewAura::GetDisplayFeature() { … }
void RenderWidgetHostViewAura::SetDisplayFeatureForTesting(
const DisplayFeature* display_feature) { … }
void RenderWidgetHostViewAura::WindowTitleChanged() { … }
bool RenderWidgetHostViewAura::IsPointerLocked() { … }
gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() { … }
void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { … }
void RenderWidgetHostViewAura::UpdateCursor(const ui::Cursor& cursor) { … }
void RenderWidgetHostViewAura::DisplayCursor(const ui::Cursor& cursor) { … }
input::CursorManager* RenderWidgetHostViewAura::GetCursorManager() { … }
void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { … }
void RenderWidgetHostViewAura::RenderProcessGone() { … }
void RenderWidgetHostViewAura::ShowWithVisibility(
PageVisibilityState page_visibility) { … }
void RenderWidgetHostViewAura::Destroy() { … }
void RenderWidgetHostViewAura::UpdateTooltipUnderCursor(
const std::u16string& tooltip_text) { … }
void RenderWidgetHostViewAura::UpdateTooltip(
const std::u16string& tooltip_text) { … }
void RenderWidgetHostViewAura::UpdateTooltipFromKeyboard(
const std::u16string& tooltip_text,
const gfx::Rect& bounds) { … }
void RenderWidgetHostViewAura::ClearKeyboardTriggeredTooltip() { … }
uint32_t RenderWidgetHostViewAura::GetCaptureSequenceNumber() const { … }
void RenderWidgetHostViewAura::CopyFromSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
base::OnceCallback<void(const SkBitmap&)> callback) { … }
#if BUILDFLAG(IS_WIN)
void RenderWidgetHostViewAura::UpdateMouseLockRegion() {
RECT window_rect =
display::Screen::GetScreen()
->DIPToScreenRectInWindow(window_, window_->GetBoundsInScreen())
.ToRECT();
::ClipCursor(&window_rect);
}
void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() {
legacy_render_widget_host_HWND_ = nullptr;
legacy_window_destroyed_ = true;
}
#endif
gfx::NativeViewAccessible
RenderWidgetHostViewAura::GetParentNativeViewAccessible() { … }
void RenderWidgetHostViewAura::ClearFallbackSurfaceForCommitPending() { … }
void RenderWidgetHostViewAura::ResetFallbackToFirstNavigationSurface() { … }
bool RenderWidgetHostViewAura::RequestRepaintForTesting() { … }
void RenderWidgetHostViewAura::DidStopFlinging() { … }
void RenderWidgetHostViewAura::TransformPointToRootSurface(gfx::PointF* point) { … }
gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { … }
void RenderWidgetHostViewAura::WheelEventAck(
const blink::WebMouseWheelEvent& event,
blink::mojom::InputEventResultState ack_result) { … }
void RenderWidgetHostViewAura::DidOverscroll(
const ui::DidOverscrollParams& params) { … }
void RenderWidgetHostViewAura::GestureEventAck(
const blink::WebGestureEvent& event,
blink::mojom::InputEventResultSource ack_source,
blink::mojom::InputEventResultState ack_result) { … }
void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
const input::TouchEventWithLatencyInfo& touch,
blink::mojom::InputEventResultState ack_result) { … }
std::unique_ptr<SyntheticGestureTarget>
RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { … }
blink::mojom::InputEventResultState RenderWidgetHostViewAura::FilterInputEvent(
const blink::WebInputEvent& input_event) { … }
gfx::AcceleratedWidget
RenderWidgetHostViewAura::AccessibilityGetAcceleratedWidget() { … }
gfx::NativeViewAccessible
RenderWidgetHostViewAura::AccessibilityGetNativeViewAccessible() { … }
void RenderWidgetHostViewAura::SetMainFrameAXTreeID(ui::AXTreeID id) { … }
blink::mojom::PointerLockResult RenderWidgetHostViewAura::LockPointer(
bool request_unadjusted_movement) { … }
blink::mojom::PointerLockResult RenderWidgetHostViewAura::ChangePointerLock(
bool request_unadjusted_movement) { … }
void RenderWidgetHostViewAura::UnlockPointer() { … }
bool RenderWidgetHostViewAura::
GetIsPointerLockedUnadjustedMovementForTesting() { … }
bool RenderWidgetHostViewAura::LockKeyboard(
std::optional<base::flat_set<ui::DomCode>> codes) { … }
void RenderWidgetHostViewAura::UnlockKeyboard() { … }
bool RenderWidgetHostViewAura::IsKeyboardLocked() { … }
base::flat_map<std::string, std::string>
RenderWidgetHostViewAura::GetKeyboardLayoutMap() { … }
base::WeakPtr<ui::TextInputClient> RenderWidgetHostViewAura::AsWeakPtr() { … }
void RenderWidgetHostViewAura::SetCompositionText(
const ui::CompositionText& composition) { … }
size_t RenderWidgetHostViewAura::ConfirmCompositionText(bool keep_selection) { … }
void RenderWidgetHostViewAura::ClearCompositionText() { … }
void RenderWidgetHostViewAura::InsertText(
const std::u16string& text,
InsertTextCursorBehavior cursor_behavior) { … }
void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { … }
bool RenderWidgetHostViewAura::CanInsertImage() { … }
void RenderWidgetHostViewAura::InsertImage(const GURL& src) { … }
ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { … }
ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { … }
base::i18n::TextDirection RenderWidgetHostViewAura::GetTextDirection() const { … }
int RenderWidgetHostViewAura::GetTextInputFlags() const { … }
bool RenderWidgetHostViewAura::CanComposeInline() const { … }
gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(
const gfx::Rect& rect) const { … }
gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen(
const gfx::Rect& rect) const { … }
gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { … }
gfx::Rect RenderWidgetHostViewAura::GetSelectionBoundingBox() const { … }
bool RenderWidgetHostViewAura::GetCompositionCharacterBounds(
size_t index,
gfx::Rect* rect) const { … }
bool RenderWidgetHostViewAura::HasCompositionText() const { … }
ui::TextInputClient::FocusReason RenderWidgetHostViewAura::GetFocusReason()
const { … }
bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const { … }
bool RenderWidgetHostViewAura::GetCompositionTextRange(
gfx::Range* range) const { … }
bool RenderWidgetHostViewAura::GetEditableSelectionRange(
gfx::Range* range) const { … }
bool RenderWidgetHostViewAura::SetEditableSelectionRange(
const gfx::Range& range) { … }
bool RenderWidgetHostViewAura::GetTextFromRange(const gfx::Range& range,
std::u16string* text) const { … }
void RenderWidgetHostViewAura::OnInputMethodChanged() { … }
bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment(
base::i18n::TextDirection direction) { … }
void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
size_t before, size_t after) { … }
#if BUILDFLAG(IS_CHROMEOS)
void RenderWidgetHostViewAura::ExtendSelectionAndReplace(
size_t before,
size_t after,
const std::u16string_view replacement_text) {
auto* input_handler = GetFrameWidgetInputHandlerForFocusedWidget();
if (!input_handler) {
return;
}
input_handler->ExtendSelectionAndReplace(before, after,
std::u16string(replacement_text));
}
#endif
void RenderWidgetHostViewAura::EnsureCaretNotInRect(
const gfx::Rect& rect_in_screen) { … }
bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
ui::TextEditCommand command) const { … }
void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent(
ui::TextEditCommand command) { … }
ukm::SourceId RenderWidgetHostViewAura::GetClientSourceForMetrics() const { … }
bool RenderWidgetHostViewAura::ShouldDoLearning() { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
bool RenderWidgetHostViewAura::SetCompositionFromExistingText(
const gfx::Range& range,
const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) { … }
#endif
#if BUILDFLAG(IS_CHROMEOS)
gfx::Range RenderWidgetHostViewAura::GetAutocorrectRange() const {
if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
return gfx::Range();
return text_input_manager_->GetAutocorrectRange();
}
gfx::Rect RenderWidgetHostViewAura::GetAutocorrectCharacterBounds() const {
if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
return gfx::Rect();
const std::vector<ui::mojom::ImeTextSpanInfoPtr>& ime_text_spans_info =
text_input_manager_->GetTextInputState()->ime_text_spans_info;
for (const auto& ime_text_span_info : ime_text_spans_info) {
if (ime_text_span_info->span.type == ui::ImeTextSpan::Type::kAutocorrect) {
return ConvertRectToScreen(ime_text_span_info->bounds);
}
}
return {};
}
bool RenderWidgetHostViewAura::SetAutocorrectRange(
const gfx::Range& range) {
if (!range.is_empty()) {
base::UmaHistogramEnumeration(
"InputMethod.Assistive.Autocorrect.Count",
TextInputClient::SubClass::kRenderWidgetHostViewAura);
}
auto* input_handler = GetFrameWidgetInputHandlerForFocusedWidget();
if (!input_handler)
return false;
input_handler->ClearImeTextSpansByType(0,
std::numeric_limits<uint32_t>::max(),
ui::ImeTextSpan::Type::kAutocorrect);
if (range.is_empty())
return true;
ui::ImeTextSpan ui_ime_text_span;
ui_ime_text_span.type = ui::ImeTextSpan::Type::kAutocorrect;
ui_ime_text_span.start_offset = 0;
ui_ime_text_span.end_offset = range.length();
ui_ime_text_span.underline_style = ui::ImeTextSpan::UnderlineStyle::kDot;
ui_ime_text_span.underline_color =
SkColorSetA(gfx::kGoogleGrey700, SK_AlphaOPAQUE * 0.7);
ui_ime_text_span.thickness = ui::ImeTextSpan::Thickness::kThick;
input_handler->AddImeTextSpansToExistingText(range.start(), range.end(),
{ui_ime_text_span});
return true;
}
std::optional<ui::GrammarFragment>
RenderWidgetHostViewAura::GetGrammarFragmentAtCursor() const {
if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
return std::nullopt;
gfx::Range selection_range;
if (GetEditableSelectionRange(&selection_range)) {
return text_input_manager_->GetGrammarFragment(selection_range);
} else {
return std::nullopt;
}
}
bool RenderWidgetHostViewAura::ClearGrammarFragments(const gfx::Range& range) {
auto* input_handler = GetFrameWidgetInputHandlerForFocusedWidget();
if (!input_handler)
return false;
input_handler->ClearImeTextSpansByType(
range.start(), range.end(), ui::ImeTextSpan::Type::kGrammarSuggestion);
return true;
}
bool RenderWidgetHostViewAura::AddGrammarFragments(
const std::vector<ui::GrammarFragment>& fragments) {
if (!fragments.empty()) {
base::UmaHistogramEnumeration(
"InputMethod.Assistive.Grammar.Count",
TextInputClient::SubClass::kRenderWidgetHostViewAura);
}
auto* input_handler = GetFrameWidgetInputHandlerForFocusedWidget();
if (!input_handler || fragments.empty())
return false;
unsigned max_fragment_end = 0;
std::vector<::ui::ImeTextSpan> ime_text_spans;
ime_text_spans.reserve(fragments.size());
for (auto& fragment : fragments) {
ui::ImeTextSpan ui_ime_text_span;
ui_ime_text_span.type = ui::ImeTextSpan::Type::kGrammarSuggestion;
ui_ime_text_span.start_offset = fragment.range.start();
ui_ime_text_span.end_offset = fragment.range.end();
ui_ime_text_span.thickness = ui::ImeTextSpan::Thickness::kThick;
ui_ime_text_span.underline_style = ui::ImeTextSpan::UnderlineStyle::kDot;
ui_ime_text_span.underline_color = gfx::kGoogleBlue400;
ui_ime_text_span.suggestions = {fragment.suggestion};
ime_text_spans.push_back(ui_ime_text_span);
if (fragment.range.end() > max_fragment_end) {
max_fragment_end = fragment.range.end();
}
}
input_handler->AddImeTextSpansToExistingText(0, max_fragment_end,
ime_text_spans);
return true;
}
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS)
void RenderWidgetHostViewAura::GetActiveTextInputControlLayoutBounds(
std::optional<gfx::Rect>* control_bounds,
std::optional<gfx::Rect>* selection_bounds) {
if (text_input_manager_) {
const std::optional<gfx::Rect> text_control_bounds =
text_input_manager_->GetTextControlBounds();
if (text_control_bounds) {
*control_bounds = ConvertRectToScreen(text_control_bounds.value());
TRACE_EVENT1(
"ime",
"RenderWidgetHostViewAura::GetActiveTextInputControlLayoutBounds",
"control_bounds_rect", control_bounds->value().ToString());
}
const std::optional<gfx::Rect> text_selection_bounds =
text_input_manager_->GetTextSelectionBounds();
if (text_selection_bounds) {
*selection_bounds = ConvertRectToScreen(text_selection_bounds.value());
}
}
}
#endif
#if BUILDFLAG(IS_WIN)
void RenderWidgetHostViewAura::SetActiveCompositionForAccessibility(
const gfx::Range& range,
const std::u16string& active_composition_text,
bool is_composition_committed) {
ui::BrowserAccessibilityManager* manager =
host()->GetRootBrowserAccessibilityManager();
if (manager) {
ui::AXPlatformNodeWin* focus_node = static_cast<ui::AXPlatformNodeWin*>(
ui::AXPlatformNode::FromNativeViewAccessible(
manager->GetFocus()->GetNativeViewAccessible()));
if (focus_node) {
focus_node->OnActiveComposition(range, active_composition_text,
is_composition_committed);
}
}
}
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
ui::TextInputClient::EditingContext
RenderWidgetHostViewAura::GetTextEditingContext() {
ui::TextInputClient::EditingContext editing_context;
RenderFrameHostImpl* frame = GetFocusedFrame();
if (frame)
editing_context.page_url = frame->GetLastCommittedURL();
return editing_context;
}
#endif
#if BUILDFLAG(IS_WIN)
void RenderWidgetHostViewAura::NotifyOnFrameFocusChanged() {
if (GetInputMethod()) {
GetInputMethod()->OnUrlChanged();
}
}
#endif
void RenderWidgetHostViewAura::OnDisplayMetricsChanged(
const display::Display& display,
uint32_t metrics) { … }
gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { … }
gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { … }
void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) { … }
gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { … }
int RenderWidgetHostViewAura::GetNonClientComponent(
const gfx::Point& point) const { … }
bool RenderWidgetHostViewAura::ShouldDescendIntoChildForEventHandling(
aura::Window* child,
const gfx::Point& location) { … }
bool RenderWidgetHostViewAura::CanFocus() { … }
void RenderWidgetHostViewAura::OnCaptureLost() { … }
void RenderWidgetHostViewAura::OnPaint(const ui::PaintContext& context) { … }
void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
float old_device_scale_factor,
float new_device_scale_factor) { … }
void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { … }
void RenderWidgetHostViewAura::OnWindowDestroyed(aura::Window* window) { … }
void RenderWidgetHostViewAura::OnWindowTargetVisibilityChanged(bool visible) { … }
bool RenderWidgetHostViewAura::HasHitTestMask() const { … }
void RenderWidgetHostViewAura::GetHitTestMask(SkPath* mask) const { … }
bool RenderWidgetHostViewAura::RequiresDoubleTapGestureEvents() const { … }
void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { … }
void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { … }
bool RenderWidgetHostViewAura::HasFallbackSurface() const { … }
bool RenderWidgetHostViewAura::TransformPointToCoordSpaceForView(
const gfx::PointF& point,
input::RenderWidgetHostViewInput* target_view,
gfx::PointF* transformed_point) { … }
viz::FrameSinkId RenderWidgetHostViewAura::GetRootFrameSinkId() { … }
viz::SurfaceId RenderWidgetHostViewAura::GetCurrentSurfaceId() const { … }
void RenderWidgetHostViewAura::FocusedNodeChanged(
bool editable,
const gfx::Rect& node_bounds_in_screen) { … }
void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { … }
void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { … }
void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { … }
std::string_view RenderWidgetHostViewAura::GetLogContext() const { … }
bool RenderWidgetHostViewAura::ShouldActivate() const { … }
void RenderWidgetHostViewAura::OnCursorVisibilityChanged(bool is_visible) { … }
void RenderWidgetHostViewAura::OnSystemCursorSizeChanged(
const gfx::Size& system_cursor_size) { … }
void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus,
aura::Window* lost_focus) { … }
void RenderWidgetHostViewAura::OnHostMovedInPixels(aura::WindowTreeHost* host) { … }
void RenderWidgetHostViewAura::OnRenderFrameMetadataChangedAfterActivation(
base::TimeTicks activation_time) { … }
RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { … }
void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { … }
void RenderWidgetHostViewAura::UpdateFrameSinkIdRegistration() { … }
void RenderWidgetHostViewAura::CreateDelegatedFrameHostClient() { … }
void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { … }
bool RenderWidgetHostViewAura::SynchronizeVisualProperties(
const cc::DeadlinePolicy& deadline_policy,
const std::optional<viz::LocalSurfaceId>& child_local_surface_id) { … }
void RenderWidgetHostViewAura::OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata) { … }
ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const { … }
RenderWidgetHostViewBase*
RenderWidgetHostViewAura::GetFocusedViewForTextSelection() const { … }
void RenderWidgetHostViewAura::Shutdown() { … }
ui::mojom::VirtualKeyboardMode
RenderWidgetHostViewAura::GetVirtualKeyboardMode() { … }
void RenderWidgetHostViewAura::NotifyVirtualKeyboardOverlayRect(
const gfx::Rect& keyboard_rect) { … }
bool RenderWidgetHostViewAura::IsHTMLFormPopup() const { … }
void RenderWidgetHostViewAura::ResetGestureDetection() { … }
bool RenderWidgetHostViewAura::FocusedFrameHasStickyActivation() const { … }
TouchSelectionControllerClientManager*
RenderWidgetHostViewAura::GetTouchSelectionControllerClientManager() { … }
bool RenderWidgetHostViewAura::NeedsInputGrab() { … }
bool RenderWidgetHostViewAura::NeedsMouseCapture() { … }
void RenderWidgetHostViewAura::SetTooltipsEnabled(bool enable) { … }
void RenderWidgetHostViewAura::NotifyRendererOfCursorVisibilityState(
bool is_visible) { … }
void RenderWidgetHostViewAura::SetOverscrollControllerEnabled(bool enabled) { … }
void RenderWidgetHostViewAura::SetSelectionControllerClientForTest(
std::unique_ptr<TouchSelectionControllerClientAura> client) { … }
void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { … }
void RenderWidgetHostViewAura::UpdateInsetsWithVirtualKeyboardEnabled() { … }
#if BUILDFLAG(IS_WIN)
void RenderWidgetHostViewAura::UpdateLegacyWin() {
if (legacy_window_destroyed_ || !GetHostWindowHWND())
return;
if (!legacy_render_widget_host_HWND_) {
legacy_render_widget_host_HWND_ =
LegacyRenderWidgetHostHWND::Create(GetHostWindowHWND(), this);
}
if (legacy_render_widget_host_HWND_) {
legacy_render_widget_host_HWND_->UpdateParent(GetHostWindowHWND());
legacy_render_widget_host_HWND_->SetBounds(
window_->GetBoundsInRootWindow());
if (!host()->is_hidden())
legacy_render_widget_host_HWND_->Show();
}
}
#endif
void RenderWidgetHostViewAura::AddedToRootWindow() { … }
void RenderWidgetHostViewAura::RemovingFromRootWindow() { … }
void RenderWidgetHostViewAura::DetachFromInputMethod(bool is_removed) { … }
void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo(
const input::NativeWebKeyboardEvent& event,
const ui::LatencyInfo& latency,
bool* update_event) { … }
void RenderWidgetHostViewAura::CreateSelectionController() { … }
void RenderWidgetHostViewAura::OnOldViewDidNavigatePreCommit() { … }
void RenderWidgetHostViewAura::OnNewViewDidNavigatePostCommit() { … }
void RenderWidgetHostViewAura::DidEnterBackForwardCache() { … }
const viz::FrameSinkId& RenderWidgetHostViewAura::GetFrameSinkId() const { … }
const viz::LocalSurfaceId& RenderWidgetHostViewAura::GetLocalSurfaceId() const { … }
void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view,
bool did_update_state) { … }
void RenderWidgetHostViewAura::OnImeCancelComposition(
TextInputManager* text_input_manager,
RenderWidgetHostViewBase* view) { … }
void RenderWidgetHostViewAura::OnSelectionBoundsChanged(
TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) { … }
void RenderWidgetHostViewAura::OnTextSelectionChanged(
TextInputManager* text_input_manager,
RenderWidgetHostViewBase* updated_view) { … }
void RenderWidgetHostViewAura::SetPopupChild(
RenderWidgetHostViewAura* popup_child_host_view) { … }
void RenderWidgetHostViewAura::ScrollFocusedEditableNodeIntoView() { … }
void RenderWidgetHostViewAura::OnSynchronizedDisplayPropertiesChanged(
bool rotation) { … }
viz::ScopedSurfaceIdAllocator
RenderWidgetHostViewAura::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) { … }
void RenderWidgetHostViewAura::DidNavigate() { … }
MouseWheelPhaseHandler* RenderWidgetHostViewAura::GetMouseWheelPhaseHandler() { … }
void RenderWidgetHostViewAura::TakeFallbackContentFrom(
RenderWidgetHostView* view) { … }
bool RenderWidgetHostViewAura::CanSynchronizeVisualProperties() { … }
void RenderWidgetHostViewAura::SetLastPointerType(
ui::EventPointerType last_pointer_type) { … }
void RenderWidgetHostViewAura::InvalidateLocalSurfaceIdAndAllocationGroup() { … }
void RenderWidgetHostViewAura::InvalidateLocalSurfaceIdOnEviction() { … }
void RenderWidgetHostViewAura::ProcessDisplayMetricsChanged() { … }
void RenderWidgetHostViewAura::CancelActiveTouches() { … }
blink::mojom::FrameWidgetInputHandler*
RenderWidgetHostViewAura::GetFrameWidgetInputHandlerForFocusedWidget() { … }
void RenderWidgetHostViewAura::SetTooltipText(
const std::u16string& tooltip_text) { … }
ui::Compositor* RenderWidgetHostViewAura::GetCompositor() { … }
}