Backed out changeset c0bf6e0b8f1d (bug 1173199) for build bustage CLOSED TREE

This commit is contained in:
Wes Kocher 2016-07-28 11:48:20 -07:00
parent 3eb94d9ea1
commit c7656c1da3
35 changed files with 28 additions and 898 deletions

View File

@ -1258,7 +1258,7 @@ Element::GetAttributeNS(const nsAString& aNamespaceURI,
nsAString& aReturn)
{
int32_t nsid =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI, OwnerDoc());
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
if (nsid == kNameSpaceID_Unknown) {
// Unknown namespace means no attribute.
@ -1300,7 +1300,7 @@ Element::RemoveAttributeNS(const nsAString& aNamespaceURI,
{
nsCOMPtr<nsIAtom> name = NS_Atomize(aLocalName);
int32_t nsid =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI, OwnerDoc());
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
if (nsid == kNameSpaceID_Unknown) {
// If the namespace ID is unknown, it means there can't possibly be an
@ -1377,7 +1377,7 @@ Element::HasAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName) const
{
int32_t nsid =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI, OwnerDoc());
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
if (nsid == kNameSpaceID_Unknown) {
// Unknown namespace means no attr...

View File

@ -23,7 +23,6 @@ static const int32_t kNameSpaceID_None = 0;
#define kNameSpaceID_RDF 8
#define kNameSpaceID_XUL 9
#define kNameSpaceID_SVG 10
#define kNameSpaceID_disabled_MathML 11
#define kNameSpaceID_LastBuiltin 11 // last 'built-in' namespace
#define kNameSpaceID_LastBuiltin 10 // last 'built-in' namespace
#endif // mozilla_dom_NameSpaceConstants_h__

View File

@ -197,8 +197,7 @@ bool
NodeInfo::NamespaceEquals(const nsAString& aNamespaceURI) const
{
int32_t nsid =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI,
mOwnerManager->GetDocument());
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
return mozilla::dom::NodeInfo::NamespaceEquals(nsid);
}

View File

@ -2892,8 +2892,7 @@ nsContentUtils::SplitQName(const nsIContent* aNamespaceResolver,
nameSpace);
NS_ENSURE_SUCCESS(rv, rv);
*aNamespace = NameSpaceManager()->GetNameSpaceID(nameSpace,
aNamespaceResolver->OwnerDoc());
*aNamespace = NameSpaceManager()->GetNameSpaceID(nameSpace);
if (*aNamespace == kNameSpaceID_Unknown)
return NS_ERROR_FAILURE;

View File

@ -446,8 +446,7 @@ nsDOMAttributeMap::GetAttrNodeInfo(const nsAString& aNamespaceURI,
if (!aNamespaceURI.IsEmpty()) {
nameSpaceID =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI,
mContent->OwnerDoc());
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
if (nameSpaceID == kNameSpaceID_Unknown) {
return nullptr;

View File

@ -15,25 +15,17 @@
#include "mozilla/dom/NodeInfo.h"
#include "nsCOMArray.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "nsIDocument.h"
#include "nsString.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/XBLChildrenElement.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
static const char* kPrefMathMLDisabled = "mathml.disabled";
static const char* kObservedPrefs[] = {
kPrefMathMLDisabled,
nullptr
};
StaticRefPtr<nsNameSpaceManager> nsNameSpaceManager::sInstance;
StaticAutoPtr<nsNameSpaceManager> nsNameSpaceManager::sInstance;
/* static */ nsNameSpaceManager*
nsNameSpaceManager::GetInstance() {
@ -57,14 +49,6 @@ bool nsNameSpaceManager::Init()
rv = AddNameSpace(dont_AddRef(uri), id); \
NS_ENSURE_SUCCESS(rv, false)
#define REGISTER_DISABLED_NAMESPACE(uri, id) \
rv = AddDisabledNameSpace(dont_AddRef(uri), id); \
NS_ENSURE_SUCCESS(rv, false)
mozilla::Preferences::AddStrongObservers(this, kObservedPrefs);
mMathMLDisabled = mozilla::Preferences::GetBool(kPrefMathMLDisabled);
// Need to be ordered according to ID.
REGISTER_NAMESPACE(nsGkAtoms::nsuri_xmlns, kNameSpaceID_XMLNS);
REGISTER_NAMESPACE(nsGkAtoms::nsuri_xml, kNameSpaceID_XML);
@ -76,10 +60,8 @@ bool nsNameSpaceManager::Init()
REGISTER_NAMESPACE(nsGkAtoms::nsuri_rdf, kNameSpaceID_RDF);
REGISTER_NAMESPACE(nsGkAtoms::nsuri_xul, kNameSpaceID_XUL);
REGISTER_NAMESPACE(nsGkAtoms::nsuri_svg, kNameSpaceID_SVG);
REGISTER_DISABLED_NAMESPACE(nsGkAtoms::nsuri_mathml, kNameSpaceID_disabled_MathML);
#undef REGISTER_NAMESPACE
#undef REGISTER_DISABLED_NAMESPACE
return true;
}
@ -128,32 +110,24 @@ nsNameSpaceManager::GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI)
}
int32_t
nsNameSpaceManager::GetNameSpaceID(const nsAString& aURI,
nsIDocument* aDocument)
nsNameSpaceManager::GetNameSpaceID(const nsAString& aURI)
{
if (aURI.IsEmpty()) {
return kNameSpaceID_None; // xmlns="", see bug 75700 for details
}
nsCOMPtr<nsIAtom> atom = NS_Atomize(aURI);
return GetNameSpaceID(atom, aDocument);
return GetNameSpaceID(atom);
}
int32_t
nsNameSpaceManager::GetNameSpaceID(nsIAtom* aURI,
nsIDocument* aDocument)
nsNameSpaceManager::GetNameSpaceID(nsIAtom* aURI)
{
if (aURI == nsGkAtoms::_empty) {
return kNameSpaceID_None; // xmlns="", see bug 75700 for details
}
int32_t nameSpaceID;
if (mMathMLDisabled &&
mDisabledURIToIDTable.Get(aURI, &nameSpaceID) &&
!nsContentUtils::IsChromeDoc(aDocument)) {
NS_POSTCONDITION(nameSpaceID >= 0, "Bogus namespace ID");
return nameSpaceID;
}
if (mURIToIDTable.Get(aURI, &nameSpaceID)) {
NS_POSTCONDITION(nameSpaceID >= 0, "Bogus namespace ID");
return nameSpaceID;
@ -179,19 +153,7 @@ NS_NewElement(Element** aResult,
}
#endif
if (ns == kNameSpaceID_MathML) {
// If the mathml.disabled pref. is true, convert all MathML nodes into
// disabled MathML nodes by swapping the namespace.
nsNameSpaceManager* nsmgr = nsNameSpaceManager::GetInstance();
if ((nsmgr && !nsmgr->mMathMLDisabled) ||
nsContentUtils::IsChromeDoc(ni->GetDocument())) {
return NS_NewMathMLElement(aResult, ni.forget());
}
RefPtr<mozilla::dom::NodeInfo> genericXMLNI =
ni->NodeInfoManager()->
GetNodeInfo(ni->NameAtom(), ni->GetPrefixAtom(),
kNameSpaceID_disabled_MathML, ni->NodeType(), ni->GetExtraName());
return NS_NewXMLElement(aResult, genericXMLNI.forget());
return NS_NewMathMLElement(aResult, ni.forget());
}
if (ns == kNameSpaceID_SVG) {
return NS_NewSVGElement(aResult, ni.forget(), aFromParser);
@ -233,35 +195,3 @@ nsresult nsNameSpaceManager::AddNameSpace(already_AddRefed<nsIAtom> aURI,
return NS_OK;
}
nsresult
nsNameSpaceManager::AddDisabledNameSpace(already_AddRefed<nsIAtom> aURI,
const int32_t aNameSpaceID)
{
nsCOMPtr<nsIAtom> uri = aURI;
if (aNameSpaceID < 0) {
// We've wrapped... Can't do anything else here; just bail.
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ASSERTION(aNameSpaceID - 1 == (int32_t) mURIArray.Length(),
"BAD! AddDisabledNameSpace not called in right order!");
mURIArray.AppendElement(uri.forget());
mDisabledURIToIDTable.Put(mURIArray.LastElement(), aNameSpaceID);
return NS_OK;
}
// nsISupports
NS_IMPL_ISUPPORTS(nsNameSpaceManager,
nsIObserver)
// nsIObserver
NS_IMETHODIMP
nsNameSpaceManager::Observe(nsISupports* aObject, const char* aTopic,
const char16_t* aMessage)
{
mMathMLDisabled = mozilla::Preferences::GetBool(kPrefMathMLDisabled);
return NS_OK;
}

View File

@ -10,8 +10,6 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIAtom.h"
#include "nsIDocument.h"
#include "nsIObserver.h"
#include "nsTArray.h"
#include "mozilla/StaticPtr.h"
@ -32,42 +30,34 @@ class nsAString;
*
*/
class nsNameSpaceManager final : public nsIObserver
class nsNameSpaceManager final
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
virtual nsresult RegisterNameSpace(const nsAString& aURI,
int32_t& aNameSpaceID);
~nsNameSpaceManager() {}
virtual nsresult GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI);
nsresult RegisterNameSpace(const nsAString& aURI, int32_t& aNameSpaceID);
nsresult GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI);
nsIAtom* NameSpaceURIAtom(int32_t aNameSpaceID) {
MOZ_ASSERT(aNameSpaceID > 0 && (int64_t) aNameSpaceID <= (int64_t) mURIArray.Length());
return mURIArray.ElementAt(aNameSpaceID - 1); // id is index + 1
}
int32_t GetNameSpaceID(const nsAString& aURI,
nsIDocument* aDocument);
int32_t GetNameSpaceID(nsIAtom* aURI,
nsIDocument* aDocument);
int32_t GetNameSpaceID(const nsAString& aURI);
int32_t GetNameSpaceID(nsIAtom* aURI);
bool HasElementCreator(int32_t aNameSpaceID);
static nsNameSpaceManager* GetInstance();
bool mMathMLDisabled;
private:
bool Init();
nsresult AddNameSpace(already_AddRefed<nsIAtom> aURI, const int32_t aNameSpaceID);
nsresult AddDisabledNameSpace(already_AddRefed<nsIAtom> aURI, const int32_t aNameSpaceID);
~nsNameSpaceManager() {};
nsDataHashtable<nsISupportsHashKey, int32_t> mURIToIDTable;
nsDataHashtable<nsISupportsHashKey, int32_t> mDisabledURIToIDTable;
nsTArray<nsCOMPtr<nsIAtom>> mURIArray;
static mozilla::StaticRefPtr<nsNameSpaceManager> sInstance;
static mozilla::StaticAutoPtr<nsNameSpaceManager> sInstance;
};
#endif // nsNameSpaceManager_h___

View File

@ -348,15 +348,6 @@ SVGAnimationElement::IsNodeOfType(uint32_t aFlags) const
return !(aFlags & ~(eCONTENT | eANIMATION));
}
//----------------------------------------------------------------------
// SVGTests methods
bool
SVGAnimationElement::IsInChromeDoc() const
{
return nsContentUtils::IsChromeDoc(OwnerDoc());
}
//----------------------------------------------------------------------
// SVG utility methods

View File

@ -86,10 +86,6 @@ public:
void EndElement(ErrorResult& rv) { EndElementAt(0.f, rv); }
void EndElementAt(float offset, ErrorResult& rv);
// SVGTests
virtual bool IsInChromeDoc() const override;
protected:
// nsSVGElement overrides

View File

@ -31,11 +31,5 @@ SVGGraphicsElement::~SVGGraphicsElement()
{
}
bool
SVGGraphicsElement::IsInChromeDoc() const
{
return nsContentUtils::IsChromeDoc(OwnerDoc());
}
} // namespace dom
} // namespace mozilla

