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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 | 347 |
| 348 ASSERT(index >= 0); | 348 ASSERT(index >= 0); |
| 349 return index; | 349 return index; |
| 350 } | 350 } |
| 351 | 351 |
| 352 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, Selectio nOption selectionOption) | 352 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction, NeedToDispatchSelectEvent eventBehaviour, Selectio nOption selectionOption) |
| 353 { | 353 { |
| 354 if (openShadowRoot() || !isTextFormControl() || !inDocument()) | 354 if (openShadowRoot() || !isTextFormControl() || !inDocument()) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 document().updateLayoutIgnorePendingStylesheets(); | |
|
tkent
2015/10/20 23:11:32
nit: Add a comment why we need to update layout.
| |
| 358 | |
| 357 const int editorValueLength = static_cast<int>(innerEditorValue().length()); | 359 const int editorValueLength = static_cast<int>(innerEditorValue().length()); |
| 358 ASSERT(editorValueLength >= 0); | 360 ASSERT(editorValueLength >= 0); |
| 359 end = std::max(std::min(end, editorValueLength), 0); | 361 end = std::max(std::min(end, editorValueLength), 0); |
| 360 start = std::min(std::max(start, 0), end); | 362 start = std::min(std::max(start, 0), end); |
| 361 cacheSelection(start, end, direction); | 363 cacheSelection(start, end, direction); |
| 362 | 364 |
| 363 if (selectionOption == NotChangeSelection || (selectionOption == ChangeSelec tionIfFocused && document().focusedElement() != this)) { | 365 if (selectionOption == NotChangeSelection || (selectionOption == ChangeSelec tionIfFocused && document().focusedElement() != this)) { |
| 364 if (eventBehaviour == DispatchSelectEvent) | 366 if (eventBehaviour == DispatchSelectEvent) |
| 365 scheduleSelectEvent(); | 367 scheduleSelectEvent(); |
| 366 return; | 368 return; |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 } | 1017 } |
| 1016 | 1018 |
| 1017 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source) | 1019 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source) |
| 1018 { | 1020 { |
| 1019 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source); | 1021 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source); |
| 1020 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1022 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1021 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1023 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1022 } | 1024 } |
| 1023 | 1025 |
| 1024 } // namespace blink | 1026 } // namespace blink |
| OLD | NEW |