Bug 47669 - Title-Element has no popup on <svg>-Elements, but on <g>
Summary: Title-Element has no popup on <svg>-Elements, but on <g>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Rob Buis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-14 07:02 PDT by Holger Jeromin
Modified: 2010-11-10 23:06 PST (History)
5 users (show)

See Also:


Attachments
SVG Demo for a title in svg and g element (524 bytes, image/svg+xml)
2010-10-14 07:02 PDT, Holger Jeromin
no flags Details
SVG Demo for a title in root svg, svg and g element (728 bytes, image/svg+xml)
2010-10-14 23:43 PDT, Holger Jeromin
no flags Details
Trivial patch (1.72 KB, patch)
2010-10-16 09:14 PDT, Rob Buis
zimmermann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Jeromin 2010-10-14 07:02:32 PDT
Created attachment 70736 [details]
SVG Demo for a title in svg and g element

The standard http://www.w3.org/TR/SVG/struct.html#DescriptionAndTitleElements defines:
"Each container element [...] in an SVG drawing can supply [...] a ‘title’ description string" where

http://www.w3.org/TR/SVG/intro.html#TermContainerElement defines an container element as
"Specifically: ‘a’, ‘defs’, ‘glyph’, ‘g’, ‘marker’, ‘mask’, ‘missing-glyph’, ‘pattern’, ‘svg’, ‘switch’ and ‘symbol’."

However a title element is only rendered as a popup at mouseover in <g>, but not in a <svg> Element as you can see in the attached demo.
Comment 1 Andreas Kling 2010-10-14 07:18:33 PDT
From SVGStyledElement::title() in WebCore/svg/SVGStyledElement.cpp:
// According to spec, we should not return titles when hovering over <svg> elements (those 
// <title> elements are the title of the document, not a tooltip) so we instantly return.
if (hasTagName(SVGNames::svgTag))
    return String();
Comment 2 Holger Jeromin 2010-10-14 07:56:03 PDT
(In reply to comment #1)
> From SVGStyledElement::title() in WebCore/svg/SVGStyledElement.cpp:
> // According to spec, we should not return titles when hovering over <svg> elements (those 
> // <title> elements are the title of the document, not a tooltip) so we instantly return.
> if (hasTagName(SVGNames::svgTag))
>     return String();

I see. 

I have not found this spec, but the title could not be the title of the document, if they are nested. The SVG Spec only references to the "outermost svg element".
Comment 3 Holger Jeromin 2010-10-14 23:43:25 PDT
Created attachment 70836 [details]
SVG Demo for a title in root svg, svg and g element
Comment 4 Holger Jeromin 2010-10-14 23:46:19 PDT
(In reply to comment #2)
> (In reply to comment #1)
> > From SVGStyledElement::title() in WebCore/svg/SVGStyledElement.cpp:
> > // According to spec, we should not return titles when hovering over <svg> elements (those 
> > // <title> elements are the title of the document, not a tooltip) so we instantly return.
> > if (hasTagName(SVGNames::svgTag))
> >     return String();
> 
> I see. 
> 
> I have not found this spec, but the title could not be the title of the document, if they are nested. The SVG Spec only references to the "outermost svg element".

Firefox 4 shows the tooltip on svg-elements, but not on the outmost svg  https://bugzilla.mozilla.org/show_bug.cgi?id=547854 

Uploaded a new testcase.
Comment 5 Rob Buis 2010-10-16 09:14:17 PDT
Created attachment 70957 [details]
Trivial patch
Comment 6 Rob Buis 2010-10-16 09:15:59 PDT
I uploaded a trivial patch to provide behaviour such as FireFox 4. I waited with the testcase implementation(which should be easy by just checking the title attribute) because for instance
Opera does not give a tooltip for svg elements either.
Cheers,

Rob.
Comment 7 Andreas Kling 2010-10-16 09:20:36 PDT
Comment on attachment 70957 [details]
Trivial patch

View in context: https://bugs.webkit.org/attachment.cgi?id=70957&action=review

> WebCore/svg/SVGStyledElement.cpp:72
> +        SVGSVGElement* svg = static_cast<SVGSVGElement*>(const_cast<SVGStyledElement*>(this));

Would read better like this IMO:
const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(this);
Comment 8 Holger Jeromin 2010-10-26 01:01:33 PDT
(In reply to comment #6)
> I uploaded a trivial patch to provide behaviour such as FireFox 4. I waited with the testcase implementation(which should be easy by just checking the title attribute) because for instance

Thanks.
It would be very nice, if this changes would land in the webkit source.

> Opera does not give a tooltip for svg elements either.

I filed a bug in the opera bug wizard (DSK-316141) as well as in Microsoft Connect 
https://connect.microsoft.com/IE/feedback/details/614675/title-element-has-no-tooltip-on-svg-elements

Perhaps it is too late for IE9 since MS marked the beta as feature complete.
Holger
Comment 9 Nikolas Zimmermann 2010-10-26 12:47:45 PDT
Comment on attachment 70957 [details]
Trivial patch

Looks fine, r=me but Andreas suggestion is correct.
Comment 10 Eric Seidel (no email) 2010-11-10 14:13:33 PST
Attachment 70957 [details] was posted by a committer and has review+, assigning to Rob Buis for commit.
Comment 11 Rob Buis 2010-11-10 23:06:38 PST
Hi Eric,

(In reply to comment #10)
> Attachment 70957 [details] was posted by a committer and has review+, assigning to Rob Buis for commit.

This was landed in r70617, I guess I forgot to close, doing that now :)
Cheers,

Rob.