Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 804163002: Revert 186849 "Bind Window focus ability to the ExecutionContext..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2250/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/LocalDOMWindow.cpp
===================================================================
--- Source/core/frame/LocalDOMWindow.cpp (revision 187183)
+++ Source/core/frame/LocalDOMWindow.cpp (working copy)
@@ -976,14 +976,12 @@
if (!host)
return;
- ASSERT(context);
-
- bool allowFocus = context->isWindowFocusAllowed();
- if (allowFocus) {
- context->consumeWindowFocus();
- } else {
+ bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
+ if (context) {
ASSERT(isMainThread());
- allowFocus = opener() && (opener() != this) && (toDocument(context)->domWindow() == opener());
+ Document* activeDocument = toDocument(context);
+ if (opener() && opener() != this && activeDocument->domWindow() == opener())
+ allowFocus = true;
}
// If we're a top level window, bring the window to the front.
@@ -990,6 +988,9 @@
if (frame()->isMainFrame() && allowFocus)
host->chrome().focus();
+ if (!frame())
+ return;
+
frame()->eventHandler().focusDocumentView();
}
« no previous file with comments | « Source/core/dom/ScopedWindowFocusAllowedIndicator.cpp ('k') | Source/modules/notifications/Notification.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698