Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |