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

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

Issue 424973003: Don't clear selection on focus change except for text form control element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-08-13T13:21:11 Created 6 years, 4 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 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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 return; 2087 return;
2088 2088
2089 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection. 2089 // When focusing an editable element in an iframe, don't reset the selec tion if it already contains a selection.
2090 if (this == frame->selection().rootEditableElement()) 2090 if (this == frame->selection().rootEditableElement())
2091 return; 2091 return;
2092 2092
2093 // FIXME: We should restore the previous selection if there is one. 2093 // FIXME: We should restore the previous selection if there is one.
2094 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), DOWNSTREAM); 2094 VisibleSelection newSelection = VisibleSelection(firstPositionInOrBefore Node(this), DOWNSTREAM);
2095 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement() 2095 // Passing DoNotSetFocus as this function is called after FocusControlle r::setFocusedElement()
2096 // and we don't want to change the focus to a new Element. 2096 // and we don't want to change the focus to a new Element.
2097 frame->selection().setSelection(newSelection, FrameSelection::DoNotSetFo cus); 2097 frame->selection().setSelection(newSelection, FrameSelection::CloseTypi ng | FrameSelection::ClearTypingStyle | FrameSelection::DoNotSetFocus);
2098 frame->selection().revealSelection(); 2098 frame->selection().revealSelection();
2099 } else if (renderer() && !renderer()->isWidget()) 2099 } else if (renderer() && !renderer()->isWidget())
2100 renderer()->scrollRectToVisible(boundingBox()); 2100 renderer()->scrollRectToVisible(boundingBox());
2101 } 2101 }
2102 2102
2103 void Element::blur() 2103 void Element::blur()
2104 { 2104 {
2105 cancelFocusAppearanceUpdate(); 2105 cancelFocusAppearanceUpdate();
2106 if (treeScope().adjustedFocusedElement() == this) { 2106 if (treeScope().adjustedFocusedElement() == this) {
2107 Document& doc = document(); 2107 Document& doc = document();
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 { 3245 {
3246 #if ENABLE(OILPAN) 3246 #if ENABLE(OILPAN)
3247 if (hasRareData()) 3247 if (hasRareData())
3248 visitor->trace(elementRareData()); 3248 visitor->trace(elementRareData());
3249 visitor->trace(m_elementData); 3249 visitor->trace(m_elementData);
3250 #endif 3250 #endif
3251 ContainerNode::trace(visitor); 3251 ContainerNode::trace(visitor);
3252 } 3252 }
3253 3253
3254 } // namespace blink 3254 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/focus-selection-textarea-expected.txt ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698