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

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: improve selection-functions.html 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 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3531 if (newFocusedElement && newFocusedElement->isFocusable()) { 3531 if (newFocusedElement && newFocusedElement->isFocusable()) {
3532 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) { 3532 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) {
3533 // delegate blocks focus change 3533 // delegate blocks focus change
3534 focusChangeBlocked = true; 3534 focusChangeBlocked = true;
3535 goto SetFocusedElementDone; 3535 goto SetFocusedElementDone;
3536 } 3536 }
3537 // Set focus on the new node 3537 // Set focus on the new node
3538 m_focusedElement = newFocusedElement; 3538 m_focusedElement = newFocusedElement;
3539 3539
3540 m_focusedElement->setFocus(true); 3540 m_focusedElement->setFocus(true);
3541 cancelFocusAppearanceUpdate();
3542 m_focusedElement->updateFocusAppearance(params.selectionBehavior);
3541 3543
3542 // Dispatch the focus event and let the node do any other focus related activities (important for text fields) 3544 // Dispatch the focus event and let the node do any other focus related activities (important for text fields)
3543 // If page lost focus, event will be dispatched on page focus, don't dup licate 3545 // If page lost focus, event will be dispatched on page focus, don't dup licate
3544 if (page() && (page()->focusController().isFocused())) { 3546 if (page() && (page()->focusController().isFocused())) {
3545 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), params .type, params.sourceCapabilities); 3547 m_focusedElement->dispatchFocusEvent(oldFocusedElement.get(), params .type, params.sourceCapabilities);
3546 3548
3547 3549
3548 if (m_focusedElement != newFocusedElement) { 3550 if (m_focusedElement != newFocusedElement) {
3549 // handler shifted focus 3551 // handler shifted focus
3550 focusChangeBlocked = true; 3552 focusChangeBlocked = true;
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
5834 #ifndef NDEBUG 5836 #ifndef NDEBUG
5835 using namespace blink; 5837 using namespace blink;
5836 void showLiveDocumentInstances() 5838 void showLiveDocumentInstances()
5837 { 5839 {
5838 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5840 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5839 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5841 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5840 for (Document* document : set) 5842 for (Document* document : set)
5841 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5843 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5842 } 5844 }
5843 #endif 5845 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698