Changeset 83750 in webkit
- Timestamp:
- Apr 13, 2011 11:04:30 AM (13 years ago)
- Location:
- trunk/Websites/bugs.webkit.org
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/bugs.webkit.org/ChangeLog
r83616 r83750 1 2011-04-12 Tony Chang <tony@chromium.org> 2 3 Reviewed by Adam Roben. 4 5 make PrettyPatch.rb aware of checksums in png files 6 https://bugs.webkit.org/show_bug.cgi?id=58387 7 8 * PrettyPatch/PrettyPatch.rb: 9 1 10 2011-04-12 Adam Barth <abarth@webkit.org> 2 11 -
trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
r81180 r83750 229 229 } 230 230 231 .Line.add {231 .Line.add, .FileDiff .add { 232 232 background-color: #dfd; 233 233 } … … 238 238 } 239 239 240 .Line.remove {240 .Line.remove, .FileDiff .remove { 241 241 background-color: #fdd; 242 242 } … … 517 517 if @image 518 518 @image_url = "data:image/png;base64," + lines_with_contents.join 519 @image_checksum = FileDiff.read_checksum_from_png(lines_with_contents.join.unpack("m").join) 519 520 elsif @git_image 520 521 begin … … 531 532 raise "no binary chunks" unless chunks 532 533 533 @image_urls = chunks.zip(@git_indexes).collect do |chunk, git_index|534 binary_contents = chunks.zip(@git_indexes).collect do |chunk, git_index| 534 535 FileDiff.extract_contents_from_git_binary_chunk(chunk, git_index) 535 536 end 537 538 @image_urls = binary_contents.collect { |content| "data:image/png;base64," + [content].pack("m") } 539 @image_checksums = binary_contents.collect { |content| FileDiff.read_checksum_from_png(content) } 536 540 rescue 537 541 @image_error = "Exception raised during decoding git binary patch:<pre>#{CGI.escapeHTML($!.to_s + "\n" + $!.backtrace.join("\n"))}</pre>" … … 545 549 str += "<h1>#{PrettyPatch.linkifyFilename(@filename)}</h1>\n" 546 550 if @image then 551 if @image_checksum then 552 str += "<p>" + @image_checksum + "</p>" 553 end 547 554 str += "<img class='image' src='" + @image_url + "' />" 548 555 elsif @git_image then … … 552 559 for i in (0...2) 553 560 image_url = @image_urls[i] 561 image_checksum = @image_checksums[i] 562 554 563 style = ["remove", "add"][i] 555 564 str += "<p class=\"#{style}\">" 565 566 if image_checksum 567 str += image_checksum + "<br>" 568 end 556 569 if image_url 557 570 str += "<img class='image' src='" + image_url + "' />" … … 591 604 end 592 605 606 def self.read_checksum_from_png(png_bytes) 607 match = png_bytes.match(/tEXtchecksum\0([a-fA-F0-9]{32})/) 608 match ? match[1] : nil 609 end 610 593 611 def self.git_new_file_binary_patch(filename, encoded_chunk, git_index) 594 612 return <<END … … 633 651 634 652 return nil if contents.empty? 635 return "data:image/png;base64," + [contents].pack("m")653 return contents 636 654 end 637 655 end
Note: See TracChangeset
for help on using the changeset viewer.