| Index: third_party/WebKit/Source/core/editing/DOMSelection.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
|
| index 51727bb61623b756fa56932170375529f905591e..20b6dfd4de3acc5c7105b96853e749e006df6086 100644
|
| --- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
|
| @@ -197,13 +197,13 @@ void DOMSelection::collapse(Node* node,
|
| IndexSizeError, String::number(offset) + " is not a valid offset.");
|
| return;
|
| }
|
| -
|
| - if (!isValidForPosition(node))
|
| - return;
|
| Range::checkNodeWOffset(node, offset, exceptionState);
|
| if (exceptionState.hadException())
|
| return;
|
|
|
| + if (!isValidForPosition(node))
|
| + return;
|
| +
|
| frame()->selection().setSelection(
|
| SelectionInDOMTree::Builder()
|
| .collapse(Position(node, offset))
|
| @@ -285,6 +285,15 @@ void DOMSelection::setBaseAndExtent(Node* baseNode,
|
| extentOffset = 0;
|
| }
|
|
|
| + Range::checkNodeWOffset(baseNode, baseOffset, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + if (extentNode) {
|
| + Range::checkNodeWOffset(extentNode, extentOffset, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + }
|
| +
|
| if (!isValidForPosition(baseNode) || !isValidForPosition(extentNode))
|
| return;
|
|
|
| @@ -380,12 +389,9 @@ void DOMSelection::extend(Node* node,
|
| IndexSizeError, String::number(offset) + " is not a valid offset.");
|
| return;
|
| }
|
| - if (static_cast<unsigned>(offset) > node->lengthOfContents()) {
|
| - exceptionState.throwDOMException(
|
| - IndexSizeError,
|
| - String::number(offset) + " is larger than the given node's length.");
|
| + Range::checkNodeWOffset(node, offset, exceptionState);
|
| + if (exceptionState.hadException())
|
| return;
|
| - }
|
|
|
| if (!isValidForPosition(node))
|
| return;
|
|
|