mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 10:40:12 +00:00
Fix for bug 131820: Hitting return in an inline style doesn't advance
caret to next line Prevent AdjustSelection() from adding a MozBR when the root node is empty so that EditAfterInner() can add the BogusBR node. r=jfrancis@netscape.com sr=sfraser@netscape.com a=scc@mozilla.org
This commit is contained in:
parent
9b16927a2b
commit
7ad75bc29d
@ -6747,6 +6747,19 @@ nsHTMLEditRules::AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection
|
||||
// check if br can go into the destination node
|
||||
if (bIsEmptyNode && mHTMLEditor->CanContainTag(selNode, NS_LITERAL_STRING("br")))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
res = mHTMLEditor->GetRootElement(getter_AddRefs(rootElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!rootElement) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMNode> rootNode(do_QueryInterface(rootElement));
|
||||
if (selNode == rootNode)
|
||||
{
|
||||
// Our root node is completely empty. Don't add a <br> here.
|
||||
// AfterEditInner() will add one for us when it calls
|
||||
// CreateBogusNodeIfNeeded()!
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> brNode;
|
||||
// we know we can skip the rest of this routine given the cirumstance
|
||||
return CreateMozBR(selNode, selOffset, address_of(brNode));
|
||||
|
Loading…
x
Reference in New Issue
Block a user