+2006-06-27 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ * editing/execCommand/remove-formatting-expected.checksum: Added.
+ * editing/execCommand/remove-formatting-expected.png: Added.
+ * editing/execCommand/remove-formatting-expected.txt: Added.
+ * editing/execCommand/remove-formatting.html: Added.
+
2006-06-27 Justin Garcia <justin.garcia@apple.com>
Reviewed by levi
--- /dev/null
+0b20b5f332955ebe0fda257b29b3c264
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 13 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > B > DIV > BODY > HTML > #document to 3 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 321x18
+ text run at (0,0) width 321: "This is a test for execCommand(\"RemoveFormat\")"
+ RenderBlock {DIV} at (0,34) size 784x54
+ RenderBlock {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 63x18
+ text run at (0,0) width 63: "foobarbaz"
+ RenderBlock {DIV} at (0,18) size 784x18
+ RenderText {#text} at (0,0) size 21x18
+ text run at (0,0) width 21: "foo"
+ RenderInline {SPAN} at (0,0) size 11x18
+ RenderText {#text} at (21,0) size 11x18
+ text run at (21,0) width 11: "\x{9}"
+ RenderText {#text} at (32,0) size 20x18
+ text run at (32,0) width 20: "bar"
+ RenderInline {SPAN} at (0,0) size 12x18
+ RenderText {#text} at (52,0) size 12x18
+ text run at (52,0) width 12: "\x{9}"
+ RenderText {#text} at (64,0) size 22x18
+ text run at (64,0) width 22: "baz"
+ RenderBlock {DIV} at (0,36) size 784x18
+ RenderText {#text} at (0,0) size 63x18
+ text run at (0,0) width 63: "foobarbaz"
+ RenderBlock (anonymous) at (0,54) size 784x0
+ RenderBlock {UL} at (0,104) size 784x0
+caret: position 9 of child 0 {#text} of child 2 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This is a test for execCommand("RemoveFormat")</p>
+<div id="test" contenteditable="true">
+<b>foo</b><a href="http://www.google.com/">bar</a><i>baz</i><br>
+<table border="1"><tr><td>foo</td><td>bar</td><td>baz</td></tr></table>
+<u>foo</u>bar<span style="text-decoration:line-through">baz</span><br>
+</div>
+<ul id="console"></ul>
+<script>
+function log(message) {
+ var console = document.getElementById("console");
+ var li = document.createElement("li");
+ var text = document.createTextNode(message);
+
+ console.appendChild(li);
+ li.appendChild(text);
+}
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+if (document.queryCommandEnabled("RemoveFormat"))
+ log("Failure: RemoveFormat enabled with no selection");
+s.setPosition(e, 0);
+if (document.queryCommandEnabled("RemoveFormat"))
+ log("Failure: RemoveFormat enabled with a caret selection");
+document.execCommand("SelectAll");
+if (!document.queryCommandEnabled("RemoveFormat"))
+ log("Failure: RemoveFormat disabled with a selection");
+if (!document.execCommand("RemoveFormat"))
+ log("Failure: execCommand('RemoveFormat') returned");
+</script>
\ No newline at end of file
+2006-06-27 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by levi
+
+ * editing/JSEditor.cpp: Added RemoveFormat.
+
2006-06-27 Kevin Decker <kdecker@apple.com>
Reviewed by brady.
return true;
}
+bool execRemoveFormat(Frame* frame, bool userInterface, const String& value)
+{
+ RefPtr<DocumentFragment> fragment = createFragmentFromText(frame->document(), frame->selection().toString().deprecatedString());
+ EditCommandPtr(new ReplaceSelectionCommand(frame->document(), fragment.get(), false)).apply();
+ return true;
+}
+
bool execSelectAll(Frame *frame, bool userInterface, const String &value)
{
frame->selectAll();
{ "PasteAndMatchStyle", { execPasteAndMatchStyle, enabledPasteAndMatchStyle, stateNone, valueNull } },
{ "Print", { execPrint, enabled, stateNone, valueNull } },
{ "Redo", { execRedo, enabledRedo, stateNone, valueNull } },
+ { "RemoveFormat", { execRemoveFormat, enabledAnyEditableRangeSelection, stateNone, valueNull } },
{ "SelectAll", { execSelectAll, enabled, stateNone, valueNull } },
{ "Strikethrough", { execStrikethrough, enabledAnyRichlyEditableSelection, stateStrikethrough, valueNull } },
{ "Subscript", { execSubscript, enabledAnyRichlyEditableSelection, stateSubscript, valueNull } },
// Overwrite (not supported)
// PlayImage (not supported)
// Refresh (not supported)
- // RemoveFormat (not supported)
// RemoveParaFormat (not supported)
// SaveAs (not supported)
// SizeToControl (not supported)