Attachment #623489: Patch part 5, v1 -- Delete empty wrappers when we delete the selection for bug #590640

View | Details | Raw Unified | Return to bug 590640
Collapse All | Expand All

(-)a/dom/imptests/editing.json (-20 lines)
Line     Link Here 
 Lines 1948-1979    Link Here 
1948
    "[[\"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,
1948
    "[[\"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,
1949
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" compare innerHTML":true,
1949
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" compare innerHTML":true,
1950
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
1950
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
1951
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") before":true,
1951
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") before":true,
1952
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") before":true,
1952
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") before":true,
1953
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
1953
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
1954
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") after":true,
1954
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandState(\"defaultparagraphseparator\") after":true,
1955
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") after":true,
1955
    "[[\"stylewithcss\",\"false\"],[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p style=color:blue>foo<div style=color:brown><p style=color:green>[]bar\" queryCommandValue(\"defaultparagraphseparator\") after":true,
1956
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar]</span>baz\" compare innerHTML":true,
1957
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar]</span>baz\" compare innerHTML":true,
1958
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar}</span>baz\" compare innerHTML":true,
1959
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar}</span>baz\" compare innerHTML":true,
1960
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
1956
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
1961
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
1957
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>[foo<span style=color:#aBcDeF>bar]</span>baz\" compare innerHTML":true,
1962
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
1958
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
1963
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
1959
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>{foo<span style=color:#aBcDeF>bar}</span>baz\" compare innerHTML":true,
1964
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span>baz]\" compare innerHTML":true,
1965
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span>baz]\" compare innerHTML":true,
1966
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar</span>baz}\" compare innerHTML":true,
1967
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>{bar</span>baz}\" compare innerHTML":true,
1968
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
1960
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
1969
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
1961
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<p>foo<span style=color:#aBcDeF>[bar</span><span style=color:#fEdCbA>baz]</span>quz\" compare innerHTML":true,
1970
    "[[\"delete\",\"\"]] \"foo<span>[bar]</span>baz\" compare innerHTML":true,
1971
    "[[\"delete\",\"\"]] \"foo<span>{bar}</span>baz\" compare innerHTML":true,
1972
    "[[\"delete\",\"\"]] \"<p>foo</p><p>{bar</p>}<p>baz</p>\" compare innerHTML":true,
1962
    "[[\"delete\",\"\"]] \"<p>foo</p><p>{bar</p>}<p>baz</p>\" compare innerHTML":true,
