Commit ded5e3c8 authored by yzshen's avatar yzshen Committed by Commit bot

Revert of Close the select box when the parent RWHVA loses focus (patchset #2...

Revert of Close the select box when the parent RWHVA loses focus (patchset #2 id:170001 of https://codereview.chromium.org/652793003/)

Reason for revert:
Broke Linux ChromiumOS Tests (dbg)(1):
RenderWidgetHostViewAuraTest.PopupClosesWhenParentLosesFocus (run #1):
[ RUN      ] RenderWidgetHostViewAuraTest.PopupClosesWhenParentLosesFocus
Xlib:  extension "RANDR" missing on display ":9".
../../content/browser/renderer_host/render_widget_host_view_aura_unittest.cc:875: Failure
Value of: observer.destroyed()
  Actual: false
Expected: true
[  FAILED  ] RenderWidgetHostViewAuraTest.PopupClosesWhenParentLosesFocus (10 ms)

Original issue's description:
> Close the select box when the parent RWHVA loses focus
>
> BUG=422264,414550
> TEST=RenderWidgetHostViewAuraTest.PopupClosesWhenParentLosesFocus
>
> Committed: https://crrev.com/1f909ee8c8ae5cbc92416482374d2228f087684c
> Cr-Commit-Position: refs/heads/master@{#301108}

TBR=tkent@chromium.org,ben@chromium.org,pkotwicz@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=422264,414550

Review URL: https://codereview.chromium.org/663483005

Cr-Commit-Position: refs/heads/master@{#301127}
parent 8890ddca
......@@ -387,7 +387,8 @@ void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit(
target != popup_parent_host_view_->window_)) {
// Note: popup_parent_host_view_ may be NULL when there are multiple
// popup children per view. See: RenderWidgetHostViewAura::InitAsPopup().
Shutdown();
in_shutdown_ = true;
host_->Shutdown();
}
}
......@@ -1827,7 +1828,10 @@ void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
}
}
}
Shutdown();
if (!in_shutdown_) {
in_shutdown_ = true;
host_->Shutdown();
}
} else {
if (event->key_code() == ui::VKEY_RETURN) {
// Do not forward return key release events if no press event was handled.
......@@ -2217,15 +2221,9 @@ void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus,
return;
}
#endif
Shutdown();
return;
in_shutdown_ = true;
host_->Shutdown();
}
// Close the child popup window if we lose focus (e.g. due to a JS alert or
// system modal dialog). This is particularly important if
// |popup_child_host_view_| has mouse capture.
if (popup_child_host_view_)
popup_child_host_view_->Shutdown();
}
}
......@@ -2316,13 +2314,6 @@ ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const {
return root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
}
void RenderWidgetHostViewAura::Shutdown() {
if (!in_shutdown_) {
in_shutdown_ = true;
host_->Shutdown();
}
}
bool RenderWidgetHostViewAura::NeedsInputGrab() {
return popup_type_ == blink::WebPopupTypeSelect;
}
......
......@@ -418,9 +418,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
ui::InputMethod* GetInputMethod() const;
// Sends shutdown request.
void Shutdown();
// Returns whether the widget needs an input grab to work properly.
bool NeedsInputGrab();
......
......@@ -56,7 +56,6 @@
#include "ui/events/gestures/gesture_configuration.h"
#include "ui/events/test/event_generator.h"
#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/window_util.h"
using testing::_;
......@@ -846,35 +845,6 @@ TEST_F(RenderWidgetHostViewAuraTest, PopupRetainsCaptureAfterMouseRelease) {
}
#endif
// Test that select boxes close when their parent window loses focus (e.g. due
// to an alert or system modal dialog).
TEST_F(RenderWidgetHostViewAuraTest, PopupClosesWhenParentLosesFocus) {
parent_view_->SetBounds(gfx::Rect(10, 10, 400, 400));
parent_view_->Focus();
EXPECT_TRUE(parent_view_->HasFocus());
ui::test::EventGenerator generator(
parent_view_->GetNativeView()->GetRootWindow(), gfx::Point(300, 300));
generator.PressLeftButton();
view_->SetPopupType(blink::WebPopupTypeSelect);
view_->InitAsPopup(parent_view_, gfx::Rect(10, 10, 100, 100));
aura::Window* popup_window = view_->GetNativeView();
TestWindowObserver observer(popup_window);
aura::test::TestWindowDelegate delegate;
scoped_ptr<aura::Window> dialog_window(new aura::Window(&delegate));
dialog_window->Init(aura::WINDOW_LAYER_TEXTURED);
aura::client::ParentWindowWithContext(
dialog_window.get(), popup_window, gfx::Rect());
dialog_window->Show();
wm::ActivateWindow(dialog_window.get());
ASSERT_TRUE(wm::IsActiveWindow(dialog_window.get()));
EXPECT_TRUE(observer.destroyed());
}
// Checks that IME-composition-event state is maintained correctly.
TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) {
view_->InitAsChild(NULL);
......
Markdown is supported
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