Chromium Code Reviews| 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..bb07211571bfdf84d3fd55960954c68380390ded 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 { |
| +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" ? true : false) |
|
yosin_UTC9
2017/03/15 09:29:28
nit: No need to have |? true : false|
tanvir
2017/03/15 10:18:15
Done.
tanvir
2017/03/15 10:18:15
Done.
|
| + .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" ? true : false) |
|
yosin_UTC9
2017/03/15 09:29:28
nit: No need to have |? true : false|
tanvir
2017/03/15 10:18:15
Done.
|
| + .build(); |
| } |
| const AtomicString& TextControlElement::autocapitalize() const { |