title: Why does external-graphic scale-down-to-fit not work when height specified by percentage?
body: <p>Suppose I have an image "tall.png" which is too tall for the block that it is being placed in.  I would like the image to automatically scale down to fit into the parent block.</p>
  
  <p>A simple example of what I mean:</p>
  
  <pre><code>&lt;fo:block-container height="10cm" width="10cm" border="solid 0.5px black"&gt;
    &lt;fo:block&gt;
      &lt;fo:external-graphic src="tall.png"
         content-width="scale-down-to-fit" content-height="scale-down-to-fit"
         width="100%" height="100%"/&gt;
    &lt;/fo:block&gt;    
  &lt;/fo:block-container&gt;
  </code></pre>
  
  <p>The above code doesn't seem to work.  The resulting PDF shows the image spilling out of the block-container.  On the other hand, if I do this...</p>
  
  <pre><code>&lt;fo:block-container height="10cm" width="10cm" border="solid 0.5px black"&gt;
    &lt;fo:block&gt;
      &lt;fo:external-graphic src="tall.png"
         content-width="scale-down-to-fit" content-height="scale-down-to-fit"
         width="10cm" height="10cm"/&gt;
    &lt;/fo:block&gt;    
  &lt;/fo:block-container&gt;
  </code></pre>
  
  <p>That seems to work.  This surprises me since the height property should refer to the height of the containing block when you use percentages (<a href="http://www.w3schools.com/xslfo/prop_height.asp" rel="noreferrer">http://www.w3schools.com/xslfo/prop_height.asp</a>).    That makes me think that using 100% and using 10cm in my example should be exactly the same, but they don't produce the same result.</p>
  
  <p>For the actual problem that I am trying to solve, I can't hardcode the width and height for the external-graphic.  I need it to just stay within the height/width of its parent block, whatever that might be.  Any idea how to accomplish that?</p>