Mac: Fix hidden find bar preventing context menu from appearing.

When the find bar is hidden, there is still an invisible view (its superview)
in its place that was consuming the right-click event.
Fixed this by hiding the find bar superview instead.
Also make sure that the initial state is set to hidden.

TEST=Invoke find bar then close it, right-click where the find bar was, context
menu should appear.

BUG=381207

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277883 0039d316-1c4b-4281-b951-d872f2087c98
parent 8c68557a
......@@ -113,6 +113,7 @@ const float kRightEdgeOffset = 25;
[findBarView_ setFrame:[self hiddenFindBarFrame]];
defaultWidth_ = NSWidth([findBarView_ frame]);
[[self view] setHidden:YES];
[self prepopulateText:[[FindPasteboard sharedInstance] findText]];
}
......@@ -449,7 +450,7 @@ const float kRightEdgeOffset = 25;
// If the find bar is not visible, make it actually hidden, so it'll no longer
// respond to key events.
[findBarView_ setHidden:![self isFindBarVisible]];
[[self view] setHidden:![self isFindBarVisible]];
[[self browserWindowController] onFindBarVisibilityChanged];
}
......@@ -505,7 +506,7 @@ const float kRightEdgeOffset = 25;
if (!animate) {
[findBarView_ setFrame:endFrame];
[findBarView_ setHidden:![self isFindBarVisible]];
[[self view] setHidden:![self isFindBarVisible]];
[[self browserWindowController] onFindBarVisibilityChanged];
showHideAnimation_.reset(nil);
return;
......@@ -513,7 +514,7 @@ const float kRightEdgeOffset = 25;
// If animating, ensure that the find bar is not hidden. Hidden status will be
// updated at the end of the animation.
[findBarView_ setHidden:NO];
[[self view] setHidden:NO];
//[[self browserWindowController] onFindBarVisibilityChanged];
// Reset the frame to what was saved above.
......
......@@ -63,14 +63,17 @@ TEST_F(FindBarCocoaControllerTest, ShowAndHide) {
ASSERT_GT([findBarView frame].origin.y, 0);
ASSERT_FALSE([controller_ isFindBarVisible]);
ASSERT_TRUE([[controller_ view] isHidden]);
[controller_ showFindBar:NO];
EXPECT_EQ([findBarView frame].origin.y, 0);
EXPECT_TRUE([controller_ isFindBarVisible]);
ASSERT_FALSE([[controller_ view] isHidden]);
[controller_ hideFindBar:NO];
EXPECT_GT([findBarView frame].origin.y, 0);
EXPECT_FALSE([controller_ isFindBarVisible]);
ASSERT_TRUE([[controller_ view] isHidden]);
}
TEST_F(FindBarCocoaControllerTest, SetFindText) {
......
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