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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1437813002: Set selection to INPUT/TEXTAREA before dispatching 'focus' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 3508 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 if (newFocusedElement && newFocusedElement->isFocusable()) { 3519 if (newFocusedElement && newFocusedElement->isFocusable()) {
3520 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) { 3520 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) {
3521 // delegate blocks focus change 3521 // delegate blocks focus change
3522 focusChangeBlocked = true; 3522 focusChangeBlocked = true;
3523 goto SetFocusedElementDone; 3523 goto SetFocusedElementDone;
3524 } 3524 }
3525 // Set focus on the new node 3525 // Set focus on the new node
3526 m_focusedElement = newFocusedElement; 3526 m_focusedElement = newFocusedElement;
3527 3527
3528 m_focusedElement->setFocus(true); 3528 m_focusedElement->setFocus(true);
3529 cancelFocusAppearanceUpdate();
3530 m_focusedElement->updateFocusAppearance(params.selectionBehavior);
3529 3531
3530 // Dispatch the focus event and let the node do any other focus related activities (important for text fields) 3532 // Dispatch the focus event and let the node do any other focus related activities (important for text fields)
3531 // If page lost focus, event will be dispatched on page focus, don't dup licate 3533 // If page lost focus, event will be dispatched on page focus, don't dup licate
3532 if (page() && (page()->focusController().isFocused())) { 3534 if (page() && (page()->focusController().isFocused())) {
3533 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), params .type, params.sourceCapabilities); 3535 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), params .type, params.sourceCapabilities);
3534 3536
3535 3537
3536 if (m_focusedElement != newFocusedElement) { 3538 if (m_focusedElement != newFocusedElement) {
3537 // handler shifted focus 3539 // handler shifted focus
3538 focusChangeBlocked = true; 3540 focusChangeBlocked = true;
(...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 #ifndef NDEBUG 5834 #ifndef NDEBUG
5833 using namespace blink; 5835 using namespace blink;
5834 void showLiveDocumentInstances() 5836 void showLiveDocumentInstances()
5835 { 5837 {
5836 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5838 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5837 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5839 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5838 for (Document* document : set) 5840 for (Document* document : set)
5839 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5841 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5840 } 5842 }
5841 #endif 5843 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698