Remove children of title element before setting new title

http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#document.title

When setting the document title through the document.title or
<title>.text there was an optimization that reused a child text node
in the cases it could. But according to the specification, all
children must be removed and re-created with the new value.

Removing the optimization has a performance impact and makes setting
document.title (or <title>.text) up to ten times slower. This has been
deemed acceptable since the change should only be visible in
specialized micro-benchmarks. It is more important to align with other
browsers and the spec that don't do this optimization.

blink-dev thread about the performance regression:

https://groups.google.com/a/chromium.org/d/msg/blink-dev/ONBQQ5uhBik/fEiTrzQeYlkJ

This is a reland of:

https://codereview.chromium.org/128603002
https://codereview.chromium.org/107513013

The original WebKit bug:

https://bugs.webkit.org/show_bug.cgi?id=28864

BUG=330140,331076

Review URL: https://codereview.chromium.org/139313009

git-svn-id: svn://svn.chromium.org/blink/trunk@165309 bbb929c8-8fbe-4397-9dbb-9b2b20218538
9 files changed
tree: 00c2e7c77c3b07a1c63a0f476a94e60ea041ca09
  1. third_party/