Document.title setter does not work for SVG documents
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 05:55:30 +0000 (05:55 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2016 05:55:30 +0000 (05:55 +0000)
commit50bd33aa4e974314c62e8c9e5d91ec2d7be24144
treeeeeaa42b9775093f73838624aa78a1dd85f7b37a
parent8d30023af4869314be16ce00f10a147a4ecdd52f
Document.title setter does not work for SVG documents
https://bugs.webkit.org/show_bug.cgi?id=159503
<rdar://problem/27212313>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline W3C test now that all checks are passing.

* web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-09-expected.txt:

Source/WebCore:

Document.title setter should work for SVG documents:
- https://html.spec.whatwg.org/multipage/dom.html#document.title

This patch aligns our behavior with the specification
and with Firefox / Chrome.

No new tests, rebaselined existing test.

* dom/Document.cpp:
(WebCore::Document::setTitle):
- Reverse the if conditions for clarity.
- If the document element is an SVG svg element, create a
  SVGTitleElement and insert it as first child of the
  document element.
- Call SVGTitleElement::setText() instead of
  HTMLTitleElement::setText() at the end of the method if
  m_titleElement is a SVGTitleElement.

(WebCore::Document::updateTitleElement):
- If document element is an SVG svg element, use the first
  child of the document element that is a SVGTitleElement.

* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::setText):
* svg/SVGTitleElement.h:
Add SVGTitleElement::setText() method that does the same
thing as HTMLTitleElement::setText().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.title-09-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLTitleElement.cpp
Source/WebCore/svg/SVGTitleElement.cpp
Source/WebCore/svg/SVGTitleElement.h