LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 18:04:42 +0000 (18:04 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2006 18:04:42 +0000 (18:04 +0000)
        Reviewed by mjs

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=10225>
        GMail Editor: Change Hilite Color doesn't work

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

WebCore:

        Reviewed by mjs

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=10225>
        GMail Editor: Change Hilite Color doesn't work

        * editing/JSEditor.cpp: Added support for execCommand("HiliteColor", ...).
        It's what GMail uses to implement text hiliting.  It's just a synonym for BackColor.
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::nodeWillBeRemoved): Moved a comment
        a more appropriate place.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15772 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/execCommand/hilitecolor-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/hilitecolor-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/hilitecolor-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/hilitecolor.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/JSEditor.cpp
WebCore/editing/SelectionController.cpp

index 916d9a0142385449eba150fb844bdfb367591e2c..2ad7de1db8dcaf9ba2050e02a008d561e89f057c 100644 (file)
@@ -1,3 +1,15 @@
+2006-08-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by mjs
+
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=10225>
+        GMail Editor: Change Hilite Color doesn't work
+
+        * editing/execCommand/hilitecolor-expected.checksum: Added.
+        * editing/execCommand/hilitecolor-expected.png: Added.
+        * editing/execCommand/hilitecolor-expected.txt: Added.
+        * editing/execCommand/hilitecolor.html: Added.
+
 2006-08-03  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Adele and Darin.
diff --git a/LayoutTests/editing/execCommand/hilitecolor-expected.checksum b/LayoutTests/editing/execCommand/hilitecolor-expected.checksum
new file mode 100644 (file)
index 0000000..fad97ae
--- /dev/null
@@ -0,0 +1 @@
+56816cdf8a1834a12e1bbfd085ac7be4
\ No newline at end of file
diff --git a/LayoutTests/editing/execCommand/hilitecolor-expected.png b/LayoutTests/editing/execCommand/hilitecolor-expected.png
new file mode 100644 (file)
index 0000000..e5d9d8b
Binary files /dev/null and b/LayoutTests/editing/execCommand/hilitecolor-expected.png differ
diff --git a/LayoutTests/editing/execCommand/hilitecolor-expected.txt b/LayoutTests/editing/execCommand/hilitecolor-expected.txt
new file mode 100644 (file)
index 0000000..4716f78
--- /dev/null
@@ -0,0 +1,25 @@
+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: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > SPAN > SPAN > DIV > BODY > HTML > #document to 6 of #text > SPAN > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+        RenderInline {SPAN} at (0,0) size 616x18
+          RenderText {#text} at (0,0) size 29x18
+            text run at (0,0) width 29: "The "
+          RenderInline {SPAN} at (0,0) size 44x18 [bgcolor=#FF0000]
+            RenderText {#text} at (29,0) size 44x18
+              text run at (29,0) width 44: "second"
+          RenderText {#text} at (73,0) size 543x18
+            text run at (73,0) width 543: " word, and only the second word of this sentence should have a red background color."
+caret: position 0 of child 0 {#text} of child 0 {SPAN} of child 0 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/execCommand/hilitecolor.html b/LayoutTests/editing/execCommand/hilitecolor.html
new file mode 100644 (file)
index 0000000..28bb242
--- /dev/null
@@ -0,0 +1,13 @@
+<div id="test" contenteditable="true">The second word, and only the second word of this sentence should have a red background color.</div>
+
+<script>
+var sel = window.getSelection();
+var e = document.getElementById("test");
+
+sel.setPosition(e, 0);
+sel.modify("move", "forward", "word");
+sel.modify("move", "forward", "word");
+sel.modify("extend", "backward", "word");
+document.execCommand("HiliteColor", false, "red");
+sel.modify("move", "backward", "line");
+</script>
\ No newline at end of file
index 6e98e87ef9e435ed6d7989cf924a289b48bcc92f..c14b6e25ce52bfab5998556d63ad411e530c29aa 100644 (file)
@@ -1,3 +1,16 @@
+2006-08-02  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by mjs
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=10225>
+        GMail Editor: Change Hilite Color doesn't work
+
+        * editing/JSEditor.cpp: Added support for execCommand("HiliteColor", ...).
+        It's what GMail uses to implement text hiliting.  It's just a synonym for BackColor.
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::nodeWillBeRemoved): Moved a comment
+        a more appropriate place.
+
 2006-08-03  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Adele and Darin.
index 71af76eddc974bf6eadac540db7581b33732a197..6453f1a5c93325fa9078c84fb474a8fac42184e6 100644 (file)
@@ -189,7 +189,7 @@ String valueStyle(Frame *frame, int propertyID)
 
 bool execBackColor(Frame *frame, bool userInterface, const String &value)
 {
-    return execStyleChange(frame,  CSS_PROP_BACKGROUND_COLOR, value);
+    return execStyleChange(frame, CSS_PROP_BACKGROUND_COLOR, value);
 }
 
 bool execBold(Frame *frame, bool userInterface, const String &value)
@@ -258,7 +258,7 @@ bool execFontSizeDelta(Frame *frame, bool userInterface, const String &value)
 
 bool execForeColor(Frame *frame, bool userInterface, const String &value)
 {
-    return execStyleChange(frame,  CSS_PROP_COLOR, value);
+    return execStyleChange(frame, CSS_PROP_COLOR, value);
 }
 
 bool execFormatBlock(Frame *frame, bool userInterface, const String &value)
@@ -643,7 +643,7 @@ CommandMap *createCommandDictionary()
 
     static const EditorCommand commands[] = {
 
-        { "BackColor", { execBackColor, enabledAnyRangeSelection, stateNone, valueBackColor } },
+        { "BackColor", { execBackColor, enabledAnyRichlyEditableRangeSelection, stateNone, valueBackColor } },
         { "Bold", { execBold, enabledAnyRichlyEditableSelection, stateBold, valueNull } },
         { "Copy", { execCopy, enabledAnyRangeSelection, stateNone, valueNull } },
         { "CreateLink", { execCreateLink, enabledAnyRichlyEditableRangeSelection, stateNone, valueNull } },
@@ -656,6 +656,7 @@ CommandMap *createCommandDictionary()
         { "ForeColor", { execForeColor, enabledAnySelection, stateNone, valueForeColor } },
         { "FormatBlock", { execFormatBlock, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
         { "ForwardDelete", { execForwardDelete, enabledAnyEditableSelection, stateNone, valueNull } },
+        { "HiliteColor", { execBackColor, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
         { "Indent", { execIndent, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
         { "InsertHorizontalRule", { execInsertHorizontalRule, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
         { "InsertHTML", { execInsertHTML, enabledAnyEditableSelection, stateNone, valueNull } },
index 6a306a909eee20e4cc71a3e067d20d4d87d9dd7a..489ab12670551d930eb2229471c84c6603d5039c 100644 (file)
@@ -208,7 +208,6 @@ void SelectionController::nodeWillBeRemoved(Node *node)
     }
 
     if (clearRenderTreeSelection) {
-        // FIXME (6498): This doesn't notify the editing delegate of a selection change.
         RefPtr<Document> document = start->document();
         document->updateRendering();
         if (RenderView* view = static_cast<RenderView*>(document->renderer()))
@@ -216,6 +215,7 @@ void SelectionController::nodeWillBeRemoved(Node *node)
     }
 
     if (clearDOMTreeSelection)
+        // FIXME (6498): This doesn't notify the editing delegate of a selection change.
         setSelection(Selection());
 }