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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2697313005: Selection API: collapse() should recreate an internal Range. (Closed)
Patch Set: Add NeedsRebaseline for platform-dependent tests 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/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 3b798ec93b6e4f0519db810ffddef6c3e5ec2560..213876fb6141745371e6f8045905d012e2f5538b 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2607,6 +2607,34 @@ void Internals::forceReload(bool bypassCache) {
ClientRedirectPolicy::NotClientRedirect);
}
+Node* Internals::visibleSelectionAnchorNode() {
+ if (!frame())
+ return nullptr;
+ Position position = frame()->selection().base();
+ return position.isNull() ? nullptr : position.computeContainerNode();
+}
+
+unsigned Internals::visibleSelectionAnchorOffset() {
+ if (!frame())
+ return 0;
+ Position position = frame()->selection().base();
+ return position.isNull() ? 0 : position.computeOffsetInContainerNode();
+}
+
+Node* Internals::visibleSelectionFocusNode() {
+ if (!frame())
+ return nullptr;
+ Position position = frame()->selection().extent();
+ return position.isNull() ? nullptr : position.computeContainerNode();
+}
+
+unsigned Internals::visibleSelectionFocusOffset() {
+ if (!frame())
+ return 0;
+ Position position = frame()->selection().extent();
+ return position.isNull() ? 0 : position.computeOffsetInContainerNode();
+}
+
ClientRect* Internals::selectionBounds(ExceptionState& exceptionState) {
if (!frame()) {
exceptionState.throwDOMException(
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698