View File

@ -25,8 +25,6 @@ protected:
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
bool IsInChromeDoc() const override;
};
} // namespace dom

View File

@ -80,16 +80,6 @@ SVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
SVGSymbolElementBase::IsAttributeMapped(name);
}
//----------------------------------------------------------------------
// SVGTests methods
bool
SVGSymbolElement::IsInChromeDoc() const
{
return nsContentUtils::IsChromeDoc(OwnerDoc());
}
//----------------------------------------------------------------------
// nsSVGElement methods

View File

@ -44,9 +44,6 @@ public:
already_AddRefed<SVGAnimatedRect> ViewBox();
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
// SVGTests
bool IsInChromeDoc() const override;
protected:
virtual nsSVGViewBox *GetViewBox() override;
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override;

View File

@ -57,7 +57,7 @@ SVGTests::SystemLanguage()
bool
SVGTests::HasExtension(const nsAString& aExtension)
{
return nsSVGFeatures::HasExtension(aExtension, IsInChromeDoc());
return nsSVGFeatures::HasExtension(aExtension);
}
bool
@ -139,7 +139,7 @@ SVGTests::PassesConditionalProcessingTests(const nsString *aAcceptLangs) const
return false;
}
for (uint32_t i = 0; i < mStringListAttributes[EXTENSIONS].Length(); i++) {
if (!nsSVGFeatures::HasExtension(mStringListAttributes[EXTENSIONS][i], IsInChromeDoc())) {
if (!nsSVGFeatures::HasExtension(mStringListAttributes[EXTENSIONS][i])) {
return false;
}
}

View File

@ -95,8 +95,6 @@ public:
already_AddRefed<DOMSVGStringList> SystemLanguage();
bool HasExtension(const nsAString& aExtension);
virtual bool IsInChromeDoc() const = 0;
protected:
virtual ~SVGTests() {}

View File

@ -15,7 +15,6 @@
#include "nsSVGFeatures.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsNameSpaceManager.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -43,14 +42,11 @@ nsSVGFeatures::HasFeature(nsISupports* aObject, const nsAString& aFeature)
}
/*static*/ bool
nsSVGFeatures::HasExtension(const nsAString& aExtension, const bool aIsInChrome)
nsSVGFeatures::HasExtension(const nsAString& aExtension)
{
#define SVG_SUPPORTED_EXTENSION(str) if (aExtension.EqualsLiteral(str)) return true;
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1999/xhtml")
nsNameSpaceManager* nameSpaceManager = nsNameSpaceManager::GetInstance();
if (aIsInChrome || !nameSpaceManager->mMathMLDisabled) {
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1998/Math/MathML")
}
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1998/Math/MathML")
#undef SVG_SUPPORTED_EXTENSION
return false;

View File

@ -30,7 +30,7 @@ public:
* "http://www.w3.org/1999/xhtml" and "http://www.w3.org/1998/Math/MathML"
*/
static bool
HasExtension(const nsAString& aExtension, const bool aIsInChrome);
HasExtension(const nsAString& aExtension);
};
#endif // __NS_SVGFEATURES_H__

