Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 623489 Details for
Bug 590640
[patch]
Patch part 5, v1 -- Delete empty wrappers when we delete the selection
patch (text/plain), 42.95 KB, created by
Aryeh Gregor (:ayg) (no longer with Mozilla)
(
hide
)
Description:
Patch part 5, v1 -- Delete empty wrappers when we delete the selection
Filename:
MIME Type:
Creator:
Aryeh Gregor (:ayg) (no longer with Mozilla)
Size:
42.95 KB
patch
obsolete
># HG changeset patch ># User Aryeh Gregor <ayg@aryeh.name> ># Date 1336661673 -10800 ># Node ID 838178dc62f84a4e473cabd7d76219c1552b67e8 ># Parent f220681e3f9b73dba3c4eff6f427ed8661c8b789 >Bug 590640 part 5 - Delete empty wrappers when we delete the selection > >diff --git a/dom/imptests/editing.json b/dom/imptests/editing.json >--- a/dom/imptests/editing.json >+++ b/dom/imptests/editing.json >@@ -1948,32 +1948,22 @@ > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") after":true, >- "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar]</span>baz\" compare innerHTML":true, >- "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar]</span>baz\" compare innerHTML":true, >- "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar}</span>baz\" compare innerHTML":true, >- "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar}</span>baz\" compare innerHTML":true, > "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true, > "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true, >- "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span>baz]\" compare innerHTML":true, >- "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span>baz]\" compare innerHTML":true, >- "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar</span>baz}\" compare innerHTML":true, >- "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar</span>baz}\" compare innerHTML":true, > "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true, >- "[[\"delete\",\"\"]] \"foo<span>[bar]</span>baz\" compare innerHTML":true, >- "[[\"delete\",\"\"]] \"foo<span>{bar}</span>baz\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"<p>foo</p><p>{bar</p>}<p>baz</p>\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true, >@@ -2052,17 +2042,16 @@ > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, >- "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" checks for modifications to non-editable content":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, >@@ -2383,17 +2372,16 @@ > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ol><li>b]ar</ol>\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ul><li>b]ar</ul>\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"<b>foo [ </b>bar]\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"foo<b> [ bar]</b>\" compare innerHTML":true, >- "[[\"delete\",\"\"]] \"[foo<b> ] bar</b>\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"<p style=display:inline>fo[o<p style=display:inline>b]ar\" compare innerHTML":true, > "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true, > "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true, > "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true, > "[[\"delete\",\"\"]] \"<ol><li>foo</ol>{}<br><ol><li>bar</ol>\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\" compare innerHTML":true, >@@ -11117,45 +11105,37 @@ > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, >- "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true, >- "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, >- "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true, >- "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, >- "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true, >- "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true, >- "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true, >- "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" compare innerHTML":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true, > "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true, > "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true, > "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\" compare innerHTML":true, >diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp >--- a/editor/libeditor/base/nsEditor.cpp >+++ b/editor/libeditor/base/nsEditor.cpp >@@ -616,29 +616,52 @@ nsEditor::GetSelectionController(nsISele > > > NS_IMETHODIMP > nsEditor::DeleteSelection(EDirection aAction) > { > return DeleteSelectionImpl(aAction); > } > >+nsresult >+nsEditor::DeleteSelection(EDirection aAction, bool aStripWrappers) >+{ >+ return DeleteSelectionImpl(aAction, aStripWrappers); >+} >+ > > > NS_IMETHODIMP > nsEditor::GetSelection(nsISelection **aSelection) > { > NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER); > *aSelection = nsnull; > nsCOMPtr<nsISelectionController> selcon; > GetSelectionController(getter_AddRefs(selcon)); > NS_ENSURE_TRUE(selcon, NS_ERROR_NOT_INITIALIZED); > return selcon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSelection); // does an addref > } > >+nsTypedSelection* >+nsEditor::GetTypedSelection() >+{ >+ nsCOMPtr<nsISelection> sel; >+ nsresult res = GetSelection(getter_AddRefs(sel)); >+ NS_ENSURE_SUCCESS(res, nsnull); >+ >+ nsCOMPtr<nsISelectionPrivate> selPrivate = do_QueryInterface(sel); >+ NS_ENSURE_TRUE(selPrivate, nsnull); >+ >+ nsRefPtr<nsFrameSelection> frameSel; >+ res = selPrivate->GetFrameSelection(getter_AddRefs(frameSel)); >+ NS_ENSURE_SUCCESS(res, nsnull); >+ >+ return frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL); >+} >+ > NS_IMETHODIMP > nsEditor::DoTransaction(nsITransaction *aTxn) > { > #ifdef NS_DEBUG_EDITOR > if (gNoisy) { printf("Editor::DoTransaction ----------\n"); } > #endif > > nsresult result = NS_OK; >@@ -4296,17 +4319,17 @@ nsresult nsEditor::EndUpdateViewBatch() > bool > nsEditor::GetShouldTxnSetSelection() > { > return mShouldTxnSetSelection; > } > > > NS_IMETHODIMP >-nsEditor::DeleteSelectionImpl(nsIEditor::EDirection aAction) >+nsEditor::DeleteSelectionImpl(EDirection aAction, bool aStripWrappers) > { > nsCOMPtr<nsISelection>selection; > nsresult res = GetSelection(getter_AddRefs(selection)); > NS_ENSURE_SUCCESS(res, res); > nsRefPtr<EditAggregateTxn> txn; > nsCOMPtr<nsIDOMNode> deleteNode; > PRInt32 deleteCharOffset = 0, deleteCharLength = 0; > res = CreateTxnForDeleteSelection(aAction, getter_AddRefs(txn), >diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h >--- a/editor/libeditor/base/nsEditor.h >+++ b/editor/libeditor/base/nsEditor.h >@@ -45,16 +45,18 @@ > #include "nsIEditor.h" > #include "nsIPlaintextEditor.h" > #include "nsIEditorIMESupport.h" > #include "nsIPhonetic.h" > > #include "nsIAtom.h" > #include "nsIDOMDocument.h" > #include "nsISelection.h" >+#include "nsRange.h" >+#include "nsTypedSelection.h" > #include "nsIDOMCharacterData.h" > #include "nsIPrivateTextRange.h" > #include "nsITransactionManager.h" > #include "nsIComponentManager.h" > #include "nsCOMArray.h" > #include "nsIEditActionListener.h" > #include "nsIEditorObserver.h" > #include "nsIDocumentStateListener.h" >@@ -198,17 +200,19 @@ public: > NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, > nsCOMPtr<nsIDOMNode> *aInOutNode, > PRInt32 *aInOutOffset, > nsIDOMDocument *aDoc); > nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert, > nsIDOMCharacterData *aTextNode, > PRInt32 aOffset, > bool aSuppressIME = false); >- NS_IMETHOD DeleteSelectionImpl(EDirection aAction); >+ nsresult DeleteSelection(EDirection aAction, bool aStripWrappers); >+ NS_IMETHOD DeleteSelectionImpl(EDirection aAction, >+ bool aStripWrappers = true); > NS_IMETHOD DeleteSelectionAndCreateNode(const nsAString& aTag, > nsIDOMNode ** aNewNode); > > /* helper routines for node/parent manipulations */ > nsresult ReplaceContainer(nsIDOMNode *inNode, > nsCOMPtr<nsIDOMNode> *outNode, > const nsAString &aNodeType, > const nsAString *aAttribute = nsnull, >@@ -613,16 +617,17 @@ public: > static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset); > static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, PRInt32 aOffset); > > static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, PRInt32 *outStartOffset); > static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, PRInt32 *outEndOffset); > #if DEBUG_JOE > static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0); > #endif >+ nsTypedSelection* GetTypedSelection(); > > // Helpers to add a node to the selection. > // Used by table cell selection methods > nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset, > nsIDOMNode *aEndParent, PRInt32 aEndOffset, > nsIDOMRange **aRange); > > // Creates a range with just the supplied node and appends that to the selection >diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp >--- a/editor/libeditor/html/nsHTMLEditRules.cpp >+++ b/editor/libeditor/html/nsHTMLEditRules.cpp >@@ -611,17 +611,18 @@ nsHTMLEditRules::WillDoAction(nsISelecti > info->inString, > info->outString, > info->maxLength); > case nsEditor::kOpLoadHTML: > return WillLoadHTML(aSelection, aCancel); > case nsEditor::kOpInsertBreak: > return WillInsertBreak(aSelection, aCancel, aHandled); > case nsEditor::kOpDeleteSelection: >- return WillDeleteSelection(aSelection, info->collapsedAction, aCancel, aHandled); >+ return WillDeleteSelection(aSelection, info->collapsedAction, >+ info->bStripWrappers, aCancel, aHandled); > case nsEditor::kOpMakeList: > return WillMakeList(aSelection, info->blockType, info->entireList, info->bulletType, aCancel, aHandled); > case nsEditor::kOpIndent: > return WillIndent(aSelection, aCancel, aHandled); > case nsEditor::kOpOutdent: > return WillOutdent(aSelection, aCancel, aHandled); > case nsEditor::kOpSetAbsolutePosition: > return WillAbsolutePosition(aSelection, aCancel, aHandled); >@@ -1819,16 +1820,26 @@ nsHTMLEditRules::SplitMailCites(nsISelec > > > nsresult > nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, > nsIEditor::EDirection aAction, > bool *aCancel, > bool *aHandled) > { >+ return WillDeleteSelection(aSelection, aAction, true, aCancel, aHandled); >+} >+ >+nsresult >+nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection, >+ nsIEditor::EDirection aAction, >+ bool aStripWrappers, >+ bool* aCancel, >+ bool* aHandled) >+{ > > if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; } > // initialize out param > *aCancel = false; > *aHandled = false; > > // remember that we did a selection deletion. Used by CreateStyleForInsertText() > mDidDeleteSelection = true; >@@ -1983,17 +1994,18 @@ nsHTMLEditRules::WillDeleteSelection(nsI > (wsType==nsWSRunObject::eBreak) || > nsHTMLEditUtils::IsHR(visNode) ) > { > // short circuit for invisible breaks. delete them and recurse. > if (nsTextEditUtils::IsBreak(visNode) && !mHTMLEditor->IsVisBreak(visNode)) > { > res = mHTMLEditor->DeleteNode(visNode); > NS_ENSURE_SUCCESS(res, res); >- return WillDeleteSelection(aSelection, aAction, aCancel, aHandled); >+ return WillDeleteSelection(aSelection, aAction, aStripWrappers, >+ aCancel, aHandled); > } > > // special handling for backspace when positioned after <hr> > if (aAction == nsIEditor::ePrevious && nsHTMLEditUtils::IsHR(visNode)) > { > /* > Only if the caret is positioned at the end-of-hr-line position, > we want to delete the <hr>. >@@ -2287,24 +2299,27 @@ nsHTMLEditRules::WillDeleteSelection(nsI > nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor); > res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor, > address_of(startNode), &startOffset, > address_of(endNode), &endOffset); > NS_ENSURE_SUCCESS(res, res); > } > > { >- // track end location of where we are deleting >- nsAutoTrackDOMPoint tracker(mHTMLEditor->mRangeUpdater, address_of(endNode), &endOffset); >+ // track location of where we are deleting >+ nsAutoTrackDOMPoint startTracker(mHTMLEditor->mRangeUpdater, >+ address_of(startNode), &startOffset); >+ nsAutoTrackDOMPoint endTracker(mHTMLEditor->mRangeUpdater, >+ address_of(endNode), &endOffset); > // we are handling all ranged deletions directly now. > *aHandled = true; > > if (endNode == startNode) > { >- res = mHTMLEditor->DeleteSelectionImpl(aAction); >+ res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers); > NS_ENSURE_SUCCESS(res, res); > } > else > { > // figure out mailcite ancestors > nsCOMPtr<nsIDOMNode> endCiteNode, startCiteNode; > res = GetTopEnclosingMailCite(startNode, address_of(startCiteNode), > IsPlaintextEditor()); >@@ -2334,17 +2349,17 @@ nsHTMLEditRules::WillDeleteSelection(nsI > if (IsBlockNode(endNode)) > rightParent = endNode; > else > rightParent = mHTMLEditor->GetBlockNodeParent(endNode); > > // are endpoint block parents the same? use default deletion > if (leftParent == rightParent) > { >- res = mHTMLEditor->DeleteSelectionImpl(aAction); >+ res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers); > } > else > { > // deleting across blocks > // are the blocks of same type? > NS_ENSURE_STATE(leftParent && rightParent); > > // are the blocks siblings? >@@ -2355,30 +2370,30 @@ nsHTMLEditRules::WillDeleteSelection(nsI > > // MOOSE: this could conceivably screw up a table.. fix me. > if ( (leftBlockParent == rightBlockParent) > && (mHTMLEditor->NodesSameType(leftParent, rightParent)) ) > { > if (nsHTMLEditUtils::IsParagraph(leftParent)) > { > // first delete the selection >- res = mHTMLEditor->DeleteSelectionImpl(aAction); >+ res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers); > NS_ENSURE_SUCCESS(res, res); > // then join para's, insert break > res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset); > NS_ENSURE_SUCCESS(res, res); > // fix up selection > res = aSelection->Collapse(selNode,selOffset); > return res; > } > if (nsHTMLEditUtils::IsListItem(leftParent) > || nsHTMLEditUtils::IsHeader(leftParent)) > { > // first delete the selection >- res = mHTMLEditor->DeleteSelectionImpl(aAction); >+ res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers); > NS_ENSURE_SUCCESS(res, res); > // join blocks > res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset); > NS_ENSURE_SUCCESS(res, res); > // fix up selection > res = aSelection->Collapse(selNode,selOffset); > return res; > } >diff --git a/editor/libeditor/html/nsHTMLEditRules.h b/editor/libeditor/html/nsHTMLEditRules.h >--- a/editor/libeditor/html/nsHTMLEditRules.h >+++ b/editor/libeditor/html/nsHTMLEditRules.h >@@ -149,16 +149,18 @@ protected: > PRInt32 aMaxLength); > nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel); > nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel, bool *aHandled); > nsresult StandardBreakImpl(nsIDOMNode *aNode, PRInt32 aOffset, nsISelection *aSelection); > nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult); > nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled); > nsresult WillDeleteSelection(nsISelection *aSelection, nsIEditor::EDirection aAction, > bool *aCancel, bool *aHandled); >+ nsresult WillDeleteSelection(nsISelection* aSelection, nsIEditor::EDirection aAction, >+ bool aStripWrappers, bool* aCancel, bool* aHandled); > nsresult DidDeleteSelection(nsISelection *aSelection, > nsIEditor::EDirection aDir, > nsresult aResult); > nsresult InsertBRIfNeeded(nsISelection *aSelection); > nsresult GetGoodSelPointForNode(nsIDOMNode *aNode, nsIEditor::EDirection aAction, > nsCOMPtr<nsIDOMNode> *outSelNode, PRInt32 *outSelOffset); > nsresult JoinBlocks(nsCOMPtr<nsIDOMNode> *aLeftBlock, nsCOMPtr<nsIDOMNode> *aRightBlock, bool *aCanceled); > nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, PRInt32 aLeftOffset, PRInt32 aRightOffset); >diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp >--- a/editor/libeditor/html/nsHTMLEditor.cpp >+++ b/editor/libeditor/html/nsHTMLEditor.cpp >@@ -1752,16 +1752,25 @@ nsHTMLEditor::InsertElementAtSelection(n > ruleInfo.insertElement = aElement; > res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); > if (cancel || (NS_FAILED(res))) return res; > > if (!handled) > { > if (aDeleteSelection) > { >+ if (!IsBlockNode(aElement)) { >+ // E.g., inserting an image. In this case we don't need to delete any >+ // inline wrappers before we do the insertion. Otherwise we let >+ // DeleteSelectionAndPrepareToCreateNode do the deletion for us, which >+ // calls DeleteSelection with aStripWrappers defaulting to true. >+ res = DeleteSelection(nsIEditor::eNone, /* aStripWrappers */ false); >+ NS_ENSURE_SUCCESS(res, res); >+ } >+ > nsCOMPtr<nsIDOMNode> tempNode; > PRInt32 tempOffset; > nsresult result = DeleteSelectionAndPrepareToCreateNode(tempNode,tempOffset); > NS_ENSURE_SUCCESS(result, result); > } > > // If deleting, selection will be collapsed. > // so if not, we collapse it >@@ -3449,16 +3458,67 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupp > iter->Next(); > } > > return rv; > } > > > NS_IMETHODIMP >+nsHTMLEditor::DeleteSelectionImpl(EDirection aAction, bool aStripWrappers) >+{ >+ nsresult res = nsEditor::DeleteSelectionImpl(aAction, aStripWrappers); >+ NS_ENSURE_SUCCESS(res, res); >+ >+ // If we weren't asked to strip any wrappers, we're done. >+ if (!aStripWrappers) { >+ return NS_OK; >+ } >+ >+ nsRefPtr<nsTypedSelection> typedSel = GetTypedSelection(); >+ NS_ENSURE_STATE(typedSel); >+ NS_ENSURE_STATE(typedSel->GetAnchorFocusRange()); >+ NS_ENSURE_STATE(typedSel->GetAnchorFocusRange()->Collapsed()); >+ >+ nsCOMPtr<nsIContent> content = do_QueryInterface(typedSel->GetAnchorNode()); >+ NS_ENSURE_STATE(content); >+ >+ // Don't strip wrappers if this is the only wrapper in the block. Then we'll >+ // add a <br> later, so it won't be an empty wrapper in the end. >+ nsCOMPtr<nsIContent> blockParent = content; >+ while (!IsBlockNode(blockParent)) { >+ blockParent = blockParent->GetParent(); >+ } >+ bool emptyBlockParent; >+ res = IsEmptyNode(blockParent, &emptyBlockParent); >+ NS_ENSURE_SUCCESS(res, res); >+ if (emptyBlockParent) { >+ return NS_OK; >+ } >+ >+ while (content && !IsBlockNode(content) && !content->Length() && >+ content->IsEditable() && content != content->GetEditingHost()) { >+ nsCOMPtr<nsIContent> parent = content->GetParent(); >+ res = DeleteNode(content); >+ NS_ENSURE_SUCCESS(res, res); >+ content = parent; >+ } >+ >+ return NS_OK; >+} >+ >+ >+nsresult >+nsHTMLEditor::DeleteNode(nsINode* aNode) >+{ >+ nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode); >+ return DeleteNode(node); >+} >+ >+NS_IMETHODIMP > nsHTMLEditor::DeleteNode(nsIDOMNode* aNode) > { > // do nothing if the node is read-only > nsCOMPtr<nsIContent> content = do_QueryInterface(aNode); > if (!IsModifiableNode(aNode) && !IsMozEditorBogusNode(content)) { > return NS_ERROR_FAILURE; > } > >diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h >--- a/editor/libeditor/html/nsHTMLEditor.h >+++ b/editor/libeditor/html/nsHTMLEditor.h >@@ -322,16 +322,18 @@ public: > const nsAString & aAttribute, > bool aSuppressTransaction); > > /** join together any afjacent editable text nodes in the range */ > NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange); > > virtual bool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2); > >+ NS_IMETHODIMP DeleteSelectionImpl(EDirection aAction, bool aStripWrappers); >+ nsresult DeleteNode(nsINode* aNode); > NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode); > NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode, > PRUint32 aOffset, > PRUint32 aLength); > NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, > nsCOMPtr<nsIDOMNode> *aInOutNode, > PRInt32 *aInOutOffset, > nsIDOMDocument *aDoc); >diff --git a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js b/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js >--- a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js >+++ b/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js >@@ -963,18 +963,16 @@ const knownFailures = { > "D-Proposed-CHAR-5_SR-body": true, > "D-Proposed-CHAR-5_SR-div": true, > "D-Proposed-CHAR-6_SC-dM": true, > "D-Proposed-CHAR-6_SC-body": true, > "D-Proposed-CHAR-6_SC-div": true, > "D-Proposed-CHAR-7_SC-dM": true, > "D-Proposed-CHAR-7_SC-body": true, > "D-Proposed-CHAR-7_SC-div": true, >- "D-Proposed-B-1_SW-dM": true, >- "D-Proposed-B-1_SW-body": true, > "D-Proposed-B-1_SW-div": true, > "D-Proposed-B-1_SL-dM": true, > "D-Proposed-B-1_SL-body": true, > "D-Proposed-B-1_SL-div": true, > "D-Proposed-B-1_SR-dM": true, > "D-Proposed-B-1_SR-body": true, > "D-Proposed-B-1_SR-div": true, > "D-Proposed-B.I-1_SM-dM": true, >diff --git a/editor/libeditor/html/tests/test_bug460740.html b/editor/libeditor/html/tests/test_bug460740.html >--- a/editor/libeditor/html/tests/test_bug460740.html >+++ b/editor/libeditor/html/tests/test_bug460740.html >@@ -103,21 +103,21 @@ function checkBR(element) { > } > > function runTests() { > var count = getBlockCount(); > var nodes = document.querySelectorAll("#content [contenteditable]"); > for (var i = 0; i < nodes.length; i++) { > var node = nodes[i]; > node.focus(); >- is(checkBR(node), 0, "This node should not have any <br> element yet."); >+ is(checkBR(node), 0, node.textContent.trim() + ": This node should not have any <br> element yet."); > for (var j = 0; j < 3; j++) { // CARET_BEGIN|MIDDLE|END > split(node, j); >- ok(checkBR(node) > 0, "Pressing [Return] should add (at least) one <br> element."); >- is(getBlockCount(), count, "Pressing [Return] should not change the number of non-<br> elements."); >+ ok(checkBR(node) > 0, node.textContent.trim() + " " + j + ": Pressing [Return] should add (at least) one <br> element."); >+ is(getBlockCount(), count, node.textContent.trim() + " " + j + ": Pressing [Return] should not change the number of non-<br> elements."); > document.execCommand("Undo", false, null); > } > } > SimpleTest.finish(); > } > </script> > </pre> > </body> >diff --git a/editor/libeditor/html/tests/test_bug668599.html b/editor/libeditor/html/tests/test_bug668599.html >--- a/editor/libeditor/html/tests/test_bug668599.html >+++ b/editor/libeditor/html/tests/test_bug668599.html >@@ -55,17 +55,17 @@ function runTests() { > span.focus(); > synthesizeKey("VK_DELETE", {}); > is(span.textContent, "", "The <span> content should have been deleted."); > > // <span> in editable block => the <span> *element* should be deleted > select(document.querySelector("#test2 span")); > document.querySelector("#test2 [contenteditable]").focus(); > synthesizeKey("VK_DELETE", {}); >- todo_is(document.querySelector("#test2 span"), null, >+ is(document.querySelector("#test2 span"), null, > "The <span> element should have been deleted."); > > // done > SimpleTest.finish(); > } > > </script> > </pre> >diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp >--- a/editor/libeditor/text/nsPlaintextEditor.cpp >+++ b/editor/libeditor/text/nsPlaintextEditor.cpp >@@ -734,17 +734,24 @@ nsPlaintextEditor::ExtendSelectionForDel > default: // avoid several compiler warnings > result = NS_OK; > break; > } > } > return result; > } > >-NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction) >+NS_IMETHODIMP >+nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction) { >+ return DeleteSelection(aAction, true); >+} >+ >+nsresult >+nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction, >+ bool aStripWrappers) > { > if (!mRules) { return NS_ERROR_NOT_INITIALIZED; } > > // Protect the edit rules object from dying > nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules); > > nsresult result; > >@@ -780,22 +787,23 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteS > else > { > aAction = eNone; > } > } > > nsTextRulesInfo ruleInfo(kOpDeleteSelection); > ruleInfo.collapsedAction = aAction; >+ ruleInfo.bStripWrappers = aStripWrappers; > bool cancel, handled; > result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); > NS_ENSURE_SUCCESS(result, result); > if (!cancel && !handled) > { >- result = DeleteSelectionImpl(aAction); >+ result = DeleteSelectionImpl(aAction, aStripWrappers); > } > if (!cancel) > { > // post-process > result = mRules->DidDoAction(selection, &ruleInfo, result); > } > > return result; >diff --git a/editor/libeditor/text/nsPlaintextEditor.h b/editor/libeditor/text/nsPlaintextEditor.h >--- a/editor/libeditor/text/nsPlaintextEditor.h >+++ b/editor/libeditor/text/nsPlaintextEditor.h >@@ -97,17 +97,19 @@ public: > bool aSuppressTransaction); > > /** prepare the editor for use */ > NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags); > > NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty); > NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable); > >- NS_IMETHOD DeleteSelection(EDirection aAction); >+ NS_IMETHOD DeleteSelection(EDirection aAction) MOZ_OVERRIDE; >+ nsresult DeleteSelection(EDirection aAction, >+ bool aStripWrappers) MOZ_OVERRIDE; > > NS_IMETHOD SetDocumentCharacterSet(const nsACString & characterSet); > > NS_IMETHOD Undo(PRUint32 aCount); > NS_IMETHOD Redo(PRUint32 aCount); > > NS_IMETHOD Cut(); > NS_IMETHOD CanCut(bool *aCanCut); >diff --git a/editor/libeditor/text/nsTextEditRules.h b/editor/libeditor/text/nsTextEditRules.h >--- a/editor/libeditor/text/nsTextEditRules.h >+++ b/editor/libeditor/text/nsTextEditRules.h >@@ -270,16 +270,17 @@ class nsTextRulesInfo : public nsRulesIn > > nsTextRulesInfo(nsEditor::OperationID aAction) : > nsRulesInfo(aAction), > inString(0), > outString(0), > outputFormat(0), > maxLength(-1), > collapsedAction(nsIEditor::eNext), >+ bStripWrappers(true), > bOrdered(false), > entireList(false), > bulletType(0), > alignType(0), > blockType(0), > insertElement(0) > {} > >@@ -288,16 +289,17 @@ class nsTextRulesInfo : public nsRulesIn > // kInsertText > const nsAString *inString; > nsAString *outString; > const nsAString *outputFormat; > PRInt32 maxLength; > > // kDeleteSelection > nsIEditor::EDirection collapsedAction; >+ bool bStripWrappers; > > // kMakeList > bool bOrdered; > bool entireList; > const nsAString *bulletType; > > // kAlign > const nsAString *alignType;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
|
Review
Attachments on
bug 590640
:
471667
|
504055
|
623485
|
623486
|
623487
|
623488
|
623489
|
623609
|
623610
|
624737
|
624810