WebCore:
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jul 2004 18:42:33 +0000 (18:42 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jul 2004 18:42:33 +0000 (18:42 +0000)
        Reviewed by John

        * khtml/xml/dom_selection.cpp:
        (DOM::Selection::modifyExtendingRightForward): Add LINE_BOUNDARY case to the switch statement in this
        function. Use the startAndEndLineNodesIncludingNode helper which already existed to get the right
        position.
        (DOM::Selection::modifyMovingRightForward): Ditto
        (DOM::Selection::modifyExtendingLeftBackward): Ditto
        (DOM::Selection::modifyMovingLeftBackward): Ditto
        * khtml/xml/dom_selection.h:
        (DOM::Selection::): Add LINE_BOUNDARY constant to ETextGranularity enum. This
        specifies a new kind of movement that we need to implement the "move-to beggining/end of line"
        behavior which AppKit binds to cmd+left/right arrow keys.
        * kwq/WebCoreBridge.h: Add WebSelectToLineBoundary constant. This matches

WebKit:

        Reviewed by John

        Add implementations for these methods. Formerly, they logged an error.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView moveToBeginningOfLine:]):
        (-[WebHTMLView moveToBeginningOfLineAndModifySelection:]):
        (-[WebHTMLView moveToEndOfLine:]):
        (-[WebHTMLView moveToEndOfLineAndModifySelection:]):

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/SelectionController.cpp
WebCore/khtml/editing/SelectionController.h
WebCore/khtml/editing/selection.cpp
WebCore/khtml/editing/selection.h
WebCore/khtml/xml/dom_selection.cpp
WebCore/khtml/xml/dom_selection.h
WebCore/kwq/WebCoreBridge.h
WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index 6d90cd4b10b5e413de104fa910b5a732dd1c6675..a3dd88dd017825b76c646c6b41c1b4e6ac3ff570 100644 (file)
@@ -1,3 +1,20 @@
+2004-07-21  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by John
+
+        * khtml/xml/dom_selection.cpp:
+        (DOM::Selection::modifyExtendingRightForward): Add LINE_BOUNDARY case to the switch statement in this
+        function. Use the startAndEndLineNodesIncludingNode helper which already existed to get the right
+        position.
+        (DOM::Selection::modifyMovingRightForward): Ditto
+        (DOM::Selection::modifyExtendingLeftBackward): Ditto
+        (DOM::Selection::modifyMovingLeftBackward): Ditto
+        * khtml/xml/dom_selection.h: 
+        (DOM::Selection::): Add LINE_BOUNDARY constant to ETextGranularity enum. This
+        specifies a new kind of movement that we need to implement the "move-to beggining/end of line"
+        behavior which AppKit binds to cmd+left/right arrow keys.
+        * kwq/WebCoreBridge.h: Add WebSelectToLineBoundary constant. This matches
+
 2004-07-20  David Hyatt  <hyatt@apple.com>
 
        Fix for 3714434, user stylesheet is always parsed in strict mode, when it should honor the document's setting.
