Closed Bug 1221934 Opened 9 years ago Closed 9 years ago

Implement SVG clipPathUnits attribute of clipPath element

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox45 --- affected

People

(Reporter: xidorn, Unassigned)

References

()

Details

(Whiteboard: [parity-blink][parity-webkit])

Attachments

(1 file)

Attached file testcase
It seems we have not yet implemented the clipPathUnits attribute of clipPath element. The attachment is a testcase, in which if this attribute works as expected, you should not see any red in the page.
Whiteboard: [parity-blink][parity-webkit]
Per http://robert.ocallahan.org/2008/06/applying-svg-effects-to-html-content_04.html clipPath, mask and filter content can also use "userSpaceOnUse" units. In SVG, "user space" is established by the SVG viewport containing the affected content. We don't have such a viewport for non-SVG content, so I make "user space" be the rectangle which is the union of all border-boxes for the affected element. User space is in CSS pixel units, so clipPath, mask and filter content can specify lengths in CSS pixels as well as percentages relative to the size of the affected element.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
(In reply to Robert Longson from comment #3) > "user space" is established by the SVG viewport containing the affected > content. We don't have such a viewport for non-SVG content, so I make "user > space" be the rectangle which is the union of all border-boxes for the > affected element. User space is in CSS pixel units, so clipPath, mask and > filter content can specify lengths in CSS pixels as well as percentages > relative to the size of the affected element. Given this explanation, I think the use case should work. roc, idea about this?
Flags: needinfo?(roc)
<clipPath id="clip" clipPathUnits="userSpaceOnUse"> <path d="M0,0L0,100,100,100,100,0Z"></path> </clipPath> Per the text you quoted, "user space" is the border-box of the <div>. So the clip path is exactly the border-box of the <div>, so no red is clipped out, so the rendering of the testcase is what I'd expect.
Flags: needinfo?(roc)
(pinged roc this morning on IRC but didn't get reply, so try to ask here again) If that's the expected behavior, then what's the difference between userSpaceOnUse and objectBoundingBox? According to MDN, clipPathUtils=objectBoundingBox matches what you said in comment 5, so how the other value makes sense? Or are you indicating that, that value makes sense only when the clipPath is applied to an SVG element? It seems to me the "user space" here should be the initial containing block, not the border-box of the <div>.
Flags: needinfo?(roc)
The way we've implemented it, at least: userSpaceOnUse -> 1 unit == 1 CSS px. 0/0% == the top/left edge of the border-box. 100% == the bottom/right edge of the border-box. objectBoundingBox -> 0/0% == the top/left edge of the visual overflow area of the element and its descendants. 1/100% == the bottom/right edge of the visual overflow area of the element and its descendants.
Flags: needinfo?(roc)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: