Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2710593002: Selection API: collapse(), setBaseAndExtent(), and extend() don't need to have code to check negati… (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e38f0d7e42fdbde9b633cc4c0e733d008db35ad8..5d1af9d7223b8acb3f1d7fb0bffb49f15787aa78 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -224,11 +224,6 @@ void DOMSelection::collapse(Node* node,
// 2. The method must throw an IndexSizeError exception if offset is longer
// than node's length ([DOM4]) and abort these steps.
- if (offset < 0) {
- exceptionState.throwDOMException(
- IndexSizeError, String::number(offset) + " is not a valid offset.");
- return;
- }
Range::checkNodeWOffset(node, offset, exceptionState);
if (exceptionState.hadException())
return;
@@ -322,20 +317,6 @@ void DOMSelection::setBaseAndExtent(Node* baseNode,
if (!isAvailable())
return;
- if (baseOffset < 0) {
- exceptionState.throwDOMException(
- IndexSizeError,
- String::number(baseOffset) + " is not a valid base offset.");
- return;
- }
-
- if (extentOffset < 0) {
- exceptionState.throwDOMException(
- IndexSizeError,
- String::number(extentOffset) + " is not a valid extent offset.");
- return;
- }
-
// TODO(editing-dev): Behavior on where base or extent is null is still
// under discussion: https://github.com/w3c/selection-api/issues/72
if (!baseNode) {
@@ -471,11 +452,6 @@ void DOMSelection::extend(Node* node,
return;
}
- if (offset < 0) {
- exceptionState.throwDOMException(
- IndexSizeError, String::number(offset) + " is not a valid offset.");
- return;
- }
Range::checkNodeWOffset(node, offset, exceptionState);
if (exceptionState.hadException())
return;

Powered by Google App Engine
This is Rietveld 408576698