1973
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
1963
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
1974
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
1964
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
1975
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") before":true,
1965
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") before":true,
1976
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
1966
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") before":true,
1977
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
1967
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
1978
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") after":true,
1968
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandState(\"defaultparagraphseparator\") after":true,
1979
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
1969
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<p>foo</p>{<p>bar}</p><p>baz</p>\" queryCommandValue(\"defaultparagraphseparator\") after":true,
 Lines 2052-2068    Link Here 
2052
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
2042
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
2053
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
2043
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
2054
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
2044
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
2055
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2045
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2056
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2046
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2057
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2047
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2058
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2048
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2059
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
2049
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
2060
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" checks for modifications to non-editable content":true,
2061
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
2050
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
2062
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
2051
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
2063
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2052
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2064
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2053
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2065
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2054
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2066
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2055
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2067
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
2056
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
2068
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
2057
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
 Lines 2383-2399    Link Here 
2383
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2372
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
2384
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2373
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
2385
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2374
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandState(\"defaultparagraphseparator\") after":true,
2386
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2375
    "[[\"defaultparagraphseparator\",\"p\"],[\"delete\",\"\"]] \"<p>fo[o<ol><li>bar<li>baz</ol><p>q]uz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
2387
    "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ol><li>b]ar</ol>\" compare innerHTML":true,
2376
    "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ol><li>b]ar</ol>\" compare innerHTML":true,
2388
    "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ul><li>b]ar</ul>\" compare innerHTML":true,
2377
    "[[\"delete\",\"\"]] \"<ol><li>fo[o</ol><ul><li>b]ar</ul>\" compare innerHTML":true,
2389
    "[[\"delete\",\"\"]] \"<b>foo [&nbsp;</b>bar]\" compare innerHTML":true,
2378
    "[[\"delete\",\"\"]] \"<b>foo [&nbsp;</b>bar]\" compare innerHTML":true,
2390
    "[[\"delete\",\"\"]] \"foo<b> [&nbsp;bar]</b>\" compare innerHTML":true,
2379
    "[[\"delete\",\"\"]] \"foo<b> [&nbsp;bar]</b>\" compare innerHTML":true,
2391
    "[[\"delete\",\"\"]] \"[foo<b>&nbsp;] bar</b>\" compare innerHTML":true,
2392
    "[[\"delete\",\"\"]] \"<p style=display:inline>fo[o<p style=display:inline>b]ar\" compare innerHTML":true,
2380
    "[[\"delete\",\"\"]] \"<p style=display:inline>fo[o<p style=display:inline>b]ar\" compare innerHTML":true,
2393
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true,
2381
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true,
2394
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true,
2382
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<span style=display:block>fo[o</span><span style=display:block>b]ar</span>\" compare innerHTML":true,
2395
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true,
2383
    "[[\"stylewithcss\",\"true\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true,
2396
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true,
2384
    "[[\"stylewithcss\",\"false\"],[\"delete\",\"\"]] \"<quasit style=display:block>fo[o</quasit><quasit style=display:block>b]ar</quasit>\" compare innerHTML":true,
2397
    "[[\"delete\",\"\"]] \"<ol><li>foo</ol>{}<br><ol><li>bar</ol>\" compare innerHTML":true,
2385
    "[[\"delete\",\"\"]] \"<ol><li>foo</ol>{}<br><ol><li>bar</ol>\" compare innerHTML":true,
2398
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
2386
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
2399
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\" compare innerHTML":true,
2387
    "[[\"defaultparagraphseparator\",\"div\"],[\"delete\",\"\"]] \"<ol><li>foo</ol><p>{}<br></p><ol><li>bar</ol>\" compare innerHTML":true,
 Lines 11117-11161    Link Here 
11117
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11105
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11118
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11106
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11119
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11107
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11120
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11108
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11121
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11109
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11122
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11110
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11123
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11111
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p><b>foo[bar</b><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11124
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11112
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11125
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true,
11126
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" compare innerHTML":true,
11127
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11113
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11128
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11114
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11129
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11115
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11130
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11116
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11131
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11117
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11132
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11118
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11133
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11119
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11134
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\": execCommand(\"insertimage\", false, \"/img/lion.svg\") return value":true,
11135
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" compare innerHTML":true,
11136
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11120
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11137
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11121
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") before":true,
11138
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11122
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11139
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11123
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11140
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11124
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandState(\"defaultparagraphseparator\") after":true,
11141
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11125
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<div><p>foo[bar</div><p>baz]quz\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11142
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11126
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11143
    "[[\"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,
11144
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" compare innerHTML":true,
11145
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11127
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11146
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true,
11128
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true,
11147
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11129
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11148
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11130
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11149
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true,
11131
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true,
11150
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11132
    "[[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11151
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11133
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\": execCommand(\"defaultparagraphseparator\", false, \"p\") return value":true,
11152
    "[[\"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,
11153
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" compare innerHTML":true,
11154
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11134
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") before":true,
11155
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true,
11135
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") before":true,
11156
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11136
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") before":true,
11157
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11137
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandIndeterm(\"defaultparagraphseparator\") after":true,
11158
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true,
11138
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandState(\"defaultparagraphseparator\") after":true,
11159
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11139
    "[[\"defaultparagraphseparator\",\"p\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<blockquote><p>baz]quz<p>qoz</blockquote\" queryCommandValue(\"defaultparagraphseparator\") after":true,
11160
    "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11140
    "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\": execCommand(\"defaultparagraphseparator\", false, \"div\") return value":true,
11161
    "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\" compare innerHTML":true,
11141
    "[[\"stylewithcss\",\"true\"],[\"defaultparagraphseparator\",\"div\"],[\"insertimage\",\"/img/lion.svg\"]] \"<p>foo[bar<p style=color:blue>baz]quz\" compare innerHTML":true,
(-)a/editor/libeditor/base/nsEditor.cpp (-1 / +24 lines)
Line     Link Here 
 Lines 616-644   nsEditor::GetSelectionController(nsISele Link Here 
616
616
617
617
618
NS_IMETHODIMP
618
NS_IMETHODIMP
619
nsEditor::DeleteSelection(EDirection aAction)
619
nsEditor::DeleteSelection(EDirection aAction)
620
{
620
{
621
  return DeleteSelectionImpl(aAction);
621
  return DeleteSelectionImpl(aAction);
622
}
622
}
623
623
624
nsresult
625
nsEditor::DeleteSelection(EDirection aAction, bool aStripWrappers)
626
{
627
  return DeleteSelectionImpl(aAction, aStripWrappers);
628
}
629
624
630
625
631
626
NS_IMETHODIMP
632
NS_IMETHODIMP
627
nsEditor::GetSelection(nsISelection **aSelection)
633
nsEditor::GetSelection(nsISelection **aSelection)
628
{
634
{
629
  NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
635
  NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
630
  *aSelection = nsnull;
636
  *aSelection = nsnull;
631
  nsCOMPtr<nsISelectionController> selcon;
637
  nsCOMPtr<nsISelectionController> selcon;
632
  GetSelectionController(getter_AddRefs(selcon));
638
  GetSelectionController(getter_AddRefs(selcon));
633
  NS_ENSURE_TRUE(selcon, NS_ERROR_NOT_INITIALIZED);
639
  NS_ENSURE_TRUE(selcon, NS_ERROR_NOT_INITIALIZED);
634
  return selcon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSelection);  // does an addref
640
  return selcon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSelection);  // does an addref
635
}
641
}
636
642
643
nsTypedSelection*
644
nsEditor::GetTypedSelection()
645
{
646
  nsCOMPtr<nsISelection> sel;
647
  nsresult res = GetSelection(getter_AddRefs(sel));
648
  NS_ENSURE_SUCCESS(res, nsnull);
649
650
  nsCOMPtr<nsISelectionPrivate> selPrivate = do_QueryInterface(sel);
651
  NS_ENSURE_TRUE(selPrivate, nsnull);
652
653
  nsRefPtr<nsFrameSelection> frameSel;
654
  res = selPrivate->GetFrameSelection(getter_AddRefs(frameSel));
655
  NS_ENSURE_SUCCESS(res, nsnull);
656
657
  return frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
658
}
659
637
NS_IMETHODIMP 
660
NS_IMETHODIMP 
638
nsEditor::DoTransaction(nsITransaction *aTxn)
661
nsEditor::DoTransaction(nsITransaction *aTxn)
639
{
662
{
640
#ifdef NS_DEBUG_EDITOR
663
#ifdef NS_DEBUG_EDITOR
641
  if (gNoisy) { printf("Editor::DoTransaction ----------\n"); }
664
  if (gNoisy) { printf("Editor::DoTransaction ----------\n"); }
642
#endif
665
#endif
643
666
644
  nsresult result = NS_OK;
667
  nsresult result = NS_OK;
 Lines 4296-4312   nsresult nsEditor::EndUpdateViewBatch() Link Here 
4296
bool 
4319
bool 
4297
nsEditor::GetShouldTxnSetSelection()
4320
nsEditor::GetShouldTxnSetSelection()
4298
{
4321
{
4299
  return mShouldTxnSetSelection;
4322
  return mShouldTxnSetSelection;
4300
}
4323
}
4301
4324
4302
4325
4303
NS_IMETHODIMP 
4326
NS_IMETHODIMP 
4304
nsEditor::DeleteSelectionImpl(nsIEditor::EDirection aAction)
4327
nsEditor::DeleteSelectionImpl(EDirection aAction, bool aStripWrappers)
4305
{
4328
{
4306
  nsCOMPtr<nsISelection>selection;
4329
  nsCOMPtr<nsISelection>selection;
4307
  nsresult res = GetSelection(getter_AddRefs(selection));
4330
  nsresult res = GetSelection(getter_AddRefs(selection));
4308
  NS_ENSURE_SUCCESS(res, res);
4331
  NS_ENSURE_SUCCESS(res, res);
4309
  nsRefPtr<EditAggregateTxn> txn;
4332
  nsRefPtr<EditAggregateTxn> txn;
4310
  nsCOMPtr<nsIDOMNode> deleteNode;
4333
  nsCOMPtr<nsIDOMNode> deleteNode;
4311
  PRInt32 deleteCharOffset = 0, deleteCharLength = 0;
4334
  PRInt32 deleteCharOffset = 0, deleteCharLength = 0;
4312
  res = CreateTxnForDeleteSelection(aAction, getter_AddRefs(txn),
4335
  res = CreateTxnForDeleteSelection(aAction, getter_AddRefs(txn),
(-)a/editor/libeditor/base/nsEditor.h (-1 / +6 lines)
Line     Link Here 
 Lines 45-60    Link Here 
45
#include "nsIEditor.h"
45
#include "nsIEditor.h"
46
#include "nsIPlaintextEditor.h"
46
#include "nsIPlaintextEditor.h"
47
#include "nsIEditorIMESupport.h"
47
#include "nsIEditorIMESupport.h"
48
#include "nsIPhonetic.h"
48
#include "nsIPhonetic.h"
49
49
50
#include "nsIAtom.h"
50
#include "nsIAtom.h"
51
#include "nsIDOMDocument.h"
51
#include "nsIDOMDocument.h"
52
#include "nsISelection.h"
52
#include "nsISelection.h"
53
#include "nsRange.h"
54
#include "nsTypedSelection.h"
53
#include "nsIDOMCharacterData.h"
55
#include "nsIDOMCharacterData.h"
54
#include "nsIPrivateTextRange.h"
56
#include "nsIPrivateTextRange.h"
55
#include "nsITransactionManager.h"
57
#include "nsITransactionManager.h"
56
#include "nsIComponentManager.h"
58
#include "nsIComponentManager.h"
57
#include "nsCOMArray.h"
59
#include "nsCOMArray.h"
58
#include "nsIEditActionListener.h"
60
#include "nsIEditActionListener.h"
59
#include "nsIEditorObserver.h"
61
#include "nsIEditorObserver.h"
60
#include "nsIDocumentStateListener.h"
62
#include "nsIDocumentStateListener.h"
 Lines 198-214   public: Link Here 
198
  NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, 
200
  NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, 
199
                               nsCOMPtr<nsIDOMNode> *aInOutNode, 
201
                               nsCOMPtr<nsIDOMNode> *aInOutNode, 
200
                               PRInt32 *aInOutOffset,
202
                               PRInt32 *aInOutOffset,
201
                               nsIDOMDocument *aDoc);
203
                               nsIDOMDocument *aDoc);
202
  nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert, 
204
  nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert, 
203
                                      nsIDOMCharacterData *aTextNode, 
205
                                      nsIDOMCharacterData *aTextNode, 
204
                                      PRInt32 aOffset,
206
                                      PRInt32 aOffset,
205
                                      bool aSuppressIME = false);
207
                                      bool aSuppressIME = false);
206
  NS_IMETHOD DeleteSelectionImpl(EDirection aAction);
208
  nsresult DeleteSelection(EDirection aAction, bool aStripWrappers);
209
  NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
210
                                 bool aStripWrappers = true);
207
  NS_IMETHOD DeleteSelectionAndCreateNode(const nsAString& aTag,
211
  NS_IMETHOD DeleteSelectionAndCreateNode(const nsAString& aTag,
208
                                           nsIDOMNode ** aNewNode);
212
                                           nsIDOMNode ** aNewNode);
209
213
210
  /* helper routines for node/parent manipulations */
214
  /* helper routines for node/parent manipulations */
211
  nsresult ReplaceContainer(nsIDOMNode *inNode, 
215
  nsresult ReplaceContainer(nsIDOMNode *inNode, 
212
                            nsCOMPtr<nsIDOMNode> *outNode, 
216
                            nsCOMPtr<nsIDOMNode> *outNode, 
213
                            const nsAString &aNodeType,
217
                            const nsAString &aNodeType,
214
                            const nsAString *aAttribute = nsnull,
218
                            const nsAString *aAttribute = nsnull,
 Lines 613-628   public: Link Here 
613
  static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset);
617
  static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, PRInt32 aOffset);
614
  static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, PRInt32 aOffset);
618
  static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, PRInt32 aOffset);
615
619
616
  static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, PRInt32 *outStartOffset);
620
  static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, PRInt32 *outStartOffset);
617
  static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, PRInt32 *outEndOffset);
621
  static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, PRInt32 *outEndOffset);
