From 3825cdfefaca4a217d2feeb50d8d689b2ec04405 Mon Sep 17 00:00:00 2001 From: "glazman%netscape.com" Date: Thu, 19 Jun 2003 14:06:05 +0000 Subject: [PATCH] Composer's structure toolbar was showing anonymous content; b=190279, r=Neil, sr=peterv git-svn-id: svn://10.0.0.236/trunk@143931 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/idl/nsIHTMLEditor.idl | 2 ++ mozilla/editor/libeditor/html/nsHTMLEditor.cpp | 8 ++++++++ mozilla/editor/libeditor/html/nsHTMLEditor.h | 2 ++ mozilla/editor/ui/composer/content/editor.js | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) 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;