Commit 4eb127ce authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Don't try to set frame on popup

BUG=859649
TEST=Covered by unit test

Change-Id: I9c662852659aec26034d0992f530398b5121ad2c
Reviewed-on: https://chromium-review.googlesource.com/1124878Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573538}
parent 4ed55578
...@@ -808,6 +808,12 @@ bool ShellSurfaceBase::IsInputEnabled(Surface*) const { ...@@ -808,6 +808,12 @@ bool ShellSurfaceBase::IsInputEnabled(Surface*) const {
} }
void ShellSurfaceBase::OnSetFrame(SurfaceFrameType frame_type) { void ShellSurfaceBase::OnSetFrame(SurfaceFrameType frame_type) {
if (is_popup_) {
// TODO(oshima): Consider supporting shadow type.
DLOG(WARNING) << "popup does not support frame decoration";
return;
}
bool frame_was_disabled = !frame_enabled(); bool frame_was_disabled = !frame_enabled();
frame_type_ = frame_type; frame_type_ = frame_type;
switch (frame_type) { switch (frame_type) {
......
...@@ -228,6 +228,11 @@ class ShellSurfaceBase : public SurfaceTreeHost, ...@@ -228,6 +228,11 @@ class ShellSurfaceBase : public SurfaceTreeHost,
// Overridden from ui::AcceleratorTarget: // Overridden from ui::AcceleratorTarget:
bool AcceleratorPressed(const ui::Accelerator& accelerator) override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
bool frame_enabled() const {
return frame_type_ != SurfaceFrameType::NONE &&
frame_type_ != SurfaceFrameType::SHADOW;
}
Surface* surface_for_testing() { return root_surface(); } Surface* surface_for_testing() { return root_surface(); }
protected: protected:
...@@ -325,11 +330,6 @@ class ShellSurfaceBase : public SurfaceTreeHost, ...@@ -325,11 +330,6 @@ class ShellSurfaceBase : public SurfaceTreeHost,
bool is_popup_ = false; bool is_popup_ = false;
bool has_grab_ = false; bool has_grab_ = false;
bool frame_enabled() const {
return frame_type_ != SurfaceFrameType::NONE &&
frame_type_ != SurfaceFrameType::SHADOW;
}
private: private:
struct Config; struct Config;
......
...@@ -630,6 +630,10 @@ TEST_F(ShellSurfaceTest, Popup) { ...@@ -630,6 +630,10 @@ TEST_F(ShellSurfaceTest, Popup) {
EXPECT_EQ(wm::CaptureController::Get()->GetCaptureWindow(), EXPECT_EQ(wm::CaptureController::Get()->GetCaptureWindow(),
popup_shell_surface->GetWidget()->GetNativeWindow()); popup_shell_surface->GetWidget()->GetNativeWindow());
// Setting frame type on popup should have no effect.
popup_surface->SetFrame(SurfaceFrameType::NORMAL);
EXPECT_FALSE(popup_shell_surface->frame_enabled());
// ShellSurface can capture the event even after it is craeted. // ShellSurface can capture the event even after it is craeted.
std::unique_ptr<Buffer> sub_popup_buffer( std::unique_ptr<Buffer> sub_popup_buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
......
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