Bug 46051 - SVG: Make RenderPath DRT output platform-independent
Summary: SVG: Make RenderPath DRT output platform-independent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 47053
Blocks: 46052
  Show dependency treegraph
 
Reported: 2010-09-19 09:05 PDT by Andreas Kling
Modified: 2010-10-08 02:50 PDT (History)
6 users (show)

See Also:


Attachments
Proposed patch, first stab (8.74 KB, patch)
2010-09-19 09:21 PDT, Andreas Kling
zimmermann: review-
Details | Formatted Diff | Diff
Proposed patch v2 (4.29 KB, patch)
2010-09-20 06:11 PDT, Andreas Kling
zimmermann: review+
Details | Formatted Diff | Diff
Mac layout test results (deleted)
2010-10-08 02:29 PDT, Nikolas Zimmermann
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2010-09-19 09:05:45 PDT
DRT currently uses the port-specific Path::debugString() to dump RenderPath objects.

We should switch to using a platform-independent output format for paths, and also simplify the format used for primitives (rect, circle, ellipse, line and polygon.)

See also: https://lists.webkit.org/pipermail/webkit-dev/2010-September/014419.html
Comment 1 Andreas Kling 2010-09-19 09:21:50 PDT
Created attachment 68026 [details]
Proposed patch, first stab

A first modest attempt at this - not gonna bother rebaselining tests just yet.
Comment 2 WebKit Review Bot 2010-09-19 09:22:41 PDT
Attachment 68026 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/rendering/SVGRenderTreeAsText.cpp:65:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Antonio Gomes 2010-09-19 09:30:43 PDT
See also bug 33784.
Comment 4 Nikolas Zimmermann 2010-09-20 04:02:52 PDT
Comment on attachment 68026 [details]
Proposed patch, first stab

Looks good to me!
I'd propose to not add those virtual methods (isRectElement) etc, just for the sake of DRT.
Just compare the tag names: if (svgElement->hasTagName(SVGNames::rectTag)) { ...}
Comment 5 Andreas Kling 2010-09-20 06:11:53 PDT
Created attachment 68073 [details]
Proposed patch v2

Using tag names instead of adding virtuals, as per Niko's request.
Comment 6 Nikolas Zimmermann 2010-09-20 08:19:55 PDT
Comment on attachment 68073 [details]
Proposed patch v2

Looks great Andreas! Can you please upload a seperated patch including all rebaselines first?
You also have to take special care of all platform specific results, not living in platform/mac.
I'll r+ it afterwards.
Comment 7 Andreas Kling 2010-09-20 08:24:23 PDT
(In reply to comment #6)
> (From update of attachment 68073 [details])
> Looks great Andreas! Can you please upload a seperated patch including all rebaselines first?
> You also have to take special care of all platform specific results, not living in platform/mac.
> I'll r+ it afterwards.

I only have access to the Qt platform right now, so I can do those - would it be acceptable to use "webkit-patch rebaseline" to complete with results from bots after landing? (I will upload a patch with Qt rebaselines first.)
Comment 8 Nikolas Zimmermann 2010-09-20 08:41:51 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (From update of attachment 68073 [details] [details])
> > Looks great Andreas! Can you please upload a seperated patch including all rebaselines first?
> > You also have to take special care of all platform specific results, not living in platform/mac.
> > I'll r+ it afterwards.
> 
> I only have access to the Qt platform right now, so I can do those - would it be acceptable to use "webkit-patch rebaseline" to complete with results from bots after landing? (I will upload a patch with Qt rebaselines first.)

Hmm, that's a problem, as IIRC the bots exit after 20 failures, so it would require many iterations to fix all Mac bots.
Can someone generate the mac results for you, my tree is hosed atm?
Comment 9 Andreas Kling 2010-09-23 06:24:25 PDT
I've asked Ossy to help with Qt results and Tor Arne with Mac.
Comment 10 Csaba Osztrogonác 2010-09-23 09:19:15 PDT
(In reply to comment #8)
> Hmm, that's a problem, as IIRC the bots exit after 20 failures, so it would require many iterations to fix all Mac bots.

No, fortunately bots use "--exit-after-n-crashes-or-timeouts 20"
option instead of previous "--exit-after-n-failures 20". ;)
Comment 11 Csaba Osztrogonác 2010-09-23 09:22:42 PDT
(In reply to comment #9)
> I've asked Ossy to help with Qt results and Tor Arne with Mac.

I checked your patch, normally we should update ~140 expected files.
But I thought over this task, and I have a better idea. :) We should
update platform independent expected files first, and Qt specific
after that. I hope we can remove some Qt specific files.
Comment 12 Andreas Kling 2010-09-23 09:42:31 PDT
(In reply to comment #10)
> No, fortunately bots use "--exit-after-n-crashes-or-timeouts 20"
> option instead of previous "--exit-after-n-failures 20". ;)

> I checked your patch, normally we should update ~140 expected files.
> But I thought over this task, and I have a better idea. :) We should
> update platform independent expected files first, and Qt specific
> after that. I hope we can remove some Qt specific files.

