WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159503
Document.title setter does not work for SVG documents
https://bugs.webkit.org/show_bug.cgi?id=159503
Summary
Document.title setter does not work for SVG documents
Chris Dumez
Reported
2016-07-06 19:30:50 PDT
Document.title setter does not work for SVG documents:
https://html.spec.whatwg.org/multipage/dom.html#document.title
It works in Firefox and Chrome. Test case:
http://w3c-test.org/html/dom/documents/dom-tree-accessors/document.title-09.html
Attachments
Patch
(9.37 KB, patch)
2016-07-06 20:11 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(10.13 KB, patch)
2016-07-06 22:54 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-07-06 19:31:22 PDT
<
rdar://problem/27212313
>
Chris Dumez
Comment 2
2016-07-06 20:11:46 PDT
Created
attachment 282983
[details]
Patch
Ryosuke Niwa
Comment 3
2016-07-06 20:58:10 PDT
Comment on
attachment 282983
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=282983&action=review
> Source/WebCore/dom/Document.cpp:1660 > + if (is<SVGSVGElement>(documentElement())) > + m_titleElement = childrenOfType<SVGTitleElement>(*documentElement()).first(); > + else { > + if (m_titleElement) { > + if (isHTMLDocument() || isXHTMLDocument()) > + m_titleElement = descendantsOfType<HTMLTitleElement>(*this).first(); > + } else > + m_titleElement = newTitleElement; > + }
Why don't we fix SVGTitleElement::insertedInto and SVGTitleElement::removedFrom so that we can use the same code path for SVG and HTML documents? We already have code to call titleElementAdded/titleElementRemoved so we just need to check that its parent is the document element of the SVG document.
> Source/WebCore/svg/SVGTitleElement.cpp:77 > + // which causes SVGTitleElement::childrenChanged(), which ends up Document::setTitle().
ends up *calling* Document::setTitle() or *invoking*
Chris Dumez
Comment 4
2016-07-06 22:52:30 PDT
Comment on
attachment 282983
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=282983&action=review
>> Source/WebCore/dom/Document.cpp:1660 >> + } > > Why don't we fix SVGTitleElement::insertedInto and SVGTitleElement::removedFrom so that we can use the same code path for SVG and HTML documents? > We already have code to call titleElementAdded/titleElementRemoved so we just need to check that its parent is the document element of the SVG document.
Sadly, this is not that easy. I tried to do what you suggest but I cannot get all the tests to pass. Here one issue: - When adding a HTMLTitleElement to a SVGDocument's whose document element is a SVGSVGElement, we would expect this title to be ignored. However, if we move the is<SVGSVGElement>(documentElement()) from Document::updateTitleElement() to SVGTitleElement::insertedInto(), it no longer gets ignored. We could add a !is<SVGSVGElement>(documentElement()) check to HTMLTitleElement::insertedInto() but this would be uglier IMHO. Note that I also tried adding a (isHTMLDocument() || isXHTMLDocument()) check to HTMLTitleElement::insertedInto() but this caused another test to fail because the HTMLTitleElement should not get ignored if added to a SVGDocument whose document element is not a SVGSVGElement. Anyway, I suggest landing the patch as is for now. We can think if there is a better way to factor this later as it does not seem trivial.
Chris Dumez
Comment 5
2016-07-06 22:54:06 PDT
Created
attachment 282991
[details]
Patch
Chris Dumez
Comment 6
2016-07-06 22:56:08 PDT
Comment on
attachment 282991
[details]
Patch Clearing flags on attachment: 282991 Committed
r202895
: <
http://trac.webkit.org/changeset/202895
>
Chris Dumez
Comment 7
2016-07-06 22:56:14 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug