<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>21565</bug_id>
          
          <creation_ts>2008-10-12 20:11:10 -0700</creation_ts>
          <short_desc>Don&apos;t depend on the suggested filename for image document titles</short_desc>
          <delta_ts>2008-11-02 20:33:43 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Images</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brett Wilson (Google)">brettw</reporter>
          <assigned_to name="Brett Wilson (Google)">brettw</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95146</commentid>
    <comment_count>0</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2008-10-12 20:11:10 -0700</bug_when>
    <thetext>The title for image documents is currently computed based on the &quot;suggested filename&quot; of the resource response.

Apparently, the Mac networking library always gives a &quot;suggested filename&quot; for all loads, regardless of whether there was actually a filename header in the response (typically, there is not). This seems to fall back on using the URL.

Chromium&apos;s networking code doesn&apos;t do this, and computing a fallback suggested filename for each load would be a waste of time, since it is almost never used. The current behavior is also not that great for Safari, since the fill URL isn&apos;t always a very good title for image documents.

After chatting with andersca on #webkit, we both think the best solution is to modify ImageDocument to just use the lastPathComponent of the URL (possibly with some fallback if that&apos;s empty) instead of the suggested filename. This will work better for different platforms, and doesn&apos;t require us to compute a suggested filename for every single load. It will also give better image document titles in many cases. This is what Firefox does.

For comparison, IE seems to use the entire URL as the title. I don&apos;t think this is as good, but if we want that, a better solution is to just use the URL rather than relying on the networking library to give a suggested filename equal to the URL of the image (and have this randomly be different depending on response headers).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95451</commentid>
    <comment_count>1</comment_count>
      <attachid>24371</attachid>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2008-10-15 14:46:45 -0700</bug_when>
    <thetext>Created attachment 24371
Patch

Use the fiename of the image URL as the title, which matches Firefox.

This uses the hostname as the fallback when there is no path component to use as the title. We can also fall back to the full URL, but that seemed like it would be longer and is not likely to contain more information.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95735</commentid>
    <comment_count>2</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2008-10-17 08:58:08 -0700</bug_when>
    <thetext>Fixed in r37655.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97442</commentid>
    <comment_count>3</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2008-11-02 20:33:43 -0800</bug_when>
    <thetext>I&apos;m not sure this was the right fix.  Chromium has issues with other cases besides image documents, such as HTML documents with no &lt;title&gt; and files handled by plugins.  The Chromium code is being fixed to handle all these in one change.

It may be reasonable for images to do something special anyway, e.g. &quot;foo.gif (GIF image, 200x192)&quot;, but just setting a title to the filename seems like something the port can do automatically when the document has no title (or else that can happen somewhere less low-level than here).

Thoughts?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>24371</attachid>
            <date>2008-10-15 14:46:45 -0700</date>
            <delta_ts>2008-10-17 04:32:57 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>image_title.diff</filename>
            <type>text/plain</type>
            <size>1694</size>
            <attacher name="Brett Wilson (Google)">brettw</attacher>
            
              <data encoding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7CisgICAgICAgIH0K
IAogICAgICAgICBtX2RvYy0+aW1hZ2VDaGFuZ2VkKCk7CiAgICAgfQo=
</data>
<flag name="review"
          id="11110"
          type_id="1"
          status="+"
          setter="timothy"
    />
          </attachment>
      

    </bug>

</bugzilla>