Merge pull request #2950 from atom/revert-2879

Fix the regression of outerHeight and outerWidth being set to 0 in hidden window
This commit is contained in:
Cheng Zhao 2015-10-01 21:01:51 +08:00
commit f9300e0912
4 changed files with 5 additions and 13 deletions

View file

@ -158,13 +158,8 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
// Then show it.
bool show = true;
options.Get(switches::kShow, &show);
if (show) {
if (show)
Show();
} else {
// When RenderView is created it sets to visible, this is to prevent
// breaking the visibility API.
web_contents()->WasHidden();
}
}
void NativeWindow::SetSize(const gfx::Size& size) {

View file

@ -470,8 +470,6 @@ bool NativeWindowMac::IsFocused() {
}
void NativeWindowMac::Show() {
web_contents()->WasShown();
// This method is supposed to put focus on window, however if the app does not
// have focus then "makeKeyAndOrderFront" will only show the window.
[NSApp activateIgnoringOtherApps:YES];
@ -480,13 +478,11 @@ void NativeWindowMac::Show() {
}
void NativeWindowMac::ShowInactive() {
web_contents()->WasShown();
[window_ orderFrontRegardless];
}
void NativeWindowMac::Hide() {
[window_ orderOut:nil];
web_contents()->WasHidden();
}
bool NativeWindowMac::IsVisible() {

View file

@ -343,17 +343,14 @@ bool NativeWindowViews::IsFocused() {
}
void NativeWindowViews::Show() {
web_contents()->WasShown();
window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
}
void NativeWindowViews::ShowInactive() {
web_contents()->WasShown();
window_->ShowInactive();
}
void NativeWindowViews::Hide() {
window_->Hide();
web_contents()->WasHidden();
}

View file

@ -122,3 +122,7 @@ window.history.go = (offset) -> sendHistoryOperation 'goToOffset', offset
Object.defineProperty window.history, 'length',
get: ->
getHistoryOperation 'length'
# Make document.hidden return the correct value.
Object.defineProperty document, 'hidden',
get: -> !remote.getCurrentWindow().isVisible()