2011-02-17 Ojan Vafai <ojan@chromium.org>
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Feb 2011 02:45:29 +0000 (02:45 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Feb 2011 02:45:29 +0000 (02:45 +0000)
        Reviewed by Adam Barth.

        use shift+j/k to focus next/previous line
        https://bugs.webkit.org/show_bug.cgi?id=54723

        Tested on a large Hyatt change to confirm it performed fine.
        (https://bugs.webkit.org/attachment.cgi?id=82533&action=review)

        * code-review.js:

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

Websites/bugs.webkit.org/ChangeLog
Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
Websites/bugs.webkit.org/code-review.js

index 62936c5..be0267c 100644 (file)
@@ -2,6 +2,18 @@
 
         Reviewed by Adam Barth.
 
+        use shift+j/k to focus next/previous line
+        https://bugs.webkit.org/show_bug.cgi?id=54723
+
+        Tested on a large Hyatt change to confirm it performed fine.
+        (https://bugs.webkit.org/attachment.cgi?id=82533&action=review)
+
+        * code-review.js:
+
+2011-02-17  Ojan Vafai  <ojan@chromium.org>
+
+        Reviewed by Adam Barth.
+
         fix escape handling in code review tool
         https://bugs.webkit.org/show_bug.cgi?id=54722
 
index 1718268..cb88130 100644 (file)
@@ -447,7 +447,7 @@ div:focus {
 }
 </style>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
-<script src="code-review.js?version=35"></script>
+<script src="code-review.js?version=36"></script>
 EOF
 
     def self.revisionOrDescription(string)
index 1065188..d31adf3 100644 (file)
@@ -1349,7 +1349,7 @@ var CODE_REVIEW_UNITTEST;
   }
 
   function focusNext(filter, direction) {
-    var focusable_nodes = $('a,.frozenComment,.previousComment,.DiffBlock,.overallComments').filter(function() {
+    var focusable_nodes = $('a,.Line,.frozenComment,.previousComment,.DiffBlock,.overallComments').filter(function() {
       return !$(this).hasClass('DiffBlock') || $('.add,.remove', this).size();
     });
 
@@ -1376,6 +1376,8 @@ var CODE_REVIEW_UNITTEST;
   var kCharCodeForP = 'p'.charCodeAt(0);
   var kCharCodeForJ = 'j'.charCodeAt(0);
   var kCharCodeForK = 'k'.charCodeAt(0);
+  var kCharCodeForCapitalJ = 'J'.charCodeAt(0);
+  var kCharCodeForCapitalK = 'K'.charCodeAt(0);
   var kCharCodeForEnter = '\r'.charCodeAt(0);
 
   function isComment(node) {
@@ -1385,6 +1387,10 @@ var CODE_REVIEW_UNITTEST;
   function isDiffBlock(node) {
     return node.hasClass('DiffBlock');
   }
+  
+  function isLine(node) {
+    return node.hasClass('Line');
+  }
 
   $('textarea').live('keydown', function(e) {
     var escape_key_code = 27;
@@ -1416,6 +1422,14 @@ var CODE_REVIEW_UNITTEST;
     case kCharCodeForK:
       handled = focusNext(isDiffBlock, DIRECTION.BACKWARD);
       break;
+      
+    case kCharCodeForCapitalJ:
+      handled = focusNext(isLine, DIRECTION.FORWARD);
+      break;
+
+    case kCharCodeForCapitalK:
+      handled = focusNext(isLine, DIRECTION.BACKWARD);
+      break;
     
     case kCharCodeForEnter:
       handled = handleEnterKeyPress();