Skip to content

Commit

Permalink
[mathml] Treat unknown MathML elements as <mrow> elements.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ian Kilpatrick <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/master@{#737263}
  • Loading branch information
fred-wang authored and Commit Bot committed Jan 31, 2020
1 parent f1e0eca commit 4c22539
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions third_party/blink/renderer/core/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
metadata: {
namespace: "MathML",
namespaceURI: "http://www.w3.org/1998/Math/MathML",
fallbackInterfaceName: "MathMLElement",
fallbackInterfaceName: "MathMLRowElement",
fallbackJSInterfaceName: "MathMLElement",
export: "CORE_EXPORT",
},
Expand Down

0 comments on commit 4c22539

Please sign in to comment.