[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

ojan at chromium.org ojan at chromium.org
Fri Jan 21 14:59:58 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 5f24062054259bf3f274e415fe196405f6247648
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 02:50:16 2011 +0000

    2011-01-05  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Adam Barth.
    
            assorted cleanups to prepare for side-by-side diffing
            https://bugs.webkit.org/show_bug.cgi?id=51961
    
            Mostly, use selector queries instead of assuming comments are next siblings.
    
            * code-review.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75130 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Websites/bugs.webkit.org/ChangeLog b/Websites/bugs.webkit.org/ChangeLog
index e37dd88..d91322e 100644
--- a/Websites/bugs.webkit.org/ChangeLog
+++ b/Websites/bugs.webkit.org/ChangeLog
@@ -2,6 +2,17 @@
 
         Reviewed by Adam Barth.
 
+        assorted cleanups to prepare for side-by-side diffing
+        https://bugs.webkit.org/show_bug.cgi?id=51961
+
+        Mostly, use selector queries instead of assuming comments are next siblings.
+
+        * code-review.js:
+
+2011-01-05  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Adam Barth.
+
         fix message container selector for code review tool
         https://bugs.webkit.org/show_bug.cgi?id=51959
 
diff --git a/Websites/bugs.webkit.org/code-review.js b/Websites/bugs.webkit.org/code-review.js
index 49cad00..9163cf0 100644
--- a/Websites/bugs.webkit.org/code-review.js
+++ b/Websites/bugs.webkit.org/code-review.js
@@ -92,21 +92,21 @@
     });
   }
 
+  function diffSectionFrom(line) {
+    return line.parents('.FileDiff');
+  }
+
   function previousCommentsFor(line) {
-    var comments = [];
-    var position = line;
-    while (position.next() && position.next().hasClass('previousComment')) {
-      position = position.next();
-      comments.push(position.get());
-    }
-    return $(comments);
+    // Scope to the diffSection as a performance improvement.
+    return $('div[data-comment-for~="' + line[0].id + '"].previousComment', diffSectionFrom(line));
   }
 
   function findCommentPositionFor(line) {
-    var position = line;
-    while (position.next() && position.next().hasClass('previousComment'))
-      position = position.next();
-    return position;
+    var previous_comments = previousCommentsFor(line);
+    var num_previous_comments = previous_comments.size();
+    if (num_previous_comments)
+      return $(previous_comments[num_previous_comments - 1])
+    return line;
   }
 
   function findCommentBlockFor(line) {
@@ -194,6 +194,7 @@
         continue;
       var quote_markers = parts[1];
       var file_name = parts[2];
+      // FIXME: Store multiple lines for multiline comments and correctly import them here.
       var line_number = parts[3];
       if (!file_name in files)
         continue;
@@ -361,19 +362,24 @@
         (amount ? amount + " " : "") + direction + "</a>";
   }
 
-  $(window).bind('click', function (e) {
-    var target = e.target;
-    if (target.className != 'ExpandLink')
-      return;
-
-    // Can't use $ here because something in the window's scope sets $ to something other than jQuery.
-    var expand_bar = jQuery(target).parents('.ExpandBar');
+  function handleExpandLinkClick(target) {
+    var expand_bar = $(target).parents('.ExpandBar');
     var file_name = expand_bar.parents('.FileDiff').children('h1')[0].textContent;
     var expand_function = partial(expand, expand_bar[0], file_name, target.getAttribute('data-direction'), Number(target.getAttribute('data-amount')));
     if (file_name in original_file_contents)
       expand_function();
     else
       getWebKitSourceFile(file_name, expand_function, expand_bar);
+  };
+
+  $(window).bind('click', function (e) {
+    var target = e.target;
+
+    switch(target.className) {
+    case 'ExpandLink':
+      handleExpandLinkClick(target);
+      break;
+    }
   });
 
   function getWebKitSourceFile(file_name, onLoad, expand_bar) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list