WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
52400
add container divs for diff blocks
https://bugs.webkit.org/show_bug.cgi?id=52400
Summary
add container divs for diff blocks
Ojan Vafai
Reported
2011-01-13 14:54:10 PST
add container divs for diff blocks
Attachments
Patch
(9.30 KB, patch)
2011-01-13 15:02 PST
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(8.99 KB, patch)
2011-01-13 15:26 PST
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(9.04 KB, patch)
2011-01-13 15:41 PST
,
Ojan Vafai
abarth
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ojan Vafai
Comment 1
2011-01-13 15:02:06 PST
Created
attachment 78860
[details]
Patch
Ojan Vafai
Comment 2
2011-01-13 15:03:07 PST
I don't really know ruby at all, so don't hesitate to let me know if I'm doing something in a stupid way.
Adam Barth
Comment 3
2011-01-13 15:09:17 PST
Comment on
attachment 78860
[details]
Patch The JavaScript parts look good to me. The ruby parts are mysterious.
Ojan Vafai
Comment 4
2011-01-13 15:26:39 PST
Created
attachment 78864
[details]
Patch
Adam Roben (:aroben)
Comment 5
2011-01-13 15:28:59 PST
Comment on
attachment 78860
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=78860&action=review
> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:611 > + @blocks = [] > + diff_block_part = nil
It's strange that you declare diff_block_part here but not diff_block.
> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:614 > + for index in 1...lines.length > + line = lines[index]
A more idiomatic way of doing this is: lines[1...lines.length].each do |line| or: for line in lines[1...lines.length]
> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:619 > + if (!diff_block_part or (diff_block_part.className != 'remove' and diff_block_part.lines.length != 0))
It's more idiomatic to say diff_block_part.nil? instead of !diff_block_part. Similarly, !diff_block_part.lines.empty? is better than diff_block_part.lines.length != 0. How would we end up with a DiffBlockPart that has no lines?
Ojan Vafai
Comment 6
2011-01-13 15:41:25 PST
Created
attachment 78867
[details]
Patch
Ojan Vafai
Comment 7
2011-01-13 15:42:29 PST
Comment on
attachment 78860
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=78860&action=review
>> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:611 >> + diff_block_part = nil > > It's strange that you declare diff_block_part here but not diff_block.
Declared both. In practice, we always create a diff_block before accessing it, but this seems cleaner anyways.
>> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:614 >> + line = lines[index] > > A more idiomatic way of doing this is: > > lines[1...lines.length].each do |line| > > or: > > for line in lines[1...lines.length]
Did the latter.
>> Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:619 >> + if (!diff_block_part or (diff_block_part.className != 'remove' and diff_block_part.lines.length != 0)) > > It's more idiomatic to say diff_block_part.nil? instead of !diff_block_part. Similarly, !diff_block_part.lines.empty? is better than diff_block_part.lines.length != 0. > > How would we end up with a DiffBlockPart that has no lines?
Used nil? and removed the lines length checks. That was a leftover from a previous iteration that happened to be correct (whoops!).
Adam Barth
Comment 8
2011-01-13 15:48:56 PST
Comment on
attachment 78867
[details]
Patch aroben said he was happy with the ruby and I'm happy with the JS. Let's rock and roll.
Ojan Vafai
Comment 9
2011-01-13 15:53:08 PST
Committed
r75747
: <
http://trac.webkit.org/changeset/75747
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug