зеркало из https://github.com/mozilla/gecko-dev.git
Bug 552044 - [MathML 3] Add support for mathcolor/mathbackground on any presentation MathML element. r=karlt
--HG-- extra : rebase_source : 62c2006154e8a89e18d8125ddec4978f6ffdfba2
This commit is contained in:
Родитель
3f30d03eb6
Коммит
d364880a0d
|
@ -22,6 +22,7 @@
|
|||
* Contributor(s):
|
||||
* Vlad Sukhoy <vladimir.sukhoy@gmail.com> (original developer)
|
||||
* Daniel Kraft <d@domob.eu> (nsMathMLElement patch, attachment 262925)
|
||||
* Frederic Wang <fred.wang@free.fr>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -122,9 +123,7 @@ nsMathMLElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
static nsGenericElement::MappedAttributeEntry sTokenStyles[] = {
|
||||
{ &nsGkAtoms::mathsize_ },
|
||||
{ &nsGkAtoms::fontsize_ },
|
||||
{ &nsGkAtoms::mathcolor_ },
|
||||
{ &nsGkAtoms::color },
|
||||
{ &nsGkAtoms::mathbackground_ },
|
||||
{ &nsGkAtoms::fontfamily_ },
|
||||
{ nsnull }
|
||||
};
|
||||
|
@ -137,27 +136,67 @@ static nsGenericElement::MappedAttributeEntry sEnvironmentStyles[] = {
|
|||
{ nsnull }
|
||||
};
|
||||
|
||||
static nsGenericElement::MappedAttributeEntry sCommonPresStyles[] = {
|
||||
{ &nsGkAtoms::mathcolor_ },
|
||||
{ &nsGkAtoms::mathbackground_ },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
PRBool
|
||||
nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const tokenMap[] = {
|
||||
sTokenStyles
|
||||
sTokenStyles,
|
||||
sCommonPresStyles
|
||||
};
|
||||
static const MappedAttributeEntry* const mstyleMap[] = {
|
||||
sTokenStyles,
|
||||
sEnvironmentStyles
|
||||
sEnvironmentStyles,
|
||||
sCommonPresStyles
|
||||
};
|
||||
static const MappedAttributeEntry* const commonPresMap[] = {
|
||||
sCommonPresStyles
|
||||
};
|
||||
|
||||
// We don't support mglyph (yet).
|
||||
nsIAtom* tag = Tag();
|
||||
if (tag == nsGkAtoms::ms_ || tag == nsGkAtoms::mi_ ||
|
||||
tag == nsGkAtoms::mn_ || tag == nsGkAtoms::mo_ ||
|
||||
tag == nsGkAtoms::mtext_)
|
||||
tag == nsGkAtoms::mtext_ || tag == nsGkAtoms::mspace_)
|
||||
return FindAttributeDependence(aAttribute, tokenMap,
|
||||
NS_ARRAY_LENGTH(tokenMap));
|
||||
if (tag == nsGkAtoms::mstyle_)
|
||||
return FindAttributeDependence(aAttribute, mstyleMap,
|
||||
NS_ARRAY_LENGTH(mstyleMap));
|
||||
|
||||
if (tag == nsGkAtoms::maction_ ||
|
||||
tag == nsGkAtoms::maligngroup_ ||
|
||||
tag == nsGkAtoms::malignmark_ ||
|
||||
tag == nsGkAtoms::math ||
|
||||
tag == nsGkAtoms::menclose_ ||
|
||||
tag == nsGkAtoms::merror_ ||
|
||||
tag == nsGkAtoms::mfenced_ ||
|
||||
tag == nsGkAtoms::mfrac_ ||
|
||||
tag == nsGkAtoms::mover_ ||
|
||||
tag == nsGkAtoms::mpadded_ ||
|
||||
tag == nsGkAtoms::mphantom_ ||
|
||||
tag == nsGkAtoms::mprescripts_ ||
|
||||
tag == nsGkAtoms::mroot_ ||
|
||||
tag == nsGkAtoms::mrow_ ||
|
||||
tag == nsGkAtoms::msqrt_ ||
|
||||
tag == nsGkAtoms::msub_ ||
|
||||
tag == nsGkAtoms::msubsup_ ||
|
||||
tag == nsGkAtoms::msup_ ||
|
||||
tag == nsGkAtoms::mtable_ ||
|
||||
tag == nsGkAtoms::mtd_ ||
|
||||
tag == nsGkAtoms::mtr_ ||
|
||||
tag == nsGkAtoms::munder_ ||
|
||||
tag == nsGkAtoms::munderover_ ||
|
||||
tag == nsGkAtoms::none) {
|
||||
return FindAttributeDependence(aAttribute, commonPresMap,
|
||||
NS_ARRAY_LENGTH(commonPresMap));
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on a presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow mathbackground="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on a presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow mathbackground="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on mstyle -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle mathbackground="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mstyle>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on mstyle -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle mathbackground="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mstyle>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!-- test mathbackground on a token element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mtext mathbackground="green">□■□■□■□</mtext>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!-- test mathbackground on a token element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mtext mathbackground="red">□■□■□■□</mtext>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on a non-presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics mathbackground="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</semantics>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathbackground on a non-presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics mathbackground="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</semantics>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on a presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow mathcolor="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on a presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mrow mathcolor="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mrow>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on mstyle -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle mathcolor="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mstyle>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on mstyle -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle mathcolor="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</mstyle>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!-- test mathcolor on a token element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mtext mathcolor="green">□■□■□■□</mtext>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!-- test mathcolor on a token element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mtext mathcolor="red">□■□■□■□</mtext>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on a non-presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics mathcolor="red">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</semantics>
|
||||
</math>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!-- test mathcolor on a non-presentation element -->
|
||||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics mathcolor="green">
|
||||
<mtext>□■□■□■□</mtext>
|
||||
</semantics>
|
||||
</math>
|
||||
|
|
@ -9,3 +9,11 @@
|
|||
== table-width-1.xhtml table-width-1-ref.xhtml
|
||||
== underbar-width-1.xhtml underbar-width-1-ref.xhtml
|
||||
== mathml-type-supported.xhtml mathml-type-supported-ref.xml
|
||||
!= mathcolor-1.mml mathcolor-1-ref.mml
|
||||
!= mathcolor-2.mml mathcolor-2-ref.mml
|
||||
!= mathcolor-3.mml mathcolor-3-ref.mml
|
||||
== mathcolor-4.mml mathcolor-4-ref.mml
|
||||
!= mathbackground-1.mml mathbackground-1-ref.mml
|
||||
!= mathbackground-2.mml mathbackground-2-ref.mml
|
||||
!= mathbackground-3.mml mathbackground-3-ref.mml
|
||||
== mathbackground-4.mml mathbackground-4-ref.mml
|
||||
|
|
Загрузка…
Ссылка в новой задаче