View File

@ -1599,7 +1599,7 @@ nsXBLPrototypeBinding::ResolveBaseBinding()
mBinding->LookupNamespaceURI(prefix, nameSpace);
if (!nameSpace.IsEmpty()) {
int32_t nameSpaceID =
nsContentUtils::NameSpaceManager()->GetNameSpaceID(nameSpace, doc);
nsContentUtils::NameSpaceManager()->GetNameSpaceID(nameSpace);
nsCOMPtr<nsIAtom> tagName = NS_Atomize(display);
// Check the white list

View File

@ -1049,9 +1049,6 @@ nsXMLContentSink::HandleEndElement(const char16_t *aName,
bool isTemplateElement = debugTagAtom == nsGkAtoms::_template &&
debugNameSpaceID == kNameSpaceID_XHTML;
NS_ASSERTION(content->NodeInfo()->Equals(debugTagAtom, debugNameSpaceID) ||
(debugNameSpaceID == kNameSpaceID_MathML &&
content->NodeInfo()->NamespaceID() == kNameSpaceID_disabled_MathML &&
content->NodeInfo()->Equals(debugTagAtom)) ||
isTemplateElement, "Wrong element being closed");
#endif

View File

@ -12,9 +12,6 @@ if CONFIG['ENABLE_TESTS']:
'imptests/mochitest.ini',
'tests/mochitest.ini',
]
MOCHITEST_CHROME_MANIFESTS += [
'tests/chrome.ini',
]
UNIFIED_SOURCES += [
'nsMathMLChar.cpp',

View File

@ -1,6 +0,0 @@
[DEFAULT]
support-files =
mathml_example_test.html
[test_disabled_chrome.html]

View File

@ -1,28 +0,0 @@
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<msub>
<mtext>O</mtext>
<mtext>O</mtext>
</msub>
<msup>
<mtext>O</mtext>
<mtext>O</mtext>
</msup>
<msubsup>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</msubsup>
<mmultiscripts>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
<mprescripts/>
<mtext>O</mtext>
<mtext>O</mtext>
</mmultiscripts>
</mstyle>
</math>
<svg id="svgel">
</svg>

View File

@ -6,7 +6,6 @@
[test_bug827713-2.html]
[test_bug827713.html]
[test_bug975681.html]
[test_disabled.html]
[test_opentype-axis-height.html]
[test_opentype-fraction.html]
[test_opentype-limits.html]

View File

@ -1,47 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Copied from
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, doTest);
function doTest() {
let t = document.getElementById('testnodes');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math"));
t.firstChild.textContent = "<foo>";
is(t.innerHTML, "<math:math>&lt;foo&gt;</math:math>");
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></math>');
t.innerHTML = null;
t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style"));
is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
is(t.innerHTML, '<math><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></math>');
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
-->
<head>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!--
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-->
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<pre id="test">
<script type="application/javascript">
add_task(function* () {
const initialPrefValue = SpecialPowers.getBoolPref("mathml.disabled");
SpecialPowers.setBoolPref("mathml.disabled", true);
const Cu = SpecialPowers.Components.utils;
const { ContentTaskUtils } = Cu.import("resource://testing-common/ContentTaskUtils.jsm", {});
let t = document.getElementById('testnodes');
let url = 'chrome://mochitests/content/chrome/layout/mathml/tests/mathml_example_test.html'
const chromeIframeEl = document.createElement('iframe');
let chromeLoadPromise = ContentTaskUtils.waitForEvent(chromeIframeEl, 'load', false);
chromeIframeEl.src = url;
t.appendChild(chromeIframeEl);
yield chromeLoadPromise;
const chromeBR = chromeIframeEl.contentDocument.body.getBoundingClientRect();
url = "http://mochi.test:8888/chrome/layout/mathml/tests/mathml_example_test.html";
const iframeEl = document.createElement('iframe');
iframeEl.src = url;
let loadPromise = ContentTaskUtils.waitForEvent(iframeEl, 'load', false);
t.appendChild(iframeEl);
yield loadPromise;
const contentBR = iframeEl.contentDocument.body.getBoundingClientRect();
ok(chromeBR.height > contentBR.height, "Chrome content height should be bigger than content due to layout");
ok(!iframeEl.contentDocument.getElementById('svgel').hasExtension("http://www.w3.org/1998/Math/MathML"), 'SVG namespace support is disabled in content iframe');
ok(chromeIframeEl.contentDocument.getElementById('svgel').hasExtension("http://www.w3.org/1998/Math/MathML"), 'SVG namespace support is enabled in chrome iframe');
SpecialPowers.setBoolPref("mathml.disabled", initialPrefValue);
});
</script>
</pre>
</body>
</html>

View File

@ -1,129 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>scriptlevel</title>
<meta charset="utf-8"/>
</head>
<body>
<!-- Test scriptlevel on mstyle -->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mtext>O</mtext>
<mstyle scriptlevel="1"><mtext>O</mtext></mstyle>
</mstyle>
</randomelement>
<!-- The mfrac element sets displaystyle to "false", or if it was already
false increments scriptlevel by 1, within numerator and denominator.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mstyle displaystyle="false">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
<mstyle displaystyle="true">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
</mstyle>
</randomelement>
<!-- The mroot element increments scriptlevel by 2, and sets
displaystyle to "false", within index, but leaves both attributes
unchanged within base.
The msqrt element leaves both attributes unchanged within its
argument. -->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mroot>
<mtext>O</mtext>
<mtext>O</mtext>
</mroot>
<msqrt>
<mtext>O</mtext>
</msqrt>
</mstyle>
</randomelement>
<!--
The msub element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within subscript, but leaves both attributes unchanged within base.
The msup element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within superscript, but leaves both attributes unchanged within
base.
The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
to "false", within subscript and superscript, but leaves both attributes
unchanged within base.
The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
to "false", within each of its arguments except base, but leaves both
attributes unchanged within base.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<msub>
<mtext>O</mtext>
<mtext>O</mtext>
</msub>
<msup>
<mtext>O</mtext>
<mtext>O</mtext>
</msup>
<msubsup>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</msubsup>
<mmultiscripts>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
<mprescripts/>
<mtext>O</mtext>
<mtext>O</mtext>
</mmultiscripts>
</mstyle>
</randomelement>
<!--
The munder element [...] always sets displaystyle to "false" within the
underscript, but increments scriptlevel by 1 only when accentunder is
"false". Within base, it always leaves both attributes unchanged.
The mover element [...] always sets displaystyle to "false" within
overscript, but increments scriptlevel by 1 only when accent is "false".
Within base, it always leaves both attributes unchanged.
The munderover [..] always sets displaystyle to "false" within underscript
and overscript, but increments scriptlevel by 1 only when accentunder or
accent, respectively, are "false". Within base, it always leaves both
attributes unchanged.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<munder>
<mtext>O</mtext>
<mtext>O</mtext>
</munder>
<mover>
<mtext>O</mtext>
<mtext>O</mtext>
</mover>
<munderover>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</munderover>
</mstyle>
</randomelement>
</body>
</html>

View File

@ -1,133 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>scriptlevel</title>
<meta charset="utf-8"/>
<style>
h2 {
text-align:center;
}
</style>
</head>
<body>
<!-- Test scriptlevel on mstyle -->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mtext>O</mtext>
<mstyle scriptlevel="1"><mtext>O</mtext></mstyle>
</mstyle>
</randomelement>
<!-- The mfrac element sets displaystyle to "false", or if it was already
false increments scriptlevel by 1, within numerator and denominator.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mstyle displaystyle="false">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
<mstyle displaystyle="true">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
</mstyle>
</randomelement>
<!-- The mroot element increments scriptlevel by 2, and sets
displaystyle to "false", within index, but leaves both attributes
unchanged within base.
The msqrt element leaves both attributes unchanged within its
argument. -->
<randomelement>
<mstyle scriptsizemultiplier="2">
<mroot>
<mtext>O</mtext>
<mtext>O</mtext>
</mroot>
<msqrt>
<mtext>O</mtext>
</msqrt>
</mstyle>
</randomelement>
<!--
The msub element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within subscript, but leaves both attributes unchanged within base.
The msup element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within superscript, but leaves both attributes unchanged within
base.
The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
to "false", within subscript and superscript, but leaves both attributes
unchanged within base.
The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
to "false", within each of its arguments except base, but leaves both
attributes unchanged within base.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<msub>
<mtext>O</mtext>
<mtext>O</mtext>
</msub>
<msup>
<mtext>O</mtext>
<mtext>O</mtext>
</msup>
<msubsup>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</msubsup>
<mmultiscripts>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
<mprescripts/>
<mtext>O</mtext>
<mtext>O</mtext>
</mmultiscripts>
</mstyle>
</randomelement>
<!--
The munder element [...] always sets displaystyle to "false" within the
underscript, but increments scriptlevel by 1 only when accentunder is
"false". Within base, it always leaves both attributes unchanged.
The mover element [...] always sets displaystyle to "false" within
overscript, but increments scriptlevel by 1 only when accent is "false".
Within base, it always leaves both attributes unchanged.
The munderover [..] always sets displaystyle to "false" within underscript
and overscript, but increments scriptlevel by 1 only when accentunder or
accent, respectively, are "false". Within base, it always leaves both
attributes unchanged.
-->
<randomelement>
<mstyle scriptsizemultiplier="2">
<munder>
<mtext>O</mtext>
<mtext>O</mtext>
</munder>
<mover>
<mtext>O</mtext>
<mtext>O</mtext>
</mover>
<munderover>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</munderover>
</mstyle>
</randomelement>
</body>
</html>

View File

@ -1,129 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>scriptlevel</title>
<meta charset="utf-8"/>
</head>
<body>
<!-- Test scriptlevel on mstyle -->
<math>
<mstyle scriptsizemultiplier="2">
<mtext>O</mtext>
<mstyle scriptlevel="1"><mtext>O</mtext></mstyle>
</mstyle>
</math>
<!-- The mfrac element sets displaystyle to "false", or if it was already
false increments scriptlevel by 1, within numerator and denominator.
-->
<math>
<mstyle scriptsizemultiplier="2">
<mstyle displaystyle="false">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
<mstyle displaystyle="true">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
</mstyle>
</math>
<!-- The mroot element increments scriptlevel by 2, and sets
displaystyle to "false", within index, but leaves both attributes
unchanged within base.
The msqrt element leaves both attributes unchanged within its
argument. -->
<math>
<mstyle scriptsizemultiplier="2">
<mroot>
<mtext>O</mtext>
<mtext>O</mtext>
</mroot>
<msqrt>
<mtext>O</mtext>
</msqrt>
</mstyle>
</math>
<!--
The msub element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within subscript, but leaves both attributes unchanged within base.
The msup element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within superscript, but leaves both attributes unchanged within
base.
The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
to "false", within subscript and superscript, but leaves both attributes
unchanged within base.
The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
to "false", within each of its arguments except base, but leaves both
attributes unchanged within base.
-->
<math>
<mstyle scriptsizemultiplier="2">
<msub>
<mtext>O</mtext>
<mtext>O</mtext>
</msub>
<msup>
<mtext>O</mtext>
<mtext>O</mtext>
</msup>
<msubsup>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</msubsup>
<mmultiscripts>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
<mprescripts/>
<mtext>O</mtext>
<mtext>O</mtext>
</mmultiscripts>
</mstyle>
</math>
<!--
The munder element [...] always sets displaystyle to "false" within the
underscript, but increments scriptlevel by 1 only when accentunder is
"false". Within base, it always leaves both attributes unchanged.
The mover element [...] always sets displaystyle to "false" within
overscript, but increments scriptlevel by 1 only when accent is "false".
Within base, it always leaves both attributes unchanged.
The munderover [..] always sets displaystyle to "false" within underscript
and overscript, but increments scriptlevel by 1 only when accentunder or
accent, respectively, are "false". Within base, it always leaves both
attributes unchanged.
-->
<math>
<mstyle scriptsizemultiplier="2">
<munder>
<mtext>O</mtext>
<mtext>O</mtext>
</munder>
<mover>
<mtext>O</mtext>
<mtext>O</mtext>
</mover>
<munderover>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</munderover>
</mstyle>
</math>
</body>
</html>

View File

@ -1,133 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>scriptlevel</title>
<meta charset="utf-8"/>
<style>
h2 {
text-align:center;
}
</style>
</head>
<body>
<!-- Test scriptlevel on mstyle -->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<mtext>O</mtext>
<mstyle scriptlevel="1"><mtext>O</mtext></mstyle>
</mstyle>
</math>
<!-- The mfrac element sets displaystyle to "false", or if it was already
false increments scriptlevel by 1, within numerator and denominator.
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<mstyle displaystyle="false">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
<mstyle displaystyle="true">
<mfrac>
<mtext>O</mtext>
<mtext>O</mtext>
</mfrac>
</mstyle>
</mstyle>
</math>
<!-- The mroot element increments scriptlevel by 2, and sets
displaystyle to "false", within index, but leaves both attributes
unchanged within base.
The msqrt element leaves both attributes unchanged within its
argument. -->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<mroot>
<mtext>O</mtext>
<mtext>O</mtext>
</mroot>
<msqrt>
<mtext>O</mtext>
</msqrt>
</mstyle>
</math>
<!--
The msub element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within subscript, but leaves both attributes unchanged within base.
The msup element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within superscript, but leaves both attributes unchanged within
base.
The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
to "false", within subscript and superscript, but leaves both attributes
unchanged within base.
The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
to "false", within each of its arguments except base, but leaves both
attributes unchanged within base.
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<msub>
<mtext>O</mtext>
<mtext>O</mtext>
</msub>
<msup>
<mtext>O</mtext>
<mtext>O</mtext>
</msup>
<msubsup>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</msubsup>
<mmultiscripts>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
<mprescripts/>
<mtext>O</mtext>
<mtext>O</mtext>
</mmultiscripts>
</mstyle>
</math>
<!--
The munder element [...] always sets displaystyle to "false" within the
underscript, but increments scriptlevel by 1 only when accentunder is
"false". Within base, it always leaves both attributes unchanged.
The mover element [...] always sets displaystyle to "false" within
overscript, but increments scriptlevel by 1 only when accent is "false".
Within base, it always leaves both attributes unchanged.
The munderover [..] always sets displaystyle to "false" within underscript
and overscript, but increments scriptlevel by 1 only when accentunder or
accent, respectively, are "false". Within base, it always leaves both
attributes unchanged.
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle scriptsizemultiplier="2">
<munder>
<mtext>O</mtext>
<mtext>O</mtext>
</munder>
<mover>
<mtext>O</mtext>
<mtext>O</mtext>
</mover>
<munderover>
<mtext>O</mtext>
<mtext>O</mtext>
<mtext>O</mtext>
</munderover>
</mstyle>
</math>
</body>
</html>

View File

@ -11,8 +11,6 @@ fails == dir-9.html dir-9-ref.html # Bug 787215
== dir-10.html dir-10-ref.html
random-if((B2G&&browserIsRemote)||Mulet) == dir-11.html dir-11-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
== css-spacing-1.html css-spacing-1-ref.html
pref(mathml.disabled,true) == disabled-scriptlevel-1.html disabled-scriptlevel-1-ref.html
pref(mathml.disabled,true) == disabled-scriptlevel-1.xhtml disabled-scriptlevel-1-ref.xhtml
== displaystyle-1.html displaystyle-1-ref.html
== displaystyle-2.html displaystyle-2-ref.html
== displaystyle-3.html displaystyle-3-ref.html

View File

@ -232,8 +232,7 @@ static bool
DoMatch(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName, MatchFn aMatch)
{
if (aNS) {
int32_t ns = nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNS,
aElement->OwnerDoc());
int32_t ns = nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNS);
NS_ENSURE_TRUE(ns != kNameSpaceID_Unknown, false);
const nsAttrValue* value = aElement->GetParsedAttr(aName, ns);
return value && aMatch(value);

View File

@ -280,9 +280,6 @@ pref("print.shrink-to-fit.scale-limit-percent", 20);
// Whether we should display simplify page checkbox on print preview UI
pref("print.use_simplify_page", false);
// Disable support for MathML
pref("mathml.disabled", false);
// Enable scale transform for stretchy MathML operators. See bug 414277.
pref("mathml.scale_stretchy_operators.enabled", true);

View File

@ -9,16 +9,7 @@
"local_changes": {
"deleted": [],
"deleted_reftests": {},
"items": {
"testharness": {
"html/syntax/parsing/math-parse01.html": [
{
"path": "html/syntax/parsing/math-parse01.html",
"url": "/html/syntax/parsing/math-parse01.html"
}
]
}
},
"items": {},
"reftest_nodes": {}
},
"reftest_nodes": {},

View File

@ -1,2 +0,0 @@
[math-parse01.html]
prefs: ["mathml.disabled:true"]

View File

@ -1,62 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>math in html: parsing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>math in html: parsing</h1>
<div id="log" style="display:block"></div>
<div style="display:none">
<div><math id="m1"><mtext/></math></div>
<div id="d1"><math><mrow/><mi/></math></div>
<div id="d2"><math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math></div>
<div id="d3">&lang;&rang;</div>
<div id="d4">&Kopf;</div>
<div id="d5"><math><semantics><mi>a</mi><annotation-xml><foo/><bar/></annotation-xml></semantics></math></div>
<div id="d6"><math><semantics><mi>a</mi><annotation-xml encoding="text/html"><div></div></annotation-xml></semantics><mn/></math>
</div>
<script>
test(function() {
assert_equals(document.getElementById("m1"),document.getElementsByTagName("math")[0]);
},"The id attribute should be recognised on math elements");
test(function() {
assert_equals(document.getElementById("d1").firstChild.nodeName,"math")
},"The node name should be math");
test(function() {
assert_equals(document.getElementById("d1").firstChild.namespaceURI ,"http://www.w3.org/1998/Math/MathML")
},"math should be in MathML Namespace");
test(function() {
assert_equals(document.getElementById("d1").firstChild.childNodes.length ,2)
},"Math has 2 children (empty tag syntax)");
test(function() {
assert_equals(document.getElementById("d2").firstChild.childNodes.length ,1)
},"Nested mrow elements should be parsed correctly");
test(function() {
assert_equals(document.getElementById("d3").firstChild.nodeValue ,"\u27E8\u27E9")
},"Testing rang and lang entity code points");
test(function() {
assert_equals(document.getElementById("d4").firstChild.nodeValue ,"\uD835\uDD42")
},"Testing Kopf (Plane 1) entity code point");
test(function() {
assert_equals(document.getElementById("d5").firstChild.firstChild.childNodes[1].childNodes.length ,2)
},"Empty element tags in annotation-xml parsed as per XML.");
test(function() {
assert_equals(document.getElementById("d6").firstChild.childNodes.length ,2)
},"html tags allowed in annotation-xml/@encoding='text/html'.");
</script>