Commit c9f2ec60 authored by Masayuki Nakano's avatar Masayuki Nakano Committed by Ian Neal
Browse files

Bug 1390562 - part 1: HTML editor shouldn't split <div> container at inserting...

Bug 1390562 - part 1: HTML editor shouldn't split <div> container at inserting a line break for backward compatibility if defaultParagraphSeparator is "br" r=m_kato

Starting from bug 1297414, HTMLEditor treats <div> container as same as <p>
container at inserting a line break.  This new behavior is check in WPT.
So, it's better to use the new behavior for compatibility with other browsers.

However, we're still using <br> as default paragraph separator for backward
compatibility even though this is non-standard behavior.

So, although, the old behavior is odd, we should keep treating them differently
in the backward compatibility mode.  Actually, this behavior change causes
an incompatibility problem in Gmail, and may be in other web apps.

MozReview-Commit-ID: INCihKYmcPd
parent 6942b59d
......@@ -1624,7 +1624,18 @@ HTMLEditRules::WillInsertBreak(Selection& aSelection,
ReturnInHeader(aSelection, *blockParent, node, offset);
*aHandled = true;
return NS_OK;
} else if (blockParent->IsAnyOfHTMLElements(nsGkAtoms::p, nsGkAtoms::div)) {
}
// XXX Ideally, we should take same behavior with both <p> container and
// <div> container. However, we are still using <br> as default
// paragraph separator (non-standard) and we've split only <p> container
// long time. Therefore, some web apps may depend on this behavior like
// Gmail. So, let's use traditional odd behavior only when the default
// paragraph separator is <br>. Otherwise, take consistent behavior
// between <p> container and <div> container.
else if ((separator == ParagraphSeparator::br &&
blockParent->IsHTMLElement(nsGkAtoms::p)) ||
(separator != ParagraphSeparator::br &&
blockParent->IsAnyOfHTMLElements(nsGkAtoms::p, nsGkAtoms::div))) {
// Paragraphs: special rules to look for <br>s
nsresult rv =
ReturnInParagraph(&aSelection, GetAsDOMNode(blockParent),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment