Closed Bug 282217 Opened 20 years ago Closed 19 years ago

SVG <title> doesn't have the same effect as <html:title>

Categories

(Core :: SVG, defect)

defect
Not set
minor

Tracking

()

VERIFIED FIXED

People

(Reporter: gtrebaol, Assigned: jwatt)

References

()

Details

(Keywords: verified1.8)

Attachments

(3 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050210
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050210

The SVG <title> element has no effect on the window title.
However, it works when the <title> element is defined in the XHTML namespace.

Reproducible: Always

Steps to Reproduce:
1. load http://gtrebaol.free.fr/bugzilla/title_ko.svg
2. The browser's window should have no title
3. load http://gtrebaol.free.fr/bugzilla/title_ok.svg
4. The browser's window should have a title

Actual Results:  
- With the title_ko.svg file, the window has no title
  because the <title> element belongs to the SVG namespace.
- With the title_ok.svg file, the window has the expected title
  but the <title> element is defined in the XHTML namespace.

Expected Results:  
The window title should be the same when the <title> element
is defined either in the SVG namespace or in the XHTML namespace.
Note that unlike <html:title> (which sets the title for the _document_),
<svg:title> sets the title for the document fragment.  See
http://w3.org/TR/SVG11/struct.html#DescriptionAndTitleElements for the details.
 So showing this title in the titlebar (where the _document_ title is shown)
would be wrong, imo.

I can see making an exception for the case when we're talking about the <title>
that corresponds to an <svg> that's the documentElement.... but even then, a
tooltip may be more appropriate (as the spec says over and over again).
Both Opera 8 and Internet Explorer with the Adobe plugin sets the window title
to the SVG document's title.
What other user agent do with something is not always correct of course, but in
this case they are. When it comes to stand-alone SVG documents, the TITLE
element of the root (SVG) element serves the same purpose in a document
(X)HTML's TITLE element.

This is what the SVG specs say:
"Authors should always provide a 'title' child element to the outermost 'svg'
element within a stand-alone SVG document. The 'title' child element to an 'svg'
element serves the purposes of identifying the content of the given SVG document
fragment. Since users often consult documents out of context, authors should
provide context-rich titles. Thus, instead of a title such as "Introduction",
which doesn’t provide much contextual background, authors should supply a title
such as "Introduction to Medieval Bee-Keeping" instead. For reasons of
accessibility, user agents should always make the content of the 'title' child
element to the outermost 'svg' element available to users. The mechanism for
doing so depends on the user agent (e.g., as a caption, spoken)."
- http://www.w3.org/TR/SVG11/struct.html#TitleElement
Where in that is the window title mentioned, pray tell me?  Note that we do make
the title available as a tooltip.
I think that we should show the <svg:title> as window title when it's connected
to an <svg> that is the documentElement. I agree that it's not required by the
spec, but it's IMHO the most usefull thing to do.

For other <svg:title>s a tooltip seems like the right solution though.
I agree with Jonas. Of course, the spec don't mention how it should be
implanted. That's not where the spec is for. When you read the about HTML's
TITLE element (http://www.w3.org/TR/html4/struct/global.html#h-7.4.2) you will
notice that it says almost the exact same thing as it says about SVG's TITLE
element. But yet we all agree that displaying the TITLE element of HTML
documents in the window title is the best solution. So why not do the same thing
for a root's TITLE child-element in a stand-alone(!!) SVG document?
See comment 1.  For a <svg> as documentElement, this makes some sense, like I said.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
This sets the document's title when loading SVG. The base nsDocument
implementation updates the window's title if it is a top-level document (one of
its presShell's containers implements nsIBaseWindow):

http://lxr.mozilla.org/mozilla/source/content/base/src/nsDocument.cpp#3106
Assignee: general → jabradford
Attachment #194559 - Flags: review?(jonathan.watt)
Comment on attachment 194559 [details] [diff] [review]
SVG title atoms set the document title

I'm not actually a peer for this part of content, so I'm not the person to ask
for review. Nevertheless I'm going to r- based on the lack of a check to make
sure that the 'title' tag in question is a direct child of the root element,
and that the root element is an SVG 'svg' element. Also please

#ifdef MOZ_SVG

out all SVG code. Boris informed me that you can obtain the parent of the
'title' element using GetCurrentContent(). You can then check that it's an SVG
'svg' element with GetNameSpaceID() and Tag(). I'd suggest you request review
and superreview from bz and approval1.8b4.

Thanks for doing this.
Attachment #194559 - Flags: review?(jonathan.watt) → review-
Attachment #194559 - Attachment is obsolete: true
Attached patch patch v2 (obsolete) — Splinter Review
Taking bug as discussed with Jason off-bug. Boris, if you have time can you see
if you can review this for 1.8b4 (and set approval1.8b4? if you r+)?
Attachment #194748 - Flags: superreview?(bzbarsky)
Attachment #194748 - Flags: review?(bzbarsky)
Assignee: jabradford → jonathan.watt
Status: ASSIGNED → NEW
Attachment #194748 - Attachment is obsolete: true
Attachment #194778 - Flags: superreview?(bzbarsky)
Attachment #194778 - Flags: review?(bzbarsky)
Attachment #194748 - Flags: superreview?(bzbarsky)
Attachment #194748 - Flags: review?(bzbarsky)
Sorry Justin, I forgot to CC you when I took the bug. Done now.
Status: NEW → ASSIGNED
Summary: SVG <title> has not the same effect as <html:title> → SVG <title> doesn't have the same effect as <html:title>
Comment on attachment 194778 [details] [diff] [review]
patch v3 - now really checking parent is the document element

>Index: mozilla/content/xml/document/src/nsXMLContentSink.cpp
>+    nsCOMPtr<nsIContent> parent = GetCurrentContent();

Why do you need the nsCOMPtr?  Just use nsIContent*.

>+        parent->GetNameSpaceID() == kNameSpaceID_SVG &&
>+        parent->Tag() == nsSVGAtoms::svg) {

parent->GetNodeInfo()->Equals(nsSVGAtoms::svg, kNameSpaceID_SVG)

r+sr=bzbarsky with those changes.
Attachment #194778 - Flags: superreview?(bzbarsky)
Attachment #194778 - Flags: superreview+
Attachment #194778 - Flags: review?(bzbarsky)
Attachment #194778 - Flags: review+
Checked in on trunk with the required changes.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #194778 - Flags: approval1.8b4?
This is pretty low risk, imo.
verifying fix. works great! 
there is a problem with my zoom and pan extensions...
it also sets the title, but wrong , which can be a little confusing, i will
update the extension now.
Status: RESOLVED → VERIFIED
QA Contact: ian → holger
Attachment #194778 - Flags: approval1.8b4? → approval1.8b4+
checked in on branch
Keywords: fixed1.8
verified on Firefox 1.4 -mozilla1.8 branch- Win, Lin and Mac : 2005-09-07
Keywords: fixed1.8verified1.8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: