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

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: 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 af8ce76a7496d5ce772e7038d6373dab28595187..7fb375dc75f9eba9dd8a4685c0f155484ece5c4a 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();
}

Powered by Google App Engine
This is Rietveld 408576698