<?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>25404</bug_id>
          
          <creation_ts>2009-04-25 20:30:08 -0700</creation_ts>
          <short_desc>Bounds Calculation for Text stroke with opacity &lt; 1 not correct</short_desc>
          <delta_ts>2010-07-01 09:11:39 -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>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</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>
          <dependson>23881</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jeff Schiller">jeffschiller</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>krit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>118871</commentid>
    <comment_count>0</comment_count>
    <who name="Jeff Schiller">jeffschiller</who>
    <bug_when>2009-04-25 20:30:08 -0700</bug_when>
    <thetext>The attached test case demonstrates an error in Webkit:  When a &lt;text&gt; element has an opacity &lt; 1.0, the calculation for the bounds of the stroke are incorrect (the left and right edges are erroneously clipped)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118872</commentid>
    <comment_count>1</comment_count>
      <attachid>29796</attachid>
    <who name="Jeff Schiller">jeffschiller</who>
    <bug_when>2009-04-25 20:30:25 -0700</bug_when>
    <thetext>Created attachment 29796
Test Case showing the problem</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118953</commentid>
    <comment_count>2</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2009-04-26 23:11:53 -0700</bug_when>
    <thetext>I see this problem on webkitgtk too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119182</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-04-28 15:17:32 -0700</bug_when>
    <thetext>The problem here would be that FloatRect RenderSVGText::repaintRectInLocalCoordinates() const isn&apos;t including the stroke correctly, I suspect.  It has some code which tries to include the stroke, but it must be wrong.

It&apos;s also possible that this is a CG bug... because I don&apos;t think we specify the size of the transparency layer when we tell CG that we need to render transparent text... hum.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119183</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-04-28 15:20:47 -0700</bug_when>
    <thetext>krit and jamesr point out that the G in the second bottom left Gradient is cut off at the top in:
http://www.w3.org/Graphics/SVG/Test/20061213/htmlObjectHarness/full-pservers-grad-08-b.html

Probably the same (or at least related) problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119191</commentid>
    <comment_count>5</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2009-04-28 15:45:01 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; krit and jamesr point out that the G in the second bottom left Gradient is cut
&gt; off at the top in:
&gt; http://www.w3.org/Graphics/SVG/Test/20061213/htmlObjectHarness/full-pservers-grad-08-b.html
&gt; 
&gt; Probably the same (or at least related) problem.

It&apos;s not direclt related to this. The G-bug was a problem in SVGResourceGradient and it&apos;s neither a CG-bug. I see it on WebKitGtk. We must have a check, if opacity&lt;1 use objectBoundingBox or something like that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119193</commentid>
    <comment_count>6</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-04-28 15:58:02 -0700</bug_when>
    <thetext>There are a couple places where we&apos;re still using objectBoundingBox() where we mean repaintRectInLocalCoordinates()  However changing those didn&apos;t fix the entire problem for full-pservers...

I think the full-pservers... bug is a separate issue.  This bug is likely cause by this code:

void SVGRootInlineBox::paint(RenderObject::PaintInfo&amp; paintInfo, int tx, int ty)
{
    if (paintInfo.context-&gt;paintingDisabled() || paintInfo.phase != PaintPhaseForeground)
        return;

    RenderObject::PaintInfo savedInfo(paintInfo);
    paintInfo.context-&gt;save();

    SVGResourceFilter* filter = 0;
    FloatRect boundingBox(tx + x(), ty + y(), width(), height());

    // Initialize text rendering
    prepareToRenderSVGContent(renderer(), paintInfo, boundingBox, filter);

Which is using a bad boundingBox calculation there.  prepareToRenderSVGContent needs to be changed to take a separate objectBoundingBox() and repaintRectInLocalCoordinates() and use the repaint rect for  the opacity clip (which we do set up manually) and the objectBoundingBox for filter setup (which we&apos;re not actually doing in ToT since filters are turned off).

maybe x(), y(), width(), height() is right, but I doubt it includes stroke width.  SVGRootInlineBox probably needs its own repaintRectInLocalCoordinates() method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119195</commentid>
    <comment_count>7</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-04-28 16:00:42 -0700</bug_when>
    <thetext>I&apos;ve split the &apos;G&apos; painting bug off into its own bug: https://bugs.webkit.org/show_bug.cgi?id=25460</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176055</commentid>
    <comment_count>8</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2009-12-30 14:44:54 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; There are a couple places where we&apos;re still using objectBoundingBox() where we
&gt; mean repaintRectInLocalCoordinates()  However changing those didn&apos;t fix the
&gt; entire problem for full-pservers...
&gt; 
&gt; I think the full-pservers... bug is a separate issue.  This bug is likely cause
&gt; by this code:
&gt; 
&gt; void SVGRootInlineBox::paint(RenderObject::PaintInfo&amp; paintInfo, int tx, int
&gt; ty)
&gt; {
&gt;     if (paintInfo.context-&gt;paintingDisabled() || paintInfo.phase !=
&gt; PaintPhaseForeground)
&gt;         return;
&gt; 
&gt;     RenderObject::PaintInfo savedInfo(paintInfo);
&gt;     paintInfo.context-&gt;save();
&gt; 
&gt;     SVGResourceFilter* filter = 0;
&gt;     FloatRect boundingBox(tx + x(), ty + y(), width(), height());
&gt; 
&gt;     // Initialize text rendering
&gt;     prepareToRenderSVGContent(renderer(), paintInfo, boundingBox, filter);
&gt; 
&gt; Which is using a bad boundingBox calculation there.  prepareToRenderSVGContent
&gt; needs to be changed to take a separate objectBoundingBox() and
&gt; repaintRectInLocalCoordinates() and use the repaint rect for  the opacity clip
&gt; (which we do set up manually) and the objectBoundingBox for filter setup (which
&gt; we&apos;re not actually doing in ToT since filters are turned off).
&gt; 
&gt; maybe x(), y(), width(), height() is right, but I doubt it includes stroke
&gt; width.  SVGRootInlineBox probably needs its own repaintRectInLocalCoordinates()
&gt; method.

I thing you&apos;re right. We give the objectBoundingBox to prepareToRenderSVGContent instead of the repaint Rect. This is wrong. It&apos;s not neccessary to give the obb to prepareToRenderSVGContent. It already has the object and can ask for the obb itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>245373</commentid>
    <comment_count>9</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2010-07-01 09:11:39 -0700</bug_when>
    <thetext>This is fixed with trunk. Closing the bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>29796</attachid>
            <date>2009-04-25 20:30:25 -0700</date>
            <delta_ts>2009-04-25 20:30:25 -0700</delta_ts>
            <desc>Test Case showing the problem</desc>
            <filename>text-stroke-opacity.svg</filename>
            <type>image/svg+xml</type>
            <size>380</size>
            <attacher name="Jeff Schiller">jeffschiller</attacher>
            
              <data encoding="base64">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxz
dmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDov
L3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iODUwIiBoZWlnaHQ9
IjIwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CiAgPHRleHQgeD0iMzAiIHk9IjYwIiBzdHJva2Ut
d2lkdGg9IjgiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIg
b3BhY2l0eT0iMC45OSIgc3Ryb2tlPSJibGFjayIgZm9udC1zaXplPSI1MS41cHgiIGZvbnQtd2Vp
Z2h0PSJib2xkIj5TVkcgT3BlbiAyMDA5PC90ZXh0Pgo8L3N2Zz4=
</data>

          </attachment>
      

    </bug>

</bugzilla>