Closed Bug 355842 Opened 18 years ago Closed 18 years ago

Zero length lines not drawn (should be visible if stroke-linecap="round")

Categories

(Core :: SVG, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: x00000000, Assigned: tor)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060814 SeaMonkey/1.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061003 Firefox/2.0

Testcase with red circles as markers around the zero length lines to see that
the line actually exists:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 20 20"
  stroke="#000" stroke-linecap="round">

  <defs>
    <marker id="mark" viewBox="0 0 8 8" refX="4" refY="4" markerHeight="3">
      <circle cx="4" cy="4" r="3" stroke="#f00" fill="none"/>
    </marker>
  </defs>

  <path d="M0,0" marker-start="url(#mark)" transform="translate(-8)"/>
  <path d="M0,0z" marker-start="url(#mark)" transform="translate(-4)"/>
  <path d="M0,0h0" marker-start="url(#mark)" transform="translate(0)"/>
  <path d="M0,0L0,0" marker-start="url(#mark)" transform="translate(4)"/>
  <path d="M0,0h1e-6" marker-start="url(#mark)" transform="translate(8)"/>

</svg>


Reproducible: Always

Steps to Reproduce:
1. Load testcase

Actual Results:  
Only the last line (near-zero, but non-zero length) is visible.


Expected Results:  
All 5 lines drawn identically (black dots with red circles around).


The spec doesn't say what to do with <path d="M0,0"/> (except that it's legal
syntax), but if the marker exists, then the line resp. the dot should be drawn
too.
On trunk, these all show fine apart from the d="M0,0" case which shows the marker but not the linecap. I think we should really be consistent here and either show both or neither.

Another thing I notice is that expose is really broken on this testcase. Drag a window around over it and the repainting is really very broken.
I see redraw problems neither in Firefox 2.0RC2 nor in SeaMonkey 1.0.4 on Linux,
so they might have been introduced when this bug was fixed on trunk.

BTW, both Batik and Adobe show all 5 markers but not the line cap in the
d="M0,0" case (like Mozilla trunk, as you say). Batik also fails to draw the
line cap in the d="M0,0z" case (with a bug report existing for that case).
The marker property wasn't getting added until a Paint, so the calculation of the update region was missing the marker contribution.
Assignee: general → tor
Status: UNCONFIRMED → ASSIGNED
Attachment #241720 - Flags: review?(roc)
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
I haven't tried it, but the patch looks like just fixing the redraw problem.

So there's still the problem with <path d="M0,0"/>:

(In reply to comment #2)
> On trunk, these all show fine apart from the d="M0,0" case which shows the
> marker but not the linecap. I think we should really be consistent here and
> either show both or neither.

The marker for a moveto without a line is required by appendix F.5 of the SVG
1.1 spec:

| If markers are specified, then a marker is drawn on every applicable vertex,
| even if the given vertex is the end point of a zero-length path segment and
| even if "moveto" commands follow each other.

For the linecaps it says:

| If 'stroke-linecap' is set to butt and the given path segment has zero
| length, do not draw the linecap for that segment; however, do draw the
| linecap for zero-length path segments when 'stroke-linecap' is set to either
| round or square. (This allows round and square dots to be drawn on the
| canvas.)

But I can't find any specification if a single moveto is a "path segment"
or what to do if it's not.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: