Commit 4d89331e authored by justing's avatar justing

LayoutTests:

        Reviewed by mjs
        
        Tests for:
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=6647>
        TinyMCE: document.execCommand("insertHTML", ...) unimplemented

        * editing/editing.js:
        * editing/execCommand/insertHTML-expected.checksum: Added.
        * editing/execCommand/insertHTML-expected.png: Added.
        * editing/execCommand/insertHTML-expected.txt: Added.
        * editing/execCommand/insertHTML.html: Added.

WebCore:

        Reviewed by mjs
        
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=6647>
        TinyMCE: document.execCommand("insertHTML", ...) unimplemented

        * editing/jsediting.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13058 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d5ce6095
2006-02-28 Justin Garcia <justin.garcia@apple.com>
Reviewed by mjs
Tests for:
<http://bugzilla.opendarwin.org/show_bug.cgi?id=6647>
TinyMCE: document.execCommand("insertHTML", ...) unimplemented
* editing/editing.js:
* editing/execCommand/insertHTML-expected.checksum: Added.
* editing/execCommand/insertHTML-expected.png: Added.
* editing/execCommand/insertHTML-expected.txt: Added.
* editing/execCommand/insertHTML.html: Added.
2006-02-27 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
......
d0062ce6530884283cd31c40d1d76aad
\ No newline at end of file
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of P > DIV > BODY > HTML > #document to 0 of P > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > P > DIV > BODY > HTML > #document to 1 of #text > P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of P > DIV > BODY > HTML > #document to 0 of P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > P > DIV > BODY > HTML > #document to 1 of #text > P > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderCanvas 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 784x36
RenderText {TEXT} at (0,0) size 704x36
text run at (0,0) width 312: "This is a test of execCommand(insertHTML, ...). "
text run at (312,0) width 392: "It selects the contents of an editable div, d, deletes it, then calls"
text run at (0,18) width 291: "execCommand(insertHTML, d.innerHTML). "
text run at (291,18) width 364: "d.innerHTML should be what it was when the test began."
RenderBlock {DIV} at (0,52) size 784x32
RenderBlock {P} at (0,0) size 784x32
RenderText {TEXT} at (0,14) size 31x18
text run at (0,14) width 31: "hello"
RenderTable {TABLE} at (31,0) size 32x28 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 0x26
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (2,2) size 12x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {TEXT} at (2,2) size 8x18
text run at (2,2) width 8: "1"
RenderTableCell {TD} at (16,2) size 12x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
RenderText {TEXT} at (2,2) size 8x18
text run at (2,2) width 8: "2"
RenderInline {B} at (0,0) size 40x18
RenderText {TEXT} at (63,14) size 40x18
text run at (63,14) width 40: "world"
RenderText {TEXT} at (103,14) size 5x18
text run at (103,14) width 5: "!"
RenderBlock {UL} at (0,100) size 784x18
RenderListItem {LI} at (40,0) size 744x18
RenderListMarker at (0,0) size 0x14
RenderText {TEXT} at (0,0) size 50x18
text run at (0,0) width 50: "Success"
caret: position 1 of child 3 {TEXT} of child 0 {P} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<html>
<head>
<script src=../editing.js language="JavaScript" type="text/JavaScript"></script>
<script>
function log(message) {
var console = document.getElementById("console");
var li = document.createElement("li");
var text = document.createTextNode(message);
li.appendChild(text);
console.appendChild(li);
}
function editingTest() {
var d = document.getElementById("test");
var html = d.innerHTML.toLowerCase();
selectAllCommand();
deleteCommand();
insertHTMLCommand(html);
var results = d.innerHTML.toLowerCase();
if (html == results)
log("Success");
else
log("Failure. Called execCommand(innerHTML, " + html + ") and the results of calling innerHTML afterword were: " + results);
}
</script>
</head>
<body>
<p>This is a test of execCommand(insertHTML, ...). It selects the contents of an editable div, d, deletes it, then calls execCommand(insertHTML, d.innerHTML). d.innerHTML should be what it was when the test began.</p>
<div id="test" contenteditable="true"><p>hello<table style="display:inline" border=1><tr><td>1</td><td>2</td></tr></table><b>world</b>!</p></div>
<ul id="console"></ul>
<script>
runEditingTest();
</script>
</body>
</html>
\ No newline at end of file
2006-02-28 Justin Garcia <justin.garcia@apple.com>
Reviewed by mjs
<http://bugzilla.opendarwin.org/show_bug.cgi?id=6647>
TinyMCE: document.execCommand("insertHTML", ...) unimplemented
* editing/jsediting.cpp:
2006-02-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
......
......@@ -32,6 +32,8 @@
#include "css_valueimpl.h"
#include "cssproperties.h"
#include "htmlediting.h"
#include "markup.h"
#include "ReplaceSelectionCommand.h"
#include "TypingCommand.h"
#include <kxmlcore/HashMap.h>
......@@ -232,6 +234,16 @@ bool execForeColor(Frame *frame, bool userInterface, const DOMString &value)
return execStyleChange(frame, CSS_PROP_COLOR, value);
}
bool execInsertHTML(Frame* frame, bool userInterface, const String& value)
{
QString baseURL = "";
bool selectReplacement = false;
RefPtr<DocumentFragmentImpl> fragment = createFragmentFromMarkup(frame->document(), value.qstring(), baseURL);
EditCommandPtr cmd(new ReplaceSelectionCommand(frame->document(), fragment.get(), selectReplacement));
cmd.apply();
return true;
}
bool execIndent(Frame *frame, bool userInterface, const DOMString &value)
{
// FIXME: Implement.
......@@ -516,6 +528,7 @@ CommandMap *createCommandDictionary()
{ "ForeColor", { execForeColor, enabledAnySelection, stateNone, valueForeColor } },
{ "ForwardDelete", { execForwardDelete, enabledAnySelection, stateNone, valueNull } },
{ "Indent", { execIndent, enabledAnySelection, stateNone, valueNull } },
{ "InsertHTML", { execInsertHTML, enabledAnySelection, stateNone, valueNull } },
{ "InsertLineBreak", { execInsertLineBreak, enabledAnySelection, stateNone, valueNull } },
{ "InsertParagraph", { execInsertParagraph, enabledAnySelection, stateNone, valueNull } },
{ "InsertNewlineInQuotedContent", { execInsertNewlineInQuotedContent, enabledAnySelection, stateNone, valueNull } },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment