[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 23:27:55 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 008dd4f2c1ebb146773fbc3790eac3fd7a39b6e8
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 19:21:40 2011 +0000

    2011-01-14  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Adam Barth.
    
            make line selection have a extend only from where you start the selection in the code review tool
            https://bugs.webkit.org/show_bug.cgi?id=52485
    
            * code-review.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76268 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Websites/bugs.webkit.org/ChangeLog b/Websites/bugs.webkit.org/ChangeLog
index dd67ea3..37fd553 100644
--- a/Websites/bugs.webkit.org/ChangeLog
+++ b/Websites/bugs.webkit.org/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-14  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        make line selection have a extend only from where you start the selection in the code review tool
+        https://bugs.webkit.org/show_bug.cgi?id=52485
+
+        * code-review.js:
+
 2011-01-18  Ojan Vafai  <ojan at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/Websites/bugs.webkit.org/code-review.js b/Websites/bugs.webkit.org/code-review.js
index bdb938e..7961f77 100644
--- a/Websites/bugs.webkit.org/code-review.js
+++ b/Websites/bugs.webkit.org/code-review.js
@@ -1057,11 +1057,11 @@
     });
   }
 
-  var in_drag_select = false;
+  var drag_select_start_index = -1;
 
   function stopDragSelect() {
     $('.selected').removeClass('selected');
-    in_drag_select = false;
+    drag_select_start_index = -1;
   }
 
   function lineOffsetFrom(line, offset) {
@@ -1084,33 +1084,39 @@
     if (line.hasClass('commentContext'))
       trimCommentContextToBefore(previousLineFor(line), line.attr('data-comment-base-line'));
   }).live('mousedown', function() {
-    in_drag_select = true;
-    lineFromLineDescendant($(this)).addClass('selected');
+    var line = lineFromLineDescendant($(this));
+    drag_select_start_index = numberFrom(line.attr('id'));
+    line.addClass('selected');
     event.preventDefault();
   });
 
+  function selectTo(focus_index) {
+    var selected = $('.selected').removeClass('selected');
+    var is_backward = drag_select_start_index > focus_index;
+    var current_index = is_backward ? focus_index : drag_select_start_index;
+    var last_index = is_backward ? drag_select_start_index : focus_index;
+    while (current_index <= last_index) {
+      $('#line' + current_index).addClass('selected')
+      current_index++;
+    }
+  }
+
+  function selectToLineContainer(line_container) {
+    var line = lineFromLineContainer(line_container);
+    selectTo(numberFrom(line.attr('id')));
+  }
+
   $('.LineContainer').live('mouseenter', function() {
-    if (!in_drag_select)
+    if (drag_select_start_index == -1)
       return;
-
-    var line = lineFromLineContainer(this);
-    line.addClass('selected');
+    selectToLineContainer(this);
   }).live('mouseup', function() {
-    if (!in_drag_select)
+    if (drag_select_start_index == -1)
       return;
 
-    var selected = $('.selected');
-
-    // Select all the lines between the first and last selected lines
-    // in case we didn't get mouseenter events for any of them.
-    var current_index = numberFrom(selected.first().attr('id'));
-    var last_index = numberFrom(selected.last().attr('id'));
-    while (current_index != last_index) {
-      $('#line' + current_index).addClass('selected')
-      current_index++;
-    }
+    selectToLineContainer(this);
 
-    selected = $('.selected');
+    var selected = $('.selected');
     var already_has_comment = selected.last().hasClass('commentContext');
     selected.addClass('commentContext');
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list