618
#if DEBUG_JOE
622
#if DEBUG_JOE
619
  static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0);
623
  static void DumpNode(nsIDOMNode *aNode, PRInt32 indent=0);
620
#endif
624
#endif
625
  nsTypedSelection* GetTypedSelection();
621
626
622
  // Helpers to add a node to the selection. 
627
  // Helpers to add a node to the selection. 
623
  // Used by table cell selection methods
628
  // Used by table cell selection methods
624
  nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset,
629
  nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset,
625
                       nsIDOMNode *aEndParent, PRInt32 aEndOffset,
630
                       nsIDOMNode *aEndParent, PRInt32 aEndOffset,
626
                       nsIDOMRange **aRange);
631
                       nsIDOMRange **aRange);
627
632
628
  // Creates a range with just the supplied node and appends that to the selection
633
  // Creates a range with just the supplied node and appends that to the selection
(-)a/editor/libeditor/html/nsHTMLEditRules.cpp (-8 / +23 lines)
Line     Link Here 
 Lines 611-627   nsHTMLEditRules::WillDoAction(nsISelecti Link Here 
611
                            info->inString,
611
                            info->inString,
612
                            info->outString,
612
                            info->outString,
613
                            info->maxLength);
613
                            info->maxLength);
614
    case nsEditor::kOpLoadHTML:
614
    case nsEditor::kOpLoadHTML:
615
      return WillLoadHTML(aSelection, aCancel);
615
      return WillLoadHTML(aSelection, aCancel);
616
    case nsEditor::kOpInsertBreak:
616
    case nsEditor::kOpInsertBreak:
617
      return WillInsertBreak(aSelection, aCancel, aHandled);
617
      return WillInsertBreak(aSelection, aCancel, aHandled);
618
    case nsEditor::kOpDeleteSelection:
618
    case nsEditor::kOpDeleteSelection:
619
      return WillDeleteSelection(aSelection, info->collapsedAction, aCancel, aHandled);
619
      return WillDeleteSelection(aSelection, info->collapsedAction,
620
                                 info->bStripWrappers, aCancel, aHandled);
620
    case nsEditor::kOpMakeList:
621
    case nsEditor::kOpMakeList:
