mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Make lspace/rspace in mo behave as leading/trailing spaces (bug 534963). r=karlt
This commit is contained in:
parent
f4c36f78b2
commit
cc96cf931e
@ -255,15 +255,15 @@ struct nsEmbellishData {
|
||||
// the 'form' may also depend on the position of the outermost
|
||||
// embellished ancestor, the set up of these values may require
|
||||
// looking up the position of our ancestors.
|
||||
nscoord leftSpace;
|
||||
nscoord rightSpace;
|
||||
nscoord leadingSpace;
|
||||
nscoord trailingSpace;
|
||||
|
||||
nsEmbellishData() {
|
||||
flags = 0;
|
||||
coreFrame = nsnull;
|
||||
direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
leftSpace = 0;
|
||||
rightSpace = 0;
|
||||
leadingSpace = 0;
|
||||
trailingSpace = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -445,11 +445,13 @@ nsMathMLContainerFrame::Stretch(nsRenderingContext& aRenderingContext,
|
||||
nsEmbellishData coreData;
|
||||
GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
|
||||
|
||||
mBoundingMetrics.width += coreData.leftSpace + coreData.rightSpace;
|
||||
mBoundingMetrics.width +=
|
||||
coreData.leadingSpace + coreData.trailingSpace;
|
||||
aDesiredStretchSize.width = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
|
||||
|
||||
nscoord dx = coreData.leftSpace;
|
||||
nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
|
||||
coreData.trailingSpace : coreData.leadingSpace);
|
||||
if (dx != 0) {
|
||||
mBoundingMetrics.leftBearing += dx;
|
||||
mBoundingMetrics.rightBearing += dx;
|
||||
@ -1528,8 +1530,8 @@ nsMathMLContainerFrame::TransmitAutomaticDataForMrowLikeElement()
|
||||
mEmbellishData.flags = 0;
|
||||
mEmbellishData.coreFrame = nsnull;
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
mEmbellishData.leftSpace = 0;
|
||||
mEmbellishData.rightSpace = 0;
|
||||
mEmbellishData.leadingSpace = 0;
|
||||
mEmbellishData.trailingSpace = 0;
|
||||
}
|
||||
|
||||
if (childFrame || embellishedOpFound) {
|
||||
|
@ -126,8 +126,8 @@ nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
|
||||
mEmbellishData.flags = 0;
|
||||
mEmbellishData.coreFrame = nsnull;
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
mEmbellishData.leftSpace = 0;
|
||||
mEmbellishData.rightSpace = 0;
|
||||
mEmbellishData.leadingSpace = 0;
|
||||
mEmbellishData.trailingSpace = 0;
|
||||
|
||||
mPresentationData.flags = 0;
|
||||
mPresentationData.baseFrame = nsnull;
|
||||
@ -211,8 +211,8 @@ nsMathMLFrame::GetEmbellishDataFrom(nsIFrame* aFrame,
|
||||
aEmbellishData.flags = 0;
|
||||
aEmbellishData.coreFrame = nsnull;
|
||||
aEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
aEmbellishData.leftSpace = 0;
|
||||
aEmbellishData.rightSpace = 0;
|
||||
aEmbellishData.leadingSpace = 0;
|
||||
aEmbellishData.trailingSpace = 0;
|
||||
|
||||
if (aFrame && aFrame->IsFrameOfType(nsIFrame::eMathML)) {
|
||||
nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame);
|
||||
|
@ -54,16 +54,16 @@
|
||||
struct OperatorData {
|
||||
OperatorData(void)
|
||||
: mFlags(0),
|
||||
mLeftSpace(0.0f),
|
||||
mRightSpace(0.0f)
|
||||
mLeadingSpace(0.0f),
|
||||
mTrailingSpace(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
// member data
|
||||
nsString mStr;
|
||||
nsOperatorFlags mFlags;
|
||||
float mLeftSpace; // unit is em
|
||||
float mRightSpace; // unit is em
|
||||
float mLeadingSpace; // unit is em
|
||||
float mTrailingSpace; // unit is em
|
||||
};
|
||||
|
||||
static PRInt32 gTableRefCount = 0;
|
||||
@ -139,11 +139,11 @@ SetProperty(OperatorData* aOperatorData,
|
||||
aOperatorData->mFlags |= NS_MATHML_OPERATOR_DIRECTION_HORIZONTAL;
|
||||
else return; // invalid value
|
||||
} else {
|
||||
bool isLeftSpace;
|
||||
bool isLeadingSpace;
|
||||
if (aName.EqualsLiteral("lspace"))
|
||||
isLeftSpace = true;
|
||||
isLeadingSpace = true;
|
||||
else if (aName.EqualsLiteral("rspace"))
|
||||
isLeftSpace = false;
|
||||
isLeadingSpace = false;
|
||||
else return; // input is not applicable
|
||||
|
||||
// aValue is assumed to be a digit from 0 to 7
|
||||
@ -151,10 +151,10 @@ SetProperty(OperatorData* aOperatorData,
|
||||
float space = aValue.ToFloat(&error) / 18.0;
|
||||
if (error) return;
|
||||
|
||||
if (isLeftSpace)
|
||||
aOperatorData->mLeftSpace = space;
|
||||
if (isLeadingSpace)
|
||||
aOperatorData->mLeadingSpace = space;
|
||||
else
|
||||
aOperatorData->mRightSpace = space;
|
||||
aOperatorData->mTrailingSpace = space;
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,14 +409,14 @@ bool
|
||||
nsMathMLOperators::LookupOperator(const nsString& aOperator,
|
||||
const nsOperatorFlags aForm,
|
||||
nsOperatorFlags* aFlags,
|
||||
float* aLeftSpace,
|
||||
float* aRightSpace)
|
||||
float* aLeadingSpace,
|
||||
float* aTrailingSpace)
|
||||
{
|
||||
if (!gInitialized) {
|
||||
InitGlobals();
|
||||
}
|
||||
if (gOperatorTable) {
|
||||
NS_ASSERTION(aFlags && aLeftSpace && aRightSpace, "bad usage");
|
||||
NS_ASSERTION(aFlags && aLeadingSpace && aTrailingSpace, "bad usage");
|
||||
NS_ASSERTION(aForm > 0 && aForm < 4, "*** invalid call ***");
|
||||
|
||||
// The MathML REC says:
|
||||
@ -441,8 +441,8 @@ nsMathMLOperators::LookupOperator(const nsString& aOperator,
|
||||
}
|
||||
if (found) {
|
||||
NS_ASSERTION(found->mStr.Equals(aOperator), "bad setup");
|
||||
*aLeftSpace = found->mLeftSpace;
|
||||
*aRightSpace = found->mRightSpace;
|
||||
*aLeadingSpace = found->mLeadingSpace;
|
||||
*aTrailingSpace = found->mTrailingSpace;
|
||||
*aFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the form bits
|
||||
*aFlags |= found->mFlags; // just add bits without overwriting
|
||||
return true;
|
||||
@ -454,44 +454,44 @@ nsMathMLOperators::LookupOperator(const nsString& aOperator,
|
||||
void
|
||||
nsMathMLOperators::LookupOperators(const nsString& aOperator,
|
||||
nsOperatorFlags* aFlags,
|
||||
float* aLeftSpace,
|
||||
float* aRightSpace)
|
||||
float* aLeadingSpace,
|
||||
float* aTrailingSpace)
|
||||
{
|
||||
if (!gInitialized) {
|
||||
InitGlobals();
|
||||
}
|
||||
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = 0;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = 0.0f;
|
||||
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = 0.0f;
|
||||
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = 0;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = 0.0f;
|
||||
|
||||
if (gOperatorTable) {
|
||||
OperatorData* found;
|
||||
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_INFIX);
|
||||
if (found) {
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_INFIX] = found->mFlags;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeftSpace;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mRightSpace;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mLeadingSpace;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_INFIX] = found->mTrailingSpace;
|
||||
}
|
||||
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_POSTFIX);
|
||||
if (found) {
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mFlags;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeftSpace;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mRightSpace;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mLeadingSpace;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_POSTFIX] = found->mTrailingSpace;
|
||||
}
|
||||
found = GetOperatorData(aOperator, NS_MATHML_OPERATOR_FORM_PREFIX);
|
||||
if (found) {
|
||||
aFlags[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mFlags;
|
||||
aLeftSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeftSpace;
|
||||
aRightSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mRightSpace;
|
||||
aLeadingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mLeadingSpace;
|
||||
aTrailingSpace[NS_MATHML_OPERATOR_FORM_PREFIX] = found->mTrailingSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ enum {
|
||||
// Additional bits not stored in the dictionary
|
||||
NS_MATHML_OPERATOR_MINSIZE_ABSOLUTE = 1<<12,
|
||||
NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE = 1<<13,
|
||||
NS_MATHML_OPERATOR_LEFTSPACE_ATTR = 1<<14,
|
||||
NS_MATHML_OPERATOR_RIGHTSPACE_ATTR = 1<<15
|
||||
NS_MATHML_OPERATOR_LSPACE_ATTR = 1<<14,
|
||||
NS_MATHML_OPERATOR_RSPACE_ATTR = 1<<15
|
||||
};
|
||||
|
||||
#define NS_MATHML_OPERATOR_SIZE_INFINITY NS_IEEEPositiveInfinity()
|
||||
@ -129,20 +129,21 @@ public:
|
||||
LookupOperator(const nsString& aOperator,
|
||||
const nsOperatorFlags aForm,
|
||||
nsOperatorFlags* aFlags,
|
||||
float* aLeftSpace,
|
||||
float* aRightSpace);
|
||||
float* aLeadingSpace,
|
||||
float* aTrailingSpace);
|
||||
|
||||
// LookupOperators:
|
||||
// Helper to return all the forms under which an operator is listed in the
|
||||
// Operator Dictionary. The caller must pass arrays of size 4, and use
|
||||
// aFlags[NS_MATHML_OPERATOR_FORM_{INFIX|POSTFIX|PREFIX}], aLeftSpace[], etc,
|
||||
// to access the attributes of the operator under a particular form. If the
|
||||
// operator wasn't found under a form, its entry aFlags[form] is set to zero.
|
||||
// aFlags[NS_MATHML_OPERATOR_FORM_{INFIX|POSTFIX|PREFIX}],
|
||||
// aLeadingSpace[], etc, to access the attributes of the operator under a
|
||||
// particular form. If the operator wasn't found under a form, its entry
|
||||
// aFlags[form] is set to zero.
|
||||
static void
|
||||
LookupOperators(const nsString& aOperator,
|
||||
nsOperatorFlags* aFlags,
|
||||
float* aLeftSpace,
|
||||
float* aRightSpace);
|
||||
float* aLeadingSpace,
|
||||
float* aTrailingSpace);
|
||||
|
||||
// IsMutableOperator:
|
||||
// Return true if the operator exists and is stretchy or largeop
|
||||
@ -235,10 +236,10 @@ public:
|
||||
#define NS_MATHML_OPERATOR_MAXSIZE_IS_ABSOLUTE(_flags) \
|
||||
(NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE == ((_flags) & NS_MATHML_OPERATOR_MAXSIZE_ABSOLUTE))
|
||||
|
||||
#define NS_MATHML_OPERATOR_HAS_LEFTSPACE_ATTR(_flags) \
|
||||
(NS_MATHML_OPERATOR_LEFTSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_LEFTSPACE_ATTR))
|
||||
#define NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(_flags) \
|
||||
(NS_MATHML_OPERATOR_LSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_LSPACE_ATTR))
|
||||
|
||||
#define NS_MATHML_OPERATOR_HAS_RIGHTSPACE_ATTR(_flags) \
|
||||
(NS_MATHML_OPERATOR_RIGHTSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_RIGHTSPACE_ATTR))
|
||||
#define NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(_flags) \
|
||||
(NS_MATHML_OPERATOR_RSPACE_ATTR == ((_flags) & NS_MATHML_OPERATOR_RSPACE_ATTR))
|
||||
|
||||
#endif /* nsMathMLOperators_h___ */
|
||||
|
@ -272,8 +272,12 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
// container (we fetch values from the core since they may use units that
|
||||
// depend on style data, and style changes could have occurred in the
|
||||
// core since our last visit there)
|
||||
nscoord leftSpace = NS_MAX(onePixel, coreData.leftSpace);
|
||||
nscoord rightSpace = NS_MAX(onePixel, coreData.rightSpace);
|
||||
nscoord leftSpace = NS_MAX(onePixel,
|
||||
NS_MATHML_IS_RTL(mPresentationData.flags) ?
|
||||
coreData.trailingSpace : coreData.leadingSpace);
|
||||
nscoord rightSpace = NS_MAX(onePixel,
|
||||
NS_MATHML_IS_RTL(mPresentationData.flags) ?
|
||||
coreData.leadingSpace : coreData.trailingSpace);
|
||||
|
||||
//////////////////
|
||||
// Get shifts
|
||||
@ -422,8 +426,8 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
nscoord slashMinHeight = slashRatio *
|
||||
NS_MIN(2 * mLineThickness, slashMaxWidthConstant);
|
||||
|
||||
nscoord leftSpace = NS_MAX(padding, coreData.leftSpace);
|
||||
nscoord rightSpace = NS_MAX(padding, coreData.rightSpace);
|
||||
nscoord leadingSpace = NS_MAX(padding, coreData.leadingSpace);
|
||||
nscoord trailingSpace = NS_MAX(padding, coreData.trailingSpace);
|
||||
nscoord delta;
|
||||
|
||||
// ___________
|
||||
@ -484,11 +488,16 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
}
|
||||
|
||||
// Set horizontal bounding metrics
|
||||
mBoundingMetrics.leftBearing = leftSpace + bmNum.leftBearing;
|
||||
mBoundingMetrics.rightBearing =
|
||||
leftSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
|
||||
if (NS_MATHML_IS_RTL(mPresentationData.flags)) {
|
||||
mBoundingMetrics.leftBearing = trailingSpace + bmDen.leftBearing;
|
||||
mBoundingMetrics.rightBearing = trailingSpace + bmDen.width + mLineRect.width + bmNum.rightBearing;
|
||||
} else {
|
||||
mBoundingMetrics.leftBearing = leadingSpace + bmNum.leftBearing;
|
||||
mBoundingMetrics.rightBearing = leadingSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
|
||||
}
|
||||
mBoundingMetrics.width =
|
||||
leftSpace + bmNum.width + mLineRect.width + bmDen.width + rightSpace;
|
||||
leadingSpace + bmNum.width + mLineRect.width + bmDen.width +
|
||||
trailingSpace;
|
||||
|
||||
// Set aDesiredSize
|
||||
aDesiredSize.ascent = mBoundingMetrics.ascent + padding;
|
||||
@ -505,20 +514,20 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
||||
|
||||
// place numerator
|
||||
dx = MirrorIfRTL(aDesiredSize.width, sizeNum.width,
|
||||
leftSpace);
|
||||
leadingSpace);
|
||||
dy = aDesiredSize.ascent - numShift - sizeNum.ascent;
|
||||
FinishReflowChild(frameNum, presContext, nsnull, sizeNum, dx, dy, 0);
|
||||
|
||||
// place the fraction bar
|
||||
dx = MirrorIfRTL(aDesiredSize.width, mLineRect.width,
|
||||
leftSpace + bmNum.width);
|
||||
leadingSpace + bmNum.width);
|
||||
dy = aDesiredSize.ascent - mBoundingMetrics.ascent;
|
||||
mLineRect.SetRect(dx, dy,
|
||||
mLineRect.width, aDesiredSize.height - 2 * padding);
|
||||
|
||||
// place denominator
|
||||
dx = MirrorIfRTL(aDesiredSize.width, sizeDen.width,
|
||||
leftSpace + bmNum.width + mLineRect.width);
|
||||
leadingSpace + bmNum.width + mLineRect.width);
|
||||
dy = aDesiredSize.ascent + denShift - sizeDen.ascent;
|
||||
FinishReflowChild(frameDen, presContext, nsnull, sizeDen, dx, dy, 0);
|
||||
}
|
||||
|
@ -266,8 +266,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
// in case of dynamic changes
|
||||
mEmbellishData.flags = 0;
|
||||
mEmbellishData.coreFrame = nsnull;
|
||||
mEmbellishData.leftSpace = 0;
|
||||
mEmbellishData.rightSpace = 0;
|
||||
mEmbellishData.leadingSpace = 0;
|
||||
mEmbellishData.trailingSpace = 0;
|
||||
if (mMathMLChar.Length() != 1)
|
||||
mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
|
||||
// else... retain the native direction obtained in ProcessTextData()
|
||||
@ -390,8 +390,8 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
|
||||
GetEmHeight(fm, em);
|
||||
|
||||
mEmbellishData.leftSpace = NSToCoordRound(lspace * em);
|
||||
mEmbellishData.rightSpace = NSToCoordRound(rspace * em);
|
||||
mEmbellishData.leadingSpace = NSToCoordRound(lspace * em);
|
||||
mEmbellishData.trailingSpace = NSToCoordRound(rspace * em);
|
||||
|
||||
// tuning if we don't want too much extra space when we are a script.
|
||||
// (with its fonts, TeX sets lspace=0 & rspace=0 as soon as scriptlevel>0.
|
||||
@ -399,22 +399,22 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
if (GetStyleFont()->mScriptLevel > 0) {
|
||||
if (NS_MATHML_OPERATOR_EMBELLISH_IS_ISOLATED(mFlags)) {
|
||||
// could be an isolated accent or script, e.g., x^{+}, just zero out
|
||||
mEmbellishData.leftSpace = 0;
|
||||
mEmbellishData.rightSpace = 0;
|
||||
mEmbellishData.leadingSpace = 0;
|
||||
mEmbellishData.trailingSpace = 0;
|
||||
}
|
||||
else if (!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
|
||||
mEmbellishData.leftSpace /= 2;
|
||||
mEmbellishData.rightSpace /= 2;
|
||||
mEmbellishData.leadingSpace /= 2;
|
||||
mEmbellishData.trailingSpace /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we are an accent without explicit lspace="." or rspace=".",
|
||||
// we will ignore our default left/right space
|
||||
// we will ignore our default leading/trailing space
|
||||
|
||||
// lspace = number h-unit | namedspace
|
||||
nscoord leftSpace = mEmbellishData.leftSpace;
|
||||
nscoord leadingSpace = mEmbellishData.leadingSpace;
|
||||
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::lspace_,
|
||||
value);
|
||||
if (!value.IsEmpty()) {
|
||||
@ -423,15 +423,15 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
ParseNamedSpaceValue(mPresentationData.mstyle, value, cssValue))
|
||||
{
|
||||
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
|
||||
leftSpace = 0;
|
||||
leadingSpace = 0;
|
||||
else if (cssValue.IsLengthUnit())
|
||||
leftSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
mFlags |= NS_MATHML_OPERATOR_LEFTSPACE_ATTR;
|
||||
leadingSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
mFlags |= NS_MATHML_OPERATOR_LSPACE_ATTR;
|
||||
}
|
||||
}
|
||||
|
||||
// rspace = number h-unit | namedspace
|
||||
nscoord rightSpace = mEmbellishData.rightSpace;
|
||||
nscoord trailingSpace = mEmbellishData.trailingSpace;
|
||||
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::rspace_,
|
||||
value);
|
||||
if (!value.IsEmpty()) {
|
||||
@ -440,26 +440,26 @@ nsMathMLmoFrame::ProcessOperatorData()
|
||||
ParseNamedSpaceValue(mPresentationData.mstyle, value, cssValue))
|
||||
{
|
||||
if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue())
|
||||
rightSpace = 0;
|
||||
trailingSpace = 0;
|
||||
else if (cssValue.IsLengthUnit())
|
||||
rightSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
mFlags |= NS_MATHML_OPERATOR_RIGHTSPACE_ATTR;
|
||||
trailingSpace = CalcLength(presContext, mStyleContext, cssValue);
|
||||
mFlags |= NS_MATHML_OPERATOR_RSPACE_ATTR;
|
||||
}
|
||||
}
|
||||
|
||||
// little extra tuning to round lspace & rspace to at least a pixel so that
|
||||
// operators don't look as if they are colliding with their operands
|
||||
if (leftSpace || rightSpace) {
|
||||
if (leadingSpace || trailingSpace) {
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
if (leftSpace && leftSpace < onePixel)
|
||||
leftSpace = onePixel;
|
||||
if (rightSpace && rightSpace < onePixel)
|
||||
rightSpace = onePixel;
|
||||
if (leadingSpace && leadingSpace < onePixel)
|
||||
leadingSpace = onePixel;
|
||||
if (trailingSpace && trailingSpace < onePixel)
|
||||
trailingSpace = onePixel;
|
||||
}
|
||||
|
||||
// the values that we get from our attributes override the dictionary
|
||||
mEmbellishData.leftSpace = leftSpace;
|
||||
mEmbellishData.rightSpace = rightSpace;
|
||||
mEmbellishData.leadingSpace = leadingSpace;
|
||||
mEmbellishData.trailingSpace = trailingSpace;
|
||||
|
||||
// Now see if there are user-defined attributes that override the dictionary.
|
||||
// XXX If an attribute can be forced to be true when it is false in the
|
||||
@ -871,36 +871,39 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
|
||||
if (!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
|
||||
|
||||
// Account the spacing if we are not an accent with explicit attributes
|
||||
nscoord leftSpace = mEmbellishData.leftSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_LEFTSPACE_ATTR(mFlags)) {
|
||||
leftSpace = 0;
|
||||
nscoord leadingSpace = mEmbellishData.leadingSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(mFlags)) {
|
||||
leadingSpace = 0;
|
||||
}
|
||||
nscoord rightSpace = mEmbellishData.rightSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_RIGHTSPACE_ATTR(mFlags)) {
|
||||
rightSpace = 0;
|
||||
nscoord trailingSpace = mEmbellishData.trailingSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(mFlags)) {
|
||||
trailingSpace = 0;
|
||||
}
|
||||
|
||||
mBoundingMetrics.width += leftSpace + rightSpace;
|
||||
mBoundingMetrics.width += leadingSpace + trailingSpace;
|
||||
aDesiredStretchSize.width = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
|
||||
|
||||
if (leftSpace) {
|
||||
nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
|
||||
trailingSpace : leadingSpace);
|
||||
if (dx) {
|
||||
// adjust the offsets
|
||||
mBoundingMetrics.leftBearing += leftSpace;
|
||||
mBoundingMetrics.rightBearing += leftSpace;
|
||||
aDesiredStretchSize.mBoundingMetrics.leftBearing += leftSpace;
|
||||
aDesiredStretchSize.mBoundingMetrics.rightBearing += leftSpace;
|
||||
mBoundingMetrics.leftBearing += dx;
|
||||
mBoundingMetrics.rightBearing += dx;
|
||||
aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
|
||||
aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
|
||||
|
||||
if (useMathMLChar) {
|
||||
nsRect rect;
|
||||
mMathMLChar.GetRect(rect);
|
||||
mMathMLChar.SetRect(nsRect(rect.x + leftSpace, rect.y, rect.width, rect.height));
|
||||
mMathMLChar.SetRect(nsRect(rect.x + dx, rect.y,
|
||||
rect.width, rect.height));
|
||||
}
|
||||
else {
|
||||
nsIFrame* childFrame = firstChild;
|
||||
while (childFrame) {
|
||||
childFrame->SetPosition(childFrame->GetPosition()
|
||||
+ nsPoint(leftSpace, 0));
|
||||
childFrame->SetPosition(childFrame->GetPosition() +
|
||||
nsPoint(dx, 0));
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
@ -1011,10 +1014,10 @@ nsMathMLmoFrame::GetIntrinsicWidth(nsRenderingContext *aRenderingContext)
|
||||
width = nsMathMLTokenFrame::GetIntrinsicWidth(aRenderingContext);
|
||||
}
|
||||
|
||||
// leftSpace and rightSpace are actually applied to the outermost
|
||||
// leadingSpace and trailingSpace are actually applied to the outermost
|
||||
// embellished container but for determining total intrinsic width it should
|
||||
// be safe to include it for the core here instead.
|
||||
width += mEmbellishData.leftSpace + mEmbellishData.rightSpace;
|
||||
width += mEmbellishData.leadingSpace + mEmbellishData.trailingSpace;
|
||||
|
||||
return width;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user