Changeset 136556 in webkit


Ignore:
Timestamp:
Dec 4, 2012, 1:11:01 PM (12 years ago)
Author:
ojan@chromium.org
Message:

Can't add followup comment to a previous comment
https://bugs.webkit.org/show_bug.cgi?id=104025

Reviewed by Adam Barth.

If we side-by-sidify a shared diff line, and then apply
a previous comment, we would incorrectly put the comment
on the Line instead of the LineContainer.

Also, get rid of global next_line_id to simplify testing.

  • code-review-test.html:
  • code-review.js:
Location:
trunk/Websites/bugs.webkit.org
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/bugs.webkit.org/ChangeLog

    r133576 r136556  
     12012-12-04  Ojan Vafai  <ojan@chromium.org>
     2
     3        Can't add followup comment to a previous comment
     4        https://bugs.webkit.org/show_bug.cgi?id=104025
     5
     6        Reviewed by Adam Barth.
     7
     8        If we side-by-sidify a shared diff line, and then apply
     9        a previous comment, we would incorrectly put the comment
     10        on the Line instead of the LineContainer.
     11
     12        Also, get rid of global next_line_id to simplify testing.
     13
     14        * code-review-test.html:
     15        * code-review.js:
     16
    1172012-11-06  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Websites/bugs.webkit.org/code-review-test.html

    r102719 r136556  
    229229  appendToolbar();
    230230
    231   var line = document.getElementById('line0')
     231  var line = document.getElementById('line0');
    232232  var author = "ojan@chromium.org";
    233233  var comment_text = "This change sux.";
     
    262262}
    263263
     264function testSideBySideDiffWithPreviousCommentsOnSharedLine() {
     265  document.getElementById('diff-content').innerHTML =
     266      '<div class="FileDiff">' +
     267        '<h1><a href="http://trac.webkit.org/browser/trunk/Source/WebCore/ChangeLog">Source/WebCore/ChangeLog</a></h1>' +
     268        '<div class="DiffSection">' +
     269          '<div class="DiffBlock">' +
     270            '<div class="DiffBlockPart shared">' +
     271              '<div class="Line LineContainer">' +
     272              '<span class="from lineNumber">336</span><span class="to lineNumber">338</span><span class="text">    layoutFlexItems(*m_orderIterator, lineContexts);</span>' +
     273              '</div>' +
     274              '<div class="Line LineContainer">' +
     275              '<span class="from lineNumber">337</span><span class="to lineNumber">339</span><span class="text"></span>' +
     276              '</div>' +
     277              '<div class="Line LineContainer">' +
     278              '<span class="from lineNumber">338</span><span class="to lineNumber">340</span><span class="text">    LayoutUnit oldClientAfterEdge = clientLogicalBottom();</span>' +
     279              '</div>' +
     280            '</div><div class="clear_float">' +
     281          '</div>' +
     282        '</div>' +
     283      '</div>';
     284
     285  next_line_id = 0;
     286  eraseDraftComments();
     287  crawlDiff();
     288
     289  convertAllFileDiffs('sidebyside', $('.FileDiff'));
     290
     291  displayPreviousComments([{
     292    author: 'ojan@chromium.org',
     293    file_name: 'Source/WebCore/ChangeLog',
     294    line_number: 338,
     295    comment_text: 'This change sux.'
     296  }]);
     297
     298  var previous_comment = document.querySelector('.previousComment');
     299  ASSERT_EQUAL(previous_comment.getAttribute('data-comment-for'), 'line0');
     300
     301  var new_comment = addCommentField(previous_comment);
     302  ASSERT("New comment should exist and contain a textarea.", new_comment.find('textarea'));
     303
     304  document.getElementById('diff-content').innerHTML = '';
     305}
     306
    264307function testIsChangeLog() {
    265308  ASSERT("Top-level ChangeLog file is a ChangeLog file", isChangeLog("ChangeLog"));
  • trunk/Websites/bugs.webkit.org/code-review.js

    r112827 r136556  
    6767  var maxLeftSideRatio = 90;
    6868  var file_diff_being_resized = null;
    69   var next_line_id = 0;
    7069  var files = {};
    7170  var original_file_contents = {};
     
    9089  }
    9190
    92   function nextLineID() {
    93     return idForLine(next_line_id++);
    94   }
    95 
    9691  function forEachLine(callback) {
    97     for (var i = 0; i < next_line_id; ++i) {
    98       callback($('#' + idForLine(i)));
    99     }
    100   }
    101 
    102   function idify() {
    103     this.id = nextLineID();
     92    var i = 0;
     93    var line;
     94    do {
     95      line = $('#' + idForLine(i));
     96      if (line[0])
     97        callback(line);
     98      i++;
     99    } while (line[0]);
    104100  }
    105101
     
    424420        if ($(this).text() != line_number)
    425421          return;
    426         var line = $(this).parent();
     422        var line = lineContainerFromDescendant($(this));
    427423        addPreviousComment(line, author, comment_text);
    428424      });
     
    602598
    603599  function crawlDiff() {
     600    var next_line_id = 0;
     601    var idify = function() {
     602      this.id = idForLine(next_line_id++);
     603    }
     604
    604605    $('.Line').each(idify).each(hoverify);
    605606    $('.FileDiff').each(function() {
     
    19291930  }
    19301931
     1932  function lineContainerFromDescendant(descendant) {
     1933    return descendant.hasClass('LineContainer') ? descendant : descendant.parents('.LineContainer');
     1934  }
     1935
    19311936  function lineFromLineContainer(lineContainer) {
    19321937    var line = $(lineContainer);
     
    20382043    window.tracLinks = tracLinks;
    20392044    window.crawlDiff = crawlDiff;
     2045    window.convertAllFileDiffs = convertAllFileDiffs;
     2046    window.displayPreviousComments = displayPreviousComments;
    20402047    window.discardComment = discardComment;
    20412048    window.addCommentField = addCommentField;
Note: See TracChangeset for help on using the changeset viewer.