<?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>67885</bug_id>
          
          <creation_ts>2011-09-09 23:35:00 -0700</creation_ts>
          <short_desc>Outline for the high-resolution broken image icon draws at 2x</short_desc>
          <delta_ts>2011-09-13 16:17:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Beth Dakin">bdakin</reporter>
          <assigned_to name="Beth Dakin">bdakin</assigned_to>
          <cc>bdakin</cc>
    
    <cc>darin</cc>
    
    <cc>mitz</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>465241</commentid>
    <comment_count>0</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-09 23:35:00 -0700</bug_when>
    <thetext>https://bugs.webkit.org/show_bug.cgi?id=67819 added high resolution platform images to WebCore. The outline for the high-resolution broken image icon draws at 2x, but it should not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>465242</commentid>
    <comment_count>1</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-09 23:36:43 -0700</bug_when>
    <thetext>&lt;rdar://problem/10104637&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466520</commentid>
    <comment_count>2</comment_count>
      <attachid>107223</attachid>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 14:09:19 -0700</bug_when>
    <thetext>Created attachment 107223
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466523</commentid>
    <comment_count>3</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 14:21:40 -0700</bug_when>
    <thetext>Also: &lt;rdar://problem/10104637&gt;. I added that the the Changelog as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466536</commentid>
    <comment_count>4</comment_count>
      <attachid>107223</attachid>
    <who name="">mitz</who>
    <bug_when>2011-09-13 14:31:41 -0700</bug_when>
    <thetext>Comment on attachment 107223
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=107223&amp;action=review

&gt; Source/WebCore/rendering/RenderImage.cpp:92
&gt; +        if (deviceScaleFactor &gt;= 2)
&gt; +            imageSize.scale(0.5f);        

