LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 00:48:03 +0000 (00:48 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2006 00:48:03 +0000 (00:48 +0000)
        Reviewed by harrison

        <rdar://problem/3655385>
        Editing: -indent: method unimplemented

        * editing/execCommand/nsresponder-indent-expected.checksum: Added.
        * editing/execCommand/nsresponder-indent-expected.png: Added.
        * editing/execCommand/nsresponder-indent-expected.txt: Added.
        * editing/execCommand/nsresponder-indent.html: Added.
        * editing/execCommand/nsresponder-outdent-expected.checksum: Added.
        * editing/execCommand/nsresponder-outdent-expected.png: Added.
        * editing/execCommand/nsresponder-outdent-expected.txt: Added.
        * editing/execCommand/nsresponder-outdent.html: Added.

WebCore:

        Reviewed by harrison

        <rdar://problem/3655385>
        Editing: -indent: method unimplemented

        Added Frame and bridge methods.

        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge indent]):
        (-[WebCoreFrameBridge outdent]):
        * page/Frame.cpp:
        (WebCore::Frame::indent):
        (WebCore::Frame::outdent):
        * page/Frame.h:

WebKit:

        Reviewed by harrison

        <rdar://problem/3655385>
        Editing: -indent: method unimplemented

        * WebView/WebHTMLView.m:
        (-[NSArray validateUserInterfaceItem:]): Only allow indent:/outdent: in
        richly editable areas.
        (-[NSArray indent:]):
        (-[NSArray outdent:]):

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/execCommand/nsresponder-indent-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-indent-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-indent-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-indent.html [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-outdent-expected.checksum [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-outdent-expected.png [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-outdent-expected.txt [new file with mode: 0644]
LayoutTests/editing/execCommand/nsresponder-outdent.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.m

index 8ab67c01002ec98573db077a5ab02534f12db51d..d3fed9f518d48b387082abca89e04257e9142aeb 100644 (file)
@@ -1,3 +1,19 @@
+2006-10-16  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/3655385>
+        Editing: -indent: method unimplemented
+
+        * editing/execCommand/nsresponder-indent-expected.checksum: Added.
+        * editing/execCommand/nsresponder-indent-expected.png: Added.
+        * editing/execCommand/nsresponder-indent-expected.txt: Added.
+        * editing/execCommand/nsresponder-indent.html: Added.
+        * editing/execCommand/nsresponder-outdent-expected.checksum: Added.
+        * editing/execCommand/nsresponder-outdent-expected.png: Added.
+        * editing/execCommand/nsresponder-outdent-expected.txt: Added.
+        * editing/execCommand/nsresponder-outdent.html: Added.
+
 2006-10-13  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by ggaren and harrison
diff --git a/LayoutTests/editing/execCommand/nsresponder-indent-expected.checksum b/LayoutTests/editing/execCommand/nsresponder-indent-expected.checksum
new file mode 100644 (file)
index 0000000..57eec8f
--- /dev/null
@@ -0,0 +1 @@
+3e8be6972e8bfb47d122d0bffe761c4f
\ No newline at end of file
diff --git a/LayoutTests/editing/execCommand/nsresponder-indent-expected.png b/LayoutTests/editing/execCommand/nsresponder-indent-expected.png
new file mode 100644 (file)
index 0000000..4218c45
Binary files /dev/null and b/LayoutTests/editing/execCommand/nsresponder-indent-expected.png differ
diff --git a/LayoutTests/editing/execCommand/nsresponder-indent-expected.txt b/LayoutTests/editing/execCommand/nsresponder-indent-expected.txt
new file mode 100644 (file)
index 0000000..0f0398a
--- /dev/null
@@ -0,0 +1,22 @@
+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: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of BLOCKQUOTE > DIV > BODY > HTML > #document to 0 of BLOCKQUOTE > 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 534x18
+          text run at (0,0) width 281: "This tests the NSResponder method indent:. "
+          text run at (281,0) width 253: "You should see an indented 'foo' below."
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderBlock {BLOCKQUOTE} at (40,0) size 704x18
+          RenderText {#text} at (0,0) size 21x18
+            text run at (0,0) width 21: "foo"
+        RenderBlock (anonymous) at (0,34) size 784x0
+caret: position 0 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/execCommand/nsresponder-indent.html b/LayoutTests/editing/execCommand/nsresponder-indent.html
new file mode 100644 (file)
index 0000000..67ab25f
--- /dev/null
@@ -0,0 +1,11 @@
+<p>This tests the NSResponder method indent:.  You should see an indented 'foo' below.</p>
+<div id="div" contenteditable="true">foo</div>
+
+<script>
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+
+textInputController.doCommand("indent:");
+</script>
diff --git a/LayoutTests/editing/execCommand/nsresponder-outdent-expected.checksum b/LayoutTests/editing/execCommand/nsresponder-outdent-expected.checksum
new file mode 100644 (file)
index 0000000..be51db3
--- /dev/null
@@ -0,0 +1 @@
+c4345696009513bcb2e6a1ad493871ba
\ No newline at end of file
diff --git a/LayoutTests/editing/execCommand/nsresponder-outdent-expected.png b/LayoutTests/editing/execCommand/nsresponder-outdent-expected.png
new file mode 100644 (file)
index 0000000..019cd75
Binary files /dev/null and b/LayoutTests/editing/execCommand/nsresponder-outdent-expected.png differ
diff --git a/LayoutTests/editing/execCommand/nsresponder-outdent-expected.txt b/LayoutTests/editing/execCommand/nsresponder-outdent-expected.txt
new file mode 100644 (file)
index 0000000..7d682d8
--- /dev/null
@@ -0,0 +1,20 @@
+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: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of 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 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 453x18
+          text run at (0,0) width 196: "This tests the outdent: method. "
+          text run at (196,0) width 257: "You should see an undented 'foo' below."
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 21x18
+          text run at (0,0) width 21: "foo"
+caret: position 0 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/execCommand/nsresponder-outdent.html b/LayoutTests/editing/execCommand/nsresponder-outdent.html
new file mode 100644 (file)
index 0000000..bbd6ac9
--- /dev/null
@@ -0,0 +1,11 @@
+<p>This tests the outdent: method.  You should see an undented 'foo' below.</p>
+<div id="div" contenteditable="true"><blockquote>foo</blockquote></div>
+
+<script>
+var div = document.getElementById("div");
+var sel = window.getSelection();
+
+sel.setPosition(div, 0);
+
+textInputController.doCommand("outdent:");
+</script>
index 0bb7469fca8523679acd7cfe1c590f278d03888f..ca1491f2dce6ca32e8113a15791dd0eff8304db3 100644 (file)
@@ -1,3 +1,21 @@
+2006-10-13  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/3655385>
+        Editing: -indent: method unimplemented
+
+        Added Frame and bridge methods.
+
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge indent]):
+        (-[WebCoreFrameBridge outdent]):
+        * page/Frame.cpp:
+        (WebCore::Frame::indent): 
+        (WebCore::Frame::outdent):
+        * page/Frame.h:
+
 2006-10-16  Adam Roben  <aroben@apple.com>
 
         Reviewed by John.
index e0a66fd32981ec2d4391531e18e985b25592b07e..5a26add8ef09fdd4741903dd78ca23cf83ce4630 100644 (file)
@@ -469,6 +469,8 @@ typedef enum {
 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
 - (void)applyStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
 - (void)applyParagraphStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
+- (void)indent;
+- (void)outdent;
 - (BOOL)selectionStartHasStyle:(DOMCSSStyleDeclaration *)style;
 - (NSCellStateValue)selectionHasStyle:(DOMCSSStyleDeclaration *)style;
 - (void)applyEditingStyleToBodyElement;
index c6f86d21e84be3ffce745f6b229aea4610b37c50..df971cd2d031cb92cc96e24505702decb2a50d3b 100644 (file)
@@ -2232,6 +2232,20 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     m_frame->applyParagraphStyle([style _CSSStyleDeclaration], static_cast<EditAction>(undoAction));
 }
 
+- (void)indent
+{
+    if (!m_frame)
+        return;
+    m_frame->indent();
+}
+
+- (void)outdent
+{
+    if (!m_frame)
+        return;
+    m_frame->outdent();
+}
+
 - (BOOL)selectionStartHasStyle:(DOMCSSStyleDeclaration *)style
 {
     if (!m_frame)
index 9a2e0dd1aebe4c5f5e0d4bb019e6949e32b48b34..8b134449d83421b5ddf59e5a949c6c45ed4a94b7 100644 (file)
@@ -55,6 +55,7 @@
 #include "HTMLObjectElement.h"
 #include "HTMLViewSourceDocument.h"
 #include "ImageDocument.h"
+#include "IndentOutdentCommand.h"
 #include "loader/icon/IconDatabase.h"
 #include "loader/icon/IconLoader.h"
 #include "MediaFeatureNames.h"
@@ -2354,6 +2355,16 @@ void Frame::applyParagraphStyle(CSSStyleDeclaration *style, EditAction editingAc
     }
 }
 
+void Frame::indent()
+{
+    applyCommand(new IndentOutdentCommand(document(), IndentOutdentCommand::Indent));
+}
+
+void Frame::outdent()
+{
+    applyCommand(new IndentOutdentCommand(document(), IndentOutdentCommand::Outdent));
+}
+
 static void updateState(CSSMutableStyleDeclaration *desiredStyle, CSSComputedStyleDeclaration *computedStyle, bool& atStart, Frame::TriState& state)
 {
     DeprecatedValueListConstIterator<CSSProperty> end;
index 4fe29a0f0432409bc01151cb049b608dfb366d65..55444ab785ba57058f865e0dfd9c306f482d4c90 100644 (file)
@@ -499,6 +499,8 @@ public:
   void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
   void applyStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
   void applyParagraphStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
+  void indent();
+  void outdent();
   TriState selectionHasStyle(CSSStyleDeclaration*) const;
   bool selectionStartHasStyle(CSSStyleDeclaration*) const;
   TriState selectionListState() const;
index c211e3cfefb0199327162686e4eec542f87a2240..cbebfce459b9243166ef724e913910dd9dde847c 100644 (file)
@@ -1,3 +1,16 @@
+2006-10-13  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/3655385>
+        Editing: -indent: method unimplemented
+
+        * WebView/WebHTMLView.m:
+        (-[NSArray validateUserInterfaceItem:]): Only allow indent:/outdent: in
+        richly editable areas.
+        (-[NSArray indent:]):
+        (-[NSArray outdent:]):
+
 2006-10-13  Maciej Stachowiak  <mjs@apple.com>
 
         Not reviewed, build fix.
index 202a3b4007af95c2e7d5c2f633ed9c15458d7ebc..be6932962d0687a118800bb8a7224e2793a84bf0 100644 (file)
@@ -2182,7 +2182,9 @@ static WebHTMLView *lastHitView = nil;
             || action == @selector(alignRight:)
             || action == @selector(changeAttributes:)
             || action == @selector(changeColor:)        
-            || action == @selector(changeFont:)) {
+            || action == @selector(changeFont:)
+            || action == @selector(indent:)
+            || action == @selector(outdent:)) {
         return [self _canEditRichly];
     } else if (action == @selector(capitalizeWord:)
                || action == @selector(lowercaseWord:)
@@ -4700,6 +4702,16 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     [self _applyParagraphStyleToSelection:style withUndoAction:WebUndoActionSetWritingDirection];
 }
 
+- (void)indent:(id)sender
+{
+    [[self _bridge] indent];
+}
+
+- (void)outdent:(id)sender
+{
+    [[self _bridge] outdent];
+}
+
 #if 0
 
 // CSS does not have a way to specify an outline font, which may make this difficult to implement.
@@ -4723,7 +4735,6 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 
 // These methods are not implemented in NSTextView yet, so perhaps there's no rush.
 - (void)changeCaseOfLetter:(id)sender;
-- (void)indent:(id)sender;
 - (void)transposeWords:(id)sender;
 
 #endif