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
This commit is contained in:
glazman%netscape.com
2003-06-19 14:06:05 +00:00
parent 2e77bcb795
commit 3825cdfefa
4 changed files with 15 additions and 1 deletions

View File

@@ -570,5 +570,7 @@ interface nsIHTMLEditor : nsISupports
void removeInsertionListener(in nsIContentFilter inFilter);
nsIDOMCSSStyleRule parseStyleAttrIntoCSSRule(in AString aString);
boolean isAnonymousElement(in nsIDOMElement aElement);
};

View File

@@ -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<nsIContent> content = do_QueryInterface(aElement);
*aReturn = content->IsNativeAnonymous();
return NS_OK;
}

View File

@@ -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);

View File

@@ -3359,7 +3359,9 @@ function GetSelectionContainer()
// and make sure the element is not a special editor node like
// the <br> 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;