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

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

Issue 777483004: Bind Window focus ability to the ExecutionContext instead of the process. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_client_focus
Patch Set: rebase 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
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 926de144193cf533bef0b4ef1472bf2137363d95..a8c7f5c59251eedb3712d86b8bbe7b854872f388 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -976,21 +976,20 @@ void LocalDOMWindow::focus(ExecutionContext* context)
if (!host)
return;
- bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
- if (context) {
+ ASSERT(context);
+
+ bool allowFocus = context->isWindowFocusAllowed();
+ if (allowFocus) {
+ context->consumeWindowFocus();
+ } else {
ASSERT(isMainThread());
- Document* activeDocument = toDocument(context);
- if (opener() && opener() != this && activeDocument->domWindow() == opener())
- allowFocus = true;
+ allowFocus = opener() && (opener() != this) && (toDocument(context)->domWindow() == opener());
}
// If we're a top level window, bring the window to the front.
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