summaryrefslogtreecommitdiffstats
path: root/dom/base/nsDocument.cpp
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-23 11:45:04 +0200
committerGitHub <noreply@github.com>2018-04-23 11:45:04 +0200
commit3b55277bc59d6bea5f61c164f9687ae242b88550 (patch)
tree1e0a3ca438adc705be3618808e71bb6aa5f1e330 /dom/base/nsDocument.cpp
parentd220a5e6aaa7410b8c62fd3f7f37e8fb853e5797 (diff)
parent0a9acadccafe04aa5bc3335523bb55fe52ca8e50 (diff)
downloadUXP-3b55277bc59d6bea5f61c164f9687ae242b88550.tar
UXP-3b55277bc59d6bea5f61c164f9687ae242b88550.tar.gz
UXP-3b55277bc59d6bea5f61c164f9687ae242b88550.tar.lz
UXP-3b55277bc59d6bea5f61c164f9687ae242b88550.tar.xz
UXP-3b55277bc59d6bea5f61c164f9687ae242b88550.zip
Merge pull request #237 from janekptacijarabaci/js_dom_getSelection_document_1
moebius#121: DOM - Selection API - getSelection() should exist on XMLDocument / Selection.type
Diffstat (limited to 'dom/base/nsDocument.cpp')
-rw-r--r--dom/base/nsDocument.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index eaea49b02..d5954a62c 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12846,3 +12846,19 @@ nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
return is;
}
+
+Selection*
+nsIDocument::GetSelection(ErrorResult& aRv)
+{
+ nsCOMPtr<nsPIDOMWindowInner> window = GetInnerWindow();
+ if (!window) {
+ return nullptr;
+ }
+
+ NS_ASSERTION(window->IsInnerWindow(), "Should have inner window here!");
+ if (!window->IsCurrentInnerWindow()) {
+ return nullptr;
+ }
+
+ return nsGlobalWindow::Cast(window)->GetSelection(aRv);
+}