[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

ojan at chromium.org ojan at chromium.org
Sun Feb 20 22:56:00 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 3f45b9d4802b1c144fde7fba2ab7a516d503d3cd
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 14 00:39:52 2011 +0000

    2011-01-13  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Adam Barth.
    
            simplify keyboard handling in code review tool
            https://bugs.webkit.org/show_bug.cgi?id=52407
    
            Now that we have DiffBlock containers, the only things that are
            focusable are previousComment nodes and DiffBlock containers
            that contain add/remove lines.
    
            Also, this means we show the focus border around the entire diff
            instead of just the first line.
    
            * code-review.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Websites/bugs.webkit.org/ChangeLog b/Websites/bugs.webkit.org/ChangeLog
index 310f782..23e8e80 100644
--- a/Websites/bugs.webkit.org/ChangeLog
+++ b/Websites/bugs.webkit.org/ChangeLog
@@ -2,6 +2,22 @@
 
         Reviewed by Adam Barth.
 
+        simplify keyboard handling in code review tool
+        https://bugs.webkit.org/show_bug.cgi?id=52407
+
+        Now that we have DiffBlock containers, the only things that are
+        focusable are previousComment nodes and DiffBlock containers
+        that contain add/remove lines.
+
+        Also, this means we show the focus border around the entire diff
+        instead of just the first line.
+
+        * code-review.js:
+
+2011-01-13  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Adam Barth.
+
         add container divs for diff blocks
         https://bugs.webkit.org/show_bug.cgi?id=52400
 
diff --git a/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb b/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
index 880b8a7..a0529d9 100644
--- a/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
+++ b/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
@@ -395,7 +395,7 @@ body {
 }
 </style>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
-<script src="code-review.js?version=22"></script>
+<script src="code-review.js?version=23"></script>
 EOF
 
     def self.revisionOrDescription(string)
diff --git a/Websites/bugs.webkit.org/code-review.js b/Websites/bugs.webkit.org/code-review.js
index f2cf8a9..a8bde40 100644
--- a/Websites/bugs.webkit.org/code-review.js
+++ b/Websites/bugs.webkit.org/code-review.js
@@ -946,64 +946,20 @@
     $(document).scrollTop(node.addClass('focused').position().top - window.innerHeight / 2);
   }
 
-  function diffBlockEndPoint(focusable_nodes, line, line_offset, is_backward) {
-    if (!line_offset && is_backward)
-      return line;
-
-    var offset = is_backward ? -1 : 1;
-
-    // If we're at a comment, get a Line in the diff block that contains the comment.
-    if (line.hasClass('previousComment')) {
-      var line_for_comment = $('#' + line.attr('data-comment-for'));
-      line_offset = focusable_nodes.index(line_for_comment);
-
-      // If the comment is not inside a diff block, return the comment node.
-      if (line_offset == -1)
-        return line;
-
-      line = line_for_comment;
-    }
-
-    // Find the Line at the beginning/end of this contiguous block of lines.
-    // Contiguous blocks of lines have contiguous IDs and are contained in the same FileDiff.
-    // Skip over comment nodes.
-    var id = numberFrom(line.attr('id'));
-    var next_node = $(focusable_nodes[line_offset + offset]);
-    while (next_node.size()
-           && (!next_node.hasClass('Line') || next_node.attr('id') == 'line' + (id + offset))
-           && fileDiffFor(line)[0] == fileDiffFor(next_node)[0]) {
-      if (next_node.hasClass('Line')) {
-        line = next_node;
-        id += offset;
-      }
-
-      line_offset += offset;
-      next_node = $(focusable_nodes[line_offset + offset]);
-    }
-    return line;
-  }
-
   function focusNext(className, is_backward) {
-    var focusable_nodes = $('.previousComment,.Line.add,.Line.remove');
-    var focused_node = $('.focused');
-    var index = focusable_nodes.index(focused_node);
-    if (is_backward && (!index || index == -1))
-      return;
+    var focusable_nodes = $('.previousComment,.DiffBlock').filter(function() {
+      return ($(this).hasClass('previousComment') || $('.add,.remove', this).size());
+    });
 
-    if (focused_node.size() && className == 'Line') {
-      focused_node = diffBlockEndPoint(focusable_nodes, focused_node, index, is_backward);
-      index = focusable_nodes.index(focused_node);
-    }
+    var index = focusable_nodes.index($('.focused'));
+    if (index == -1 && is_backward)
+      index = focusable_nodes.length;
 
-    var end = is_backward ? 0 : focusable_nodes.size();
     var offset = is_backward ? -1 : 1;
+    var end = is_backward ? -1 : focusable_nodes.size();
     for (var i = index + offset; i != end; i = i + offset) {
       var node = $(focusable_nodes[i]);
       if (node.hasClass(className)) {
-        if (className == 'Line') {
-          // Pass in true for is_backward because we always want to focus the start of the diff block.
-          node = diffBlockEndPoint(focusable_nodes, node, i, true);
-        }
         focusOn(node);
         return;
       }
@@ -1031,11 +987,11 @@
       break;
 
     case kCharCodeForJ:
-      focusNext('Line', false);
+      focusNext('DiffBlock', false);
       break;
 
     case kCharCodeForK:
-      focusNext('Line', true);
+      focusNext('DiffBlock', true);
       break;
     }
   });

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list