Closed Bug 853889 Opened 12 years ago Closed 9 years ago

SVG path with more than one subpath can render incorrectly

Categories

(Core :: Graphics, defect)

22 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: eugeniom, Assigned: twointofive)

Details

Attachments

(3 files, 3 obsolete files)

Attached file test-svg.html
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.40 Safari/537.31 Steps to reproduce: Tried to render a path with two subpaths (i.e. d=".... Z ... Z"). This subpath was generated by code, from the conversion of a Flash ad. Actual results: When one of the subpaths is outside the viewBox of the SVG, the whole path (i.e. the part that is inside the viewBox and visible) is rendered incorrectly. Expected results: In the attached example, it should render a green bar (one of the subpaths) but instead it renders a red bar that should be covered by it.
Component: Untriaged → SVG
Product: Firefox → Core
Attachment #728248 - Attachment mime type: text/plain → text/html
Works for me on Windows using Firefox nightly. Would you try a build from https://nightly.mozilla.org
Flags: needinfo?(eugeniom)
Tested in both current and nighties for Linux and it does not work. I had missed that it does work in Mac OS (and apparently in Windows as well).
Flags: needinfo?(eugeniom)
Version: 19 Branch → 22 Branch
Attached image testcase2.svg
This looks to be a cairo bug; the attached slightly modified testcase shows the broken behavior a little more clearly: when drawing the green path, in _cairo_path_fixed_fill_rectilinear_to_boxes we take the else leg where _cairo_path_fixed_iter_is_fill_box returns a box for the first subpath that has its p1 to the right of its p2. _cairo_traps_tessellate_rectangle adds that box to |traps| as a trap with its left side to the right of its right side, and then sends |traps| with one element to _cairo_bentley_ottmann_tessellate_rectangular_traps (the other subpath got clipped out). _cairo_bentley_ottmann_tessellate_rectangular_traps doesn't do anything if there's only one trap, so |traps| gets returned unadjusted. Eventually it makes its way to _cairo_xlib_surface_fill_rectangles which calls XRenderFillRectangle on a rectangle with a negative width (because the sides of the trap were switched), only XRenderFillRectangle takes width as unsigned, so we get the very wide green rectangle going in the wrong direction.
Assignee: nobody → twointofive
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch bug853889.diff (obsolete) — Splinter Review
I submitted a patch that fixes this to cairo (the same as the attached patch): https://bugs.freedesktop.org/show_bug.cgi?id=90984 but note that this bug isn't actually reproducible in the current cairo code (though the patch still seems relevant), i.e. this works upstream, but it seems to me the original bug/hole still exists. I'll update once I hear back from them.
Milan would you review or suggest a reviewer?
Component: SVG → Graphics
Flags: needinfo?(milan)
Attached patch bug853889.diff (obsolete) — Splinter Review
Added a reftest.
Attachment #8622629 - Attachment is obsolete: true
Flags: needinfo?(milan)
Attachment #8622782 - Flags: review?(jmuizelaar)
Attachment #8622782 - Flags: review?(jmuizelaar) → review+
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5e51a0f3b4d0 Getting some intermittent failures. M-bc2 and M-bc3 failed on the first run, but I ran them again and they passed. Plus the failures appear to be known issues, though one failure report is marked as WORKSFORME... M-dt8 failed twice on the try, with different tests failing on each run, but all the failures seem to be known issues, though one of the failure reports has been marked as FIXED... So a) am I supposed to do anything with the failures that have been marked as WORKSFORME and FIXED? b) Does the fact that these are all known issues mean that effectively I can ignore them? (Especially since all of them work for me locally on my linux debug build (pulled to the most recent code)...) Thanks
Keywords: checkin-needed
Attached patch bug853889.diff (obsolete) — Splinter Review
Apparently android and b2g were failing on a similar bug in _cairo_bentley_ottmann_tessellate_boxes that has already been fixed in upstream cairo, so I added their fix to this patch - do I need to indicate that in some other way? i.e. that that's not my code - and the try runs look good: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c962c38e93f0 https://treeherder.mozilla.org/#/jobs?repo=try&revision=3a2b369391e2 (missed Android 2.3 on the first try)
Attachment #8622782 - Attachment is obsolete: true
Attachment #8624177 - Flags: review?(jmuizelaar)
(In reply to Tom Klein from comment #12) > Created attachment 8624177 [details] [diff] [review] > bug853889.diff > > Apparently android and b2g were failing on a similar bug in > _cairo_bentley_ottmann_tessellate_boxes that has already been fixed in > upstream cairo, so I added their fix to this patch - do I need to indicate > that in some other way? i.e. that that's not my code - and the try runs look > good: > https://treeherder.mozilla.org/#/jobs?repo=try&revision=c962c38e93f0 > https://treeherder.mozilla.org/#/jobs?repo=try&revision=3a2b369391e2 (missed > Android 2.3 on the first try) If you can reference the upstream commit hash in the commit message that would be great.
Attachment #8624177 - Flags: review?(jmuizelaar) → review+
Attached patch bug853889.diffSplinter Review
Updated the commit message to include the cairo commit hash for the _cairo_bentley_ottmann_tessellate_boxes part of this patch.
Attachment #8624177 - Attachment is obsolete: true
Attachment #8624446 - Flags: checkin?
Comment on attachment 8624446 [details] [diff] [review] bug853889.diff In the future, please just use the checkin-needed bug keyword. It works better with the various automated bug marking tools.
Attachment #8624446 - Flags: checkin?
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: