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

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

Issue 2692423006: Fix stale focusedElement in unloaded document. (Closed)
Patch Set: Check nullptr. 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() &&
2649 toHTMLFrameOwnerElement(this)->contentDocument()->unloadStarted())
2650 return;
2651
2647 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); 2652 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
2648 if (!isFocusable()) 2653 if (!isFocusable())
2649 return; 2654 return;
2650 2655
2651 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) { 2656 if (authorShadowRoot() && authorShadowRoot()->delegatesFocus()) {
2652 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement())) 2657 if (isShadowIncludingInclusiveAncestorOf(document().focusedElement()))
2653 return; 2658 return;
2654 2659
2655 // Slide the focus to its inner node. 2660 // Slide the focus to its inner node.
2656 Element* found = 2661 Element* found =
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 } 4139 }
4135 4140
4136 DEFINE_TRACE_WRAPPERS(Element) { 4141 DEFINE_TRACE_WRAPPERS(Element) {
4137 if (hasRareData()) { 4142 if (hasRareData()) {
4138 visitor->traceWrappers(elementRareData()); 4143 visitor->traceWrappers(elementRareData());
4139 } 4144 }
4140 ContainerNode::traceWrappers(visitor); 4145 ContainerNode::traceWrappers(visitor);
4141 } 4146 }
4142 4147
4143 } // namespace blink 4148 } // 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