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

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

Issue 2698413002: selection: Align collapse-NN.html and extend-NN.html to the latest draft. (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
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/selection/removeAllRanges-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f14363f72d40bd6c089440af596e4a44d02fcece..a1abcd196b9f0c79a394804ef596e40a4255b0e1 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -428,11 +428,15 @@ void DOMSelection::modify(const String& alterString,
frame()->selection().modify(alter, direction, granularity);
}
+// https://www.w3.org/TR/selection-api/#dom-selection-extend
void DOMSelection::extend(Node* node,
int offset,
ExceptionState& exceptionState) {
DCHECK(node);
- // https://www.w3.org/TR/selection-api/#dom-selection-extend
+ // 1. If node's root is not the document associated with the context object,
+ // abort these steps.
+ if (!isValidForPosition(node))
+ return;
// 2. If the context object is empty, throw an InvalidStateError exception and
// abort these steps.
@@ -451,11 +455,6 @@ void DOMSelection::extend(Node* node,
if (exceptionState.hadException())
return;
- // 1. If node's root is not the document associated with the context object,
- // abort these steps.
- if (!isValidForPosition(node))
- return;
-
// 3. Let oldAnchor and oldFocus be the context object's anchor and focus, and
// let newFocus be the boundary point (node, offset).
const Position& oldAnchor = anchorPosition();
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/selection/removeAllRanges-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698