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

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

Issue 284823005: Calling focus() on an iframe should not trigger a 'focusout' event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/frames/frame-focus-no-focusout-event.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. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 RefPtr<LocalFrame> frame(document().frame()); 2106 RefPtr<LocalFrame> frame(document().frame());
2107 if (!frame) 2107 if (!frame)
2108 return; 2108 return;
2109 2109
2110 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection. 2110 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection.
2111 if (this == frame->selection().rootEditableElement()) 2111 if (this == frame->selection().rootEditableElement())
2112 return; 2112 return;
2113 2113
2114 // FIXME: We should restore the previous selection if there is one. 2114 // FIXME: We should restore the previous selection if there is one.
2115 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), DOWNSTREAM); 2115 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), DOWNSTREAM);
2116 frame->selection().setSelection(newSelection); 2116 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement()
2117 // and we don't want to change the focus to a new Element.
2118 frame->selection().setSelection(newSelection, FrameSelection::DoNotSetFo cus);
2117 frame->selection().revealSelection(); 2119 frame->selection().revealSelection();
2118 } else if (renderer() && !renderer()->isWidget()) 2120 } else if (renderer() && !renderer()->isWidget())
2119 renderer()->scrollRectToVisible(boundingBox()); 2121 renderer()->scrollRectToVisible(boundingBox());
2120 } 2122 }
2121 2123
2122 void Element::blur() 2124 void Element::blur()
2123 { 2125 {
2124 cancelFocusAppearanceUpdate(); 2126 cancelFocusAppearanceUpdate();
2125 if (treeScope().adjustedFocusedElement() == this) { 2127 if (treeScope().adjustedFocusedElement() == this) {
2126 Document& doc = document(); 2128 Document& doc = document();
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3301 3303
3302 void Element::trace(Visitor* visitor) 3304 void Element::trace(Visitor* visitor)
3303 { 3305 {
3304 if (hasRareData()) 3306 if (hasRareData())
3305 visitor->trace(elementRareData()); 3307 visitor->trace(elementRareData());
3306 3308
3307 ContainerNode::trace(visitor); 3309 ContainerNode::trace(visitor);
3308 } 3310 }
3309 3311
3310 } // namespace WebCore 3312 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/frames/frame-focus-no-focusout-event.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698