| Index: third_party/WebKit/Source/core/html/TextControlElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp
|
| index 36a1878ddcf5e579f9967e30bf62b5da92a2dcec..fe6bc4dd67228a527780da6a31fe2220fc264e85 100644
|
| --- a/third_party/WebKit/Source/core/html/TextControlElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
|
| @@ -608,9 +608,9 @@ static inline void setContainerAndOffsetForRange(Node* node,
|
| }
|
| }
|
|
|
| -Range* TextControlElement::selection() const {
|
| +SelectionInDOMTree TextControlElement::selection() const {
|
| if (!layoutObject() || !isTextControl())
|
| - return nullptr;
|
| + return SelectionInDOMTree();
|
|
|
| int start = m_cachedSelectionStart;
|
| int end = m_cachedSelectionEnd;
|
| @@ -618,10 +618,14 @@ Range* TextControlElement::selection() const {
|
| DCHECK_LE(start, end);
|
| HTMLElement* innerText = innerEditorElement();
|
| if (!innerText)
|
| - return nullptr;
|
| + return SelectionInDOMTree();
|
|
|
| - if (!innerText->hasChildren())
|
| - return Range::create(document(), innerText, 0, innerText, 0);
|
| + if (!innerText->hasChildren()) {
|
| + return SelectionInDOMTree::Builder()
|
| + .collapse(Position(innerText, 0))
|
| + .setIsDirectional(selectionDirection() != "none")
|
| + .build();
|
| + }
|
|
|
| int offset = 0;
|
| Node* startNode = 0;
|
| @@ -643,9 +647,12 @@ Range* TextControlElement::selection() const {
|
| }
|
|
|
| if (!startNode || !endNode)
|
| - return nullptr;
|
| + return SelectionInDOMTree();
|
|
|
| - return Range::create(document(), startNode, start, endNode, end);
|
| + return SelectionInDOMTree::Builder()
|
| + .setBaseAndExtent(Position(startNode, start), Position(endNode, end))
|
| + .setIsDirectional(selectionDirection() != "none")
|
| + .build();
|
| }
|
|
|
| const AtomicString& TextControlElement::autocapitalize() const {
|
|
|