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

Unified Diff: Source/core/dom/Document.cpp

Issue 1312093002: Set focused flag earlier than dispatching focus events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove body tag. Created 5 years, 4 months 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
« no previous file with comments | « LayoutTests/fast/events/focus-querySelector-in-focus-event-handler-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index b624312af7e4dd9fe040f124f899472a90a82f02..0f98d181f0a27fe4b9b2eea4ce4dc67671d68113 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -3455,6 +3455,8 @@ bool Document::setFocusedElement(PassRefPtrWillBeRawPtr<Element> prpNewFocusedEl
// Set focus on the new node
m_focusedElement = newFocusedElement;
+ m_focusedElement->setFocus(true);
+
// Dispatch the focus event and let the node do any other focus related activities (important for text fields)
// If page lost focus, event will be dispatched on page focus, don't duplicate
if (page() && (page()->focusController().isFocused())) {
@@ -3485,8 +3487,6 @@ bool Document::setFocusedElement(PassRefPtrWillBeRawPtr<Element> prpNewFocusedEl
}
}
- m_focusedElement->setFocus(true);
-
if (m_focusedElement->isRootEditableElement())
frame()->spellChecker().didBeginEditing(m_focusedElement.get());
« no previous file with comments | « LayoutTests/fast/events/focus-querySelector-in-focus-event-handler-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698