It seems strange to always multiply by 1/2 rather than by 1/deviceScaleFactor. Is this relying on some knowledge of which sizes the broken image is available at?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466546</commentid>
    <comment_count>5</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 14:37:04 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; (From update of attachment 107223 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=107223&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/rendering/RenderImage.cpp:92
&gt; &gt; +        if (deviceScaleFactor &gt;= 2)
&gt; &gt; +            imageSize.scale(0.5f);        
&gt; 
&gt; It seems strange to always multiply by 1/2 rather than by 1/deviceScaleFactor. Is this relying on some knowledge of which sizes the broken image is available at?

This matter came up in https://bugs.webkit.org/show_bug.cgi?id=67819 

In that bug, Darin felt strongly that code similar to this in RenderLayer should use 0.5 instead of 1/deviceScaleFactor which was how I had coded it at one point. His argument was that currently we only have 2x images so (to quote him directly): &quot;If the scale factor was 4 we would load the 2x image and then scale its size down by 4, so so display a half-sized resized. Not good! It would just get worse at higher resolutions.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466559</commentid>
    <comment_count>6</comment_count>
      <attachid>107223</attachid>
    <who name="">mitz</who>
    <bug_when>2011-09-13 14:44:55 -0700</bug_when>
    <thetext>Comment on attachment 107223
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=107223&amp;action=review

&gt;&gt;&gt; Source/WebCore/rendering/RenderImage.cpp:92
&gt;&gt;&gt; +            imageSize.scale(0.5f);        
&gt;&gt; 
&gt;&gt; It seems strange to always multiply by 1/2 rather than by 1/deviceScaleFactor. Is this relying on some knowledge of which sizes the broken image is available at?
&gt; 
&gt; This matter came up in https://bugs.webkit.org/show_bug.cgi?id=67819 
&gt; 
&gt; In that bug, Darin felt strongly that code similar to this in RenderLayer should use 0.5 instead of 1/deviceScaleFactor which was how I had coded it at one point. His argument was that currently we only have 2x images so (to quote him directly): &quot;If the scale factor was 4 we would load the 2x image and then scale its size down by 4, so so display a half-sized resized. Not good! It would just get worse at higher resolutions.&quot;

I see. Dividing by the scale factor would be incorrect, and doing this is correct, but the reason why it’s correct is nowhere near this code. A comment here could explain why this is the right thing to do, but still won’t help us remember to change this when we add more versions of the image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466561</commentid>
    <comment_count>7</comment_count>
    <who name="">mitz</who>
    <bug_when>2011-09-13 14:46:18 -0700</bug_when>
    <thetext>A good way to have the code do the right thing would be to have a way to ask an image for its resolution (or scale factor), but that is outside the scope of this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466563</commentid>
    <comment_count>8</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 14:49:05 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; 
&gt; I see. Dividing by the scale factor would be incorrect, and doing this is correct, but the reason why it’s correct is nowhere near this code. A comment here could explain why this is the right thing to do, but still won’t help us remember to change this when we add more versions of the image.

Thanks for the review.

I agree this code is problematic in that it will be tricky to find in the future, unlike the RenderLayer code which is just a few lines below the call that actually loads the image. I will definitely add a comment here. Perhaps we should make 0.5 a global constant somewhere? Called something along the lines of highResolutionArtworkScaleFactor? When we have more then one scale factor for high-resolution artwork, the global constant will be insufficient, but it would at least make all instances more find-able? What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466567</commentid>
    <comment_count>9</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 14:50:35 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; A good way to have the code do the right thing would be to have a way to ask an image for its resolution (or scale factor), but that is outside the scope of this bug.

Oh that&apos;s a good idea too. (I didn&apos;t see this comment before I left my last comment.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466611</commentid>
    <comment_count>10</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 15:33:56 -0700</bug_when>
    <thetext>Committed this change with revision 95048…and then fixed up the ChangeLog mishap with revision 95051.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466621</commentid>
    <comment_count>11</comment_count>
    <who name="Beth Dakin">bdakin</who>
    <bug_when>2011-09-13 15:40:59 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; Committed this change with revision 95048…and then fixed up the ChangeLog mishap with revision 95051.

Doh! And in revision 95053 I added a comment. Feeling spacey today.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466643</commentid>
    <comment_count>12</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-09-13 16:17:14 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; A good way to have the code do the right thing would be to have a way to ask an image for its resolution (or scale factor), but that is outside the scope of this bug.

We don’t even have to go that far. Just returning a scale factor along with the image from the brokenImage function would do for this case.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>107223</attachid>
            <date>2011-09-13 14:09:19 -0700</date>
            <delta_ts>2011-09-13 14:44:55 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>for-review.txt</filename>
            <type>text/plain</type>
            <size>2171</size>
            <attacher name="Beth Dakin">bdakin</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDk1MDQzKQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTQgQEAKKzIwMTEtMDktMTMgIEJldGggRGFr
aW4gIDxiZGFraW5AYXBwbGUuY29tPgorCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3Jn
L3Nob3dfYnVnLmNnaT9pZD02Nzg4NQorICAgICAgICBPdXRsaW5lIGZvciB0aGUgaGlnaC1yZXNv
bHV0aW9uIGJyb2tlbiBpbWFnZSBpY29uIGRyYXdzIGF0IDJ4CisKKyAgICAgICAgUmV2aWV3ZWQg
YnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgU2NhbGVkIHRoZSBpbWFnZSBzaXplIHRvIGFj
Y291bnQgZm9yIHRoZSBkZXZpY2VTY2FsZUZhY3Rvci4gCisgICAgICAgICogcmVuZGVyaW5nL1Jl
bmRlckltYWdlLmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OlJlbmRlckltYWdlOjppbWFnZVNpemVG
b3JFcnJvcik6CisKIDIwMTEtMDktMTMgIEVyaWMgU2VpZGVsICA8ZXJpY0B3ZWJraXQub3JnPgog
CiAgICAgICAgIFJlbW92ZSBFTkFCTEVfU1ZHX0ZPUkVJR05fT0JKRUNUIGFzIGl0IGlzIGEgcmVx
dWlyZWQgcGFydCBvZiBIVE1MN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VNjYWxlRmFjdG9yID49IDIpCisgICAg
ICAgICAgICBpbWFnZVNpemUuc2NhbGUoMC41Zik7ICAgICAgICAKKyAgICB9IGVsc2UKKyAgICAg
ICAgaW1hZ2VTaXplID0gbmV3SW1hZ2UtPmltYWdlKCktPnNpemUoKTsKIAogICAgIC8vIGltYWdl
U2l6ZSgpIHJldHVybnMgMCBmb3IgdGhlIGVycm9yIGltYWdlLiBXZSBuZWVkIHRoZSB0cnVlIHNp
emUgb2YgdGhlCiAgICAgLy8gZXJyb3IgaW1hZ2UsIHNvIHdlIGhhdmUgdG8gZ2V0IGl0IGJ5IGdy
YWJiaW5nIGltYWdlKCkgZGlyZWN0bHkuCi0gICAgcmV0dXJuIEludFNpemUocGFkZGluZ1dpZHRo
ICsgYnJva2VuSW1hZ2UtPndpZHRoKCkgKiBzdHlsZSgpLT5lZmZlY3RpdmVab29tKCksIHBhZGRp
bmdIZWlnaHQgKyBicm9rZW5JbWFnZS0+aGVpZ2h0KCkgKiBzdHlsZSgpLT5lZmZlY3RpdmVab29t
KCkpOworICAgIHJldHVybiBJbnRTaXplKHBhZGRpbmdXaWR0aCArIGltYWdlU2l6ZS53aWR0aCgp
ICogc3R5bGUoKS0+ZWZmZWN0aXZlWm9vbSgpLCBwYWRkaW5nSGVpZ2h0ICsgaW1hZ2VTaXplLmhl
aWdodCgpICogc3R5bGUoKS0+ZWZmZWN0aXZlWm9vbSgpKTsKIH0KIAogLy8gU2V0cyB0aGUgaW1h
Z2UgaGVpZ2h0IGFuZCB3aWR0aCB0byBmaXQgdGhlIGFsdCB0ZXh0LiAgUmV0dXJucyB0cnVlIGlm
IHRoZQo=
</data>
<flag name="review"
          id="103863"
          type_id="1"
          status="+"
          setter="mitz"
    />
          </attachment>
      

    </bug>

</bugzilla>