summaryrefslogtreecommitdiff
path: root/dom/base/nsDocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/nsDocument.cpp')
-rw-r--r--dom/base/nsDocument.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index a1b1408a54..40bfa97e2a 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3031,20 +3031,9 @@ Element*
nsIDocument::GetActiveElement()
{
// Get the focused element.
- if (nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow()) {
- nsCOMPtr<nsPIDOMWindowOuter> focusedWindow;
- nsIContent* focusedContent =
- nsFocusManager::GetFocusedDescendant(window, false,
- getter_AddRefs(focusedWindow));
- // be safe and make sure the element is from this document
- if (focusedContent && focusedContent->OwnerDoc() == this) {
- if (focusedContent->ChromeOnlyAccess()) {
- focusedContent = focusedContent->FindFirstNonChromeOnlyAccessContent();
- }
- if (focusedContent) {
- return focusedContent->AsElement();
- }
- }
+ Element* focusedElement = GetRetargetedFocusedElement();
+ if (focusedElement) {
+ return focusedElement;
}
// No focused element anywhere in this document. Try to get the BODY.