WideFrame::OnMouseEvent should emit a toggle maximize event only once.
The event was emitted twice – during the (double) press and release of the mouse button. This change adds an additional condition to emit the event only when the button is pressed. Previously, the test checking maximize on double-clicking the caption passed because, accidentally, the window was not maximizable. So the first toggle restored the window, and the second was blocked. Fixed: 384006471 Change-Id: I37d10770f98a05f8e9a84d1507f8ba745126e6a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6088880 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Commit-Queue: Robert Ferens <rferens@google.com> Cr-Commit-Position: refs/heads/main@{#1396118}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
60a24d6c54
commit
aa772b96d9
@ -739,6 +739,7 @@ TEST_F(NonClientFrameViewAshTest, WideFrame) {
|
||||
NonClientFrameViewAsh* non_client_frame_view =
|
||||
delegate->non_client_frame_view();
|
||||
chromeos::HeaderView* header_view = non_client_frame_view->GetHeaderView();
|
||||
delegate->SetCanMaximize(true);
|
||||
widget->Maximize();
|
||||
|
||||
std::unique_ptr<WideFrameView> wide_frame_view =
|
||||
|
@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/frame/wide_frame_view.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/frame/non_client_frame_view_ash.h"
|
||||
@ -23,6 +24,7 @@
|
||||
#include "ui/aura/window_targeter.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/types/event_type.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/caption_button_layout_constants.h"
|
||||
|
||||
@ -165,7 +167,8 @@ void WideFrameView::Layout(PassKey) {
|
||||
|
||||
void WideFrameView::OnMouseEvent(ui::MouseEvent* event) {
|
||||
if (event->IsOnlyLeftMouseButton()) {
|
||||
if ((event->flags() & ui::EF_IS_DOUBLE_CLICK)) {
|
||||
if ((event->flags() & ui::EF_IS_DOUBLE_CLICK) &&
|
||||
event->type() == ui::EventType::kMousePressed) {
|
||||
base::RecordAction(
|
||||
base::UserMetricsAction("Caption_ClickTogglesMaximize"));
|
||||
const WMEvent wm_event(WM_EVENT_TOGGLE_MAXIMIZE_CAPTION);
|
||||
|
Reference in New Issue
Block a user