Closed Bug 828815 Opened 11 years ago Closed 11 years ago

SVGRectElement["onxxx"] = Function does not work, No Tooltip on SVG graphic (StatCounter)

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
All
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla21
Tracking Status
firefox19 --- unaffected
firefox20 + verified
firefox21 + verified

People

(Reporter: markus.popp, Assigned: dzbarsky)

References

Details

(Keywords: regression, testcase)

Attachments

(3 files, 5 obsolete files)

Access http://gs.statcounter.com/#browser-ww-daily-20130109-20130109-bar with Firefox 20 or 21, with Flash disabled.

There should be a tooltip on each (SVG) bar in the graph to show the percentage. While up to Firefox 19 this works, in Firefox 20 and 21 there is no tooltip.
WFM: On a current OS X nightly, I get a tooltip on that graph, showing the name of the browser and a percentage.

I don't see any SVG here, though. If I right-click on the graph, I get a context menu for Flash (and the "tooltips" are clearly not browser tooltips).
Summary: No Tooltip on SVG graphic (StatCounter) → No Tooltip on Flash graphic (StatCounter)
Flash needs to be disabled, then an SVG version will show up instead.
Last good nightly: 2013-01-06
First bad nightly: 2013-01-07

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=20d1a5916ef6&tochange=605ae260b7c8

I guess that this is caused by one of David's checkins and I would bisect the exact changeset if required
Component: General → SVG
Keywords: regression
OS: Linux → All
Product: Firefox → Core
Summary: No Tooltip on Flash graphic (StatCounter) → No Tooltip on SVG graphic (StatCounter)
The first bad revision is:
changeset:   117786:04feda337f8b
user:        David Zbarsky <dzbarsky@gmail.com>
date:        Sun Jan 06 04:32:01 2013 -0500
summary:     Bug 825147: Convert SVGRectElement to WebIDL r=bz
Matti, thanks!
Assignee: nobody → dzbarsky
Blocks: 825147
FWIW I don't think the tooltips are created by having <title> children. I think they are programatically generated.

There is a TypeError: src is null in the Error Console. That may be where the problem is perhaps?
TypeError is generated even on Firefox 18. I suppose it's unrelated to the tooltip problem.
The tooltips appear if I disable the new bindings for SVGRectElement.  Unfortunately, I haven't been able to figure out how to save the site locally and still have it work so I can't reduce it.  Maybe the tooltips are broken because event handlers on new binding nodes do something different?
Event handlers on new-binding nodes shouldn't do anything different...

Alice0775, do you think you can make a more-reduced testcase here?
Keywords: testcase-wanted
The chart seems to be based on highcharts. Highcharts have a demo site and that seems to have the same issue i.e. no tooltips on trunk:

http://www.highcharts.com/demo/column-basic

Since this includes a way to copy to jsfiddle perhaps that will be more amenable to debugging/reduction.
Yes, that should be way simpler to reduce.  Thanks!
Attached file testcase html (obsolete) —
Color should change by mouse hover.
in highcharts.js,

    on: function (a, b) {
      if (Ba && a === "click") this.element.ontouchstart = function (a) {
        a.preventDefault();
        b()
      };
      this.element["on" + a] = b;
      return this
    },