621
      return WillMakeList(aSelection, info->blockType, info->entireList, info->bulletType, aCancel, aHandled);
622
      return WillMakeList(aSelection, info->blockType, info->entireList, info->bulletType, aCancel, aHandled);
622
    case nsEditor::kOpIndent:
623
    case nsEditor::kOpIndent:
623
      return WillIndent(aSelection, aCancel, aHandled);
624
      return WillIndent(aSelection, aCancel, aHandled);
624
    case nsEditor::kOpOutdent:
625
    case nsEditor::kOpOutdent:
625
      return WillOutdent(aSelection, aCancel, aHandled);
626
      return WillOutdent(aSelection, aCancel, aHandled);
626
    case nsEditor::kOpSetAbsolutePosition:
627
    case nsEditor::kOpSetAbsolutePosition:
627
      return WillAbsolutePosition(aSelection, aCancel, aHandled);
628
      return WillAbsolutePosition(aSelection, aCancel, aHandled);
 Lines 1819-1834   nsHTMLEditRules::SplitMailCites(nsISelec Link Here 
1819
1820
1820
1821
1821
nsresult
1822
nsresult
1822
nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, 
1823
nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection, 
1823
                                     nsIEditor::EDirection aAction, 
1824
                                     nsIEditor::EDirection aAction, 
1824
                                     bool *aCancel,
1825
                                     bool *aCancel,
1825
                                     bool *aHandled)
1826
                                     bool *aHandled)
