Changeset 84266 in webkit


Ignore:
Timestamp:
Apr 19, 2011 11:08:12 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-19 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>

Reviewed by Adam Roben.

PrettyPatch tries to show images for deleted files
https://bugs.webkit.org/show_bug.cgi?id=28457

When the image data is empty, instead of generating an <img> tag, generate
a text to indicate the image was deleted.

  • PrettyPatch/PrettyPatch.rb:
Location:
trunk/Websites/bugs.webkit.org
Files:
2 edited

Legend:

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

    r83870 r84266  
     12011-04-19  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Reviewed by Adam Roben.
     4
     5        PrettyPatch tries to show images for deleted files
     6        https://bugs.webkit.org/show_bug.cgi?id=28457
     7
     8        When the image data is empty, instead of generating an <img> tag, generate
     9        a text to indicate the image was deleted.
     10
     11        * PrettyPatch/PrettyPatch.rb:
     12
    1132011-04-14  Tony Chang  <tony@chromium.org>
    214
  • trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb

    r83870 r84266  
    515515            lines_with_contents = lines[startOfSections...lines.length]
    516516            @sections = DiffSection.parse(lines_with_contents) unless @binary
    517             if @image
     517            if @image and not lines_with_contents.empty?
    518518                @image_url = "data:image/png;base64," + lines_with_contents.join
    519519                @image_checksum = FileDiff.read_checksum_from_png(lines_with_contents.join.unpack("m").join)
     
    545545        end
    546546
     547        def image_to_html
     548            if not @image_url then
     549                return "<span class='text'>Image file removed</span>"
     550            end
     551            image_snippet = "<img class='image' src='" + @image_url + "' />"
     552            if not @image_checksum then
     553                return image_snippet
     554            end
     555            return "<p>" + @image_checksum + "</p>" + image_snippet
     556        end
     557
    547558        def to_html
    548559            str = "<div class='FileDiff'>\n"
    549560            str += "<h1>#{PrettyPatch.linkifyFilename(@filename)}</h1>\n"
    550561            if @image then
    551                 if @image_checksum then
    552                     str += "<p>" + @image_checksum + "</p>"
    553                 end
    554                 str += "<img class='image' src='" + @image_url + "' />"
     562                str += self.image_to_html
    555563            elsif @git_image then
    556564                if @image_error
Note: See TracChangeset for help on using the changeset viewer.