Commit 4c22539f authored by Frédéric Wang's avatar Frédéric Wang Committed by Commit Bot

[mathml] Treat unknown MathML elements as <mrow> elements.

The MathML CG decided that unknown elements in the MathML namespace with
a math display should behave like an <mrow> element [1] [2]. This CL
ensures that a MathMLRowElement is created for unknown MathML elements
in order to make that possible. It does not seem necessary to create a
specific MathMLUnknownElement C++ class at that point. Whether a
specific MathMLUnknownElement IDL is needed is still open [1][3].

[1] https://github.com/mathml-refresh/mathml/issues/139
[2] https://mathml-refresh.github.io/mathml-core/#new-display-math-value
[3] https://bugs.chromium.org/p/chromium/issues/detail?id=1021837

Bug: 6606
Change-Id: Ia493392ee8bfe9a7073e2ea6f1ce65927ec7fcae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007738
Commit-Queue: Frédéric Wang <fwang@igalia.com>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737263}
parent f1e0ecaf
......@@ -247,6 +247,7 @@
#include "third_party/blink/renderer/core/loader/progress_tracker.h"
#include "third_party/blink/renderer/core/loader/text_resource_decoder_builder.h"
#include "third_party/blink/renderer/core/mathml/mathml_element.h"
#include "third_party/blink/renderer/core/mathml/mathml_row_element.h"
#include "third_party/blink/renderer/core/mathml_element_factory.h"
#include "third_party/blink/renderer/core/mathml_names.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
......@@ -1022,10 +1023,11 @@ Element* Document::CreateRawElement(const QualifiedName& qname,
} else if (RuntimeEnabledFeatures::MathMLCoreEnabled() &&
qname.NamespaceURI() == mathml_names::kNamespaceURI) {
element = MathMLElementFactory::Create(qname.LocalName(), *this, flags);
// An unknown MathML element is treated like an <mrow> element.
// TODO(crbug.com/1021837): Determine if we need to introduce a
// MathMLUnknownClass.
// MathMLUnknownElement IDL.
if (!element)
element = MakeGarbageCollected<MathMLElement>(qname, *this);
element = MakeGarbageCollected<MathMLRowElement>(qname, *this);
saw_elements_in_known_namespaces_ = true;
} else {
element = MakeGarbageCollected<Element>(qname, this);
......
......@@ -2,7 +2,7 @@
metadata: {
namespace: "MathML",
namespaceURI: "http://www.w3.org/1998/Math/MathML",
fallbackInterfaceName: "MathMLElement",
fallbackInterfaceName: "MathMLRowElement",
fallbackJSInterfaceName: "MathMLElement",
export: "CORE_EXPORT",
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment