mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1297414 - Support <div> separator in ReturnIn(Header|ListItem); r=masayuki
MozReview-Commit-ID: EkvFpyTmXDc
This commit is contained in:
parent
7c603e0235
commit
3611697a7f
@ -6324,6 +6324,16 @@ HTMLEditRules::IsInListItem(nsINode* aNode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom&
|
||||
HTMLEditRules::DefaultParagraphSeparator()
|
||||
{
|
||||
MOZ_ASSERT(mHTMLEditor);
|
||||
if (!mHTMLEditor) {
|
||||
return *nsGkAtoms::div;
|
||||
}
|
||||
return ParagraphSeparatorElement(mHTMLEditor->GetDefaultParagraphSeparator());
|
||||
}
|
||||
|
||||
/**
|
||||
* ReturnInHeader: do the right thing for returns pressed in headers
|
||||
*/
|
||||
@ -6379,8 +6389,12 @@ HTMLEditRules::ReturnInHeader(Selection& aSelection,
|
||||
htmlEditor->mTypeInState->ClearAllProps();
|
||||
|
||||
// Create a paragraph
|
||||
nsIAtom& paraAtom = DefaultParagraphSeparator();
|
||||
// We want a wrapper element even if we separate with <br>
|
||||
nsCOMPtr<Element> pNode =
|
||||
htmlEditor->CreateNode(nsGkAtoms::p, headerParent, offset + 1);
|
||||
htmlEditor->CreateNode(¶Atom == nsGkAtoms::br ? nsGkAtoms::p
|
||||
: ¶Atom,
|
||||
headerParent, offset + 1);
|
||||
NS_ENSURE_STATE(pNode);
|
||||
|
||||
// Append a <br> to it
|
||||
@ -6651,8 +6665,12 @@ HTMLEditRules::ReturnInListItem(Selection& aSelection,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Time to insert a paragraph
|
||||
nsIAtom& paraAtom = DefaultParagraphSeparator();
|
||||
// We want a wrapper even if we separate with <br>
|
||||
nsCOMPtr<Element> pNode =
|
||||
htmlEditor->CreateNode(nsGkAtoms::p, listParent, offset + 1);
|
||||
htmlEditor->CreateNode(¶Atom == nsGkAtoms::br ? nsGkAtoms::p
|
||||
: ¶Atom,
|
||||
listParent, offset + 1);
|
||||
NS_ENSURE_STATE(pNode);
|
||||
|
||||
// Append a <br> to it
|
||||
|
@ -273,6 +273,7 @@ protected:
|
||||
int32_t* aIndex, Lists aLists = Lists::yes,
|
||||
Tables aTables = Tables::yes);
|
||||
Element* IsInListItem(nsINode* aNode);
|
||||
nsIAtom& DefaultParagraphSeparator();
|
||||
nsresult ReturnInHeader(Selection& aSelection, Element& aHeader,
|
||||
nsINode& aNode, int32_t aOffset);
|
||||
nsresult ReturnInParagraph(Selection* aSelection, nsIDOMNode* aHeader,
|
||||
|
@ -36,21 +36,12 @@
|
||||
[[["defaultparagraphseparator","p"\],["insertparagraph",""\]\] "<table><tr><td>[foo\]</table>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<ol><li>[foo\]<li>bar</ol>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<span>foo[\]</span>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","p"\],["insertparagraph",""\]\] "<span>foo[\]</span>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<h1>foo[\]</h1>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<h1>foo[\]<br></h1>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","p"\],["insertparagraph",""\]\] "<script>foo[\]bar</script>baz" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
@ -60,18 +51,6 @@
|
||||
[[["stylewithcss","false"\],["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<div style=display:none>foo[\]bar</div>baz" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<ol><li>{}<br></li></ol>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<ol><li>foo<li>{}<br></ol>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<dl><dt>foo<dd>{}<br></dl>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<dl><dt>{}<br><dd>bar</dl>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["insertparagraph",""\]\] "<dl><dt>foo<dd>bar<dl><dt>{}<br><dd>baz</dl></dl>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
@ -108,9 +87,6 @@
|
||||
[[["defaultparagraphseparator","p"\],["insertparagraph",""\]\] "<h1>foo</h1>{}<br><h2>bar</h2>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<p>foo</p><h1>[bar\]</h1><p>baz</p>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<p>foo</p>{<h1>bar</h1>}<p>baz</p>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
@ -369,15 +345,3 @@
|
||||
[[["insertparagraph",""\]\] "<listing>foo[\]bar</listing>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "foo<ol><li>{}<br></li></ol>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<ol><li>{}<br></li></ol>foo" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<ol><li>{}<br><li>bar</ol>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
[[["defaultparagraphseparator","div"\],["insertparagraph",""\]\] "<dl><dt>{}<br></dt></dl>" compare innerHTML]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user