Skip to content

Commit

Permalink
Fix some lint errors in ui/views/.
Browse files Browse the repository at this point in the history
(This addresses about half; more to come.)

Bug: none
Change-Id: Ic715d0294fc5ab35a8e1a0d2568ef6ff700cb58f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100025
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749837}
  • Loading branch information
pkasting authored and Commit Bot committed Mar 12, 2020
1 parent 248779c commit 62bf27a
Show file tree
Hide file tree
Showing 115 changed files with 261 additions and 99 deletions.
6 changes: 3 additions & 3 deletions ash/test/ui_controls_factory_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ class UIControlsAsh : public UIControlsAura {
window, key, control, shift, alt, command, std::move(closure));
}

bool SendMouseMove(long x, long y) override {
bool SendMouseMove(int x, int y) override {
gfx::Point p(x, y);
UIControlsAura* ui_controls = GetUIControlsAt(p);
return ui_controls && ui_controls->SendMouseMove(p.x(), p.y());
}

bool SendMouseMoveNotifyWhenDone(long x,
long y,
bool SendMouseMoveNotifyWhenDone(int x,
int y,
base::OnceClosure closure) override {
gfx::Point p(x, y);
UIControlsAura* ui_controls = GetUIControlsAt(p);
Expand Down
10 changes: 4 additions & 6 deletions chrome/browser/ui/send_mouse_move_uitest_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ IN_PROC_BROWSER_TEST_F(SendMouseMoveUITest, DISABLED_Fullscreen) {

display::Screen* const screen = display::Screen::GetScreen();
const gfx::Rect screen_bounds = screen->GetPrimaryDisplay().bounds();
for (long scan_y = screen_bounds.y(),
bound_y = scan_y + screen_bounds.height();
scan_y < bound_y; ++scan_y) {
for (long scan_x = screen_bounds.x(),
bound_x = scan_x + screen_bounds.width();
scan_x < bound_x; ++scan_x) {
for (int scan_y = screen_bounds.y(); scan_y < screen_bounds.bottom();
++scan_y) {
for (int scan_x = screen_bounds.x(); scan_x < screen_bounds.right();
++scan_x) {
SCOPED_TRACE(testing::Message()
<< "(" << scan_x << ", " << scan_y << ")");
// Move the pointer.
Expand Down
6 changes: 3 additions & 3 deletions ui/aura/test/ui_controls_factory_aurawin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class UIControlsWin : public UIControlsAura {
return ui_controls::internal::SendKeyPressImpl(window, key, control, shift,
alt, std::move(task));
}
bool SendMouseMove(long screen_x, long screen_y) override {
bool SendMouseMove(int screen_x, int screen_y) override {
return ui_controls::internal::SendMouseMoveImpl(screen_x, screen_y,
base::OnceClosure());
}
bool SendMouseMoveNotifyWhenDone(long screen_x,
long screen_y,
bool SendMouseMoveNotifyWhenDone(int screen_x,
int screen_y,
base::OnceClosure task) override {
return ui_controls::internal::SendMouseMoveImpl(screen_x, screen_y,
std::move(task));
Expand Down
6 changes: 3 additions & 3 deletions ui/aura/test/ui_controls_factory_aurax11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class UIControlsX11 : public UIControlsAura {
return true;
}

bool SendMouseMove(long screen_x, long screen_y) override {
bool SendMouseMove(int screen_x, int screen_y) override {
return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::OnceClosure());
}
bool SendMouseMoveNotifyWhenDone(long screen_x,
long screen_y,
bool SendMouseMoveNotifyWhenDone(int screen_x,
int screen_y,
base::OnceClosure closure) override {
gfx::Point root_location(screen_x, screen_y);
aura::client::ScreenPositionClient* screen_position_client =
Expand Down
6 changes: 3 additions & 3 deletions ui/aura/test/ui_controls_factory_ozone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
return true;
}

bool SendMouseMove(long screen_x, long screen_y) override {
bool SendMouseMove(int screen_x, int screen_y) override {
return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::OnceClosure());
}
bool SendMouseMoveNotifyWhenDone(long screen_x,
long screen_y,
bool SendMouseMoveNotifyWhenDone(int screen_x,
int screen_y,
base::OnceClosure closure) override {
gfx::PointF host_location(screen_x, screen_y);
int64_t display_id = display::kInvalidDisplayId;
Expand Down
6 changes: 3 additions & 3 deletions ui/base/test/ui_controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
base::OnceClosure task);

// Simulate a mouse move.
bool SendMouseMove(long screen_x, long screen_y);
bool SendMouseMove(int screen_x, int screen_y);

// Returns false on Windows if the desired position is not over a window
// belonging to the current process.
bool SendMouseMoveNotifyWhenDone(long screen_x,
long screen_y,
bool SendMouseMoveNotifyWhenDone(int screen_x,
int screen_y,
base::OnceClosure task);

enum MouseButton {
Expand Down
4 changes: 2 additions & 2 deletions ui/base/test/ui_controls_aura.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
}

// static
bool SendMouseMove(long x, long y) {
bool SendMouseMove(int x, int y) {
CHECK(g_ui_controls_enabled);
return instance_->SendMouseMove(x, y);
}

// static
bool SendMouseMoveNotifyWhenDone(long x, long y, base::OnceClosure task) {
bool SendMouseMoveNotifyWhenDone(int x, int y, base::OnceClosure task) {
CHECK(g_ui_controls_enabled);
return instance_->SendMouseMoveNotifyWhenDone(x, y, std::move(task));
}
Expand Down
6 changes: 3 additions & 3 deletions ui/base/test/ui_controls_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class UIControlsAura {
base::OnceClosure task) = 0;

// Simulate a mouse move. (x,y) are absolute screen coordinates.
virtual bool SendMouseMove(long x, long y) = 0;
virtual bool SendMouseMoveNotifyWhenDone(long x,
long y,
virtual bool SendMouseMove(int x, int y) = 0;
virtual bool SendMouseMoveNotifyWhenDone(int x,
int y,
base::OnceClosure task) = 0;

// Sends a mouse down and/or up message. The click will be sent to wherever
Expand Down
2 changes: 1 addition & 1 deletion ui/base/test/ui_controls_internal_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ bool SendKeyPressImpl(HWND window,
return true;
}

bool SendMouseMoveImpl(long screen_x, long screen_y, base::OnceClosure task) {
bool SendMouseMoveImpl(int screen_x, int screen_y, base::OnceClosure task) {
gfx::Point screen_point =
display::win::ScreenWin::DIPToScreenPoint({screen_x, screen_y});
screen_x = screen_point.x();
Expand Down
2 changes: 1 addition & 1 deletion ui/base/test/ui_controls_internal_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool SendKeyPressImpl(HWND hwnd,
bool shift,
bool alt,
base::OnceClosure task);
bool SendMouseMoveImpl(long screen_x, long screen_y, base::OnceClosure task);
bool SendMouseMoveImpl(int screen_x, int screen_y, base::OnceClosure task);
bool SendMouseEventsImpl(MouseButton type,
int button_state,
base::OnceClosure task,
Expand Down
4 changes: 2 additions & 2 deletions ui/base/test/ui_controls_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
return true;
}

bool SendMouseMove(long x, long y) {
bool SendMouseMove(int x, int y) {
CHECK(g_ui_controls_enabled);
return SendMouseMoveNotifyWhenDone(x, y, base::OnceClosure());
}
Expand All @@ -298,7 +298,7 @@ bool SendMouseMove(long x, long y) {
// events require them window-relative, so we adjust. We *DO* flip
// the coordinate space, so input events can be the same for all
// platforms. E.g. (0,0) is upper-left.
bool SendMouseMoveNotifyWhenDone(long x, long y, base::OnceClosure task) {
bool SendMouseMoveNotifyWhenDone(int x, int y, base::OnceClosure task) {
CHECK(g_ui_controls_enabled);
g_mouse_location = gfx::ScreenPointToNSPoint(gfx::Point(x, y)); // flip!

Expand Down
2 changes: 2 additions & 0 deletions ui/views/accessible_pane_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/accessible_pane_view.h"

#include <utility>

#include "base/macros.h"
#include "build/build_config.h"
#include "ui/base/accelerators/accelerator.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/background.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/background.h"

#include <utility>

#include "base/logging.h"
#include "base/macros.h"
#include "base/scoped_observer.h"
Expand Down
1 change: 1 addition & 0 deletions ui/views/border.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ui/views/border.h"

#include <memory>
#include <utility>

#include "base/logging.h"
#include "base/macros.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/event_monitor_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef UI_VIEWS_EVENT_MONITOR_AURA_H_
#define UI_VIEWS_EVENT_MONITOR_AURA_H_

#include <set>

#include "base/macros.h"
#include "ui/views/event_monitor.h"

Expand Down
2 changes: 2 additions & 0 deletions ui/views/event_monitor_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef UI_VIEWS_EVENT_MONITOR_MAC_H_
#define UI_VIEWS_EVENT_MONITOR_MAC_H_

#include <set>

#include "base/macros.h"
#include "ui/base/cocoa/weak_ptr_nsobject.h"
#include "ui/gfx/native_widget_types.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/event_monitor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/event_monitor.h"

#include <utility>

#include "base/macros.h"
#include "ui/events/event_observer.h"
#include "ui/events/test/event_generator.h"
Expand Down
4 changes: 4 additions & 0 deletions ui/views/examples/vector_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

#include "ui/views/examples/vector_example.h"

#include <memory>
#include <string>
#include <utility>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/macros.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/examples/webview_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/examples/webview_example.h"

#include <memory>

#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "ui/views/controls/webview/webview.h"
Expand Down
3 changes: 3 additions & 0 deletions ui/views/examples/widget_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "ui/views/examples/widget_example.h"

#include <memory>
#include <utility>

#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/focus/external_focus_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/focus/external_focus_tracker.h"

#include <memory>

#include "base/logging.h"
#include "ui/views/view.h"
#include "ui/views/view_tracker.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/focus/external_focus_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef UI_VIEWS_FOCUS_EXTERNAL_FOCUS_TRACKER_H_
#define UI_VIEWS_FOCUS_EXTERNAL_FOCUS_TRACKER_H_

#include <memory>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/views/focus/focus_manager.h"
Expand Down
1 change: 1 addition & 0 deletions ui/views/focus/focus_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ui/views/focus/focus_manager.h"

#include <algorithm>
#include <utility>
#include <vector>

#include "base/auto_reset.h"
Expand Down
2 changes: 1 addition & 1 deletion ui/views/focus/focus_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class VIEWS_EXPORT FocusManager : public ViewObserver {
kDirectFocusChange
};

// TODO: use Direction in place of bool reverse throughout.
// TODO(dmazzoni): use Direction in place of bool reverse throughout.
enum Direction { kForward, kBackward };

enum FocusCycleWrappingBehavior { kWrap, kNoWrap };
Expand Down
1 change: 1 addition & 0 deletions ui/views/focus/focus_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <stddef.h>

#include <string>
#include <utility>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion ui/views/focus/focus_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FocusTraversable;
class VIEWS_EXPORT FocusSearch {
public:
// The direction in which the focus traversal is going.
// TODO (jcampan): add support for lateral (left, right) focus traversal. The
// TODO(jcampan): add support for lateral (left, right) focus traversal. The
// goal is to switch to focusable views on the same level when using the arrow
// keys (ala Windows: in a dialog box, arrow keys typically move between the
// dialog OK, Cancel buttons).
Expand Down
14 changes: 5 additions & 9 deletions ui/views/layout/animating_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const ChildLayout* FindChildViewInLayout(const ProposedLayout& layout,
return nullptr;
}

ChildLayout* FindChildViewInLayout(ProposedLayout* layout, const View* view) {
return const_cast<ChildLayout*>(FindChildViewInLayout(*layout, view));
}

// Describes the type of fade, used by LayoutFadeInfo (see below).
enum LayoutFadeType {
// This view is fading in as part of the current animation.
Expand All @@ -50,14 +54,6 @@ enum LayoutFadeType {
kContinuingFade
};

// Non-const version of above.
ChildLayout* FindChildViewInLayout(ProposedLayout& layout, const View* view) {
// This const_cast is safe because we know we were passed in a non-const
// layout (also we don't want to duplicate the logic).
return const_cast<ChildLayout*>(
FindChildViewInLayout(const_cast<const ProposedLayout&>(layout), view));
}

} // namespace

// Holds data about a view that is fading in or out as part of an animation.
Expand Down Expand Up @@ -684,7 +680,7 @@ void AnimatingLayoutManager::UpdateCurrentLayout(double percent) {
}

ChildLayout* const to_overwrite =
FindChildViewInLayout(current_layout_, fade_info.child_view);
FindChildViewInLayout(&current_layout_, fade_info.child_view);
if (to_overwrite)
*to_overwrite = child_layout;
else
Expand Down
1 change: 1 addition & 0 deletions ui/views/layout/animating_layout_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "ui/views/layout/animating_layout_manager.h"

#include <algorithm>
#include <utility>
#include <vector>

Expand Down
2 changes: 2 additions & 0 deletions ui/views/layout/box_layout_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <stddef.h>

#include <memory>
#include <utility>
#include <vector>

#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/insets.h"
Expand Down
2 changes: 2 additions & 0 deletions ui/views/layout/fill_layout_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ui/views/layout/fill_layout.h"

#include <memory>

#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/border.h"
#include "ui/views/test/test_views.h"
Expand Down
1 change: 1 addition & 0 deletions ui/views/layout/flex_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/compiler_specific.h"
Expand Down
2 changes: 1 addition & 1 deletion ui/views/layout/flex_layout_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MockView : public View {
}

int GetHeightForWidth(int width) const override {
DCHECK(width > 0);
DCHECK_GT(width, 0);
const gfx::Size preferred = GetPreferredSize();
switch (size_mode_) {
case SizeMode::kUsePreferredSize:
Expand Down
Loading

0 comments on commit 62bf27a

Please sign in to comment.