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

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

Issue 2692423006: Fix stale focusedElement in unloaded document. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/loader/crash-focus-in-unload.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 void Element::focus(const FocusParams& params) { 2637 void Element::focus(const FocusParams& params) {
2638 if (!isConnected()) 2638 if (!isConnected())
2639 return; 2639 return;
2640 2640
2641 if (document().focusedElement() == this) 2641 if (document().focusedElement() == this)
2642 return; 2642 return;
2643 2643
2644 if (!document().isActive()) 2644 if (!document().isActive())
2645 return; 2645 return;
2646 2646
2647 if (isFrameOwnerElement() &&
2648 toHTMLFrameOwnerElement(this)->contentDocument()->unloadStarted())
tkent 2017/02/17 07:34:00 contnetDocument() might return nullptr.
2649 return;
2650
2647 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); 2651 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
2648 if (!isFocusable()) 2652 if (!isFocusable())
2649 return; 2653 return;
2650 2654
2651 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) { 2655 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) {
2652 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement())) 2656 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement()))
2653 return; 2657 return;
2654 2658
2655 // Slide the focus to its inner node. 2659 // Slide the focus to its inner node.
2656 Element* found = 2660 Element* found =
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 } 4138 }
4135 4139
4136 DEFINE_TRACE_WRAPPERS(Element) { 4140 DEFINE_TRACE_WRAPPERS(Element) {
4137 if (hasRareData()) { 4141 if (hasRareData()) {
4138 visitor->traceWrappers(elementRareData()); 4142 visitor->traceWrappers(elementRareData());
4139 } 4143 }
4140 ContainerNode::traceWrappers(visitor); 4144 ContainerNode::traceWrappers(visitor);
4141 } 4145 }
4142 4146
4143 } // namespace blink 4147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/loader/crash-focus-in-unload.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698