1826
{
1827
{
1828
  return WillDeleteSelection(aSelection, aAction, true, aCancel, aHandled);
1829
}
1830
1831
nsresult
1832
nsHTMLEditRules::WillDeleteSelection(nsISelection* aSelection,
1833
                                     nsIEditor::EDirection aAction,
1834
                                     bool aStripWrappers,
1835
                                     bool* aCancel,
1836
                                     bool* aHandled)
1837
{
1827
1838
1828
  if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
1839
  if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
1829
  // initialize out param
1840
  // initialize out param
1830
  *aCancel = false;
1841
  *aCancel = false;
1831
  *aHandled = false;
1842
  *aHandled = false;
1832
1843
1833
  // remember that we did a selection deletion.  Used by CreateStyleForInsertText()
1844
  // remember that we did a selection deletion.  Used by CreateStyleForInsertText()
1834
  mDidDeleteSelection = true;
1845
  mDidDeleteSelection = true;
 Lines 1983-1999   nsHTMLEditRules::WillDeleteSelection(nsI Link Here 
1983
              (wsType==nsWSRunObject::eBreak)    ||
1994
              (wsType==nsWSRunObject::eBreak)    ||
1984
              nsHTMLEditUtils::IsHR(visNode) ) 
1995
              nsHTMLEditUtils::IsHR(visNode) ) 
1985
    {
1996
    {
1986
      // short circuit for invisible breaks.  delete them and recurse.
1997
      // short circuit for invisible breaks.  delete them and recurse.
1987
      if (nsTextEditUtils::IsBreak(visNode) && !mHTMLEditor->IsVisBreak(visNode))
1998
      if (nsTextEditUtils::IsBreak(visNode) && !mHTMLEditor->IsVisBreak(visNode))
1988
      {
1999
      {
1989
        res = mHTMLEditor->DeleteNode(visNode);
2000
        res = mHTMLEditor->DeleteNode(visNode);
1990
        NS_ENSURE_SUCCESS(res, res);
2001
        NS_ENSURE_SUCCESS(res, res);
1991
        return WillDeleteSelection(aSelection, aAction, aCancel, aHandled);
2002
        return WillDeleteSelection(aSelection, aAction, aStripWrappers,
2003
                                   aCancel, aHandled);
1992
      }
2004
      }
1993
      
2005
      
1994
      // special handling for backspace when positioned after <hr>
2006
      // special handling for backspace when positioned after <hr>
1995
      if (aAction == nsIEditor::ePrevious && nsHTMLEditUtils::IsHR(visNode))
2007
      if (aAction == nsIEditor::ePrevious && nsHTMLEditUtils::IsHR(visNode))
1996
      {
2008
      {
1997
        /*
2009
        /*
1998
          Only if the caret is positioned at the end-of-hr-line position,
2010
          Only if the caret is positioned at the end-of-hr-line position,
1999
          we want to delete the <hr>.
2011
          we want to delete the <hr>.
 Lines 2287-2310   nsHTMLEditRules::WillDeleteSelection(nsI Link Here 
2287
    nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
2299
    nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
2288
    res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor,
2300
    res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor,
2289
                                            address_of(startNode), &startOffset, 
2301
                                            address_of(startNode), &startOffset, 
2290
                                            address_of(endNode), &endOffset);
2302
                                            address_of(endNode), &endOffset);
2291
    NS_ENSURE_SUCCESS(res, res); 
2303
    NS_ENSURE_SUCCESS(res, res); 
2292
  }
2304
  }
2293
  
2305
  
2294
  {
2306
  {
2295
    // track end location of where we are deleting
2307
    // track location of where we are deleting
2296
    nsAutoTrackDOMPoint tracker(mHTMLEditor->mRangeUpdater, address_of(endNode), &endOffset);
2308
    nsAutoTrackDOMPoint startTracker(mHTMLEditor->mRangeUpdater,
2309
                                     address_of(startNode), &startOffset);
2310
    nsAutoTrackDOMPoint endTracker(mHTMLEditor->mRangeUpdater,
2311
                                   address_of(endNode), &endOffset);
2297
    // we are handling all ranged deletions directly now.
2312
    // we are handling all ranged deletions directly now.
2298
    *aHandled = true;
2313
    *aHandled = true;
2299
    
2314
    
2300
    if (endNode == startNode)
2315
    if (endNode == startNode)
2301
    {
2316
    {
2302
      res = mHTMLEditor->DeleteSelectionImpl(aAction);
2317
      res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
2303
      NS_ENSURE_SUCCESS(res, res); 
2318
      NS_ENSURE_SUCCESS(res, res); 
2304
    }
2319
    }
2305
    else
2320
    else
2306
    {
2321
    {
2307
      // figure out mailcite ancestors
2322
      // figure out mailcite ancestors
2308
      nsCOMPtr<nsIDOMNode> endCiteNode, startCiteNode;
2323
      nsCOMPtr<nsIDOMNode> endCiteNode, startCiteNode;
2309
      res = GetTopEnclosingMailCite(startNode, address_of(startCiteNode), 
2324
      res = GetTopEnclosingMailCite(startNode, address_of(startCiteNode), 
2310
                                    IsPlaintextEditor());
2325
                                    IsPlaintextEditor());
 Lines 2334-2350   nsHTMLEditRules::WillDeleteSelection(nsI Link Here 
2334
      if (IsBlockNode(endNode))
2349
      if (IsBlockNode(endNode))
2335
        rightParent = endNode;
2350
        rightParent = endNode;
2336
      else
2351
      else
2337
        rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
2352
        rightParent = mHTMLEditor->GetBlockNodeParent(endNode);
2338
        
2353
        
2339
      // are endpoint block parents the same?  use default deletion
2354
      // are endpoint block parents the same?  use default deletion
2340
      if (leftParent == rightParent) 
2355
      if (leftParent == rightParent) 
2341
      {
2356
      {
2342
        res = mHTMLEditor->DeleteSelectionImpl(aAction);
2357
        res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
2343
      }
2358
      }
2344
      else
2359
      else
2345
      {
2360
      {
2346
        // deleting across blocks
2361
        // deleting across blocks
2347
        // are the blocks of same type?
2362
        // are the blocks of same type?
2348
        NS_ENSURE_STATE(leftParent && rightParent);
2363
        NS_ENSURE_STATE(leftParent && rightParent);
2349
        
2364
        
2350
        // are the blocks siblings?
2365
        // are the blocks siblings?
 Lines 2355-2384   nsHTMLEditRules::WillDeleteSelection(nsI Link Here 
2355
2370
2356
        // MOOSE: this could conceivably screw up a table.. fix me.
2371
        // MOOSE: this could conceivably screw up a table.. fix me.
2357
        if (   (leftBlockParent == rightBlockParent)
2372
        if (   (leftBlockParent == rightBlockParent)
2358
            && (mHTMLEditor->NodesSameType(leftParent, rightParent))  )
2373
            && (mHTMLEditor->NodesSameType(leftParent, rightParent))  )
2359
        {
2374
        {
2360
          if (nsHTMLEditUtils::IsParagraph(leftParent))
2375
          if (nsHTMLEditUtils::IsParagraph(leftParent))
2361
          {
2376
          {
2362
            // first delete the selection
2377
            // first delete the selection
2363
            res = mHTMLEditor->DeleteSelectionImpl(aAction);
2378
            res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
2364
            NS_ENSURE_SUCCESS(res, res);
2379
            NS_ENSURE_SUCCESS(res, res);
2365
            // then join para's, insert break
2380
            // then join para's, insert break
2366
            res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset);
2381
            res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset);
2367
            NS_ENSURE_SUCCESS(res, res);
2382
            NS_ENSURE_SUCCESS(res, res);
2368
            // fix up selection
2383
            // fix up selection
2369
            res = aSelection->Collapse(selNode,selOffset);
2384
            res = aSelection->Collapse(selNode,selOffset);
2370
            return res;
2385
            return res;
2371
          }
2386
          }
2372
          if (nsHTMLEditUtils::IsListItem(leftParent)
2387
          if (nsHTMLEditUtils::IsListItem(leftParent)
2373
              || nsHTMLEditUtils::IsHeader(leftParent))
2388
              || nsHTMLEditUtils::IsHeader(leftParent))
2374
          {
2389
          {
2375
            // first delete the selection
2390
            // first delete the selection
2376
            res = mHTMLEditor->DeleteSelectionImpl(aAction);
2391
            res = mHTMLEditor->DeleteSelectionImpl(aAction, aStripWrappers);
2377
            NS_ENSURE_SUCCESS(res, res);
2392
            NS_ENSURE_SUCCESS(res, res);
2378
            // join blocks
2393
            // join blocks
2379
            res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset);
2394
            res = mHTMLEditor->JoinNodeDeep(leftParent,rightParent,address_of(selNode),&selOffset);
2380
            NS_ENSURE_SUCCESS(res, res);
2395
            NS_ENSURE_SUCCESS(res, res);
2381
            // fix up selection
2396
            // fix up selection
2382
            res = aSelection->Collapse(selNode,selOffset);
2397
            res = aSelection->Collapse(selNode,selOffset);
2383
            return res;
2398
            return res;
2384
          }
2399
          }
(-)a/editor/libeditor/html/nsHTMLEditRules.h (+2 lines)
Line     Link Here 
 Lines 149-164   protected: Link Here 
149
                            PRInt32          aMaxLength);
149
                            PRInt32          aMaxLength);
150
  nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
150
  nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
151
  nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel, bool *aHandled);
151
  nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel, bool *aHandled);
152
  nsresult StandardBreakImpl(nsIDOMNode *aNode, PRInt32 aOffset, nsISelection *aSelection);
152
  nsresult StandardBreakImpl(nsIDOMNode *aNode, PRInt32 aOffset, nsISelection *aSelection);
153
  nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
153
  nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
154
  nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled);
154
  nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled);
155
  nsresult WillDeleteSelection(nsISelection *aSelection, nsIEditor::EDirection aAction, 
155
  nsresult WillDeleteSelection(nsISelection *aSelection, nsIEditor::EDirection aAction, 
156
                               bool *aCancel, bool *aHandled);
156
                               bool *aCancel, bool *aHandled);
157
  nsresult WillDeleteSelection(nsISelection* aSelection, nsIEditor::EDirection aAction,
158
                               bool aStripWrappers, bool* aCancel, bool* aHandled);
157
  nsresult DidDeleteSelection(nsISelection *aSelection, 
159
  nsresult DidDeleteSelection(nsISelection *aSelection, 
158
                              nsIEditor::EDirection aDir, 
160
                              nsIEditor::EDirection aDir, 
159
                              nsresult aResult);
161
                              nsresult aResult);
160
  nsresult InsertBRIfNeeded(nsISelection *aSelection);
162
  nsresult InsertBRIfNeeded(nsISelection *aSelection);
161
  nsresult GetGoodSelPointForNode(nsIDOMNode *aNode, nsIEditor::EDirection aAction, 
163
  nsresult GetGoodSelPointForNode(nsIDOMNode *aNode, nsIEditor::EDirection aAction, 
162
                                  nsCOMPtr<nsIDOMNode> *outSelNode, PRInt32 *outSelOffset);
164
                                  nsCOMPtr<nsIDOMNode> *outSelNode, PRInt32 *outSelOffset);
163
  nsresult JoinBlocks(nsCOMPtr<nsIDOMNode> *aLeftBlock, nsCOMPtr<nsIDOMNode> *aRightBlock, bool *aCanceled);
165
  nsresult JoinBlocks(nsCOMPtr<nsIDOMNode> *aLeftBlock, nsCOMPtr<nsIDOMNode> *aRightBlock, bool *aCanceled);
164
  nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, PRInt32 aLeftOffset, PRInt32 aRightOffset);
166
  nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, PRInt32 aLeftOffset, PRInt32 aRightOffset);
(-)a/editor/libeditor/html/nsHTMLEditor.cpp (+60 lines)
Line     Link Here 
 Lines 1752-1767   nsHTMLEditor::InsertElementAtSelection(n Link Here 
1752
  ruleInfo.insertElement = aElement;
1752
  ruleInfo.insertElement = aElement;
1753
  res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
1753
  res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
1754
  if (cancel || (NS_FAILED(res))) return res;
1754
  if (cancel || (NS_FAILED(res))) return res;
1755
1755
1756
  if (!handled)
1756
  if (!handled)
1757
  {
1757
  {
1758
    if (aDeleteSelection)
1758
    if (aDeleteSelection)
1759
    {
1759
    {
1760
      if (!IsBlockNode(aElement)) {
1761
        // E.g., inserting an image.  In this case we don't need to delete any
1762
        // inline wrappers before we do the insertion.  Otherwise we let
1763
        // DeleteSelectionAndPrepareToCreateNode do the deletion for us, which
1764
        // calls DeleteSelection with aStripWrappers defaulting to true.
1765
        res = DeleteSelection(nsIEditor::eNone, /* aStripWrappers */ false);
1766
        NS_ENSURE_SUCCESS(res, res);
1767
      }
1768
1760
      nsCOMPtr<nsIDOMNode> tempNode;
1769
      nsCOMPtr<nsIDOMNode> tempNode;
1761
      PRInt32 tempOffset;
1770
      PRInt32 tempOffset;
1762
      nsresult result = DeleteSelectionAndPrepareToCreateNode(tempNode,tempOffset);
1771
      nsresult result = DeleteSelectionAndPrepareToCreateNode(tempNode,tempOffset);
1763
      NS_ENSURE_SUCCESS(result, result);
1772
      NS_ENSURE_SUCCESS(result, result);
1764
    }
1773
    }
1765
1774
1766
    // If deleting, selection will be collapsed.
1775
    // If deleting, selection will be collapsed.
1767
    // so if not, we collapse it
1776
    // so if not, we collapse it
 Lines 3449-3464   nsHTMLEditor::GetEmbeddedObjects(nsISupp Link Here 
3449
    iter->Next();
3458
    iter->Next();
3450
  }
3459
  }
