Skip to content
Snippets Groups Projects
Unverified Commit f503a781 authored by Charles Kerr's avatar Charles Kerr
Browse files

refactor: avoid repeating the return type from the declaration; use a braced...

refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

NB: using the braced-initializer list uncovered an error here:
the float returned by std::floor() can't be implicitly cast to
an int. This is solved by using base::ClampFloor<int>() instead.
std::floor()
parent 186dfade
No related merge requests found
......@@ -14,6 +14,7 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "components/input/cursor_manager.h"
......@@ -115,9 +116,9 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
ui::MouseWheelEvent UiMouseWheelEventFromWebMouseEvent(
blink::WebMouseWheelEvent event) {
return ui::MouseWheelEvent(UiMouseEventFromWebMouseEvent(event),
std::floor(event.delta_x),
std::floor(event.delta_y));
return {UiMouseEventFromWebMouseEvent(event),
base::ClampFloor<int>(event.delta_x),
base::ClampFloor<int>(event.delta_y)};
}
} // namespace
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment