2007-06-12 06:10:23 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
1999-09-21 02:12:01 +00:00
|
|
|
|
|
|
|
#ifndef nsMathMLmfracFrame_h___
|
|
|
|
#define nsMathMLmfracFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-09-21 02:12:01 +00:00
|
|
|
#include "nsMathMLContainerFrame.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// <mfrac> -- form a fraction from two subexpressions
|
|
|
|
//
|
|
|
|
|
|
|
|
/*
|
|
|
|
The MathML REC describes:
|
|
|
|
|
|
|
|
The <mfrac> element is used for fractions. It can also be used to mark up
|
|
|
|
fraction-like objects such as binomial coefficients and Legendre symbols.
|
|
|
|
The syntax for <mfrac> is:
|
|
|
|
<mfrac> numerator denominator </mfrac>
|
|
|
|
|
|
|
|
Attributes of <mfrac>:
|
|
|
|
Name values default
|
|
|
|
linethickness number [ v-unit ] | thin | medium | thick 1
|
|
|
|
|
|
|
|
E.g.,
|
|
|
|
linethickness=2 actually means that linethickness=2*DEFAULT_THICKNESS
|
|
|
|
(DEFAULT_THICKNESS is not specified by MathML, see below.)
|
|
|
|
|
|
|
|
The linethickness attribute indicates the thickness of the horizontal
|
|
|
|
"fraction bar", or "rule", typically used to render fractions. A fraction
|
|
|
|
with linethickness="0" renders without the bar, and might be used within
|
|
|
|
binomial coefficients. A linethickness greater than one might be used with
|
2000-01-26 06:49:38 +00:00
|
|
|
nested fractions.
|
1999-09-21 02:12:01 +00:00
|
|
|
|
|
|
|
In general, the value of linethickness can be a number, as a multiplier
|
|
|
|
of the default thickness of the fraction bar (the default thickness is
|
|
|
|
not specified by MathML), or a number with a unit of vertical length (see
|
|
|
|
Section 2.3.3), or one of the keywords medium (same as 1), thin (thinner
|
|
|
|
than 1, otherwise up to the renderer), or thick (thicker than 1, otherwise
|
|
|
|
up to the renderer).
|
|
|
|
|
|
|
|
The <mfrac> element sets displaystyle to "false", or if it was already
|
|
|
|
false increments scriptlevel by 1, within numerator and denominator.
|
|
|
|
These attributes are inherited by every element from its rendering
|
|
|
|
environment, but can be set explicitly only on the <mstyle>
|
2000-01-26 06:49:38 +00:00
|
|
|
element.
|
1999-09-21 02:12:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class nsMathMLmfracFrame : public nsMathMLContainerFrame {
|
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
friend nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
1999-09-21 02:12:01 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual eMathMLFrameType GetMathMLFrameType() override;
|
2005-09-06 23:47:01 +00:00
|
|
|
|
2009-10-07 09:31:45 +00:00
|
|
|
virtual nsresult
|
2015-12-15 21:56:41 +00:00
|
|
|
MeasureForWidth(DrawTarget* aDrawTarget,
|
2016-07-21 10:36:38 +00:00
|
|
|
ReflowOutput& aDesiredSize) override;
|
2008-03-14 05:02:49 +00:00
|
|
|
|
2008-03-18 04:52:48 +00:00
|
|
|
virtual nsresult
|
2015-12-15 21:56:41 +00:00
|
|
|
Place(DrawTarget* aDrawTarget,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aPlaceOrigin,
|
2016-07-21 10:36:38 +00:00
|
|
|
ReflowOutput& aDesiredSize) override;
|
1999-09-21 02:12:01 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
1999-09-21 02:12:01 +00:00
|
|
|
|
2016-03-31 01:59:00 +00:00
|
|
|
virtual nsresult
|
|
|
|
AttributeChanged(int32_t aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
int32_t aModType) override;
|
|
|
|
|
2002-02-01 15:10:50 +00:00
|
|
|
NS_IMETHOD
|
2015-03-21 16:28:04 +00:00
|
|
|
TransmitAutomaticData() override;
|
2002-02-01 15:10:50 +00:00
|
|
|
|
2005-09-16 00:39:27 +00:00
|
|
|
// override the base method so that we can deal with the fraction line
|
|
|
|
virtual nscoord
|
2016-07-21 10:36:38 +00:00
|
|
|
FixInterFrameSpacing(ReflowOutput& aDesiredSize) override;
|
2005-09-16 00:39:27 +00:00
|
|
|
|
2000-03-28 09:38:24 +00:00
|
|
|
// helper to translate the thickness attribute into a usable form
|
|
|
|
static nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
CalcLineThickness(nsPresContext* aPresContext,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aStyleContext,
|
2000-03-28 09:38:24 +00:00
|
|
|
nsString& aThicknessAttribute,
|
|
|
|
nscoord onePixel,
|
2014-10-25 06:29:00 +00:00
|
|
|
nscoord aDefaultRuleThickness,
|
|
|
|
float aFontSizeInflation);
|
1999-09-21 02:12:01 +00:00
|
|
|
|
2014-01-15 14:49:00 +00:00
|
|
|
uint8_t
|
2015-03-21 16:28:04 +00:00
|
|
|
ScriptIncrement(nsIFrame* aFrame) override;
|
2014-01-15 14:49:00 +00:00
|
|
|
|
1999-09-21 02:12:01 +00:00
|
|
|
protected:
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsMathMLmfracFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
|
1999-09-21 02:12:01 +00:00
|
|
|
virtual ~nsMathMLmfracFrame();
|
2015-12-15 21:56:41 +00:00
|
|
|
|
|
|
|
nsresult PlaceInternal(DrawTarget* aDrawTarget,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aPlaceOrigin,
|
2016-07-21 10:36:38 +00:00
|
|
|
ReflowOutput& aDesiredSize,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aWidthOnly);
|
2009-10-07 09:31:45 +00:00
|
|
|
|
|
|
|
// Display a slash
|
2013-02-14 11:12:27 +00:00
|
|
|
void DisplaySlash(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame, const nsRect& aRect,
|
|
|
|
nscoord aThickness,
|
|
|
|
const nsDisplayListSet& aLists);
|
2009-10-07 09:31:45 +00:00
|
|
|
|
|
|
|
nsRect mLineRect;
|
2002-01-05 01:15:04 +00:00
|
|
|
nsMathMLChar* mSlashChar;
|
2009-10-07 09:31:45 +00:00
|
|
|
nscoord mLineThickness;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsBevelled;
|
1999-09-21 02:12:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsMathMLmfracFrame_h___ */
|