Rename get/set_notify_enter_exit_on_child and add property Metadata.
Bug: 938501 Change-Id: Ic1c7569e35229d8d9b7ab36daff7fc800f4d97de Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402133 Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Evan Stade <estade@chromium.org> Commit-Queue: Allen Bauer <kylixrd@chromium.org> Cr-Commit-Position: refs/heads/master@{#805791}
This commit is contained in:
ash
app_list
login
public
cpp
external_arc
message_center
shelf
system
holding_space
network
tray
wm
chrome/browser/ui/views
autofill
extensions
global_media_controls
location_bar
passwords
tabs
ui
message_center
views
@ -81,7 +81,7 @@ SearchResultView::SearchResultView(SearchResultListView* list_view,
|
||||
badge_icon_->set_can_process_events_within_subtree(false);
|
||||
|
||||
set_context_menu_controller(this);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
}
|
||||
|
||||
SearchResultView::~SearchResultView() = default;
|
||||
|
@ -227,7 +227,7 @@ LockScreenMediaControlsView::LockScreenMediaControlsView(
|
||||
// Media controls have not been dismissed initially.
|
||||
Shell::Get()->media_controller()->SetMediaControlsDismissed(false);
|
||||
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
contents_view_ = AddChildView(std::make_unique<views::View>());
|
||||
contents_view_->SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
|
@ -254,7 +254,7 @@ ArcNotificationContentView::ArcNotificationContentView(
|
||||
DCHECK_EQ(360, message_center::kNotificationWidth);
|
||||
|
||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
item_->IncrementWindowRefCount();
|
||||
item_->AddObserver(this);
|
||||
|
@ -49,7 +49,7 @@ ShelfTooltipPreviewBubble::ShelfTooltipPreviewBubble(
|
||||
set_margins(gfx::Insets());
|
||||
// We hide this tooltip on mouse exit, so we want to get enter/exit events
|
||||
// at this level, even for subviews.
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kHorizontal,
|
||||
|
@ -60,7 +60,7 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item)
|
||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
|
||||
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity());
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
// Ink drop layers should be clipped to match the corner radius of this view.
|
||||
views::InstallRoundRectHighlightPathGenerator(this, gfx::Insets(),
|
||||
|
@ -115,7 +115,7 @@ class NetworkStateListDetailedView::InfoBubble
|
||||
SetArrow(views::BubbleBorder::NONE);
|
||||
set_shadow(views::BubbleBorder::NO_ASSETS);
|
||||
set_anchor_view_insets(gfx::Insets(0, 0, kBubbleMargin, 0));
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
SetLayoutManager(std::make_unique<views::FillLayout>());
|
||||
AddChildView(content);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ ActionableView::ActionableView(TrayPopupInkDropStyle ink_drop_style)
|
||||
ink_drop_style_(ink_drop_style) {
|
||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||
set_has_ink_drop_action_on_click(false);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
// TODO(pbos): Replace the use of FocusPainter with the FocusRing (using the
|
||||
// below HighlightPathGenerator).
|
||||
SetInstallFocusRingOnFocus(false);
|
||||
|
@ -32,7 +32,7 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener,
|
||||
: ActionableView(TrayPopupInkDropStyle::FILL_BOUNDS),
|
||||
listener_(listener),
|
||||
use_unified_theme_(use_unified_theme) {
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
SetInkDropMode(InkDropMode::ON);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ TrayBackgroundView::TrayBackgroundView(Shelf* shelf)
|
||||
show_when_collapsed_(true),
|
||||
widget_observer_(new TrayWidgetObserver(this)) {
|
||||
DCHECK(shelf_);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor());
|
||||
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity());
|
||||
|
||||
|
@ -236,7 +236,7 @@ TrayBubbleView::TrayBubbleView(const InitParams& init_params)
|
||||
bubble_border_->set_avoid_shadow_overlap(true);
|
||||
set_parent_window(params_.parent_window);
|
||||
SetCanActivate(false);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
set_close_on_deactivate(init_params.close_on_deactivate);
|
||||
set_margins(gfx::Insets());
|
||||
|
||||
|
@ -122,7 +122,7 @@ class WindowCycleItemView : public WindowMiniView {
|
||||
public:
|
||||
explicit WindowCycleItemView(aura::Window* window) : WindowMiniView(window) {
|
||||
SetFocusBehavior(FocusBehavior::ALWAYS);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
}
|
||||
WindowCycleItemView(const WindowCycleItemView&) = delete;
|
||||
WindowCycleItemView& operator=(const WindowCycleItemView&) = delete;
|
||||
|
@ -970,7 +970,7 @@ AutofillPopupRowView::AutofillPopupRowView(
|
||||
AutofillPopupViewNativeViews* popup_view,
|
||||
int line_number)
|
||||
: popup_view_(popup_view), line_number_(line_number) {
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
}
|
||||
|
||||
void AutofillPopupRowView::Init() {
|
||||
|
@ -54,7 +54,7 @@ ExtensionsMenuItemView::ExtensionsMenuItemView(
|
||||
model_(ToolbarActionsModel::Get(browser->profile())) {
|
||||
// Set so the extension button receives enter/exit on children to retain hover
|
||||
// status when hovering child views.
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
context_menu_controller_ = std::make_unique<ExtensionContextMenuController>(
|
||||
nullptr, controller_.get());
|
||||
|
@ -80,7 +80,7 @@ MediaNotificationContainerImplView::MediaNotificationContainerImplView(
|
||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kVertical));
|
||||
SetPreferredSize(kNormalSize);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
|
||||
SetTooltipText(
|
||||
l10n_util::GetStringUTF16(IDS_GLOBAL_MEDIA_CONTROLS_BACK_TO_TAB));
|
||||
|
@ -148,7 +148,7 @@ IconLabelBubbleView::IconLabelBubbleView(const gfx::FontList& font_list,
|
||||
|
||||
UpdateBorder();
|
||||
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
// Flip the canvas in RTL so the separator is drawn on the correct side.
|
||||
separator_view_->EnableCanvasFlippingForRTLUI(true);
|
||||
|
@ -294,7 +294,7 @@ ZoomBubbleView::ZoomBubbleView(
|
||||
chrome::FindBrowserWithWebContents(web_contents)->session_id()) {
|
||||
SetButtons(ui::DIALOG_BUTTON_NONE);
|
||||
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
if (immersive_mode_controller_)
|
||||
immersive_mode_controller_->AddObserver(this);
|
||||
UseCompactMargins();
|
||||
|
@ -64,7 +64,7 @@ CredentialsItemView::CredentialsItemView(
|
||||
int upper_text_style,
|
||||
int lower_text_style)
|
||||
: Button(button_listener), form_(form) {
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
views::BoxLayout* layout =
|
||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kHorizontal));
|
||||
|
@ -193,7 +193,7 @@ Tab::Tab(TabController* controller)
|
||||
|
||||
// So we get don't get enter/exit on children and don't prematurely stop the
|
||||
// hover.
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
SetID(VIEW_ID_TAB);
|
||||
|
||||
|
@ -2449,7 +2449,7 @@ void TabStrip::HandleDragExited() {
|
||||
void TabStrip::Init() {
|
||||
SetID(VIEW_ID_TAB_STRIP);
|
||||
// So we get enter/exit on children to switch stacked layout on and off.
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
tab_controls_container_ =
|
||||
AddChildView(std::make_unique<TabControlsContainer>());
|
||||
|
@ -39,7 +39,7 @@ MessagePopupView::MessagePopupView(const Notification& notification,
|
||||
if (!message_view_->IsManuallyExpandedOrCollapsed())
|
||||
message_view_->SetExpanded(message_view_->IsAutoExpandingAllowed());
|
||||
AddChildView(message_view_);
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
}
|
||||
|
||||
MessagePopupView::MessagePopupView(MessagePopupCollection* popup_collection)
|
||||
|
@ -629,7 +629,7 @@ NotificationViewMD::NotificationViewMD(const Notification& notification)
|
||||
CreateOrUpdateViews(notification);
|
||||
UpdateControlButtonsVisibilityWithNotification(notification);
|
||||
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
click_activator_ = std::make_unique<ClickActivator>(this);
|
||||
// Reasons to use pretarget handler instead of OnMousePressed:
|
||||
|
@ -167,7 +167,7 @@ ScrollView::ScrollView()
|
||||
corner_view_(std::make_unique<ScrollCornerView>()),
|
||||
scroll_with_layers_enabled_(base::FeatureList::IsEnabled(
|
||||
::features::kUiCompositorScrollWithLayers)) {
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
|
||||
// Since |contents_viewport_| is accessed during the AddChildView call, make
|
||||
// sure the field is initialized.
|
||||
|
@ -127,7 +127,7 @@ void OverlayScrollBar::Thumb::OnStateChanged() {
|
||||
}
|
||||
|
||||
OverlayScrollBar::OverlayScrollBar(bool horizontal) : ScrollBar(horizontal) {
|
||||
set_notify_enter_exit_on_child(true);
|
||||
SetNotifyEnterExitOnChild(true);
|
||||
SetPaintToLayer();
|
||||
layer()->SetMasksToBounds(true);
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
|
@ -1316,6 +1316,14 @@ void View::OnTouchEvent(ui::TouchEvent* event) {
|
||||
|
||||
void View::OnGestureEvent(ui::GestureEvent* event) {}
|
||||
|
||||
void View::SetNotifyEnterExitOnChild(bool notify) {
|
||||
notify_enter_exit_on_child_ = notify;
|
||||
}
|
||||
|
||||
bool View::GetNotifyEnterExitOnChild() const {
|
||||
return notify_enter_exit_on_child_;
|
||||
}
|
||||
|
||||
const ui::InputMethod* View::GetInputMethod() const {
|
||||
Widget* widget = const_cast<Widget*>(GetWidget());
|
||||
return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod())
|
||||
@ -3013,6 +3021,7 @@ ADD_PROPERTY_METADATA(int, ID)
|
||||
ADD_READONLY_PROPERTY_METADATA(gfx::Size, MaximumSize)
|
||||
ADD_READONLY_PROPERTY_METADATA(gfx::Size, MinimumSize)
|
||||
ADD_PROPERTY_METADATA(bool, Mirrored)
|
||||
ADD_PROPERTY_METADATA(bool, NotifyEnterExitOnChild)
|
||||
ADD_PROPERTY_METADATA(bool, Visible)
|
||||
END_METADATA
|
||||
|
||||
|
@ -1069,12 +1069,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
|
||||
virtual bool OnMouseWheel(const ui::MouseWheelEvent& event);
|
||||
|
||||
// See field for description.
|
||||
void set_notify_enter_exit_on_child(bool notify) {
|
||||
notify_enter_exit_on_child_ = notify;
|
||||
}
|
||||
bool notify_enter_exit_on_child() const {
|
||||
return notify_enter_exit_on_child_;
|
||||
}
|
||||
void SetNotifyEnterExitOnChild(bool notify);
|
||||
bool GetNotifyEnterExitOnChild() const;
|
||||
|
||||
// Convenience method to retrieve the InputMethod associated with the
|
||||
// Widget that contains this view.
|
||||
|
@ -1698,7 +1698,7 @@ TEST_F(ViewTest, CanProcessEventsWithinSubtree) {
|
||||
TestView* v = new TestView;
|
||||
v->SetBounds(0, 0, 100, 100);
|
||||
root_view->AddChildView(v);
|
||||
v->set_notify_enter_exit_on_child(true);
|
||||
v->SetNotifyEnterExitOnChild(true);
|
||||
|
||||
TestView* v_child = new TestView;
|
||||
v_child->SetBounds(0, 0, 20, 30);
|
||||
@ -1857,7 +1857,7 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) {
|
||||
TestView* v1 = new TestView;
|
||||
v1->SetBounds(0, 0, 100, 100);
|
||||
root_view->AddChildView(v1);
|
||||
v1->set_notify_enter_exit_on_child(true);
|
||||
v1->SetNotifyEnterExitOnChild(true);
|
||||
|
||||
TestView* v11 = new TestView;
|
||||
v11->SetBounds(0, 0, 20, 30);
|
||||
|
@ -506,7 +506,7 @@ void RootView::OnMouseMoved(const ui::MouseEvent& event) {
|
||||
if (v && v != this) {
|
||||
if (v != mouse_move_handler_) {
|
||||
if (mouse_move_handler_ != nullptr &&
|
||||
(!mouse_move_handler_->notify_enter_exit_on_child() ||
|
||||
(!mouse_move_handler_->GetNotifyEnterExitOnChild() ||
|
||||
!mouse_move_handler_->Contains(v))) {
|
||||
MouseEnterExitEvent exit(event, ui::ET_MOUSE_EXITED);
|
||||
exit.ConvertLocationToTarget(static_cast<View*>(this),
|
||||
@ -531,7 +531,7 @@ void RootView::OnMouseMoved(const ui::MouseEvent& event) {
|
||||
}
|
||||
View* old_handler = mouse_move_handler_;
|
||||
mouse_move_handler_ = v;
|
||||
if (!mouse_move_handler_->notify_enter_exit_on_child() ||
|
||||
if (!mouse_move_handler_->GetNotifyEnterExitOnChild() ||
|
||||
!mouse_move_handler_->Contains(old_handler)) {
|
||||
MouseEnterExitEvent entered(event, ui::ET_MOUSE_ENTERED);
|
||||
entered.ConvertLocationToTarget(static_cast<View*>(this),
|
||||
@ -728,7 +728,7 @@ ui::EventDispatchDetails RootView::NotifyEnterExitOfDescendant(
|
||||
View* view,
|
||||
View* sibling) {
|
||||
for (View* p = view->parent(); p; p = p->parent()) {
|
||||
if (!p->notify_enter_exit_on_child())
|
||||
if (!p->GetNotifyEnterExitOnChild())
|
||||
continue;
|
||||
if (sibling && p->Contains(sibling))
|
||||
break;
|
||||
|
@ -695,7 +695,7 @@ TEST_F(RootViewTest, DeleteWidgetOnMouseExitDispatchFromChild) {
|
||||
subchild->SetBounds(0, 0, 100, 100);
|
||||
|
||||
// Make mouse enter and exit events get propagated from |subchild| to |child|.
|
||||
child->set_notify_enter_exit_on_child(true);
|
||||
child->SetNotifyEnterExitOnChild(true);
|
||||
|
||||
internal::RootView* root_view =
|
||||
static_cast<internal::RootView*>(widget->GetRootView());
|
||||
|
Reference in New Issue
Block a user