|this.element["on" + a] = b;|  does not work  in Aurora20.0a1 and Nightly21.0a1,  but works in Firefox19.0beta and earlier
Attached file testcase html
Color should change by mouse hover.
Attachment #702209 - Attachment is obsolete: true
Summary: No Tooltip on SVG graphic (StatCounter) → SVGRectElement.["onxxx"] = Function does not work, No Tooltip on SVG graphic (StatCounter)
onxxx attributes are only available on HTML elements. Evang matter.
Component: SVG → English US
Product: Core → Tech Evangelism
Summary: SVGRectElement.["onxxx"] = Function does not work, No Tooltip on SVG graphic (StatCounter) → SVGRectElement["onxxx"] = Function does not work, No Tooltip on SVG graphic (StatCounter)
Version: 20 Branch → unspecified
(In reply to Masatoshi Kimura [:emk] from comment #15)
> onxxx attributes are only available on HTML elements. Evang matter.

However this onmouseover="mouseover_colorsize(evt)" attributes of SVGRectElement  works in Nightly21.0a1.

What is going on?
Setting |svgElement.onxxx = func| used to work, and for backwards compatibility and consistency with HTML I think it should continue to work.
(In reply to Alice0775 White from comment #16)
> What is going on?

Sounds like setting of the JS property on SVG elements isn't being mapped to setting the attribute/event handler.
Alice0775, thank you for the testcase!

> Setting |svgElement.onxxx = func| used to work, and for backwards compatibility and
> consistency with HTML I think it should continue to work.

That's trivial enough to do in our WebIDL code.  Can we get this specced on the SVG end?  Right now it's certainly not in the spec...

The reason this used to work is that DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES includes nsIInlineEventHandlers and nsITouchEventReceiver, but that stuff is not present on SVGElement in the WebIDL.

David, you want to fix this?  You'll need to do the prefcontrolled hackery for touch events that HTMLElement does...  On Aurora this will probably just need copy/paste.  On trunk, bug 829072 will make things nicer here eventually, but you can do copy/paste for now.
Component: English US → DOM
Product: Tech Evangelism → Core
Attached patch Patch (obsolete) — Splinter Review
This fixes the testcase.
Attachment #702470 - Flags: review?(bzbarsky)
Comment on attachment 702470 [details] [diff] [review]
Patch

You need to make the interface [PrefControlled] and have SVGElement::PrefEnabled() call nsGenericHTMLElement::PrefEnabled().  Otherwise the touch stuff won't work right.

r=me with that change, assuming you just copied that list from HTMLElement.
Attachment #702470 - Flags: review?(bzbarsky) → review+
[Approval Request Comment]
Bug caused by (feature/regressing bug #): 823394
User impact if declined: Websites that set event handlers on svg elements from script may not work
Testing completed (on m-c, etc.):
Risk to taking this patch (and alternatives if risky): Low
String or UUID changes made by this patch: None
Attachment #702470 - Attachment is obsolete: true
Attachment #702482 - Flags: review+
Attachment #702482 - Flags: approval-mozilla-aurora?
We have already resolved to include event listener IDL attributes in SVG 2:

  https://svgwg.org/svg2-draft/interact.html#SVGEvents (annotation 2 there)

so it should happen in due course.
Sounds fine.  Note that HTML has moved these out into interfaces it pulls in via "implements", so SVG could just use those.
Oh, and.... this bug needs a test!
(In reply to Boris Zbarsky (:bz) from comment #25)
> Sounds fine.  Note that HTML has moved these out into interfaces it pulls in
> via "implements", so SVG could just use those.

Great!
Attached file Part 1 merged to (obsolete) —
Attachment #702646 - Flags: review?(peterv)
Attached patch Part 2 merged to (obsolete) — Splinter Review
Attachment #702649 - Flags: review?(peterv)
Attached patch Merged to (obsolete) — Splinter Review
Attachment #702650 - Flags: review?(peterv)
Comment on attachment 702646 [details]
Part 1 merged to

Wrong bug.  :(
Attachment #702646 - Attachment is obsolete: true
Attachment #702646 - Attachment is patch: false
Attachment #702646 - Flags: review?(peterv)
Attachment #702649 - Attachment is obsolete: true
Attachment #702649 - Flags: review?(peterv)
Attachment #702650 - Attachment is obsolete: true
Attachment #702650 - Flags: review?(peterv)
https://hg.mozilla.org/mozilla-central/rev/d21cb6921b71
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Comment on attachment 702482 [details] [diff] [review]
Patch for checkin

low risk and early in aurora so approving.
Attachment #702482 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Flags: in-testsuite?
Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0

Verified as fixed in Firefox 20 beta 6 (buildID: 20130320062118) using provided test case.
Verified as fixed in Firefox 21 beta 2 (build ID: 20130401192816), using the attached test case.

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0
Mozilla/5.0 (Windows NT 6.2; rv:21.0) Gecko/20100101 Firefox/21.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0
Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: