diff --git a/mozilla/editor/idl/nsIHTMLEditor.idl b/mozilla/editor/idl/nsIHTMLEditor.idl
index 8afaee71774..56c07e76c9a 100644
--- a/mozilla/editor/idl/nsIHTMLEditor.idl
+++ b/mozilla/editor/idl/nsIHTMLEditor.idl
@@ -570,5 +570,7 @@ interface nsIHTMLEditor : nsISupports
void removeInsertionListener(in nsIContentFilter inFilter);
nsIDOMCSSStyleRule parseStyleAttrIntoCSSRule(in AString aString);
+
+ boolean isAnonymousElement(in nsIDOMElement aElement);
};
diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
index ccb738765b1..b3749621443 100644
--- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp
@@ -6178,3 +6178,11 @@ nsHTMLEditor::EndUpdateViewBatch()
return res;
}
+NS_IMETHODIMP
+nsHTMLEditor::IsAnonymousElement(nsIDOMElement * aElement, PRBool * aReturn)
+{
+ NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
+ nsCOMPtr content = do_QueryInterface(aElement);
+ *aReturn = content->IsNativeAnonymous();
+ return NS_OK;
+}
diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.h b/mozilla/editor/libeditor/html/nsHTMLEditor.h
index e6acad1c306..8d15b3e27a0 100644
--- a/mozilla/editor/libeditor/html/nsHTMLEditor.h
+++ b/mozilla/editor/libeditor/html/nsHTMLEditor.h
@@ -242,6 +242,8 @@ public:
NS_IMETHOD AddInsertionListener(nsIContentFilter *aFilter);
NS_IMETHOD RemoveInsertionListener(nsIContentFilter *aFilter);
+ NS_IMETHOD IsAnonymousElement(nsIDOMElement * aElement, PRBool * aReturn);
+
/* ------------ nsIEditorIMESupport overrides -------------- */
NS_IMETHOD SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js
index 59b73d71e96..253eb086367 100644
--- a/mozilla/editor/ui/composer/content/editor.js
+++ b/mozilla/editor/ui/composer/content/editor.js
@@ -3359,7 +3359,9 @@ function GetSelectionContainer()
// and make sure the element is not a special editor node like
// the
we insert in blank lines
- while (result.node.hasAttribute("_moz_editor_bogus_node"))
+ // and don't select anonymous content !!! (fix for bug 190279)
+ while (result.node.hasAttribute("_moz_editor_bogus_node") ||
+ editor.isAnonymousElement(result.node))
result.node = result.node.parentNode;
return result;