3451
3460
3452
  return rv;
3461
  return rv;
3453
}
3462
}
3454
3463
3455
3464
3456
NS_IMETHODIMP
3465
NS_IMETHODIMP
3466
nsHTMLEditor::DeleteSelectionImpl(EDirection aAction, bool aStripWrappers)
3467
{
3468
  nsresult res = nsEditor::DeleteSelectionImpl(aAction, aStripWrappers);
3469
  NS_ENSURE_SUCCESS(res, res);
3470
3471
  // If we weren't asked to strip any wrappers, we're done.
3472
  if (!aStripWrappers) {
3473
    return NS_OK;
3474
  }
3475
3476
  nsRefPtr<nsTypedSelection> typedSel = GetTypedSelection();
3477
  NS_ENSURE_STATE(typedSel);
3478
  NS_ENSURE_STATE(typedSel->GetAnchorFocusRange());
3479
  NS_ENSURE_STATE(typedSel->GetAnchorFocusRange()->Collapsed());
3480
3481
  nsCOMPtr<nsIContent> content = do_QueryInterface(typedSel->GetAnchorNode());
3482
  NS_ENSURE_STATE(content);
3483
3484
  // Don't strip wrappers if this is the only wrapper in the block.  Then we'll
3485
  // add a <br> later, so it won't be an empty wrapper in the end.
3486
  nsCOMPtr<nsIContent> blockParent = content;
3487
  while (!IsBlockNode(blockParent)) {
3488
    blockParent = blockParent->GetParent();
3489
  }
3490
  bool emptyBlockParent;
3491
  res = IsEmptyNode(blockParent, &emptyBlockParent);
3492
  NS_ENSURE_SUCCESS(res, res);
3493
  if (emptyBlockParent) {
3494
    return NS_OK;
3495
  }
3496
3497
  while (content && !IsBlockNode(content) && !content->Length() &&
3498
         content->IsEditable() && content != content->GetEditingHost()) {
3499
    nsCOMPtr<nsIContent> parent = content->GetParent();
3500
    res = DeleteNode(content);
3501
    NS_ENSURE_SUCCESS(res, res);
3502
    content = parent;
3503
  }
3504
3505
  return NS_OK;
3506
}
3507
3508
3509
nsresult
3510
nsHTMLEditor::DeleteNode(nsINode* aNode)
3511
{
3512
  nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
3513
  return DeleteNode(node);
3514
}
3515
3516
NS_IMETHODIMP
3457
nsHTMLEditor::DeleteNode(nsIDOMNode* aNode)
3517
nsHTMLEditor::DeleteNode(nsIDOMNode* aNode)
3458
{
3518
{
3459
  // do nothing if the node is read-only
3519
  // do nothing if the node is read-only
3460
  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
3520
  nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
3461
  if (!IsModifiableNode(aNode) && !IsMozEditorBogusNode(content)) {
3521
  if (!IsModifiableNode(aNode) && !IsMozEditorBogusNode(content)) {
3462
    return NS_ERROR_FAILURE;
3522
    return NS_ERROR_FAILURE;
3463
  }
3523
  }
3464
3524
(-)a/editor/libeditor/html/nsHTMLEditor.h (+2 lines)
Line     Link Here 
 Lines 322-337   public: Link Here 
322
                                         const nsAString & aAttribute,
322
                                         const nsAString & aAttribute,
323
                                         bool aSuppressTransaction);
323
                                         bool aSuppressTransaction);
