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

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

Issue 1667623002: Make sure Document::updateLayoutTree*() is called before Element::isFocusable(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 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 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, n ewFocusedElement.get(), params.sourceCapabilities); // DOM level 3 name for the bubbling blur event. 3616 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, n ewFocusedElement.get(), params.sourceCapabilities); // DOM level 3 name for the bubbling blur event.
3617 // FIXME: We should remove firing DOMFocusOutEvent event when we are sure no content depends 3617 // FIXME: We should remove firing DOMFocusOutEvent event when we are sure no content depends
3618 // on it, probably when <rdar://problem/8503958> is resolved. 3618 // on it, probably when <rdar://problem/8503958> is resolved.
3619 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut , newFocusedElement.get(), params.sourceCapabilities); // DOM level 2 name for c ompatibility. 3619 oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut , newFocusedElement.get(), params.sourceCapabilities); // DOM level 2 name for c ompatibility.
3620 3620
3621 if (m_focusedElement) { 3621 if (m_focusedElement) {
3622 // handler shifted focus 3622 // handler shifted focus
3623 focusChangeBlocked = true; 3623 focusChangeBlocked = true;
3624 newFocusedElement = nullptr; 3624 newFocusedElement = nullptr;
3625 } 3625 }
3626 // Event handlers might make newFocusedElement dirty.
3627 if (newFocusedElement)
3628 updateLayoutTreeIgnorePendingStylesheets();
3629 } 3626 }
3630 3627
3631 if (view()) { 3628 if (view()) {
3632 Widget* oldWidget = widgetForElement(*oldFocusedElement); 3629 Widget* oldWidget = widgetForElement(*oldFocusedElement);
3633 if (oldWidget) 3630 if (oldWidget)
3634 oldWidget->setFocus(false, params.type); 3631 oldWidget->setFocus(false, params.type);
3635 else 3632 else
3636 view()->setFocus(false, params.type); 3633 view()->setFocus(false, params.type);
3637 } 3634 }
3638 } 3635 }
3639 3636
3637 if (newFocusedElement)
3638 updateLayoutTreeIgnorePendingStylesheets();
3640 if (newFocusedElement && newFocusedElement->isFocusable()) { 3639 if (newFocusedElement && newFocusedElement->isFocusable()) {
3641 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) { 3640 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) {
3642 // delegate blocks focus change 3641 // delegate blocks focus change
3643 focusChangeBlocked = true; 3642 focusChangeBlocked = true;
3644 goto SetFocusedElementDone; 3643 goto SetFocusedElementDone;
3645 } 3644 }
3646 // Set focus on the new node 3645 // Set focus on the new node
3647 m_focusedElement = newFocusedElement; 3646 m_focusedElement = newFocusedElement;
3648 3647
3649 m_focusedElement->setFocus(true); 3648 m_focusedElement->setFocus(true);
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after
5950 #ifndef NDEBUG 5949 #ifndef NDEBUG
5951 using namespace blink; 5950 using namespace blink;
5952 void showLiveDocumentInstances() 5951 void showLiveDocumentInstances()
5953 { 5952 {
5954 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5953 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5955 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5954 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5956 for (Document* document : set) 5955 for (Document* document : set)
5957 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5956 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5958 } 5957 }
5959 #endif 5958 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.h » ('j') | third_party/WebKit/Source/core/dom/Element.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698