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