324
324
325
  /** join together any afjacent editable text nodes in the range */
325
  /** join together any afjacent editable text nodes in the range */
326
  NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
326
  NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
327
327
328
  virtual bool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
328
  virtual bool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
329
329
330
  NS_IMETHODIMP DeleteSelectionImpl(EDirection aAction, bool aStripWrappers);
331
  nsresult DeleteNode(nsINode* aNode);
330
  NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
332
  NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
331
  NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
333
  NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
332
                           PRUint32             aOffset,
334
                           PRUint32             aOffset,
333
                           PRUint32             aLength);
335
                           PRUint32             aLength);
334
  NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, 
336
  NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, 
335
                            nsCOMPtr<nsIDOMNode> *aInOutNode, 
337
                            nsCOMPtr<nsIDOMNode> *aInOutNode, 
336
                            PRInt32 *aInOutOffset,
338
                            PRInt32 *aInOutOffset,
337
                            nsIDOMDocument *aDoc);
339
                            nsIDOMDocument *aDoc);
(-)a/editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js (-2 lines)
Line     Link Here 
 Lines 963-980   const knownFailures = { Link Here 
963
    "D-Proposed-CHAR-5_SR-body": true,
963
    "D-Proposed-CHAR-5_SR-body": true,
964
    "D-Proposed-CHAR-5_SR-div": true,
964
    "D-Proposed-CHAR-5_SR-div": true,
965
    "D-Proposed-CHAR-6_SC-dM": true,
965
    "D-Proposed-CHAR-6_SC-dM": true,
966
    "D-Proposed-CHAR-6_SC-body": true,
966
    "D-Proposed-CHAR-6_SC-body": true,
967
    "D-Proposed-CHAR-6_SC-div": true,
967
    "D-Proposed-CHAR-6_SC-div": true,
968
    "D-Proposed-CHAR-7_SC-dM": true,
968
    "D-Proposed-CHAR-7_SC-dM": true,
969
    "D-Proposed-CHAR-7_SC-body": true,
969
    "D-Proposed-CHAR-7_SC-body": true,
970
    "D-Proposed-CHAR-7_SC-div": true,
970
    "D-Proposed-CHAR-7_SC-div": true,
971
    "D-Proposed-B-1_SW-dM": true,
972
    "D-Proposed-B-1_SW-body": true,
973
    "D-Proposed-B-1_SW-div": true,
971
    "D-Proposed-B-1_SW-div": true,
974
    "D-Proposed-B-1_SL-dM": true,
972
    "D-Proposed-B-1_SL-dM": true,
975
    "D-Proposed-B-1_SL-body": true,
973
    "D-Proposed-B-1_SL-body": true,
976
    "D-Proposed-B-1_SL-div": true,
974
    "D-Proposed-B-1_SL-div": true,
977
    "D-Proposed-B-1_SR-dM": true,
975
    "D-Proposed-B-1_SR-dM": true,
978
    "D-Proposed-B-1_SR-body": true,
976
    "D-Proposed-B-1_SR-body": true,
979
    "D-Proposed-B-1_SR-div": true,
977
    "D-Proposed-B-1_SR-div": true,
980
    "D-Proposed-B.I-1_SM-dM": true,
978
    "D-Proposed-B.I-1_SM-dM": true,
(-)a/editor/libeditor/html/tests/test_bug460740.html (-3 / +3 lines)
Line     Link Here 
 Lines 103-123   function checkBR(element) { Link Here 
103
}
103
}
104
104
105
function runTests() {
105
function runTests() {
106
  var count = getBlockCount();
106
  var count = getBlockCount();
107
  var nodes = document.querySelectorAll("#content [contenteditable]");
107
  var nodes = document.querySelectorAll("#content [contenteditable]");
108
  for (var i = 0; i < nodes.length; i++) {
108
  for (var i = 0; i < nodes.length; i++) {
109
    var node = nodes[i];
109
    var node = nodes[i];
110
    node.focus();
110
    node.focus();
111
    is(checkBR(node), 0, "This node should not have any <br> element yet.");
111
    is(checkBR(node), 0, node.textContent.trim() + ": This node should not have any <br> element yet.");
112
    for (var j = 0; j < 3; j++) { // CARET_BEGIN|MIDDLE|END
112
    for (var j = 0; j < 3; j++) { // CARET_BEGIN|MIDDLE|END
113
      split(node, j);
113
      split(node, j);
114
      ok(checkBR(node) > 0, "Pressing [Return] should add (at least) one <br> element.");
114
      ok(checkBR(node) > 0, node.textContent.trim() + " " + j + ": Pressing [Return] should add (at least) one <br> element.");
115
      is(getBlockCount(), count, "Pressing [Return] should not change the number of non-<br> elements.");
115
      is(getBlockCount(), count, node.textContent.trim() + " " + j + ": Pressing [Return] should not change the number of non-<br> elements.");
116
      document.execCommand("Undo", false, null);
116
      document.execCommand("Undo", false, null);
117
    }
117
    }
118
  }
118
  }
119
  SimpleTest.finish();
119
  SimpleTest.finish();
120
}
120
}
121
</script>
121
</script>
122
</pre>
122
</pre>
123
</body>
123
</body>
(-)a/editor/libeditor/html/tests/test_bug668599.html (-1 / +1 lines)
Line     Link Here 
 Lines 55-71   function runTests() { Link Here 
55
  span.focus();
55
  span.focus();
56
  synthesizeKey("VK_DELETE", {});
56
  synthesizeKey("VK_DELETE", {});
57
  is(span.textContent, "", "The <span> content should have been deleted.");
57
  is(span.textContent, "", "The <span> content should have been deleted.");
58
58
59
  // <span> in editable block => the <span> *element* should be deleted
59
  // <span> in editable block => the <span> *element* should be deleted
60
  select(document.querySelector("#test2 span"));
60
  select(document.querySelector("#test2 span"));
61
  document.querySelector("#test2 [contenteditable]").focus();
61
  document.querySelector("#test2 [contenteditable]").focus();
62
  synthesizeKey("VK_DELETE", {});
62
  synthesizeKey("VK_DELETE", {});
63
  todo_is(document.querySelector("#test2 span"), null,
63
  is(document.querySelector("#test2 span"), null,
64
    "The <span> element should have been deleted.");
64
    "The <span> element should have been deleted.");
65
65
66
  // done
66
  // done
67
  SimpleTest.finish();
67
  SimpleTest.finish();
68
}
68
}
69
69
70
</script>
70
</script>
71
</pre>
71
</pre>
(-)a/editor/libeditor/text/nsPlaintextEditor.cpp (-2 / +10 lines)
Line     Link Here 
 Lines 734-750   nsPlaintextEditor::ExtendSelectionForDel Link Here 
