Closed
Bug 619955
Opened 14 years ago
Closed 14 years ago
pointer-events is fairly broken on SVG text
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status2.0 | --- | wanted |
People
(Reporter: heycam, Assigned: jwatt)
References
()
Details
Attachments
(2 files)
(deleted),
image/svg+xml
|
Details | |
(deleted),
patch
|
longsonr
:
review+
roc
:
approval2.0+
|
Details | Diff | Splinter Review |
Moving the mouse over a <text pointer-events="fill" fill="none"> element should dispatch mouse events.
Reporter | ||
Comment 1•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Assignee | ||
Comment 2•14 years ago
|
||
Actually our handling of pointer-events on text is pretty broken. nsSVGGlyphFrame::GetFrameForPoint requires that the pointer event be inside mRect:
http://hg.mozilla.org/mozilla-central/annotate/b9e2c6e0f2ad/layout/svg/base/src/nsSVGGlyphFrame.cpp#l413
However, when nsSVGGlyphFrame::UpdateCoveredRegion sets mRect it does not account for stroke if stroke-opacity=0, and if we have no stroke and fill=none, then mRect is actually set to empty (the cause of the problem in comment 0):
http://hg.mozilla.org/mozilla-central/annotate/b9e2c6e0f2ad/layout/svg/base/src/nsSVGGlyphFrame.cpp#l468
Besides that, nsSVGGlyphFrame::ContainsPoint (called by GetFrameForPoint) only checks if the hit is in the fill, so any stroke that lies outside the character cell will never intercept events.
http://hg.mozilla.org/mozilla-central/annotate/b9e2c6e0f2ad/layout/svg/base/src/nsSVGGlyphFrame.cpp#l1476
OS: Mac OS X → All
Hardware: x86 → All
Assignee | ||
Comment 3•14 years ago
|
||
There's not too much in the way or real changes here. Essentially I'm just moving things about, with the few real changes being located in nsSVGGlyphFrame.
Attachment #507410 -
Flags: review?(longsonr)
Assignee | ||
Comment 4•14 years ago
|
||
Actually, the HITTEST_MASK_CHECK_MRECT check needs to be removed because mRect is not based on character cells, but on actual fill/stroke areas.
Comment 5•14 years ago
|
||
I'd really like to see the svg image element tested as it has some different requirements to everything else i.e. fill and stroke properties don't apply, however image frames are derived from nsSVGPathGeometry frames. The code changes seem basically OK.
Assignee | ||
Comment 6•14 years ago
|
||
Agreed, but this bug is about <text>, and I've only just finished working out <text>'s special code and test requirements. I'll get to <image> in bug 311942, but right now it's too broken to just add to the test framework in test_pointer-events.xhtml.
Updated•14 years ago
|
Attachment #507410 -
Flags: review?(longsonr) → review+
Assignee | ||
Comment 7•14 years ago
|
||
Comment on attachment 507410 [details] [diff] [review]
patch
longsonr: thanks!
Passed Try fine: http://tbpl.mozilla.org/?tree=MozillaTry&rev=7952468eded0
Requesting approval.
Attachment #507410 -
Flags: approval2.0?
Assignee | ||
Updated•14 years ago
|
Summary: pointer-events:fill on text with no fill not working → pointer-events is fairly broken on SVG text
Comment on attachment 507410 [details] [diff] [review]
patch
+ if (mask & HITTEST_MASK_FILL || mask & HITTEST_MASK_STROKE) {
if (mask & (HITTEST_MASK_FILL | HITTEST_MASK_STROKE))
Attachment #507410 -
Flags: approval2.0? → approval2.0+
Assignee | ||
Comment 9•14 years ago
|
||
Thanks.
Pushed http://hg.mozilla.org/mozilla-central/rev/822a61861a38
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•