Bug 556767 - (semantics) Improve/Complete implementation of <semantics/>. r=roc

This commit is contained in:
Frederic Wang 2010-05-12 12:11:59 +02:00
Родитель 903fcea3d7
Коммит ef884ea7fd
9 изменённых файлов: 321 добавлений и 1 удалений

Просмотреть файл

@ -4703,7 +4703,8 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
SIMPLE_MATHML_CREATE(maction_, NS_NewMathMLmactionFrame),
SIMPLE_MATHML_CREATE(mrow_, NS_NewMathMLmrowFrame),
SIMPLE_MATHML_CREATE(merror_, NS_NewMathMLmrowFrame),
SIMPLE_MATHML_CREATE(menclose_, NS_NewMathMLmencloseFrame)
SIMPLE_MATHML_CREATE(menclose_, NS_NewMathMLmencloseFrame),
SIMPLE_MATHML_CREATE(semantics_, NS_NewMathMLsemanticsFrame)
};
return FindDataByTag(aTag, aContent, aStyleContext, sMathMLData,

Просмотреть файл

@ -176,6 +176,7 @@ public:
nsMathMLmtrFrame_id,
nsMathMLmunderFrame_id,
nsMathMLmunderoverFrame_id,
nsMathMLsemanticsFrame_id,
nsMathMLTokenFrame_id,
nsMenuBarFrame_id,
nsMenuFrame_id,

Просмотреть файл

@ -86,6 +86,7 @@ CPPSRCS = nsMathMLChar.cpp \
nsMathMLmrootFrame.cpp \
nsMathMLmactionFrame.cpp \
nsMathMLmencloseFrame.cpp \
nsMathMLsemanticsFrame.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk

Просмотреть файл

@ -70,6 +70,7 @@ nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aCont
nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla MathML Project.
*
* The Initial Developer of the Original Code is
* Frederic Wang <fred.wang@free.fr>
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMathMLsemanticsFrame.h"
//
// <semantics> -- associate annotations with a MathML expression
//
nsIFrame*
NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsMathMLsemanticsFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLsemanticsFrame)
nsMathMLsemanticsFrame::~nsMathMLsemanticsFrame()
{
}
NS_IMETHODIMP
nsMathMLsemanticsFrame::TransmitAutomaticData()
{
// The REC defines the following elements to be embellished operators:
// * one of the elements msub, msup, msubsup, munder, mover, munderover,
// mmultiscripts, mfrac, or semantics (Section 5.1 Annotation Framework),
// whose first argument exists and is an embellished operator;
//
// If our first child is an embellished operator, its flags bubble to us
mPresentationData.baseFrame = mFrames.FirstChild();
GetEmbellishDataFrom(mPresentationData.baseFrame, mEmbellishData);
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla MathML Project.
*
* The Initial Developer of the Original Code is
* Frederic Wang <fred.wang@free.fr>
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsMathMLsemanticsFrame_h___
#define nsMathMLsemanticsFrame_h___
#include "nsMathMLContainerFrame.h"
//
// <semantics> -- associate annotations with a MathML expression
//
class nsMathMLsemanticsFrame : public nsMathMLContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewMathMLsemanticsFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
NS_IMETHOD
TransmitAutomaticData();
protected:
nsMathMLsemanticsFrame(nsStyleContext* aContext) :
nsMathMLContainerFrame(aContext) {}
virtual ~nsMathMLsemanticsFrame();
};
#endif /* nsMathMLsemanticsFrame_h___ */

Просмотреть файл

@ -9,3 +9,4 @@
== 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
== semantics-1.xhtml semantics-1-ref.xhtml

Просмотреть файл

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=utf-8" />
<title>Various tests for semantics</title>
</head>
<body>
<!-- displaystyle (bug 468059) -->
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<semantics>
<mstyle displaystyle="true">
<munderover>
<mo movablelimits="true">□■□</mo>
<mtext>■□■□■□</mtext>
<mtext>■□■□■□</mtext>
</munderover>
</mstyle>
</semantics>
</math></p>
<!-- embellished operator (bug 21479) -->
<p><math xmlns="http://www.w3.org/1998/Math/MathML">
<mover>
<mtext>■□■□■□■□■□■□</mtext>
<mo>&#xaf;</mo>
</mover>
</math></p>
<!-- unwanted whitespace (bug 512418) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mrow>
<mo>lcm</mo>
<mo>(</mo>
<mi>a</mi>
<mo>,</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mfrac>
<mrow>
<mo>(</mo>
<mi>a</mi>
<mo>&#x2062;</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
<mrow>
<mo>gcd</mo>
<mo>(</mo>
<mi>a</mi>
<mo>,</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
</mfrac>
</mrow>
</math>■□■□■□</p>
<!-- maction and semantics (bug 523037) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<maction actiontype="toggle" selection="3">
<mn>1</mn>
<mn>2</mn>
<mn>3</mn>
<mn>4</mn>
<mn>5</mn>
</maction>
</math>■□■□■□</p>
<!-- maction and semantics (bug 523045) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<maction actiontype="toggle" selection="4">
<mn>1</mn>
<mn>2</mn>
<mn>3</mn>
<mn>4</mn>
<mn>5</mn>
</maction>
</math>■□■□■□</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=utf-8" />
<title>Various tests for semantics</title>
</head>
<body>
<!-- displaystyle (bug 468059) -->
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<semantics>
<munderover>
<mo movablelimits="true">□■□</mo>
<mtext>■□■□■□</mtext>
<mtext>■□■□■□</mtext>
</munderover>
</semantics>
</math></p>
<!-- embellished operator (bug 21479) -->
<p><math xmlns="http://www.w3.org/1998/Math/MathML">
<mover>
<mtext>■□■□■□■□■□■□</mtext>
<semantics><mo>&#xaf;</mo></semantics>
</mover>
</math></p>
<!-- unwanted whitespace (bug 512418) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mrow>
<mo>lcm</mo>
<mo>(</mo>
<mi>a</mi>
<mo>,</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mfrac>
<mrow>
<mo>(</mo>
<mi>a</mi>
<mo>&#x2062;</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
<mrow>
<mo>gcd</mo>
<mo>(</mo>
<mi>a</mi>
<mo>,</mo>
<mi>b</mi>
<mo>)</mo>
</mrow>
</mfrac>
</mrow>
</semantics>
</math>■□■□■□</p>
<!-- maction and semantics (bug 523037) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<maction actiontype="toggle" selection="3">
<mn>1</mn>
<mn>2</mn>
<semantics>
<mn>3</mn>
<annotation encoding="text">three</annotation>
</semantics>
<semantics>
<mn>4</mn>
<annotation encoding="text">four</annotation>
</semantics>
<mn>5</mn>
</maction>
</math>■□■□■□</p>
<!-- maction and semantics (bug 523045) -->
<p>■□■□■□<math xmlns="http://www.w3.org/1998/Math/MathML">
<maction actiontype="toggle" selection="4">
<mn>1</mn>
<mn>2</mn>
<semantics>
<mn>3</mn>
<annotation encoding="text">three</annotation>
</semantics>
<semantics>
<mn>4</mn>
<annotation encoding="text">four</annotation>
</semantics>
<mn>5</mn>
</maction>
</math>■□■□■□</p>
</body>
</html>