From 9e59f290d1f7897d7c867263e093b14c51120905 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 26 Apr 2018 23:35:19 -0400 Subject: [PATCH] Bug 1455674 part 7. Simplify HTMLEditor::GetFocusedNode. r=masayuki --- editor/libeditor/HTMLEditor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index ec8225ea8b05..8be9dbe26c5a 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -4948,6 +4948,11 @@ HTMLEditor::GetFocusedNode() return nullptr; } + // focusedContent might be non-null even fm->GetFocusedContent() is + // null. That's the designMode case, and in that case our + // FocusedContent() returns the root element, but we want to return + // the document. + nsIFocusManager* fm = nsFocusManager::GetFocusManager(); NS_ASSERTION(fm, "Focus manager is null"); nsCOMPtr focusedElement;