734
      default:       // avoid several compiler warnings
734
      default:       // avoid several compiler warnings
735
        result = NS_OK;
735
        result = NS_OK;
736
        break;
736
        break;
737
    }
737
    }
738
  }
738
  }
739
  return result;
739
  return result;
740
}
740
}
741
741
742
NS_IMETHODIMP nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction)
742
NS_IMETHODIMP
743
nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction) {
744
  return DeleteSelection(aAction, true);
745
}
746
747
nsresult
748
nsPlaintextEditor::DeleteSelection(nsIEditor::EDirection aAction,
749
                                   bool aStripWrappers)
743
{
750
{
744
  if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
751
  if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
745
752
746
  // Protect the edit rules object from dying
753
  // Protect the edit rules object from dying
747
  nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
754
  nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
748
755
749
  nsresult result;
756
  nsresult result;
750
757
 Lines 780-801   NS_IMETHODIMP nsPlaintextEditor::DeleteS Link Here 
780
    else
787
    else
781
    { 
788
    { 
782
      aAction = eNone;
789
      aAction = eNone;
783
    }
790
    }
784
  }
791
  }
785
792
786
  nsTextRulesInfo ruleInfo(kOpDeleteSelection);
793
  nsTextRulesInfo ruleInfo(kOpDeleteSelection);
787
  ruleInfo.collapsedAction = aAction;
794
  ruleInfo.collapsedAction = aAction;
795
  ruleInfo.bStripWrappers = aStripWrappers;
788
  bool cancel, handled;
796
  bool cancel, handled;
789
  result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
797
  result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
790
  NS_ENSURE_SUCCESS(result, result);
798
  NS_ENSURE_SUCCESS(result, result);
791
  if (!cancel && !handled)
799
  if (!cancel && !handled)
792
  {
800
  {
793
    result = DeleteSelectionImpl(aAction);
801
    result = DeleteSelectionImpl(aAction, aStripWrappers);
794
  }
802
  }
795
  if (!cancel)
803
  if (!cancel)
796
  {
804
  {
797
    // post-process 
805
    // post-process 
798
    result = mRules->DidDoAction(selection, &ruleInfo, result);
806
    result = mRules->DidDoAction(selection, &ruleInfo, result);
799
  }
807
  }
800
808
801
  return result;
809
  return result;
(-)a/editor/libeditor/text/nsPlaintextEditor.h (-1 / +3 lines)
Line     Link Here 
 Lines 97-113   public: Link Here 
97
                                         bool aSuppressTransaction);
97
                                         bool aSuppressTransaction);
98
98
99
  /** prepare the editor for use */
99
  /** prepare the editor for use */
100
  NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
100
  NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
101
  
101
  
102
  NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty);
102
  NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty);
103
  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
103
  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
104
104
105
  NS_IMETHOD DeleteSelection(EDirection aAction);
105
  NS_IMETHOD DeleteSelection(EDirection aAction) MOZ_OVERRIDE;
106
  nsresult DeleteSelection(EDirection aAction,
107
                           bool aStripWrappers) MOZ_OVERRIDE;
106
108
107
  NS_IMETHOD SetDocumentCharacterSet(const nsACString & characterSet);
109
  NS_IMETHOD SetDocumentCharacterSet(const nsACString & characterSet);
108
110
109
  NS_IMETHOD Undo(PRUint32 aCount);
111
  NS_IMETHOD Undo(PRUint32 aCount);
110
  NS_IMETHOD Redo(PRUint32 aCount);
112
  NS_IMETHOD Redo(PRUint32 aCount);
111
113
112
  NS_IMETHOD Cut();
114
  NS_IMETHOD Cut();
113
  NS_IMETHOD CanCut(bool *aCanCut);
115
  NS_IMETHOD CanCut(bool *aCanCut);
(-)a/editor/libeditor/text/nsTextEditRules.h (+2 lines)
Line     Link Here 
 Lines 270-285   class nsTextRulesInfo : public nsRulesIn Link Here 
270
 
270
 
271
  nsTextRulesInfo(nsEditor::OperationID aAction) :
271
  nsTextRulesInfo(nsEditor::OperationID aAction) :
272
    nsRulesInfo(aAction),
272
    nsRulesInfo(aAction),
273
    inString(0),
273
    inString(0),
274
    outString(0),
274
    outString(0),
275
    outputFormat(0),
275
    outputFormat(0),
276
    maxLength(-1),
276
    maxLength(-1),
277
    collapsedAction(nsIEditor::eNext),
277
    collapsedAction(nsIEditor::eNext),
278
    bStripWrappers(true),
278
    bOrdered(false),
279
    bOrdered(false),
279
    entireList(false),
280
    entireList(false),
280
    bulletType(0),
281
    bulletType(0),
281
    alignType(0),
282
    alignType(0),
282
    blockType(0),
283
    blockType(0),
283
    insertElement(0)
284
    insertElement(0)
284
    {}
285
    {}
285
286
 Lines 288-303   class nsTextRulesInfo : public nsRulesIn Link Here 
288
  // kInsertText
289
  // kInsertText
289
  const nsAString *inString;
290
  const nsAString *inString;
290
  nsAString *outString;
291
  nsAString *outString;
291
  const nsAString *outputFormat;
292
  const nsAString *outputFormat;
292
  PRInt32 maxLength;
293
  PRInt32 maxLength;
293
  
294
  
294
  // kDeleteSelection
295
  // kDeleteSelection
295
  nsIEditor::EDirection collapsedAction;
296
  nsIEditor::EDirection collapsedAction;
297
  bool bStripWrappers;
296
  
298
  
297
  // kMakeList
299
  // kMakeList
298
  bool bOrdered;
300
  bool bOrdered;
299
  bool entireList;
301
  bool entireList;
300
  const nsAString *bulletType;
302
  const nsAString *bulletType;
301
303
302
  // kAlign
304
  // kAlign
303
  const nsAString *alignType;
305
  const nsAString *alignType;

Return to bug 590640