That would be fantastic. :) Nikolas, thoughts?
Comment 13 Dirk Schulze 2010-09-29 12:57:05 PDT
(In reply to comment #12)
> (In reply to comment #10)
> > No, fortunately bots use "--exit-after-n-crashes-or-timeouts 20"
> > option instead of previous "--exit-after-n-failures 20". ;)
> 
> > I checked your patch, normally we should update ~140 expected files.
> > But I thought over this task, and I have a better idea. :) We should
> > update platform independent expected files first, and Qt specific
> > after that. I hope we can remove some Qt specific files.
> 
> That would be fantastic. :) Nikolas, thoughts?

To the patch. Please correct me if I'm wrong, but you may get just the relative values for rect or circle, if x,y,.. are in percentage. It would be great if we could get the repaintRect of the shape.
On the other side, we'll get platform dependent results again, because RenderPath::repaintRectInLocalCoordinates() calls Path::strokeBoundaries and Path::fillBoundaries. So I'm still unsure if this is the right way to go.

Niko, what is your opinion?
Comment 14 Dirk Schulze 2010-09-29 13:00:10 PDT
(In reply to comment #11)
> (In reply to comment #9)
> > I've asked Ossy to help with Qt results and Tor Arne with Mac.
> 
> I checked your patch, normally we should update ~140 expected files.
> But I thought over this task, and I have a better idea. :) We should
> update platform independent expected files first, and Qt specific
> after that. I hope we can remove some Qt specific files.

Yes, it's better to test it on mac, create the reuslts and look if other platforms can reuse it afterwards. But we'll still end up with different results because of the fonts.
Comment 15 Nikolas Zimmermann 2010-10-01 03:10:10 PDT
Comment on attachment 68073 [details]
Proposed patch v2

As discussed on IRC, the right way to go is to introduce a RenderSVGShape class whose repaintRectInLocalCoordinates can be dumped.
The problem is that dumping RenderPath::repaintRectInLocalCoordinates, is that it's platform-dependant, as Path::boundingBox is used.

As first step, I'd introduce RenderSVGShape : public RenderPath (which should be renamed and moved to rendering/svg/RenderSVGPath first)
and let SVGCircle/RectElement etc. create RenderSVGShape instead of RenderSVGPath.

Once that's done, we need to introduce platform-dependant ways to create rects, circles, instead of the home-brewn code in Path.cpp (addEllipse, etc.)
Then we need to write a method which calculates the circle/rect/etc. boundaries in a _cross platform_ fashion.

Then RenderSVGShape can use this new logic, and inherit from RenderSVGModelObject, and be completly decoupled from RenderSVGPath.
Once that's done the DRT problem vanishes.

(This is just a short summary of the IRC discussion).
Comment 16 Nikolas Zimmermann 2010-10-08 01:29:18 PDT
(In reply to comment #15)
> (From update of attachment 68073 [details])
> As discussed on IRC, the right way to go is to introduce a RenderSVGShape class whose repaintRectInLocalCoordinates can be dumped.
> The problem is that dumping RenderPath::repaintRectInLocalCoordinates, is that it's platform-dependant, as Path::boundingBox is used.
> 
> As first step, I'd introduce RenderSVGShape : public RenderPath (which should be renamed and moved to rendering/svg/RenderSVGPath first)
> and let SVGCircle/RectElement etc. create RenderSVGShape instead of RenderSVGPath.
> 
> Once that's done, we need to introduce platform-dependant ways to create rects, circles, instead of the home-brewn code in Path.cpp (addEllipse, etc.)
> Then we need to write a method which calculates the circle/rect/etc. boundaries in a _cross platform_ fashion.
> 
> Then RenderSVGShape can use this new logic, and inherit from RenderSVGModelObject, and be completly decoupled from RenderSVGPath.
> Once that's done the DRT problem vanishes.

Ok, we had another discussion. This approach is fine.
We'll just move SVG away from using the static Path::create* methods, and let them use Path::addEllipse etc. These methods already ask their platform specific implementations, and we don't need to decompose ellipses to paths etc. on our own.

Andreas patch is just fine!
I'll upload a baseline for mac, soon.
Comment 17 Nikolas Zimmermann 2010-10-08 01:31:10 PDT
Comment on attachment 68073 [details]
Proposed patch v2

Ok, we made up our mind.
Comment 18 Nikolas Zimmermann 2010-10-08 02:29:08 PDT
Created attachment 70215 [details]
Mac layout test results

As mentioned on IRC, the patch is missing an " || svgElement->hasTagName(SVGNames::polylineTag)" branch, the rest is perfect.
Please land your patch together with the mac results.
Comment 19 Andreas Kling 2010-10-08 02:50:24 PDT
Committed r69386: <http://trac.webkit.org/changeset/69386>