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

Side by Side Diff: Source/core/html/HTMLTextFormControlElement.cpp

Issue 945873003: Ignore setSelectionRange when node is un-parented. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add NeverFixTests entry Created 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/editing/input/orphan-set-selection-range-expected.txt ('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 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ++index; 341 ++index;
342 } 342 }
343 } 343 }
344 344
345 ASSERT(index >= 0); 345 ASSERT(index >= 0);
346 return index; 346 return index;
347 } 347 }
348 348
349 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, Selectio nOption selectionOption) 349 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, Selectio nOption selectionOption)
350 { 350 {
351 if (hasOpenShadowRoot() || !isTextFormControl()) 351 if (hasOpenShadowRoot() || !isTextFormControl() || !parentOrShadowHostNode() )
leviw_travelin_and_unemployed 2015/02/20 21:53:48 You probably want isRooted(). If you parent this f
szager1 2015/02/20 22:05:18 Done.
352 return; 352 return;
353 353
354 const int editorValueLength = static_cast<int>(innerEditorValue().length()); 354 const int editorValueLength = static_cast<int>(innerEditorValue().length());
355 ASSERT(editorValueLength >= 0); 355 ASSERT(editorValueLength >= 0);
356 end = std::max(std::min(end, editorValueLength), 0); 356 end = std::max(std::min(end, editorValueLength), 0);
357 start = std::min(std::max(start, 0), end); 357 start = std::min(std::max(start, 0), end);
358 cacheSelection(start, end, direction); 358 cacheSelection(start, end, direction);
359 359
360 if (selectionOption == NotChangeSelection || (selectionOption == ChangeSelec tionIfFocused && document().focusedElement() != this)) { 360 if (selectionOption == NotChangeSelection || (selectionOption == ChangeSelec tionIfFocused && document().focusedElement() != this)) {
361 if (eventBehaviour == DispatchSelectEvent) 361 if (eventBehaviour == DispatchSelectEvent)
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 Text* textNode = toText(node); 970 Text* textNode = toText(node);
971 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi votPosition.offsetInContainerNode() : 0); 971 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi votPosition.offsetInContainerNode() : 0);
972 if (firstLineBreak != kNotFound) 972 if (firstLineBreak != kNotFound)
973 return Position(textNode, firstLineBreak + 1); 973 return Position(textNode, firstLineBreak + 1);
974 } 974 }
975 } 975 }
976 return endOfInnerText(textFormControl); 976 return endOfInnerText(textFormControl);
977 } 977 }
978 978
979 } // namespace blink 979 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/editing/input/orphan-set-selection-range-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698