XMLSerializer: Support element prefix rewriting.

We need to change the prefix of an element if:
 - The element's namespace is same as the inherited default namespace,
   and the element prefix is not empty,
 - The prefix-namespace pair of an element is not declared, and there
   is another prefix associated to the namespace, or
 - The namespace of an element is not associated to any prefixes, and
   the element's prefix is declared for another namespace in the
   element.

This CL implements Step 11, 12.1 to 12.5 of [1].
* Add capability to serialize prefix which is not element.prefix()
  to MarkupFormatter
* MarkupAccumulator::AppendElement() returns a serialized prefix,
  and AppendEndTag() takes it as an argument.
* MarkupAccumulator::AppendStartTagOpen() implements the steps, and
  returns a serialized prefix as well as 'ignore namespace
  definition attribute' flag.
* MarkupAccumulator::RetrievePreferredPrefixString():
  Remove the code for empty prefix for elements. Empty prefix is
  handled in the callsite.
* MarkupAccumulator::ShouldAddNamespaceElement(): Removed. It's not
  used any longer.

* dom/domparsing/xmlserializer-xml-namespace-expected.txt:
  The new behavior is expected. We successfully find 'xml' prefix.

[1] https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node

Bug: 929035
Change-Id: Icf63cb40b120d29a4b8678104592739d773f3a48
Reviewed-on: https://chromium-review.googlesource.com/c/1473090
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632459}
8 files changed