Bug 1110056 - Merge nsMathMLmphantomFrame into nsMathMLmrowFrame. r=jkitch

This commit is contained in:
Frédéric Wang 2015-02-09 11:19:00 +01:00
parent 8141cc96f9
commit fb56fe513c
13 changed files with 98 additions and 86 deletions

View File

@ -4952,7 +4952,7 @@ nsCSSFrameConstructor::FindMathMLData(Element* aElement,
SIMPLE_MATHML_CREATE(munder_, NS_NewMathMLmunderoverFrame),
SIMPLE_MATHML_CREATE(mover_, NS_NewMathMLmunderoverFrame),
SIMPLE_MATHML_CREATE(munderover_, NS_NewMathMLmunderoverFrame),
SIMPLE_MATHML_CREATE(mphantom_, NS_NewMathMLmphantomFrame),
SIMPLE_MATHML_CREATE(mphantom_, NS_NewMathMLmrowFrame),
SIMPLE_MATHML_CREATE(mpadded_, NS_NewMathMLmpaddedFrame),
SIMPLE_MATHML_CREATE(mspace_, NS_NewMathMLmspaceFrame),
SIMPLE_MATHML_CREATE(none, NS_NewMathMLmspaceFrame),

View File

@ -83,7 +83,6 @@ FRAME_ID(nsMathMLmmultiscriptsFrame)
FRAME_ID(nsMathMLmoFrame)
FRAME_ID(nsMathMLmoverFrame)
FRAME_ID(nsMathMLmpaddedFrame)
FRAME_ID(nsMathMLmphantomFrame)
FRAME_ID(nsMathMLmrootFrame)
FRAME_ID(nsMathMLmrowFrame)
FRAME_ID(nsMathMLmspaceFrame)

View File

@ -327,7 +327,11 @@ mscarries {
}
*/
/* Do not expose the <mphantom> element to the accessible tree. */
/* "The mphantom element renders invisibly, but with the same size and other
dimensions, including baseline position, that its contents would have if
they were rendered normally.".
Also, we do not expose the <mphantom> element to the accessible tree
(see bug 1108378). */
mphantom {
visibility: hidden;
}

View File

@ -18,7 +18,6 @@ UNIFIED_SOURCES += [
'nsMathMLmmultiscriptsFrame.cpp',
'nsMathMLmoFrame.cpp',
'nsMathMLmpaddedFrame.cpp',
'nsMathMLmphantomFrame.cpp',
'nsMathMLmrootFrame.cpp',
'nsMathMLmrowFrame.cpp',
'nsMathMLmspaceFrame.cpp',

View File

@ -13,7 +13,6 @@
nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame* NS_NewMathMLmsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);

View File

@ -1,35 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMathMLmphantomFrame.h"
#include "mozilla/gfx/2D.h"
//
// <mphantom> -- make content invisible but preserve its size
//
nsIFrame*
NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsMathMLmphantomFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmphantomFrame)
nsMathMLmphantomFrame::~nsMathMLmphantomFrame()
{
}
NS_IMETHODIMP
nsMathMLmphantomFrame::InheritAutomaticData(nsIFrame* aParent)
{
// let the base class get the default from our parent
nsMathMLContainerFrame::InheritAutomaticData(aParent);
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
return NS_OK;
}

View File

@ -1,46 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsMathMLmphantomFrame_h___
#define nsMathMLmphantomFrame_h___
#include "mozilla/Attributes.h"
#include "nsMathMLContainerFrame.h"
//
// <mphantom> -- make content invisible but preserve its size
//
class nsMathMLmphantomFrame : public nsMathMLContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_IMETHOD
InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE;
NS_IMETHOD
TransmitAutomaticData() MOZ_OVERRIDE {
return TransmitAutomaticDataForMrowLikeElement();
}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
bool
IsMrowLike() MOZ_OVERRIDE {
return mFrames.FirstChild() != mFrames.LastChild() ||
!mFrames.FirstChild();
}
protected:
explicit nsMathMLmphantomFrame(nsStyleContext* aContext)
: nsMathMLContainerFrame(aContext) {}
virtual ~nsMathMLmphantomFrame();
};
#endif /* nsMathMLmphantomFrame_h___ */

View File

@ -11,6 +11,8 @@
//
// <mrow> -- horizontally group any number of subexpressions
// <mphantom> -- make content invisible but preserve its size
// <mstyle> -- make style changes that affect the rendering of its contents
//
class nsMathMLmrowFrame : public nsMathMLContainerFrame {

View File

@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<title>mphantom</title>
<meta charset="utf-8"/>
</head>
<body>
<!-- <mphantom> should be invisible. -->
</body>
</html>

View File

@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<title>mphantom</title>
<meta charset="utf-8"/>
</head>
<body>
<!-- Test different kinds of content inside <mphantom>. -->
<p><math>
<mrow style="visibility: hidden">
<msqrt>
<mfrac>
<mn>1</mn>
<mi>x</mi>
</mfrac>
</msqrt>
<mo>+</mo>
<menclose notation="box updiagonalstrike">
<mover>
<mspace width="3em" height="1em" mathbackground="red"/>
<mo></mo>
</mover>
</menclose>
</mrow>
</math></p>
</body>
</html>

View File

@ -0,0 +1,22 @@
<!doctype html>
<html>
<head>
<title>mphantom</title>
<meta charset="utf-8"/>
</head>
<body>
<p>
<math>
<mtext>LEFT</mtext>
<munderover>
<mspace width="4em" height="3em" depth="2em"/>
<mtext>BELOW</mtext>
<mtext>ABOVE</mtext>
</munderover>
<mtext>RIGHT</mtext>
</math>
</p>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<title>mphantom</title>
<meta charset="utf-8"/>
</head>
<body>
<!-- Test that <mphantom> has the size of its content. -->
<p>
<math>
<mtext>LEFT</mtext>
<munderover>
<mphantom>
<mspace width="4em" height="3em" depth="2em" mathbackground="red"/>
</mphantom>
<mtext>BELOW</mtext>
<mtext>ABOVE</mtext>
</munderover>
<mtext>RIGHT</mtext>
</math>
</p>
</body>
</html>

View File

@ -19,6 +19,8 @@ skip-if(B2G&&browserIsRemote) random-if(smallScreen&&Android) fuzzy(255,200) ==
!= mirror-op-3.html mirror-op-3-ref.html
!= mirror-op-4.html mirror-op-4-ref.html
== dynamic-mi.xhtml dynamic-mi-ref.xhtml
== mphantom-1.html mphantom-1-ref.html
== mphantom-2.html mphantom-2-ref.html
== mfenced-1.xhtml mfenced-1-ref.xhtml
== mfenced-2a.xhtml mfenced-2-ref.xhtml
== mfenced-2b.xhtml mfenced-2-ref.xhtml