index 147cca63e5503ba89de60dfa14a62448dec385b2..e66bc720627f5efbfd74a659ef3ea2ffd0bbe080 100644 (file)
@@ -211,6 +211,12 @@ Position Selection::modifyExtendingRightForward(ETextGranularity granularity)
         case LINE:
             pos = pos.nextLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -235,6 +241,12 @@ Position Selection::modifyMovingRightForward(ETextGranularity granularity)
         case LINE:
             pos = end().nextLinePosition(xPosForVerticalArrowNavigation(END, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -259,6 +271,12 @@ Position Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = pos.previousLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -283,6 +301,12 @@ Position Selection::modifyMovingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = start().previousLinePosition(xPosForVerticalArrowNavigation(START, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
index 72a12dea1da0915037dc2e4bae4b87924fabbacc..2b77862e86b2f1f8ce198c61ddb751a273bb431f 100644 (file)
@@ -48,7 +48,7 @@ public:
     enum EState { NONE, CARET, RANGE };
     enum EAlter { MOVE, EXTEND };
     enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT };
-    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH };
+    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH, LINE_BOUNDARY };
 
     Selection();
     Selection(const Range &);
index 147cca63e5503ba89de60dfa14a62448dec385b2..e66bc720627f5efbfd74a659ef3ea2ffd0bbe080 100644 (file)
@@ -211,6 +211,12 @@ Position Selection::modifyExtendingRightForward(ETextGranularity granularity)
         case LINE:
             pos = pos.nextLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -235,6 +241,12 @@ Position Selection::modifyMovingRightForward(ETextGranularity granularity)
         case LINE:
             pos = end().nextLinePosition(xPosForVerticalArrowNavigation(END, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -259,6 +271,12 @@ Position Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = pos.previousLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -283,6 +301,12 @@ Position Selection::modifyMovingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = start().previousLinePosition(xPosForVerticalArrowNavigation(START, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
index 72a12dea1da0915037dc2e4bae4b87924fabbacc..2b77862e86b2f1f8ce198c61ddb751a273bb431f 100644 (file)
@@ -48,7 +48,7 @@ public:
     enum EState { NONE, CARET, RANGE };
     enum EAlter { MOVE, EXTEND };
     enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT };
-    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH };
+    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH, LINE_BOUNDARY };
 
     Selection();
     Selection(const Range &);
index 147cca63e5503ba89de60dfa14a62448dec385b2..e66bc720627f5efbfd74a659ef3ea2ffd0bbe080 100644 (file)
@@ -211,6 +211,12 @@ Position Selection::modifyExtendingRightForward(ETextGranularity granularity)
         case LINE:
             pos = pos.nextLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -235,6 +241,12 @@ Position Selection::modifyMovingRightForward(ETextGranularity granularity)
         case LINE:
             pos = end().nextLinePosition(xPosForVerticalArrowNavigation(END, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(end().node(), end().offset(), selection);
+            pos = selection.end();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -259,6 +271,12 @@ Position Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = pos.previousLinePosition(xPosForVerticalArrowNavigation(EXTENT));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
@@ -283,6 +301,12 @@ Position Selection::modifyMovingLeftBackward(ETextGranularity granularity)
         case LINE:
             pos = start().previousLinePosition(xPosForVerticalArrowNavigation(START, state() == RANGE));
             break;
+        case LINE_BOUNDARY: {
+            Selection selection;
+            startAndEndLineNodesIncludingNode(start().node(), start().offset(), selection);
+            pos = selection.start();
+            break;
+        }
         case PARAGRAPH:
             // not implemented
             break;
index 72a12dea1da0915037dc2e4bae4b87924fabbacc..2b77862e86b2f1f8ce198c61ddb751a273bb431f 100644 (file)
@@ -48,7 +48,7 @@ public:
     enum EState { NONE, CARET, RANGE };
     enum EAlter { MOVE, EXTEND };
     enum EDirection { FORWARD, BACKWARD, RIGHT, LEFT };
-    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH };
+    enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH, LINE_BOUNDARY };
 
     Selection();
     Selection(const Range &);
index 847767b00332598cb691b80307665b573664ed11..0ea3b3d76f903f374076767454cc1e804de4e0ac 100644 (file)
@@ -106,7 +106,8 @@ typedef enum {
     WebSelectByCharacter,
     WebSelectByWord,
     WebSelectByLine,
-    WebSelectByParagraph
+    WebSelectByParagraph,
+    WebSelectToLineBoundary,
 } WebSelectionGranularity;
 
 
index 22252e9227fe1a543d2fb2b7b2984de4d0890611..ff06b8d933ee32a4b017f57760f7ea22016dafe2 100644 (file)
@@ -1,3 +1,15 @@
+2004-07-21  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by John
+
+        Add implementations for these methods. Formerly, they logged an error.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView moveToBeginningOfLine:]):
+        (-[WebHTMLView moveToBeginningOfLineAndModifySelection:]):
+        (-[WebHTMLView moveToEndOfLine:]):
+        (-[WebHTMLView moveToEndOfLineAndModifySelection:]):
+
 2004-07-21  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by John
index 242b5a3d9a7506556915535eab42df1754aa0a87..4dae157007f9175c1ceed35114dee274b09f94e5 100644 (file)
@@ -2395,12 +2395,12 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)moveToBeginningOfLine:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alterCurrentSelection:WebSelectByMoving direction:WebSelectLeft granularity:WebSelectToLineBoundary];
 }
 
 - (void)moveToBeginningOfLineAndModifySelection:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alterCurrentSelection:WebSelectByExtending direction:WebSelectLeft granularity:WebSelectToLineBoundary];
 }
 
 - (void)moveToBeginningOfParagraph:(id)sender
@@ -2425,12 +2425,12 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)moveToEndOfLine:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alterCurrentSelection:WebSelectByMoving direction:WebSelectRight granularity:WebSelectToLineBoundary];
 }
 
 - (void)moveToEndOfLineAndModifySelection:(id)sender
 {
-    ERROR("unimplemented");
+    [self _alterCurrentSelection:WebSelectByExtending direction:WebSelectRight granularity:WebSelectToLineBoundary];
 }
 
 - (void)moveToEndOfParagraph:(id)sender