Backed out 7 changesets (bug 1908069) for causing wr failures on mo-lspace-rspace-4.html. CLOSED TREE
Backed out changeset d497ae104185 (bug 1908069) Backed out changeset c87b8ca300dc (bug 1908069) Backed out changeset 3e76c02843a7 (bug 1908069) Backed out changeset f4c5983c700b (bug 1908069) Backed out changeset 5468da212605 (bug 1908069) Backed out changeset ab5ab71ddfc4 (bug 1908069) Backed out changeset 21269d373fff (bug 1908069)
This commit is contained in:
@@ -120,10 +120,6 @@ struct BaseMargin {
|
||||
left = std::min(left, aMargin.left);
|
||||
}
|
||||
|
||||
bool IsAllZero() const {
|
||||
return left == 0 && top == 0 && right == 0 && bottom == 0;
|
||||
}
|
||||
|
||||
// Overloaded operators. Note that '=' isn't defined so we'll get the
|
||||
// compiler generated default assignment operator
|
||||
bool operator==(const Sub& aMargin) const {
|
||||
|
||||
@@ -1423,7 +1423,10 @@ class LogicalMargin {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IsAllZero() const { return mMargin.IsAllZero(); }
|
||||
bool IsAllZero() const {
|
||||
return (mMargin.left == 0 && mMargin.top == 0 && mMargin.right == 0 &&
|
||||
mMargin.bottom == 0);
|
||||
}
|
||||
|
||||
bool operator==(const LogicalMargin& aMargin) const {
|
||||
CHECK_WRITING_MODE(aMargin.GetWritingMode());
|
||||
|
||||
@@ -72,17 +72,22 @@ math[display="inline" i] {
|
||||
|
||||
*/
|
||||
|
||||
/* Fractions */
|
||||
mfrac {
|
||||
padding-inline: 1px;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* merror */
|
||||
/**************************************************************************/
|
||||
|
||||
merror {
|
||||
border: 1px solid red;
|
||||
display: block;
|
||||
font-family: sans-serif;
|
||||
font-weight: bold;
|
||||
white-space: pre;
|
||||
margin: 1em;
|
||||
padding: 1em;
|
||||
border-width: thin;
|
||||
border-style: inset;
|
||||
border-color: red;
|
||||
font-size: 14pt;
|
||||
background-color: lightyellow;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,46 +93,6 @@ void nsMathMLContainerFrame::ClearSavedChildMetrics() {
|
||||
}
|
||||
}
|
||||
|
||||
nsMargin nsMathMLContainerFrame::GetBorderPaddingForPlace(
|
||||
const PlaceFlags& aFlags) {
|
||||
if (aFlags.contains(PlaceFlag::IgnoreBorderPadding)) {
|
||||
return nsMargin();
|
||||
}
|
||||
|
||||
if (aFlags.contains(PlaceFlag::IntrinsicSize)) {
|
||||
// Bug 1910859: Should we provide separate left and right border/padding?
|
||||
return nsMargin(0, IntrinsicISizeOffsets().BorderPadding(), 0, 0);
|
||||
}
|
||||
|
||||
return GetUsedBorderAndPadding();
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsMargin nsMathMLContainerFrame::GetMarginForPlace(const PlaceFlags& aFlags,
|
||||
nsIFrame* aChild) {
|
||||
if (aFlags.contains(PlaceFlag::IntrinsicSize)) {
|
||||
// Bug 1910859: Should we provide separate left and right margin?
|
||||
return nsMargin(0, aChild->IntrinsicISizeOffsets().margin, 0, 0);
|
||||
}
|
||||
|
||||
return aChild->GetUsedMargin();
|
||||
}
|
||||
|
||||
void nsMathMLContainerFrame::InflateReflowAndBoundingMetrics(
|
||||
const nsMargin& aBorderPadding, ReflowOutput& aReflowOutput,
|
||||
nsBoundingMetrics& aBoundingMetrics) {
|
||||
// Bug 1910858: It is not really clear what is the right way to update the
|
||||
// ink bounding box when adding border or padding. Below, we assume that
|
||||
// border/padding inflate it.
|
||||
aBoundingMetrics.rightBearing += aBorderPadding.LeftRight();
|
||||
aBoundingMetrics.width += aBorderPadding.LeftRight();
|
||||
aReflowOutput.mBoundingMetrics = aBoundingMetrics;
|
||||
aReflowOutput.Width() += aBorderPadding.LeftRight();
|
||||
aReflowOutput.SetBlockStartAscent(aReflowOutput.BlockStartAscent() +
|
||||
aBorderPadding.top);
|
||||
aReflowOutput.Height() += aBorderPadding.TopBottom();
|
||||
}
|
||||
|
||||
// helper to get the preferred size that a container frame should use to fire
|
||||
// the stretch on its stretchy child frames.
|
||||
void nsMathMLContainerFrame::GetPreferredStretchSize(
|
||||
@@ -143,10 +103,9 @@ void nsMathMLContainerFrame::GetPreferredStretchSize(
|
||||
// when our actual size is ok, just use it
|
||||
aPreferredStretchSize = mBoundingMetrics;
|
||||
} else if (aOptions & STRETCH_CONSIDER_EMBELLISHMENTS) {
|
||||
// compute our up-to-date size using Place(), without border/padding.
|
||||
// compute our up-to-date size using Place()
|
||||
ReflowOutput reflowOutput(GetWritingMode());
|
||||
PlaceFlags flags(PlaceFlag::MeasureOnly, PlaceFlag::IgnoreBorderPadding);
|
||||
Place(aDrawTarget, flags, reflowOutput);
|
||||
Place(aDrawTarget, false, reflowOutput);
|
||||
aPreferredStretchSize = reflowOutput.mBoundingMetrics;
|
||||
} else {
|
||||
// compute a size that includes embellishments iff the container stretches
|
||||
@@ -337,8 +296,7 @@ nsMathMLContainerFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
}
|
||||
|
||||
// re-position all our children
|
||||
PlaceFlags flags;
|
||||
nsresult rv = Place(aDrawTarget, flags, aDesiredStretchSize);
|
||||
nsresult rv = Place(aDrawTarget, true, aDesiredStretchSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Make sure the child frames get their DidReflow() calls.
|
||||
DidReflowChildren(mFrames.FirstChild());
|
||||
@@ -420,18 +378,14 @@ nsresult nsMathMLContainerFrame::FinalizeReflow(DrawTarget* aDrawTarget,
|
||||
!NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) ||
|
||||
(mEmbellishData.coreFrame != this && !mPresentationData.baseFrame &&
|
||||
mEmbellishData.direction == NS_STRETCH_DIRECTION_UNSUPPORTED);
|
||||
PlaceFlags flags;
|
||||
if (!placeOrigin) {
|
||||
flags += PlaceFlag::MeasureOnly;
|
||||
}
|
||||
nsresult rv = Place(aDrawTarget, flags, aDesiredSize);
|
||||
nsresult rv = Place(aDrawTarget, placeOrigin, aDesiredSize);
|
||||
|
||||
// Place() will call FinishReflowChild() when placeOrigin is true but if
|
||||
// it returns before reaching FinishReflowChild() due to errors we need
|
||||
// to fulfill the reflow protocol by calling DidReflow for the child frames
|
||||
// that still needs it here (or we may crash - bug 366012).
|
||||
// If placeOrigin is false we should reach Place() with
|
||||
// PlaceFlag::MeasureOnly unset through Stretch() eventually.
|
||||
// If placeOrigin is false we should reach Place() with aPlaceOrigin == true
|
||||
// through Stretch() eventually.
|
||||
if (NS_FAILED(rv)) {
|
||||
GatherAndStoreOverflow(&aDesiredSize);
|
||||
DidReflowChildren(PrincipalChildList().FirstChild());
|
||||
@@ -888,11 +842,7 @@ void nsMathMLContainerFrame::UpdateIntrinsicISize(
|
||||
// Include the additional width added by FixInterFrameSpacing to ensure
|
||||
// consistent width calculations.
|
||||
AddInterFrameSpacingToSize(desiredSize, this);
|
||||
|
||||
// ReflowOuput::mSize corresponds to the border box, but callers
|
||||
// expect padding/border are not included.
|
||||
mIntrinsicISize = desiredSize.ISize(GetWritingMode()) -
|
||||
IntrinsicISizeOffsets().BorderPadding();
|
||||
mIntrinsicISize = desiredSize.ISize(GetWritingMode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -915,6 +865,9 @@ void nsMathMLContainerFrame::GetIntrinsicISizeMetrics(
|
||||
containerFrame->GetIntrinsicISizeMetrics(aRenderingContext,
|
||||
childDesiredSize);
|
||||
} else {
|
||||
// XXX This includes margin while Reflow currently doesn't consider
|
||||
// margin, so we may end up with too much space, but, with stretchy
|
||||
// characters, this is an approximation anyway.
|
||||
nscoord width = nsLayoutUtils::IntrinsicForContainer(
|
||||
aRenderingContext, childFrame, IntrinsicISizeType::PrefISize);
|
||||
|
||||
@@ -941,8 +894,7 @@ void nsMathMLContainerFrame::GetIntrinsicISizeMetrics(
|
||||
nsresult rv =
|
||||
MeasureForWidth(aRenderingContext->GetDrawTarget(), aDesiredSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
PlaceAsMrow(aRenderingContext->GetDrawTarget(), flags, aDesiredSize);
|
||||
PlaceAsMrow(aRenderingContext->GetDrawTarget(), false, aDesiredSize);
|
||||
}
|
||||
|
||||
ClearSavedChildMetrics();
|
||||
@@ -951,8 +903,7 @@ void nsMathMLContainerFrame::GetIntrinsicISizeMetrics(
|
||||
/* virtual */
|
||||
nsresult nsMathMLContainerFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
return Place(aDrawTarget, flags, aDesiredSize);
|
||||
return Place(aDrawTarget, false, aDesiredSize);
|
||||
}
|
||||
|
||||
// see spacing table in Chapter 18, TeXBook (p.170)
|
||||
@@ -1062,12 +1013,10 @@ static nscoord GetThinSpace(const nsStyleFont* aStyleFont) {
|
||||
|
||||
class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
public:
|
||||
explicit RowChildFrameIterator(nsMathMLContainerFrame* aParentFrame,
|
||||
const PlaceFlags& aFlags)
|
||||
explicit RowChildFrameIterator(nsMathMLContainerFrame* aParentFrame)
|
||||
: mParentFrame(aParentFrame),
|
||||
mReflowOutput(aParentFrame->GetWritingMode()),
|
||||
mX(0),
|
||||
mFlags(aFlags),
|
||||
mChildFrameType(eMathMLFrameType_UNKNOWN),
|
||||
mCarrySpace(0),
|
||||
mFromFrameType(eMathMLFrameType_UNKNOWN),
|
||||
@@ -1087,7 +1036,6 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
RowChildFrameIterator& operator++() {
|
||||
// add child size + italic correction
|
||||
mX += mReflowOutput.mBoundingMetrics.width + mItalicCorrection;
|
||||
mX += mMargin.LeftRight();
|
||||
|
||||
if (!mRTL) {
|
||||
mChildFrame = mChildFrame->GetNextSibling();
|
||||
@@ -1116,7 +1064,6 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
nscoord Descent() const {
|
||||
return mReflowOutput.Height() - mReflowOutput.BlockStartAscent();
|
||||
}
|
||||
const nsMargin& Margin() const { return mMargin; }
|
||||
const nsBoundingMetrics& BoundingMetrics() const {
|
||||
return mReflowOutput.mBoundingMetrics;
|
||||
}
|
||||
@@ -1126,8 +1073,6 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
nsIFrame* mChildFrame;
|
||||
ReflowOutput mReflowOutput;
|
||||
nscoord mX;
|
||||
const PlaceFlags mFlags;
|
||||
nsMargin mMargin;
|
||||
|
||||
nscoord mItalicCorrection;
|
||||
eMathMLFrameType mChildFrameType;
|
||||
@@ -1140,7 +1085,6 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
GetReflowAndBoundingMetricsFor(mChildFrame, mReflowOutput,
|
||||
mReflowOutput.mBoundingMetrics,
|
||||
&mChildFrameType);
|
||||
mMargin = GetMarginForPlace(mFlags, mChildFrame);
|
||||
nscoord leftCorrection, rightCorrection;
|
||||
GetItalicCorrection(mReflowOutput.mBoundingMetrics, leftCorrection,
|
||||
rightCorrection);
|
||||
@@ -1163,31 +1107,21 @@ class nsMathMLContainerFrame::RowChildFrameIterator {
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLContainerFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
// This is needed in case this frame is empty (i.e., no child frames)
|
||||
mBoundingMetrics = nsBoundingMetrics();
|
||||
|
||||
RowChildFrameIterator child(this, aFlags);
|
||||
RowChildFrameIterator child(this);
|
||||
nscoord ascent = 0, descent = 0;
|
||||
while (child.Frame()) {
|
||||
nscoord topMargin = child.Margin().top;
|
||||
nscoord bottomMargin = child.Margin().bottom;
|
||||
ascent = std::max(ascent, child.Ascent() + topMargin);
|
||||
descent = std::max(descent, child.Descent() + bottomMargin);
|
||||
|
||||
if (descent < child.Descent()) descent = child.Descent();
|
||||
if (ascent < child.Ascent()) ascent = child.Ascent();
|
||||
// add the child size
|
||||
mBoundingMetrics.width = child.X();
|
||||
nsBoundingMetrics childBm = child.BoundingMetrics();
|
||||
childBm.ascent += topMargin;
|
||||
childBm.descent += bottomMargin;
|
||||
childBm.rightBearing += child.Margin().LeftRight();
|
||||
childBm.width += child.Margin().LeftRight();
|
||||
mBoundingMetrics += childBm;
|
||||
|
||||
mBoundingMetrics += child.BoundingMetrics();
|
||||
++child;
|
||||
}
|
||||
|
||||
// Add the italic correction at the end (including the last child).
|
||||
// This gives a nice gap between math and non-math frames, and still
|
||||
// gives the same math inter-spacing in case this frame connects to
|
||||
@@ -1199,35 +1133,30 @@ nsresult nsMathMLContainerFrame::Place(DrawTarget* aDrawTarget,
|
||||
aDesiredSize.SetBlockStartAscent(ascent);
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.BlockStartAscent();
|
||||
|
||||
//////////////////
|
||||
// Place Children
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
PositionRowChildFrames(borderPadding.left, aDesiredSize.BlockStartAscent());
|
||||
|
||||
if (aPlaceOrigin) {
|
||||
PositionRowChildFrames(0, aDesiredSize.BlockStartAscent());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMathMLContainerFrame::PlaceAsMrow(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
return nsMathMLContainerFrame::Place(aDrawTarget, aFlags, aDesiredSize);
|
||||
return nsMathMLContainerFrame::Place(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
|
||||
void nsMathMLContainerFrame::PositionRowChildFrames(nscoord aOffsetX,
|
||||
nscoord aBaseline) {
|
||||
PlaceFlags flags;
|
||||
RowChildFrameIterator child(this, flags);
|
||||
RowChildFrameIterator child(this);
|
||||
while (child.Frame()) {
|
||||
nscoord dx = aOffsetX + child.X() + child.Margin().left;
|
||||
nscoord dx = aOffsetX + child.X();
|
||||
nscoord dy = aBaseline - child.Ascent();
|
||||
FinishReflowChild(child.Frame(), PresContext(), child.GetReflowOutput(),
|
||||
nullptr, dx, dy, ReflowChildFlags::Default);
|
||||
|
||||
@@ -133,37 +133,11 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
// Additional methods
|
||||
|
||||
protected:
|
||||
enum class PlaceFlag : uint8_t {
|
||||
// If MeasureOnly is set, compute your desired size using the information
|
||||
// from GetReflowAndBoundingMetricsFor. However, child frames or other
|
||||
// elements should not be repositioned.
|
||||
// If MeasureOnly is not set, reflow is finished. You should position all
|
||||
// your children, and return your desired size. You should now use
|
||||
// FinishReflowChild() on your children to complete post-reflow operations.
|
||||
MeasureOnly,
|
||||
|
||||
// If IntrinsicSize is set, the function is actually used to determine
|
||||
// intrinsic size (and consequently MeasureOnly is expected to be set too).
|
||||
// - It will use nsMathMLChar::GetMaxWidth instead of nsMathMLChar::Stretch.
|
||||
// - It will use IntrinsicISizeOffsets() for padding/border/margin instead
|
||||
// of GetUsedBorder/Padding/Margin().
|
||||
// - etc
|
||||
IntrinsicSize,
|
||||
|
||||
// If IgnoreBorderPadding is set, the function will complete without
|
||||
// adding the border/padding around the math layout. This can be used for
|
||||
// elements like <msqrt> that first layout their children as an <mrow>,
|
||||
// place some radical symbol on top of them and finally add its
|
||||
// padding/border around that radical symbol.
|
||||
IgnoreBorderPadding,
|
||||
};
|
||||
using PlaceFlags = mozilla::EnumSet<PlaceFlag>;
|
||||
|
||||
/* Place :
|
||||
* This method is used to measure or position child frames and other
|
||||
* elements. It may be called any number of times with MeasureOnly
|
||||
* true, and the final call of the Reflow process before
|
||||
* returning from Reflow() or Stretch() will have MeasureOnly false
|
||||
* elements. It may be called any number of times with aPlaceOrigin
|
||||
* false to measure, and the final call of the Reflow process before
|
||||
* returning from Reflow() or Stretch() will have aPlaceOrigin true
|
||||
* to position the elements.
|
||||
*
|
||||
* IMPORTANT: This method uses GetReflowAndBoundingMetricsFor() which must
|
||||
@@ -172,8 +146,15 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
* The Place() method will use this information to compute the desired size
|
||||
* of the frame.
|
||||
*
|
||||
* @param aFlags [in] Flags to indicate the way the Place method should
|
||||
* behave. See document for PlaceFlag above.
|
||||
* @param aPlaceOrigin [in]
|
||||
* If aPlaceOrigin is false, compute your desired size using the
|
||||
* information from GetReflowAndBoundingMetricsFor. However, child
|
||||
* frames or other elements should not be repositioned.
|
||||
*
|
||||
* If aPlaceOrigin is true, reflow is finished. You should position
|
||||
* all your children, and return your desired size. You should now
|
||||
* use FinishReflowChild() on your children to complete post-reflow
|
||||
* operations.
|
||||
*
|
||||
* @param aDesiredSize [out] parameter where you should return your desired
|
||||
* size and your ascent/descent info. Compute your desired size using
|
||||
@@ -181,7 +162,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
* any space you want for border/padding in the desired size you
|
||||
* return.
|
||||
*/
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize);
|
||||
|
||||
// MeasureForWidth:
|
||||
@@ -216,7 +197,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
* (typically invalid markup) was encountered during reflow. Parameters are
|
||||
* the same as Place().
|
||||
*/
|
||||
nsresult PlaceAsMrow(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
nsresult PlaceAsMrow(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize);
|
||||
|
||||
/*
|
||||
@@ -255,8 +236,6 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
ReflowOutput& aDesiredSize, const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
nsMargin GetBorderPaddingForPlace(const PlaceFlags& aFlags);
|
||||
|
||||
protected:
|
||||
// helper to add the inter-spacing when <math> is the immediate parent.
|
||||
// Since we don't (yet) handle the root <math> element ourselves, we need to
|
||||
@@ -293,12 +272,6 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
|
||||
// SaveReflowAndBoundingMetricsFor() from all child frames.
|
||||
void ClearSavedChildMetrics();
|
||||
|
||||
static nsMargin GetMarginForPlace(const PlaceFlags& aFlags, nsIFrame* aChild);
|
||||
|
||||
static void InflateReflowAndBoundingMetrics(
|
||||
const nsMargin& aBorderPadding, ReflowOutput& aReflowOutput,
|
||||
nsBoundingMetrics& aBoundingMetrics);
|
||||
|
||||
// helper to let the update of presentation data pass through
|
||||
// a subtree that may contain non-MathML container frames
|
||||
static void PropagatePresentationDataFor(nsIFrame* aFrame,
|
||||
|
||||
@@ -149,22 +149,15 @@ void nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
|
||||
// pass, it is not computed here because our children may be text frames
|
||||
// that do not implement the GetBoundingMetrics() interface.
|
||||
/* virtual */
|
||||
nsresult nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
nsresult nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
mBoundingMetrics = nsBoundingMetrics();
|
||||
for (nsIFrame* childFrame : PrincipalChildList()) {
|
||||
ReflowOutput childSize(aDesiredSize.GetWritingMode());
|
||||
nsBoundingMetrics bmChild;
|
||||
GetReflowAndBoundingMetricsFor(childFrame, childSize, bmChild, nullptr);
|
||||
auto childMargin = GetMarginForPlace(aFlags, childFrame);
|
||||
bmChild.ascent += childMargin.top;
|
||||
bmChild.descent += childMargin.bottom;
|
||||
bmChild.rightBearing += childMargin.LeftRight();
|
||||
bmChild.width += childMargin.LeftRight();
|
||||
|
||||
GetReflowAndBoundingMetricsFor(childFrame, childSize,
|
||||
childSize.mBoundingMetrics, nullptr);
|
||||
// compute and cache the bounding metrics
|
||||
mBoundingMetrics += bmChild;
|
||||
mBoundingMetrics += childSize.mBoundingMetrics;
|
||||
}
|
||||
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
@@ -178,24 +171,17 @@ nsresult nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
|
||||
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() +
|
||||
std::max(mBoundingMetrics.descent, descent);
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
nscoord dx = borderPadding.left;
|
||||
if (aPlaceOrigin) {
|
||||
nscoord dy, dx = 0;
|
||||
for (nsIFrame* childFrame : PrincipalChildList()) {
|
||||
ReflowOutput childSize(aDesiredSize.GetWritingMode());
|
||||
GetReflowAndBoundingMetricsFor(childFrame, childSize,
|
||||
childSize.mBoundingMetrics);
|
||||
auto childMargin = GetMarginForPlace(aFlags, childFrame);
|
||||
|
||||
// place and size the child; (dx,0) makes the caret happy - bug 188146
|
||||
nscoord dy = childSize.Height() == 0
|
||||
? 0
|
||||
: aDesiredSize.BlockStartAscent() -
|
||||
childSize.BlockStartAscent() + childMargin.top;
|
||||
dy = childSize.Height() == 0
|
||||
? 0
|
||||
: aDesiredSize.BlockStartAscent() - childSize.BlockStartAscent();
|
||||
FinishReflowChild(childFrame, PresContext(), childSize, nullptr, dx, dy,
|
||||
ReflowChildFlags::Default);
|
||||
dx += childSize.Width();
|
||||
|
||||
@@ -53,8 +53,8 @@ class nsMathMLTokenFrame : public nsMathMLContainerFrame {
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
protected:
|
||||
explicit nsMathMLTokenFrame(ComputedStyle* aStyle,
|
||||
|
||||
@@ -206,7 +206,8 @@ void nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// paint the menclosed content
|
||||
nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists);
|
||||
|
||||
nsRect mencloseRect = nsIFrame::GetContentRectRelativeToSelf();
|
||||
nsRect mencloseRect = nsIFrame::GetRect();
|
||||
mencloseRect.x = mencloseRect.y = 0;
|
||||
|
||||
if (IsToDraw(NOTATION_RADICAL)) {
|
||||
mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists, 0);
|
||||
@@ -298,28 +299,26 @@ void nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
/* virtual */
|
||||
nsresult nsMathMLmencloseFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
return PlaceInternal(aDrawTarget, flags, aDesiredSize);
|
||||
return PlaceInternal(aDrawTarget, false, aDesiredSize, true);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmencloseFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
return PlaceInternal(aDrawTarget, aFlags, aDesiredSize);
|
||||
return PlaceInternal(aDrawTarget, aPlaceOrigin, aDesiredSize, false);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize,
|
||||
bool aWidthOnly) {
|
||||
///////////////
|
||||
// Measure the size of our content using the base class to format like an
|
||||
// inferred mrow, without border/padding.
|
||||
// inferred mrow.
|
||||
ReflowOutput baseSize(aDesiredSize.GetWritingMode());
|
||||
PlaceFlags flags =
|
||||
aFlags + PlaceFlag::MeasureOnly + PlaceFlag::IgnoreBorderPadding;
|
||||
nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, flags, baseSize);
|
||||
nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, false, baseSize);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
DidReflowChildren(PrincipalChildList().FirstChild());
|
||||
@@ -462,7 +461,7 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
///////////////
|
||||
// longdiv notation:
|
||||
if (IsToDraw(NOTATION_LONGDIV)) {
|
||||
if (aFlags.contains(PlaceFlag::IntrinsicSize)) {
|
||||
if (aWidthOnly) {
|
||||
nscoord longdiv_width = mMathMLChar[mLongDivCharIndex].GetMaxWidth(
|
||||
this, aDrawTarget, fontSizeInflation);
|
||||
|
||||
@@ -504,7 +503,7 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
? &dx_right
|
||||
: &dx_left;
|
||||
|
||||
if (aFlags.contains(PlaceFlag::IntrinsicSize)) {
|
||||
if (aWidthOnly) {
|
||||
nscoord radical_width = mMathMLChar[mRadicalCharIndex].GetMaxWidth(
|
||||
this, aDrawTarget, fontSizeInflation);
|
||||
|
||||
@@ -625,20 +624,15 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.BlockStartAscent();
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
//////////////////
|
||||
// Set position and size of MathMLChars
|
||||
if (IsToDraw(NOTATION_LONGDIV))
|
||||
mMathMLChar[mLongDivCharIndex].SetRect(nsRect(
|
||||
dx_left - bmLongdivChar.width + borderPadding.left,
|
||||
dx_left - bmLongdivChar.width,
|
||||
aDesiredSize.BlockStartAscent() - longdivAscent, bmLongdivChar.width,
|
||||
bmLongdivChar.ascent + bmLongdivChar.descent));
|
||||
|
||||
@@ -648,17 +642,15 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
: dx_left - bmRadicalChar.width);
|
||||
|
||||
mMathMLChar[mRadicalCharIndex].SetRect(nsRect(
|
||||
dx + borderPadding.left,
|
||||
aDesiredSize.BlockStartAscent() - radicalAscent, bmRadicalChar.width,
|
||||
bmRadicalChar.ascent + bmRadicalChar.descent));
|
||||
dx, aDesiredSize.BlockStartAscent() - radicalAscent,
|
||||
bmRadicalChar.width, bmRadicalChar.ascent + bmRadicalChar.descent));
|
||||
}
|
||||
|
||||
mContentWidth = bmBase.width;
|
||||
|
||||
//////////////////
|
||||
// Finish reflowing child frames
|
||||
PositionRowChildFrames(dx_left + borderPadding.left,
|
||||
aDesiredSize.BlockStartAscent());
|
||||
PositionRowChildFrames(dx_left, aDesiredSize.BlockStartAscent());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -54,8 +54,8 @@ class nsMathMLmencloseFrame : public nsMathMLContainerFrame {
|
||||
friend nsIFrame* NS_NewMathMLmencloseFrame(mozilla::PresShell* aPresShell,
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
virtual nsresult MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
@@ -86,8 +86,8 @@ class nsMathMLmencloseFrame : public nsMathMLContainerFrame {
|
||||
ClassID aID = kClassID);
|
||||
virtual ~nsMathMLmencloseFrame();
|
||||
|
||||
nsresult PlaceInternal(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize);
|
||||
nsresult PlaceInternal(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize, bool aWidthOnly);
|
||||
|
||||
// functions to parse the "notation" attribute.
|
||||
nsresult AddNotation(const nsAString& aNotation);
|
||||
|
||||
@@ -130,8 +130,7 @@ nsresult nsMathMLmfracFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
/* virtual */
|
||||
nsresult nsMathMLmfracFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
return PlaceInternal(aDrawTarget, flags, aDesiredSize);
|
||||
return PlaceInternal(aDrawTarget, false, aDesiredSize, true);
|
||||
}
|
||||
|
||||
nscoord nsMathMLmfracFrame::FixInterFrameSpacing(ReflowOutput& aDesiredSize) {
|
||||
@@ -143,15 +142,15 @@ nscoord nsMathMLmfracFrame::FixInterFrameSpacing(ReflowOutput& aDesiredSize) {
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmfracFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
nsresult nsMathMLmfracFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
return PlaceInternal(aDrawTarget, aFlags, aDesiredSize);
|
||||
return PlaceInternal(aDrawTarget, aPlaceOrigin, aDesiredSize, false);
|
||||
}
|
||||
|
||||
nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize,
|
||||
bool aWidthOnly) {
|
||||
////////////////////////////////////
|
||||
// Get the children's desired sizes
|
||||
nsBoundingMetrics bmNum, bmDen;
|
||||
@@ -162,17 +161,14 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
if (frameNum) frameDen = frameNum->GetNextSibling();
|
||||
if (!frameNum || !frameDen || frameDen->GetNextSibling()) {
|
||||
// report an error, encourage people to get their markups in order
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
ReportChildCountError();
|
||||
}
|
||||
return PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
GetReflowAndBoundingMetricsFor(frameNum, sizeNum, bmNum);
|
||||
GetReflowAndBoundingMetricsFor(frameDen, sizeDen, bmDen);
|
||||
|
||||
nsMargin numMargin = GetMarginForPlace(aFlags, frameNum),
|
||||
denMargin = GetMarginForPlace(aFlags, frameDen);
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
@@ -209,12 +205,13 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
|
||||
mLineRect.height = mLineThickness;
|
||||
|
||||
// Add lspace & rspace that may come from <mo> if we are an outermost
|
||||
// by default, leave at least one-pixel padding at either end, and add
|
||||
// lspace & rspace that may come from <mo> if we are an outermost
|
||||
// embellished 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 = 0;
|
||||
nscoord rightSpace = 0;
|
||||
nscoord leftSpace = onePixel;
|
||||
nscoord rightSpace = onePixel;
|
||||
if (outermostEmbellished) {
|
||||
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nsEmbellishData coreData;
|
||||
@@ -278,8 +275,8 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
oneDevPixel);
|
||||
}
|
||||
|
||||
nscoord actualClearance = (numShift - bmNum.descent - numMargin.bottom) -
|
||||
(bmDen.ascent + denMargin.top - denShift);
|
||||
nscoord actualClearance =
|
||||
(numShift - bmNum.descent) - (bmDen.ascent - denShift);
|
||||
// actualClearance should be >= minClearance
|
||||
if (actualClearance < minClearance) {
|
||||
nscoord halfGap = (minClearance - actualClearance) / 2;
|
||||
@@ -315,14 +312,14 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
}
|
||||
|
||||
// adjust numShift to maintain minClearanceNum if needed
|
||||
nscoord actualClearanceNum = (numShift - bmNum.descent - numMargin.bottom) -
|
||||
(axisHeight + actualRuleThickness / 2);
|
||||
nscoord actualClearanceNum =
|
||||
(numShift - bmNum.descent) - (axisHeight + actualRuleThickness / 2);
|
||||
if (actualClearanceNum < minClearanceNum) {
|
||||
numShift += (minClearanceNum - actualClearanceNum);
|
||||
}
|
||||
// adjust denShift to maintain minClearanceDen if needed
|
||||
nscoord actualClearanceDen = (axisHeight - actualRuleThickness / 2) -
|
||||
(bmDen.ascent + denMargin.top - denShift);
|
||||
nscoord actualClearanceDen =
|
||||
(axisHeight - actualRuleThickness / 2) - (bmDen.ascent - denShift);
|
||||
if (actualClearanceDen < minClearanceDen) {
|
||||
denShift += (minClearanceDen - actualClearanceDen);
|
||||
}
|
||||
@@ -333,59 +330,40 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
||||
|
||||
// XXX Need revisiting the width. TeX uses the exact width
|
||||
// e.g. in $$\huge\frac{\displaystyle\int}{i}$$
|
||||
nscoord width = std::max(bmNum.width + numMargin.LeftRight(),
|
||||
bmDen.width + denMargin.LeftRight());
|
||||
nscoord dxNum =
|
||||
leftSpace + (width - sizeNum.Width() - numMargin.LeftRight()) / 2;
|
||||
nscoord dxDen =
|
||||
leftSpace + (width - sizeDen.Width() - denMargin.LeftRight()) / 2;
|
||||
nscoord width = std::max(bmNum.width, bmDen.width);
|
||||
nscoord dxNum = leftSpace + (width - sizeNum.Width()) / 2;
|
||||
nscoord dxDen = leftSpace + (width - sizeDen.Width()) / 2;
|
||||
width += leftSpace + rightSpace;
|
||||
|
||||
mBoundingMetrics.rightBearing =
|
||||
std::max(dxNum + bmNum.rightBearing + numMargin.LeftRight(),
|
||||
dxDen + bmDen.rightBearing + denMargin.LeftRight());
|
||||
std::max(dxNum + bmNum.rightBearing, dxDen + bmDen.rightBearing);
|
||||
if (mBoundingMetrics.rightBearing < width - rightSpace)
|
||||
mBoundingMetrics.rightBearing = width - rightSpace;
|
||||
mBoundingMetrics.leftBearing =
|
||||
std::min(dxNum + bmNum.leftBearing, dxDen + bmDen.leftBearing);
|
||||
if (mBoundingMetrics.leftBearing > leftSpace)
|
||||
mBoundingMetrics.leftBearing = leftSpace;
|
||||
mBoundingMetrics.ascent = bmNum.ascent + numShift + numMargin.top;
|
||||
mBoundingMetrics.descent = bmDen.descent + denShift + denMargin.bottom;
|
||||
mBoundingMetrics.ascent = bmNum.ascent + numShift;
|
||||
mBoundingMetrics.descent = bmDen.descent + denShift;
|
||||
mBoundingMetrics.width = width;
|
||||
|
||||
aDesiredSize.SetBlockStartAscent(numMargin.top + sizeNum.BlockStartAscent() +
|
||||
numShift);
|
||||
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() + sizeDen.Height() +
|
||||
denMargin.bottom - sizeDen.BlockStartAscent() +
|
||||
denShift;
|
||||
aDesiredSize.SetBlockStartAscent(sizeNum.BlockStartAscent() + numShift);
|
||||
aDesiredSize.Height() = aDesiredSize.BlockStartAscent() + sizeDen.Height() -
|
||||
sizeDen.BlockStartAscent() + denShift;
|
||||
aDesiredSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
leftSpace += borderPadding.left;
|
||||
rightSpace += borderPadding.right;
|
||||
width += borderPadding.LeftRight();
|
||||
dxNum += borderPadding.left;
|
||||
dxDen += borderPadding.left;
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.BlockStartAscent();
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
nscoord dy;
|
||||
// place numerator
|
||||
dxNum += numMargin.left;
|
||||
dy = borderPadding.top + numMargin.top;
|
||||
dy = 0;
|
||||
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dxNum, dy,
|
||||
ReflowChildFlags::Default);
|
||||
// place denominator
|
||||
dxDen += denMargin.left;
|
||||
dy = aDesiredSize.Height() - sizeDen.Height() - denMargin.bottom -
|
||||
borderPadding.bottom;
|
||||
dy = aDesiredSize.Height() - sizeDen.Height();
|
||||
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dxDen, dy,
|
||||
ReflowChildFlags::Default);
|
||||
// place the fraction bar - dy is top of bar
|
||||
|
||||
@@ -66,8 +66,8 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
|
||||
virtual nsresult MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
@@ -98,8 +98,8 @@ class nsMathMLmfracFrame final : public nsMathMLContainerFrame {
|
||||
mLineThickness(0) {}
|
||||
virtual ~nsMathMLmfracFrame();
|
||||
|
||||
nsresult PlaceInternal(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize);
|
||||
nsresult PlaceInternal(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize, bool aWidthOnly);
|
||||
|
||||
// Display a slash
|
||||
void DisplaySlash(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
|
||||
@@ -93,24 +93,24 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData() {
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmmultiscriptsFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
nscoord subScriptShift = 0;
|
||||
nscoord supScriptShift = 0;
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
|
||||
return PlaceMultiScript(PresContext(), aDrawTarget, aFlags, aDesiredSize,
|
||||
this, subScriptShift, supScriptShift,
|
||||
return PlaceMultiScript(PresContext(), aDrawTarget, aPlaceOrigin,
|
||||
aDesiredSize, this, subScriptShift, supScriptShift,
|
||||
fontSizeInflation);
|
||||
}
|
||||
|
||||
// exported routine that both munderover and mmultiscripts share.
|
||||
// munderover uses this when movablelimits is set.
|
||||
nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
nsPresContext* aPresContext, DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags, ReflowOutput& aDesiredSize,
|
||||
nsMathMLContainerFrame* aFrame, nscoord aUserSubScriptShift,
|
||||
nscoord aUserSupScriptShift, float aFontSizeInflation) {
|
||||
nsPresContext* aPresContext, DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize, nsMathMLContainerFrame* aFrame,
|
||||
nscoord aUserSubScriptShift, nscoord aUserSupScriptShift,
|
||||
float aFontSizeInflation) {
|
||||
nsAtom* tag = aFrame->GetContent()->NodeInfo()->NameAtom();
|
||||
|
||||
// This function deals with both munderover etc. as well as msubsup etc.
|
||||
@@ -139,7 +139,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
aFrame->ReportErrorToConsole("NoBase");
|
||||
else
|
||||
aFrame->ReportChildCountError();
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
|
||||
// get x-height (an ex)
|
||||
@@ -269,7 +269,6 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
|
||||
bool firstPrescriptsPair = false;
|
||||
nsBoundingMetrics bmBase, bmSubScript, bmSupScript, bmMultiSub, bmMultiSup;
|
||||
nsMargin baseMargin, subScriptMargin, supScriptMargin;
|
||||
multiSubSize.SetBlockStartAscent(-0x7FFFFFFF);
|
||||
multiSupSize.SetBlockStartAscent(-0x7FFFFFFF);
|
||||
bmMultiSub.ascent = bmMultiSup.ascent = -0x7FFFFFFF;
|
||||
@@ -291,24 +290,24 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
while (childFrame) {
|
||||
if (childFrame->GetContent()->IsMathMLElement(nsGkAtoms::mprescripts_)) {
|
||||
if (tag != nsGkAtoms::mmultiscripts_) {
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
aFrame->ReportInvalidChildError(nsGkAtoms::mprescripts_);
|
||||
}
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
if (prescriptsFrame) {
|
||||
// duplicate <mprescripts/> found
|
||||
// report an error, encourage people to get their markups in order
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
aFrame->ReportErrorToConsole("DuplicateMprescripts");
|
||||
}
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
if (!isSubScript) {
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
aFrame->ReportErrorToConsole("SubSupMismatch");
|
||||
}
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
|
||||
prescriptsFrame = childFrame;
|
||||
@@ -317,7 +316,6 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
// base
|
||||
baseFrame = childFrame;
|
||||
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
|
||||
baseMargin = GetMarginForPlace(aFlags, baseFrame);
|
||||
|
||||
if (tag != nsGkAtoms::msub_) {
|
||||
// Apply italics correction if there is the potential for a
|
||||
@@ -331,9 +329,8 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
|
||||
// we update boundingMetrics.{ascent,descent} with that
|
||||
// of the baseFrame only after processing all the sup/sub pairs
|
||||
boundingMetrics.width = bmBase.width + baseMargin.LeftRight();
|
||||
boundingMetrics.rightBearing =
|
||||
bmBase.rightBearing + baseMargin.LeftRight();
|
||||
boundingMetrics.width = bmBase.width;
|
||||
boundingMetrics.rightBearing = bmBase.rightBearing;
|
||||
boundingMetrics.leftBearing = bmBase.leftBearing; // until overwritten
|
||||
} else {
|
||||
// super/subscript block
|
||||
@@ -342,31 +339,23 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
subScriptFrame = childFrame;
|
||||
GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize,
|
||||
bmSubScript);
|
||||
subScriptMargin = GetMarginForPlace(aFlags, subScriptFrame);
|
||||
|
||||
if (!mathFont) {
|
||||
// get the subdrop from the subscript font
|
||||
GetSubDropFromChild(subScriptFrame, subDrop, aFontSizeInflation);
|
||||
}
|
||||
|
||||
// parameter v, Rule 18a, App. G, TeXbook
|
||||
minSubScriptShift = bmBase.descent + baseMargin.bottom + subDrop;
|
||||
minSubScriptShift = bmBase.descent + subDrop;
|
||||
trySubScriptShift = std::max(minSubScriptShift, subScriptShift);
|
||||
multiSubSize.SetBlockStartAscent(
|
||||
std::max(multiSubSize.BlockStartAscent(),
|
||||
subScriptSize.BlockStartAscent() + subScriptMargin.top));
|
||||
bmMultiSub.ascent = std::max(bmMultiSub.ascent,
|
||||
bmSubScript.ascent + subScriptMargin.top);
|
||||
bmMultiSub.descent = std::max(
|
||||
bmMultiSub.descent, bmSubScript.descent + subScriptMargin.bottom);
|
||||
multiSubSize.SetBlockStartAscent(std::max(
|
||||
multiSubSize.BlockStartAscent(), subScriptSize.BlockStartAscent()));
|
||||
bmMultiSub.ascent = std::max(bmMultiSub.ascent, bmSubScript.ascent);
|
||||
bmMultiSub.descent = std::max(bmMultiSub.descent, bmSubScript.descent);
|
||||
multiSubSize.Height() =
|
||||
std::max(multiSubSize.Height(),
|
||||
subScriptSize.Height() - subScriptSize.BlockStartAscent() +
|
||||
subScriptMargin.bottom);
|
||||
if (bmSubScript.width) {
|
||||
width = bmSubScript.width + subScriptMargin.LeftRight() + scriptSpace;
|
||||
}
|
||||
rightBearing = bmSubScript.rightBearing + subScriptMargin.LeftRight();
|
||||
subScriptSize.Height() - subScriptSize.BlockStartAscent());
|
||||
if (bmSubScript.width) width = bmSubScript.width + scriptSpace;
|
||||
rightBearing = bmSubScript.rightBearing;
|
||||
|
||||
if (tag == nsGkAtoms::msub_) {
|
||||
boundingMetrics.rightBearing = boundingMetrics.width + rightBearing;
|
||||
@@ -381,8 +370,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
// = h(x) - 4/5 * sigma_5, Rule 18b, App. G, TeXbook
|
||||
subscriptTopMax = NSToCoordRound((4.0f / 5.0f) * xHeight);
|
||||
}
|
||||
nscoord minShiftFromXHeight =
|
||||
bmSubScript.ascent + subScriptMargin.top - subscriptTopMax;
|
||||
nscoord minShiftFromXHeight = bmSubScript.ascent - subscriptTopMax;
|
||||
maxSubScriptShift = std::max(trySubScriptShift, minShiftFromXHeight);
|
||||
|
||||
maxSubScriptShift = std::max(maxSubScriptShift, trySubScriptShift);
|
||||
@@ -393,13 +381,12 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
supScriptFrame = childFrame;
|
||||
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize,
|
||||
bmSupScript);
|
||||
supScriptMargin = GetMarginForPlace(aFlags, supScriptFrame);
|
||||
if (!mathFont) {
|
||||
// get the supdrop from the supscript font
|
||||
GetSupDropFromChild(supScriptFrame, supDrop, aFontSizeInflation);
|
||||
}
|
||||
// parameter u, Rule 18a, App. G, TeXbook
|
||||
minSupScriptShift = bmBase.ascent + baseMargin.top - supDrop;
|
||||
minSupScriptShift = bmBase.ascent - supDrop;
|
||||
nscoord superscriptBottomMin;
|
||||
if (mathFont) {
|
||||
superscriptBottomMin = mathFont->MathTable()->Constant(
|
||||
@@ -409,31 +396,23 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
// = d(x) + 1/4 * sigma_5, Rule 18c, App. G, TeXbook
|
||||
superscriptBottomMin = NSToCoordRound((1.0f / 4.0f) * xHeight);
|
||||
}
|
||||
minShiftFromXHeight =
|
||||
bmSupScript.descent + supScriptMargin.bottom + superscriptBottomMin;
|
||||
minShiftFromXHeight = bmSupScript.descent + superscriptBottomMin;
|
||||
trySupScriptShift = std::max(
|
||||
minSupScriptShift, std::max(minShiftFromXHeight, supScriptShift));
|
||||
multiSupSize.SetBlockStartAscent(
|
||||
std::max(multiSupSize.BlockStartAscent(),
|
||||
supScriptSize.BlockStartAscent() + supScriptMargin.top));
|
||||
bmMultiSup.ascent = std::max(bmMultiSup.ascent,
|
||||
bmSupScript.ascent + supScriptMargin.top);
|
||||
bmMultiSup.descent = std::max(
|
||||
bmMultiSup.descent, bmSupScript.descent + supScriptMargin.bottom);
|
||||
multiSupSize.SetBlockStartAscent(std::max(
|
||||
multiSupSize.BlockStartAscent(), supScriptSize.BlockStartAscent()));
|
||||
bmMultiSup.ascent = std::max(bmMultiSup.ascent, bmSupScript.ascent);
|
||||
bmMultiSup.descent = std::max(bmMultiSup.descent, bmSupScript.descent);
|
||||
multiSupSize.Height() =
|
||||
std::max(multiSupSize.Height(),
|
||||
supScriptSize.Height() - supScriptSize.BlockStartAscent() +
|
||||
supScriptMargin.bottom);
|
||||
supScriptSize.Height() - supScriptSize.BlockStartAscent());
|
||||
|
||||
if (bmSupScript.width)
|
||||
width =
|
||||
std::max(width, bmSupScript.width + supScriptMargin.LeftRight() +
|
||||
scriptSpace);
|
||||
width = std::max(width, bmSupScript.width + scriptSpace);
|
||||
|
||||
if (!prescriptsFrame) { // we are still looping over base & postscripts
|
||||
rightBearing = std::max(rightBearing,
|
||||
italicCorrection + bmSupScript.rightBearing +
|
||||
supScriptMargin.LeftRight());
|
||||
italicCorrection + bmSupScript.rightBearing);
|
||||
boundingMetrics.rightBearing = boundingMetrics.width + rightBearing;
|
||||
boundingMetrics.width += width;
|
||||
} else {
|
||||
@@ -459,10 +438,8 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
GetRuleThickness(aDrawTarget, fm, ruleSize);
|
||||
subSuperscriptGapMin = 4 * ruleSize;
|
||||
}
|
||||
nscoord gap =
|
||||
(trySupScriptShift - bmSupScript.descent -
|
||||
supScriptMargin.bottom) -
|
||||
(subScriptMargin.top + bmSubScript.ascent - trySubScriptShift);
|
||||
nscoord gap = (trySupScriptShift - bmSupScript.descent) -
|
||||
(bmSubScript.ascent - trySubScriptShift);
|
||||
if (gap < subSuperscriptGapMin) {
|
||||
// adjust trySubScriptShift to get a gap of subSuperscriptGapMin
|
||||
trySubScriptShift += subSuperscriptGapMin - gap;
|
||||
@@ -479,8 +456,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
NSToCoordRound((4.0f / 5.0f) * xHeight);
|
||||
}
|
||||
gap = superscriptBottomMaxWithSubscript -
|
||||
(trySupScriptShift - bmSupScript.descent -
|
||||
supScriptMargin.bottom);
|
||||
(trySupScriptShift - bmSupScript.descent);
|
||||
if (gap > 0) {
|
||||
trySupScriptShift += gap;
|
||||
trySubScriptShift -= gap;
|
||||
@@ -505,7 +481,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
(count != 3 && tag == nsGkAtoms::msubsup_) || !baseFrame ||
|
||||
(!isSubScript && tag == nsGkAtoms::mmultiscripts_)) {
|
||||
// report an error, encourage people to get their markups in order
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
if ((count != 2 &&
|
||||
(tag == nsGkAtoms::msup_ || tag == nsGkAtoms::msub_)) ||
|
||||
(count != 3 && tag == nsGkAtoms::msubsup_)) {
|
||||
@@ -516,7 +492,7 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
aFrame->ReportErrorToConsole("SubSupMismatch");
|
||||
}
|
||||
}
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return aFrame->PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
|
||||
// we left out the width of prescripts, so ...
|
||||
@@ -530,40 +506,34 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
|
||||
// we left out the base during our bounding box updates, so ...
|
||||
if (tag == nsGkAtoms::msub_) {
|
||||
boundingMetrics.ascent = std::max(bmBase.ascent + baseMargin.top,
|
||||
bmMultiSub.ascent - maxSubScriptShift);
|
||||
boundingMetrics.ascent =
|
||||
std::max(bmBase.ascent, bmMultiSub.ascent - maxSubScriptShift);
|
||||
} else {
|
||||
boundingMetrics.ascent = std::max(bmBase.ascent + baseMargin.top,
|
||||
(bmMultiSup.ascent + maxSupScriptShift));
|
||||
boundingMetrics.ascent =
|
||||
std::max(bmBase.ascent, (bmMultiSup.ascent + maxSupScriptShift));
|
||||
}
|
||||
if (tag == nsGkAtoms::msup_) {
|
||||
boundingMetrics.descent = std::max(bmBase.descent + baseMargin.bottom,
|
||||
bmMultiSup.descent - maxSupScriptShift);
|
||||
boundingMetrics.descent =
|
||||
std::max(bmBase.descent, bmMultiSup.descent - maxSupScriptShift);
|
||||
} else {
|
||||
boundingMetrics.descent =
|
||||
std::max(bmBase.descent + baseMargin.bottom,
|
||||
(bmMultiSub.descent + maxSubScriptShift));
|
||||
std::max(bmBase.descent, (bmMultiSub.descent + maxSubScriptShift));
|
||||
}
|
||||
aFrame->SetBoundingMetrics(boundingMetrics);
|
||||
|
||||
// get the reflow metrics ...
|
||||
aDesiredSize.SetBlockStartAscent(
|
||||
std::max(baseSize.BlockStartAscent() + baseMargin.top,
|
||||
std::max(baseSize.BlockStartAscent(),
|
||||
std::max(multiSubSize.BlockStartAscent() - maxSubScriptShift,
|
||||
multiSupSize.BlockStartAscent() + maxSupScriptShift)));
|
||||
aDesiredSize.Height() =
|
||||
aDesiredSize.BlockStartAscent() +
|
||||
std::max(
|
||||
baseSize.Height() - baseSize.BlockStartAscent() + baseMargin.bottom,
|
||||
std::max(multiSubSize.Height() + maxSubScriptShift,
|
||||
multiSupSize.Height() - maxSupScriptShift));
|
||||
std::max(baseSize.Height() - baseSize.BlockStartAscent(),
|
||||
std::max(multiSubSize.Height() + maxSubScriptShift,
|
||||
multiSupSize.Height() - maxSupScriptShift));
|
||||
aDesiredSize.Width() = boundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = boundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = aFrame->GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize, boundingMetrics);
|
||||
|
||||
aFrame->SetBoundingMetrics(boundingMetrics);
|
||||
aFrame->SetReference(nsPoint(0, aDesiredSize.BlockStartAscent()));
|
||||
|
||||
//////////////////
|
||||
@@ -573,11 +543,8 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
// The list of frames is in the order: {base} {postscripts} {prescripts}
|
||||
// We go over the list in a circular manner, starting at <prescripts/>
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
const bool isRTL =
|
||||
aFrame->StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nscoord dx = isRTL ? borderPadding.right : borderPadding.left;
|
||||
nscoord dy = 0;
|
||||
if (aPlaceOrigin) {
|
||||
nscoord dx = 0, dy = 0;
|
||||
|
||||
// With msub and msup there is only one element and
|
||||
// subscriptFrame/supScriptFrame have already been set above where
|
||||
@@ -594,18 +561,13 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
// place the base ...
|
||||
childFrame = baseFrame;
|
||||
dy = aDesiredSize.BlockStartAscent() - baseSize.BlockStartAscent();
|
||||
baseMargin = GetMarginForPlace(aFlags, baseFrame);
|
||||
dx += isRTL ? baseMargin.right : baseMargin.left;
|
||||
FinishReflowChild(
|
||||
baseFrame, aPresContext, baseSize, nullptr,
|
||||
aFrame->MirrorIfRTL(aDesiredSize.Width(), baseSize.Width(), dx), dy,
|
||||
ReflowChildFlags::Default);
|
||||
dx += bmBase.width;
|
||||
dx += isRTL ? baseMargin.left : baseMargin.right;
|
||||
} else if (prescriptsFrame == childFrame) {
|
||||
// Clear reflow flags of prescripts frame.
|
||||
// FIXME (bug 1909417): We should call FinishReflowChild at the same
|
||||
// position as baseFrame.
|
||||
prescriptsFrame->DidReflow(aPresContext, nullptr);
|
||||
} else {
|
||||
// process each sup/sub pair
|
||||
@@ -618,28 +580,20 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
|
||||
// get the ascent/descent of sup/subscripts stored in their rects
|
||||
// rect.x = descent, rect.y = ascent
|
||||
if (subScriptFrame) {
|
||||
if (subScriptFrame)
|
||||
GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize,
|
||||
bmSubScript);
|
||||
subScriptMargin = GetMarginForPlace(aFlags, subScriptFrame);
|
||||
}
|
||||
if (supScriptFrame) {
|
||||
if (supScriptFrame)
|
||||
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize,
|
||||
bmSupScript);
|
||||
supScriptMargin = GetMarginForPlace(aFlags, supScriptFrame);
|
||||
}
|
||||
|
||||
width = std::max(subScriptSize.Width() + subScriptMargin.LeftRight(),
|
||||
supScriptSize.Width() + supScriptMargin.LeftRight());
|
||||
width = std::max(subScriptSize.Width(), supScriptSize.Width());
|
||||
|
||||
if (subScriptFrame) {
|
||||
nscoord x =
|
||||
dx + (isRTL ? subScriptMargin.right : subScriptMargin.left);
|
||||
nscoord x = dx;
|
||||
// prescripts should be right aligned
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=928675
|
||||
if (isPreScript) {
|
||||
x += width - subScriptSize.Width() - subScriptMargin.LeftRight();
|
||||
}
|
||||
if (isPreScript) x += width - subScriptSize.Width();
|
||||
dy = aDesiredSize.BlockStartAscent() -
|
||||
subScriptSize.BlockStartAscent() + maxSubScriptShift;
|
||||
FinishReflowChild(subScriptFrame, aPresContext, subScriptSize,
|
||||
@@ -650,10 +604,9 @@ nsresult nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
}
|
||||
|
||||
if (supScriptFrame) {
|
||||
nscoord x =
|
||||
dx + (isRTL ? supScriptMargin.right : supScriptMargin.left);
|
||||
nscoord x = dx;
|
||||
if (isPreScript) {
|
||||
x += width - supScriptSize.Width() - supScriptMargin.LeftRight();
|
||||
x += width - supScriptSize.Width();
|
||||
} else {
|
||||
// post superscripts are shifted by the italic correction value
|
||||
x += italicCorrection;
|
||||
|
||||
@@ -31,14 +31,16 @@ class nsMathMLmmultiscriptsFrame final : public nsMathMLContainerFrame {
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData() override;
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
static nsresult PlaceMultiScript(
|
||||
nsPresContext* aPresContext, DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags, ReflowOutput& aDesiredSize,
|
||||
nsMathMLContainerFrame* aFrame, nscoord aUserSubScriptShift,
|
||||
nscoord aUserSupScriptShift, float aFontSizeInflation);
|
||||
static nsresult PlaceMultiScript(nsPresContext* aPresContext,
|
||||
DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize,
|
||||
nsMathMLContainerFrame* aForFrame,
|
||||
nscoord aUserSubScriptShift,
|
||||
nscoord aUserSupScriptShift,
|
||||
float aFontSizeInflation);
|
||||
|
||||
uint8_t ScriptIncrement(nsIFrame* aFrame) override;
|
||||
|
||||
|
||||
@@ -738,10 +738,9 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
}
|
||||
}
|
||||
|
||||
// Place our children using the default method and no border/padding.
|
||||
// Place our children using the default method
|
||||
// This will allow our child text frame to get its DidReflow()
|
||||
PlaceFlags flags = PlaceFlag::IgnoreBorderPadding;
|
||||
nsresult rv = Place(aDrawTarget, flags, aDesiredStretchSize);
|
||||
nsresult rv = Place(aDrawTarget, true, aDesiredStretchSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Make sure the child frames get their DidReflow() calls.
|
||||
DidReflowChildren(mFrames.FirstChild());
|
||||
@@ -839,20 +838,17 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
// container and so we put the spacing, otherwise we don't include the
|
||||
// spacing, the outermost embellished container will take care of it.
|
||||
|
||||
nscoord leadingSpace = 0, trailingSpace = 0;
|
||||
if (!NS_MATHML_OPERATOR_HAS_EMBELLISH_ANCESTOR(mFlags)) {
|
||||
// Account the spacing if we are not an accent with explicit attributes
|
||||
if (!isAccent || NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(mFlags)) {
|
||||
leadingSpace = mEmbellishData.leadingSpace;
|
||||
nscoord leadingSpace = mEmbellishData.leadingSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_LSPACE_ATTR(mFlags)) {
|
||||
leadingSpace = 0;
|
||||
}
|
||||
if (!isAccent || NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(mFlags)) {
|
||||
trailingSpace = mEmbellishData.trailingSpace;
|
||||
nscoord trailingSpace = mEmbellishData.trailingSpace;
|
||||
if (isAccent && !NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(mFlags)) {
|
||||
trailingSpace = 0;
|
||||
}
|
||||
}
|
||||
|
||||
flags = PlaceFlags();
|
||||
auto borderPadding = GetBorderPaddingForPlace(flags);
|
||||
if (leadingSpace || trailingSpace || !borderPadding.IsAllZero()) {
|
||||
mBoundingMetrics.width += leadingSpace + trailingSpace;
|
||||
aDesiredStretchSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
|
||||
@@ -860,29 +856,22 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget,
|
||||
nscoord dx = StyleVisibility()->mDirection == StyleDirection::Rtl
|
||||
? trailingSpace
|
||||
: leadingSpace;
|
||||
mBoundingMetrics.leftBearing += dx;
|
||||
mBoundingMetrics.rightBearing += dx;
|
||||
aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
|
||||
aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
|
||||
|
||||
// Add border/padding.
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredStretchSize,
|
||||
mBoundingMetrics);
|
||||
dx += borderPadding.left;
|
||||
nscoord dy = borderPadding.top;
|
||||
|
||||
if (dx || dy) {
|
||||
if (dx) {
|
||||
// adjust the offsets
|
||||
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 + dx, rect.y + dy, rect.width, rect.height));
|
||||
nsRect(rect.x + dx, rect.y, rect.width, rect.height));
|
||||
} else {
|
||||
nsIFrame* childFrame = firstChild;
|
||||
while (childFrame) {
|
||||
childFrame->SetPosition(childFrame->GetPosition() + nsPoint(dx, dy));
|
||||
childFrame->SetPosition(childFrame->GetPosition() + nsPoint(dx, 0));
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
@@ -941,10 +930,10 @@ void nsMathMLmoFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsMathMLTokenFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
|
||||
}
|
||||
|
||||
nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
nsresult rv = nsMathMLTokenFrame::Place(aDrawTarget, aFlags, aDesiredSize);
|
||||
nsresult rv =
|
||||
nsMathMLTokenFrame::Place(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@@ -961,8 +950,7 @@ nsresult nsMathMLmoFrame::Place(DrawTarget* aDrawTarget,
|
||||
Stretch() method.
|
||||
*/
|
||||
|
||||
if (aFlags.contains(PlaceFlag::MeasureOnly) &&
|
||||
StyleFont()->mMathStyle == StyleMathStyle::Normal &&
|
||||
if (!aPlaceOrigin && StyleFont()->mMathStyle == StyleMathStyle::Normal &&
|
||||
NS_MATHML_OPERATOR_IS_LARGEOP(mFlags) && UseMathMLChar()) {
|
||||
nsBoundingMetrics newMetrics;
|
||||
rv = mMathMLChar.Stretch(
|
||||
@@ -1026,7 +1014,6 @@ void nsMathMLmoFrame::GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
|
||||
aDesiredSize.Width() = mMathMLChar.GetMaxWidth(
|
||||
this, aRenderingContext->GetDrawTarget(),
|
||||
nsLayoutUtils::FontSizeInflationFor(this), stretchHint);
|
||||
aDesiredSize.Width() += IntrinsicISizeOffsets().BorderPadding();
|
||||
} else {
|
||||
nsMathMLTokenFrame::GetIntrinsicISizeMetrics(aRenderingContext,
|
||||
aDesiredSize);
|
||||
|
||||
@@ -46,8 +46,8 @@ class nsMathMLmoFrame final : public nsMathMLTokenFrame {
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
virtual void MarkIntrinsicISizesDirty() override;
|
||||
|
||||
|
||||
@@ -313,13 +313,9 @@ void nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
// First perform normal row layout without border/padding.
|
||||
PlaceFlags flags =
|
||||
aFlags + PlaceFlag::MeasureOnly + PlaceFlag::IgnoreBorderPadding;
|
||||
nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, flags, aDesiredSize);
|
||||
nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, false, aDesiredSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
DidReflowChildren(PrincipalChildList().FirstChild());
|
||||
return rv;
|
||||
@@ -425,16 +421,10 @@ nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget,
|
||||
mBoundingMetrics.descent = depth;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
dx += borderPadding.left;
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.BlockStartAscent();
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
// Finish reflowing child frames, positioning their origins.
|
||||
PositionRowChildFrames(dx, aDesiredSize.BlockStartAscent() - voffset);
|
||||
}
|
||||
@@ -446,6 +436,5 @@ nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget,
|
||||
nsresult nsMathMLmpaddedFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
ProcessAttributes();
|
||||
PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
return Place(aDrawTarget, flags, aDesiredSize);
|
||||
return Place(aDrawTarget, false, aDesiredSize);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ class nsMathMLmpaddedFrame final : public nsMathMLContainerFrame {
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
virtual nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
bool IsMrowLike() override {
|
||||
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
|
||||
|
||||
@@ -148,7 +148,6 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
aDesiredSize.SetBlockStartAscent(0);
|
||||
|
||||
nsBoundingMetrics bmSqr, bmBase, bmIndex;
|
||||
nsMargin baseMargin, indexMargin;
|
||||
DrawTarget* drawTarget = aReflowInput.mRenderingContext->GetDrawTarget();
|
||||
|
||||
//////////////////
|
||||
@@ -176,13 +175,11 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
baseFrame = childFrame;
|
||||
baseSize = childDesiredSize;
|
||||
bmBase = childDesiredSize.mBoundingMetrics;
|
||||
baseMargin = baseFrame->GetUsedMargin();
|
||||
} else if (1 == count) {
|
||||
// index
|
||||
indexFrame = childFrame;
|
||||
indexSize = childDesiredSize;
|
||||
bmIndex = childDesiredSize.mBoundingMetrics;
|
||||
indexMargin = indexFrame->GetUsedMargin();
|
||||
}
|
||||
count++;
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
@@ -204,9 +201,7 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
char16_t one = '1';
|
||||
nsBoundingMetrics bmOne =
|
||||
nsLayoutUtils::AppUnitBoundsOfString(&one, 1, *fm, drawTarget);
|
||||
if (bmOne.ascent > bmBase.ascent + baseMargin.top) {
|
||||
psi += bmOne.ascent - bmBase.ascent - baseMargin.top;
|
||||
}
|
||||
if (bmOne.ascent > bmBase.ascent) psi += bmOne.ascent - bmBase.ascent;
|
||||
|
||||
// make sure that the rule appears on on screen
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
@@ -222,8 +217,7 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Stretch the radical symbol to the appropriate height if it is not big
|
||||
// enough.
|
||||
nsBoundingMetrics contSize = bmBase;
|
||||
contSize.descent =
|
||||
bmBase.ascent + bmBase.descent + baseMargin.TopBottom() + psi;
|
||||
contSize.descent = bmBase.ascent + bmBase.descent + psi;
|
||||
contSize.ascent = ruleThickness;
|
||||
|
||||
// height(radical) should be >= height(base) + psi + ruleThickness
|
||||
@@ -238,18 +232,15 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// Update the desired size for the container (like msqrt, index is not yet
|
||||
// included) the baseline will be that of the base.
|
||||
mBoundingMetrics.ascent =
|
||||
bmBase.ascent + baseMargin.top + psi + ruleThickness;
|
||||
mBoundingMetrics.descent =
|
||||
std::max(bmBase.descent + baseMargin.bottom,
|
||||
(bmSqr.ascent + bmSqr.descent - mBoundingMetrics.ascent));
|
||||
mBoundingMetrics.width = bmSqr.width + bmBase.width + baseMargin.LeftRight();
|
||||
mBoundingMetrics.ascent = bmBase.ascent + psi + ruleThickness;
|
||||
mBoundingMetrics.descent = std::max(
|
||||
bmBase.descent, (bmSqr.ascent + bmSqr.descent - mBoundingMetrics.ascent));
|
||||
mBoundingMetrics.width = bmSqr.width + bmBase.width;
|
||||
mBoundingMetrics.leftBearing = bmSqr.leftBearing;
|
||||
mBoundingMetrics.rightBearing =
|
||||
bmSqr.width +
|
||||
std::max(
|
||||
bmBase.width + baseMargin.LeftRight(),
|
||||
bmBase.rightBearing + baseMargin.left); // take also care of the rule
|
||||
std::max(bmBase.width,
|
||||
bmBase.rightBearing); // take also care of the rule
|
||||
|
||||
aDesiredSize.SetBlockStartAscent(mBoundingMetrics.ascent + leading);
|
||||
aDesiredSize.Height() =
|
||||
@@ -274,8 +265,8 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
nscoord indexRaisedAscent =
|
||||
mBoundingMetrics.ascent // top of radical
|
||||
- (bmSqr.ascent + bmSqr.descent) // to bottom of radical
|
||||
+ raiseIndexDelta + bmIndex.ascent + bmIndex.descent +
|
||||
indexMargin.TopBottom(); // to top of raised index
|
||||
+ raiseIndexDelta + bmIndex.ascent +
|
||||
bmIndex.descent; // to top of raised index
|
||||
|
||||
nscoord indexClearance = 0;
|
||||
if (mBoundingMetrics.ascent < indexRaisedAscent) {
|
||||
@@ -289,54 +280,37 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nscoord dxIndex, dxSqr;
|
||||
GetRadicalXOffsets(bmIndex.width + indexMargin.LeftRight(), bmSqr.width, fm,
|
||||
&dxIndex, &dxSqr);
|
||||
GetRadicalXOffsets(bmIndex.width, bmSqr.width, fm, &dxIndex, &dxSqr);
|
||||
|
||||
mBoundingMetrics.width =
|
||||
dxSqr + bmSqr.width + bmBase.width + baseMargin.LeftRight();
|
||||
mBoundingMetrics.width = dxSqr + bmSqr.width + bmBase.width;
|
||||
mBoundingMetrics.leftBearing =
|
||||
std::min(dxIndex + bmIndex.leftBearing, dxSqr + bmSqr.leftBearing);
|
||||
mBoundingMetrics.rightBearing =
|
||||
dxSqr + bmSqr.width +
|
||||
std::max(bmBase.width + baseMargin.LeftRight(),
|
||||
bmBase.rightBearing + baseMargin.left);
|
||||
dxSqr + bmSqr.width + std::max(bmBase.width, bmBase.rightBearing);
|
||||
|
||||
aDesiredSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border around the final layout.
|
||||
auto borderPadding = GetUsedBorderAndPadding();
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
|
||||
GatherAndStoreOverflow(&aDesiredSize);
|
||||
|
||||
// place the index
|
||||
const bool isRTL = StyleVisibility()->mDirection == StyleDirection::Rtl;
|
||||
nscoord borderPaddingInlineStart =
|
||||
isRTL ? borderPadding.right : borderPadding.left;
|
||||
nscoord dx = borderPaddingInlineStart + dxIndex +
|
||||
indexMargin.Side(isRTL ? eSideRight : eSideLeft);
|
||||
nscoord dx = dxIndex;
|
||||
nscoord dy =
|
||||
aDesiredSize.BlockStartAscent() -
|
||||
(indexRaisedAscent + indexSize.BlockStartAscent() - bmIndex.ascent);
|
||||
FinishReflowChild(indexFrame, aPresContext, indexSize, nullptr,
|
||||
MirrorIfRTL(aDesiredSize.Width(), indexSize.Width(), dx),
|
||||
dy + indexMargin.top, ReflowChildFlags::Default);
|
||||
dy, ReflowChildFlags::Default);
|
||||
|
||||
// place the radical symbol and the radical bar
|
||||
dx = borderPaddingInlineStart + dxSqr;
|
||||
dy = borderPadding.top + indexClearance +
|
||||
leading; // leave a leading at the top
|
||||
dx = dxSqr;
|
||||
dy = indexClearance + leading; // leave a leading at the top
|
||||
mSqrChar.SetRect(nsRect(MirrorIfRTL(aDesiredSize.Width(), bmSqr.width, dx),
|
||||
dy, bmSqr.width, bmSqr.ascent + bmSqr.descent));
|
||||
dx += bmSqr.width;
|
||||
mBarRect.SetRect(MirrorIfRTL(aDesiredSize.Width(),
|
||||
bmBase.width + baseMargin.LeftRight(), dx),
|
||||
dy, bmBase.width + baseMargin.LeftRight(), ruleThickness);
|
||||
mBarRect.SetRect(MirrorIfRTL(aDesiredSize.Width(), bmBase.width, dx), dy,
|
||||
bmBase.width, ruleThickness);
|
||||
|
||||
// place the base
|
||||
dx += isRTL ? baseMargin.right : baseMargin.left;
|
||||
dy = aDesiredSize.BlockStartAscent() - baseSize.BlockStartAscent();
|
||||
FinishReflowChild(baseFrame, aPresContext, baseSize, nullptr,
|
||||
MirrorIfRTL(aDesiredSize.Width(), baseSize.Width(), dx), dy,
|
||||
@@ -347,11 +321,12 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmrootFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
const PlaceFlags flags(PlaceFlag::IntrinsicSize, PlaceFlag::MeasureOnly);
|
||||
void nsMathMLmrootFrame::GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
if (ShouldUseRowFallback()) {
|
||||
return PlaceAsMrow(aDrawTarget, flags, aDesiredSize);
|
||||
nsMathMLContainerFrame::GetIntrinsicISizeMetrics(aRenderingContext,
|
||||
aDesiredSize);
|
||||
return;
|
||||
}
|
||||
|
||||
// ShouldUseRowFallback() returned false so there are exactly two children.
|
||||
@@ -361,38 +336,25 @@ nsresult nsMathMLmrootFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
MOZ_ASSERT(indexFrame);
|
||||
MOZ_ASSERT(!indexFrame->GetNextSibling());
|
||||
|
||||
nsBoundingMetrics bmBase, bmIndex;
|
||||
ReflowOutput baseSize(aDesiredSize.GetWritingMode());
|
||||
ReflowOutput indexSize(aDesiredSize.GetWritingMode());
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
|
||||
GetReflowAndBoundingMetricsFor(indexFrame, indexSize, bmIndex);
|
||||
nscoord baseMargin = baseFrame->IntrinsicISizeOffsets().margin,
|
||||
indexMargin = indexFrame->IntrinsicISizeOffsets().margin;
|
||||
nscoord sqrWidth = mSqrChar.GetMaxWidth(this, aDrawTarget, fontSizeInflation);
|
||||
nscoord baseWidth = nsLayoutUtils::IntrinsicForContainer(
|
||||
aRenderingContext, baseFrame, IntrinsicISizeType::PrefISize);
|
||||
nscoord indexWidth = nsLayoutUtils::IntrinsicForContainer(
|
||||
aRenderingContext, indexFrame, IntrinsicISizeType::PrefISize);
|
||||
nscoord sqrWidth = mSqrChar.GetMaxWidth(
|
||||
this, aRenderingContext->GetDrawTarget(), fontSizeInflation);
|
||||
|
||||
nscoord dxIndex, dxSqr;
|
||||
nscoord dxSqr;
|
||||
RefPtr<nsFontMetrics> fm =
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
|
||||
GetRadicalXOffsets(bmIndex.width + indexMargin, sqrWidth, fm, &dxIndex,
|
||||
&dxSqr);
|
||||
GetRadicalXOffsets(indexWidth, sqrWidth, fm, nullptr, &dxSqr);
|
||||
|
||||
mBoundingMetrics.width = dxSqr + sqrWidth + bmBase.width + baseMargin;
|
||||
mBoundingMetrics.leftBearing =
|
||||
std::min(dxIndex + bmIndex.leftBearing + indexMargin, dxSqr);
|
||||
mBoundingMetrics.rightBearing =
|
||||
dxSqr + sqrWidth +
|
||||
std::max(bmBase.width + baseMargin, bmBase.rightBearing + baseMargin);
|
||||
nscoord width = dxSqr + sqrWidth + baseWidth;
|
||||
|
||||
aDesiredSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add border+padding.
|
||||
nsMargin borderPadding = GetBorderPaddingForPlace(flags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
|
||||
return NS_OK;
|
||||
aDesiredSize.Width() = width;
|
||||
aDesiredSize.mBoundingMetrics.width = width;
|
||||
aDesiredSize.mBoundingMetrics.leftBearing = 0;
|
||||
aDesiredSize.mBoundingMetrics.rightBearing = width;
|
||||
}
|
||||
|
||||
void nsMathMLmrootFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
||||
|
||||
@@ -42,8 +42,8 @@ class nsMathMLmrootFrame final : public nsMathMLContainerFrame {
|
||||
nsFontMetrics* aFontMetrics, nscoord* aIndexOffset,
|
||||
nscoord* aSqrOffset);
|
||||
|
||||
nsresult MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ReflowOutput& aDesiredSize) final;
|
||||
virtual void GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
@@ -95,11 +95,11 @@ void nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
ProcessAttributes(aPresContext);
|
||||
|
||||
const auto& borderPadding = GetUsedBorderAndPadding();
|
||||
auto borderPadding = aReflowInput.ComputedPhysicalBorderPadding();
|
||||
mBoundingMetrics = nsBoundingMetrics();
|
||||
mBoundingMetrics.width = mWidth + borderPadding.LeftRight();
|
||||
mBoundingMetrics.ascent = mHeight + borderPadding.top;
|
||||
mBoundingMetrics.descent = mDepth + borderPadding.bottom;
|
||||
mBoundingMetrics.ascent = mHeight + borderPadding.Side(eSideTop);
|
||||
mBoundingMetrics.descent = mDepth + borderPadding.Side(eSideBottom);
|
||||
mBoundingMetrics.leftBearing = 0;
|
||||
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
|
||||
|
||||
@@ -116,7 +116,7 @@ nsresult nsMathMLmspaceFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
||||
ProcessAttributes(PresContext());
|
||||
mBoundingMetrics = nsBoundingMetrics();
|
||||
auto offsets = IntrinsicISizeOffsets();
|
||||
mBoundingMetrics.width = mWidth + offsets.BorderPadding();
|
||||
mBoundingMetrics.width = mWidth + offsets.padding + offsets.border;
|
||||
aDesiredSize.Width() = std::max(0, mBoundingMetrics.width);
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
return NS_OK;
|
||||
|
||||
@@ -358,7 +358,7 @@ i.e.,:
|
||||
|
||||
/* virtual */
|
||||
nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
const PlaceFlags& aFlags,
|
||||
bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) {
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
if (NS_MATHML_EMBELLISH_IS_MOVABLELIMITS(mEmbellishData.flags) &&
|
||||
@@ -366,17 +366,17 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
// place like sub sup or subsup
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::munderover_)) {
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
PresContext(), aDrawTarget, aFlags, aDesiredSize, this, 0, 0,
|
||||
PresContext(), aDrawTarget, aPlaceOrigin, aDesiredSize, this, 0, 0,
|
||||
fontSizeInflation);
|
||||
} else if (mContent->IsMathMLElement(nsGkAtoms::munder_)) {
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
PresContext(), aDrawTarget, aFlags, aDesiredSize, this, 0, 0,
|
||||
PresContext(), aDrawTarget, aPlaceOrigin, aDesiredSize, this, 0, 0,
|
||||
fontSizeInflation);
|
||||
} else {
|
||||
NS_ASSERTION(mContent->IsMathMLElement(nsGkAtoms::mover_),
|
||||
"mContent->NodeInfo()->NameAtom() not recognized");
|
||||
return nsMathMLmmultiscriptsFrame::PlaceMultiScript(
|
||||
PresContext(), aDrawTarget, aFlags, aDesiredSize, this, 0, 0,
|
||||
PresContext(), aDrawTarget, aPlaceOrigin, aDesiredSize, this, 0, 0,
|
||||
fontSizeInflation);
|
||||
}
|
||||
}
|
||||
@@ -426,21 +426,17 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
}
|
||||
}
|
||||
if (haveError) {
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
ReportChildCountError();
|
||||
}
|
||||
return PlaceAsMrow(aDrawTarget, aFlags, aDesiredSize);
|
||||
return PlaceAsMrow(aDrawTarget, aPlaceOrigin, aDesiredSize);
|
||||
}
|
||||
GetReflowAndBoundingMetricsFor(baseFrame, baseSize, bmBase);
|
||||
nsMargin baseMargin = GetMarginForPlace(aFlags, baseFrame);
|
||||
nsMargin underMargin, overMargin;
|
||||
if (underFrame) {
|
||||
GetReflowAndBoundingMetricsFor(underFrame, underSize, bmUnder);
|
||||
underMargin = GetMarginForPlace(aFlags, underFrame);
|
||||
}
|
||||
if (overFrame) {
|
||||
GetReflowAndBoundingMetricsFor(overFrame, overSize, bmOver);
|
||||
overMargin = GetMarginForPlace(aFlags, overFrame);
|
||||
}
|
||||
|
||||
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
@@ -482,8 +478,7 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
gfxMathTable::LowerLimitBaselineDropMin, oneDevPixel);
|
||||
bigOpSpacing5 = 0;
|
||||
}
|
||||
underDelta1 = std::max(
|
||||
bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent - underMargin.bottom));
|
||||
underDelta1 = std::max(bigOpSpacing2, (bigOpSpacing4 - bmUnder.ascent));
|
||||
underDelta2 = bigOpSpacing5;
|
||||
} else {
|
||||
// No corresponding rule in TeXbook - we are on our own here
|
||||
@@ -495,7 +490,7 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
underDelta2 = ruleThickness;
|
||||
}
|
||||
// empty under?
|
||||
if (bmUnder.ascent + bmUnder.descent + underMargin.TopBottom() <= 0) {
|
||||
if (!(bmUnder.ascent + bmUnder.descent)) {
|
||||
underDelta1 = 0;
|
||||
underDelta2 = 0;
|
||||
}
|
||||
@@ -521,19 +516,16 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
gfxMathTable::UpperLimitBaselineRiseMin, oneDevPixel);
|
||||
bigOpSpacing5 = 0;
|
||||
}
|
||||
overDelta1 = std::max(bigOpSpacing1,
|
||||
(bigOpSpacing3 - bmOver.descent - overMargin.bottom));
|
||||
overDelta1 = std::max(bigOpSpacing1, (bigOpSpacing3 - bmOver.descent));
|
||||
overDelta2 = bigOpSpacing5;
|
||||
|
||||
// XXX This is not a TeX rule...
|
||||
// delta1 (as computed abvove) can become really big when bmOver.descent is
|
||||
// negative, e.g., if the content is &OverBar. In such case, we use the
|
||||
// height
|
||||
if (bmOver.descent + overMargin.bottom < 0) {
|
||||
if (bmOver.descent < 0)
|
||||
overDelta1 = std::max(bigOpSpacing1,
|
||||
(bigOpSpacing3 - (bmOver.ascent + bmOver.descent +
|
||||
overMargin.TopBottom())));
|
||||
}
|
||||
(bigOpSpacing3 - (bmOver.ascent + bmOver.descent)));
|
||||
} else {
|
||||
// Rule 12, App. G, TeXbook
|
||||
// We are going to modify this rule to make it more general.
|
||||
@@ -570,14 +562,14 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
accentBaseHeight = mathFont->MathTable()->Constant(
|
||||
gfxMathTable::AccentBaseHeight, oneDevPixel);
|
||||
}
|
||||
if (bmBase.ascent + baseMargin.top < accentBaseHeight) {
|
||||
if (bmBase.ascent < accentBaseHeight) {
|
||||
// also ensure at least accentBaseHeight above the baseline of the base
|
||||
overDelta1 += accentBaseHeight - bmBase.ascent - baseMargin.top;
|
||||
overDelta1 += accentBaseHeight - bmBase.ascent;
|
||||
}
|
||||
overDelta2 = ruleThickness;
|
||||
}
|
||||
// empty over?
|
||||
if (bmOver.ascent + bmOver.descent + overMargin.TopBottom() <= 0) {
|
||||
if (!(bmOver.ascent + bmOver.descent)) {
|
||||
overDelta1 = 0;
|
||||
overDelta2 = 0;
|
||||
}
|
||||
@@ -591,33 +583,30 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
// Ad-hoc - This is to override fonts which have ready-made _accent_
|
||||
// glyphs with negative lbearing and rbearing. We want to position
|
||||
// the overscript ourselves
|
||||
nscoord overWidth = bmOver.width + overMargin.LeftRight();
|
||||
if (overWidth <= 0 && (bmOver.rightBearing - bmOver.leftBearing > 0)) {
|
||||
nscoord overWidth = bmOver.width;
|
||||
if (!overWidth && (bmOver.rightBearing - bmOver.leftBearing > 0)) {
|
||||
overWidth = bmOver.rightBearing - bmOver.leftBearing;
|
||||
dxOver = -bmOver.leftBearing;
|
||||
}
|
||||
|
||||
if (NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) {
|
||||
mBoundingMetrics.width = bmBase.width + baseMargin.LeftRight();
|
||||
mBoundingMetrics.width = bmBase.width;
|
||||
dxOver += correction;
|
||||
} else {
|
||||
mBoundingMetrics.width =
|
||||
std::max(bmBase.width + baseMargin.LeftRight(), overWidth);
|
||||
mBoundingMetrics.width = std::max(bmBase.width, overWidth);
|
||||
dxOver += correction / 2;
|
||||
}
|
||||
|
||||
dxOver += (mBoundingMetrics.width - overWidth) / 2;
|
||||
dxBase = (mBoundingMetrics.width - bmBase.width - baseMargin.LeftRight()) / 2;
|
||||
dxBase = (mBoundingMetrics.width - bmBase.width) / 2;
|
||||
|
||||
mBoundingMetrics.ascent = baseMargin.top + bmBase.ascent + overDelta1 +
|
||||
bmOver.ascent + bmOver.descent +
|
||||
overMargin.TopBottom();
|
||||
mBoundingMetrics.descent = bmBase.descent + baseMargin.bottom;
|
||||
mBoundingMetrics.ascent =
|
||||
bmBase.ascent + overDelta1 + bmOver.ascent + bmOver.descent;
|
||||
mBoundingMetrics.descent = bmBase.descent;
|
||||
mBoundingMetrics.leftBearing =
|
||||
std::min(dxBase + bmBase.leftBearing, dxOver + bmOver.leftBearing);
|
||||
mBoundingMetrics.rightBearing =
|
||||
std::max(dxBase + bmBase.rightBearing + baseMargin.LeftRight(),
|
||||
dxOver + bmOver.rightBearing + overMargin.LeftRight());
|
||||
std::max(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
|
||||
|
||||
//////////
|
||||
// pass 2, do what <munder> does: attach the underscript on the previous
|
||||
@@ -627,18 +616,17 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
// end up like <munder>.
|
||||
|
||||
nsBoundingMetrics bmAnonymousBase = mBoundingMetrics;
|
||||
nscoord ascentAnonymousBase = std::max(
|
||||
mBoundingMetrics.ascent + overDelta2,
|
||||
overMargin.TopBottom() + overSize.BlockStartAscent() + bmOver.descent +
|
||||
overDelta1 + baseMargin.top + bmBase.ascent);
|
||||
ascentAnonymousBase = std::max(ascentAnonymousBase,
|
||||
baseSize.BlockStartAscent() + baseMargin.top);
|
||||
nscoord ascentAnonymousBase =
|
||||
std::max(mBoundingMetrics.ascent + overDelta2,
|
||||
overSize.BlockStartAscent() + bmOver.descent + overDelta1 +
|
||||
bmBase.ascent);
|
||||
ascentAnonymousBase =
|
||||
std::max(ascentAnonymousBase, baseSize.BlockStartAscent());
|
||||
|
||||
// Width of non-spacing marks is zero so use left and right bearing.
|
||||
nscoord underWidth = bmUnder.width + underMargin.LeftRight();
|
||||
if (underWidth <= 0) {
|
||||
underWidth =
|
||||
bmUnder.rightBearing + underMargin.LeftRight() - bmUnder.leftBearing;
|
||||
nscoord underWidth = bmUnder.width;
|
||||
if (!underWidth) {
|
||||
underWidth = bmUnder.rightBearing - bmUnder.leftBearing;
|
||||
dxUnder = -bmUnder.leftBearing;
|
||||
}
|
||||
|
||||
@@ -656,51 +644,40 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
dxOver += dxAnonymousBase;
|
||||
dxBase += dxAnonymousBase;
|
||||
|
||||
mBoundingMetrics.width =
|
||||
std::max(dxAnonymousBase + bmAnonymousBase.width,
|
||||
dxUnder + bmUnder.width + underMargin.LeftRight());
|
||||
mBoundingMetrics.width = std::max(dxAnonymousBase + bmAnonymousBase.width,
|
||||
dxUnder + bmUnder.width);
|
||||
// At this point, mBoundingMetrics.ascent = bmAnonymousBase.ascent
|
||||
mBoundingMetrics.descent = bmAnonymousBase.descent + underDelta1 +
|
||||
bmUnder.ascent + bmUnder.descent +
|
||||
underMargin.TopBottom();
|
||||
mBoundingMetrics.descent =
|
||||
bmAnonymousBase.descent + underDelta1 + bmUnder.ascent + bmUnder.descent;
|
||||
mBoundingMetrics.leftBearing =
|
||||
std::min(dxAnonymousBase + bmAnonymousBase.leftBearing,
|
||||
dxUnder + bmUnder.leftBearing);
|
||||
mBoundingMetrics.rightBearing =
|
||||
std::max(dxAnonymousBase + bmAnonymousBase.rightBearing,
|
||||
dxUnder + bmUnder.rightBearing + underMargin.LeftRight());
|
||||
dxUnder + bmUnder.rightBearing);
|
||||
|
||||
aDesiredSize.SetBlockStartAscent(ascentAnonymousBase);
|
||||
aDesiredSize.Height() =
|
||||
aDesiredSize.BlockStartAscent() +
|
||||
std::max(mBoundingMetrics.descent + underDelta2,
|
||||
bmAnonymousBase.descent + underDelta1 + underMargin.top +
|
||||
bmUnder.ascent + underSize.Height() -
|
||||
underSize.BlockStartAscent() + underMargin.bottom);
|
||||
bmAnonymousBase.descent + underDelta1 + bmUnder.ascent +
|
||||
underSize.Height() - underSize.BlockStartAscent());
|
||||
aDesiredSize.Height() =
|
||||
std::max(aDesiredSize.Height(),
|
||||
aDesiredSize.BlockStartAscent() + baseSize.Height() -
|
||||
baseSize.BlockStartAscent() + baseMargin.bottom);
|
||||
std::max(aDesiredSize.Height(), aDesiredSize.BlockStartAscent() +
|
||||
baseSize.Height() -
|
||||
baseSize.BlockStartAscent());
|
||||
aDesiredSize.Width() = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// Add padding+border.
|
||||
auto borderPadding = GetBorderPaddingForPlace(aFlags);
|
||||
InflateReflowAndBoundingMetrics(borderPadding, aDesiredSize,
|
||||
mBoundingMetrics);
|
||||
dxOver += borderPadding.left + overMargin.left;
|
||||
dxBase += borderPadding.left + baseMargin.left;
|
||||
dxUnder += borderPadding.left + underMargin.left;
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.BlockStartAscent();
|
||||
|
||||
if (!aFlags.contains(PlaceFlag::MeasureOnly)) {
|
||||
if (aPlaceOrigin) {
|
||||
nscoord dy;
|
||||
// place overscript
|
||||
if (overFrame) {
|
||||
dy = aDesiredSize.BlockStartAscent() - mBoundingMetrics.ascent +
|
||||
overMargin.top + bmOver.ascent - overSize.BlockStartAscent();
|
||||
bmOver.ascent - overSize.BlockStartAscent();
|
||||
FinishReflowChild(overFrame, PresContext(), overSize, nullptr, dxOver, dy,
|
||||
ReflowChildFlags::Default);
|
||||
}
|
||||
@@ -711,7 +688,7 @@ nsresult nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
|
||||
// place underscript
|
||||
if (underFrame) {
|
||||
dy = aDesiredSize.BlockStartAscent() + mBoundingMetrics.descent -
|
||||
bmUnder.descent - underMargin.bottom - underSize.BlockStartAscent();
|
||||
bmUnder.descent - underSize.BlockStartAscent();
|
||||
FinishReflowChild(underFrame, PresContext(), underSize, nullptr, dxUnder,
|
||||
dy, ReflowChildFlags::Default);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class nsMathMLmunderoverFrame final : public nsMathMLContainerFrame,
|
||||
friend nsIFrame* NS_NewMathMLmunderoverFrame(mozilla::PresShell* aPresShell,
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
|
||||
nsresult Place(DrawTarget* aDrawTarget, bool aPlaceOrigin,
|
||||
ReflowOutput& aDesiredSize) override;
|
||||
|
||||
NS_IMETHOD InheritAutomaticData(nsIFrame* aParent) override;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[default-mfrac-padding-style.html]
|
||||
[Default CSS properties on mfrac]
|
||||
expected: FAIL
|
||||
@@ -1,2 +1,2 @@
|
||||
[frac-bar-002.html]
|
||||
expected: [PASS, FAIL] # bug 1911053
|
||||
expected: FAIL
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[merror-001.html]
|
||||
[Default CSS properties on merror]
|
||||
expected: FAIL
|
||||
|
||||
[Bounding box is the same as mrow + 1px border]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,4 @@
|
||||
[attribute-mapping-001.html]
|
||||
[mathsize on the merror element is mapped to CSS font-size]
|
||||
expected: FAIL
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[border-001.html]
|
||||
[Border properties on mrow (logical, shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow (shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow (logical)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow (logical, rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,144 @@
|
||||
[border-002.html]
|
||||
[Border properties on mmultiscripts]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mn]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msup]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msubsup]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msub]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on merror]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on menclose]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msqrt]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mstyle]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on maction]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on munder]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mpadded]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mroot]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mi]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mphantom]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mo]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on ms]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on munderover]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mtable]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on semantics]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mtext]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mfrac]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mover]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msub (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mmultiscripts (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mover (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on munderover (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on munder (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msqrt (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on ms (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mi (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mfrac (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mo (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mroot (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mphantom (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on maction (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mtext (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on semantics (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mtable (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on menclose (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mstyle (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on msubsup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mpadded (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on mn (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Border properties on merror (rtl)]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,18 @@
|
||||
[margin-001.html]
|
||||
[Margin properties on mrow (logical, shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (logical)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (logical, rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
@@ -1,9 +1,219 @@
|
||||
[margin-002.html]
|
||||
[Margin properties on msup]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msubsup]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msub]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on merror]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on menclose]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msqrt]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mstyle]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mmultiscripts]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on maction]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munder]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mpadded]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mroot]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mi]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mphantom]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mo]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on ms]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munderover]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mn]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtable]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on semantics]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtext]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mfrac]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mspace]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mover]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on menclose (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mo (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mi (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on maction (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msubsup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtable (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msubsup (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mphantom (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munder (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mo (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on semantics (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on merror (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtext (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msqrt (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtext (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mmultiscripts (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on ms (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mover (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msqrt (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on menclose (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mpadded (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on merror (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msup (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munderover (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mfrac (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mover (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mstyle (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munderover (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mpadded (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mn (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mmultiscripts (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msub (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mroot (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mphantom (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mroot (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on maction (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mstyle (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on semantics (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mtable (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mn (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on munder (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mfrac (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on msub (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on ms (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on mi (no margin-collapsing)]
|
||||
expected: FAIL
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
[margin-003.html]
|
||||
[Margin properties on the children of munderover]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mroot]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of msup]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of msubsup]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of munder]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mstyle]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of menclose]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of msqrt]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mfrac]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mphantom]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mover]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of msub]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of merror]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mpadded]
|
||||
expected: FAIL
|
||||
|
||||
[Margin properties on the children of mmultiscripts]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,18 @@
|
||||
[padding-001.html]
|
||||
[Padding properties on mrow (shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow (logical, shorthand)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow (logical)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow (logical, rtl)]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,144 @@
|
||||
[padding-002.html]
|
||||
[Padding properties on mphantom]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mtext]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on ms]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msqrt]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on menclose]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on merror]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mstyle]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on semantics]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mn]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mo]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mi]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mroot]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on munder]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on maction]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on munderover]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msubsup]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mtable]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msub]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mfrac]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mmultiscripts]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msup]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mover]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mpadded]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mtext (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on semantics (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on munder (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mo (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mroot (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mn (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mstyle (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on merror (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msub (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mmultiscripts (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on menclose (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msubsup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msup (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mover (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mpadded (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mi (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on maction (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on ms (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mrow (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mphantom (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mtable (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on mfrac (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on msqrt (rtl)]
|
||||
expected: FAIL
|
||||
|
||||
[Padding properties on munderover (rtl)]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,2 @@
|
||||
[padding-border-margin-001.html]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,2 @@
|
||||
[padding-border-margin-002.html]
|
||||
expected: FAIL
|
||||
@@ -0,0 +1,2 @@
|
||||
[padding-border-margin-003.html]
|
||||
expected: FAIL
|
||||
@@ -5,23 +5,16 @@
|
||||
<title>border</title>
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that border is taken into account.">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
math {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script src="/mathml/support/mathml-fragments.js"></script>
|
||||
<script src="/mathml/support/box-comparison.js"></script>
|
||||
<script src="/mathml/support/fonts.js"></script>
|
||||
<script>
|
||||
var epsilon = 2;
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
|
||||
|
||||
@@ -5,23 +5,16 @@
|
||||
<title>margin</title>
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that margin is taken into account.">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
math {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script src="/mathml/support/mathml-fragments.js"></script>
|
||||
<script src="/mathml/support/box-comparison.js"></script>
|
||||
<script src="/mathml/support/fonts.js"></script>
|
||||
<script>
|
||||
var epsilon = 2;
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
for (var i = 0; i < element.children.length; i++) {
|
||||
var childBox = element.children[i].getBoundingClientRect();
|
||||
var referenceChildBox = reference.children[i].getBoundingClientRect();
|
||||
assert_approx_equals(childBox.width + marginLeft + marginRight, referenceChildBox.width, epsilon, `inline size (child ${i})`);
|
||||
assert_approx_equals(childBox.height + marginTop + marginBottom, referenceChildBox.height, epsilon, `block size (child ${i})`);
|
||||
assert_approx_equals(childBox.width + marginLeft + marginRight, referenceChildBox.width, epsilon, "inline size (child ${i})");
|
||||
assert_approx_equals(childBox.height + marginTop + marginBottom, referenceChildBox.height, epsilon, "block size (child ${i})");
|
||||
|
||||
assert_approx_equals(childBox.left - marginLeft - elementBox.left,
|
||||
referenceChildBox.left - referenceBox.left,
|
||||
|
||||
@@ -5,23 +5,16 @@
|
||||
<title>padding</title>
|
||||
<link rel="help" href="https://w3c.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that padding is taken into account.">
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
math {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script src="/mathml/support/mathml-fragments.js"></script>
|
||||
<script src="/mathml/support/box-comparison.js"></script>
|
||||
<script src="/mathml/support/fonts.js"></script>
|
||||
<script>
|
||||
var epsilon = 2;
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
|
||||
|
||||
@@ -25,10 +25,8 @@
|
||||
surrounded by a 10px pink margin.</p>
|
||||
<div style="background: pink; position: absolute; left: 10px; top: 4em;">
|
||||
<math>
|
||||
<mrow>
|
||||
<mspace height="750px" depth="750px"/>
|
||||
<mo lspace="0" rspace="0" style="background: blue; border: 10px dashed yellow; padding: 10px; margin: 10px; color: cyan;">⥜</mo>
|
||||
</mrow>
|
||||
<mspace height="750px" depth="750px"/>
|
||||
<mo lspace="0" rspace="0" style="background: blue; border: 10px dashed yellow; padding: 10px; margin: 10px; color: cyan;">⥜</mo>
|
||||
</math>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on msqrt (reference)</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: RadicalFont;
|
||||
src: url("/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
|
||||
}
|
||||
msqrt {
|
||||
font-family: RadicalFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow style="border: 30px solid blue; padding: 20px;">
|
||||
<msqrt style="color: gray">
|
||||
<mspace width="120px" height="60px" depth="60px"></mspace>
|
||||
</msqrt>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on msqrt</title>
|
||||
<link rel="match" href="padding-border-margin-005-ref.html"/>
|
||||
<meta name="assert" content="Verify visual how padding/border/margin on an msqrt element affect the position of the painted radical symbol.">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: RadicalFont;
|
||||
src: url("/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
|
||||
}
|
||||
msqrt {
|
||||
font-family: RadicalFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow>
|
||||
<msqrt style="border: 30px solid blue; padding: 20px; color: gray">
|
||||
<mspace width="100px" height="50px" depth="50px" style="margin: 10px"></mspace>
|
||||
</msqrt>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on mroot (reference)</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: RadicalFont;
|
||||
src: url("/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
|
||||
}
|
||||
mroot {
|
||||
font-family: RadicalFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow style="border: 30px solid blue; padding: 20px;">
|
||||
<mroot style="color: gray">
|
||||
<mspace width="120px" height="60px" depth="60px"></mspace>
|
||||
<mspace width="30px" height="15px" depth="15px"></mspace>
|
||||
</mroot>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on mroot</title>
|
||||
<link rel="match" href="padding-border-margin-006-ref.html"/>
|
||||
<meta name="assert" content="Verify visual how padding/border/margin on an mroot element affect the position of the painted radical symbol.">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: RadicalFont;
|
||||
src: url("/fonts/math/radical-kernafterdegreeminus5000-rulethickness1000.woff");
|
||||
}
|
||||
mroot {
|
||||
font-family: RadicalFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow>
|
||||
<mroot style="border: 30px solid blue; padding: 20px; color: gray">
|
||||
<mspace width="100px" height="50px" depth="50px" style="margin: 10px"></mspace>
|
||||
<mspace width="20px" height="10px" depth="10px" style="margin: 5px"></mspace>
|
||||
</mroot>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on mfrac (reference)</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: FractionFont;
|
||||
src: url("/fonts/math/fraction-rulethickness10000.woff");
|
||||
}
|
||||
mfrac {
|
||||
font-family: FractionFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow style="border: 30px solid blue; padding: 20px;">
|
||||
<mfrac style="padding: 0; color: gray">
|
||||
<mspace width="120px" height="60px" depth="60px"></mspace>
|
||||
<mspace width="120px" height="60px" depth="60px"></mspace>
|
||||
</mfrac>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Padding/border/margin on mfrac</title>
|
||||
<link rel="match" href="padding-border-margin-007-ref.html"/>
|
||||
<meta name="assert" content="Verify visual how padding/border/margin on an mfrac element affect the position of the painted fraction bar.">
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: FractionFont;
|
||||
src: url("/fonts/math/fraction-rulethickness10000.woff");
|
||||
}
|
||||
mfrac {
|
||||
font-family: FractionFont;
|
||||
}
|
||||
</style>
|
||||
<math>
|
||||
<mrow>
|
||||
<mfrac style="border: 30px solid blue; padding: 20px; color: gray">
|
||||
<mspace width="100px" height="50px" depth="50px" style="margin: 10px"></mspace>
|
||||
<mspace width="100px" height="50px" depth="50px" style="margin: 10px"></mspace>
|
||||
</mfrac>
|
||||
</mrow>
|
||||
</math>
|
||||
@@ -23,8 +23,8 @@ function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
|
||||
if (!direction)
|
||||
direction = "ltr";
|
||||
document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
|
||||
<div style="display: inline-block"><math display="block"><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
|
||||
<div style="display: inline-block"><math display="block"><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
|
||||
<div style="display: inline-block"><math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
|
||||
<div style="display: inline-block"><math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
|
||||
</div>`);
|
||||
var div = document.body.lastElementChild;
|
||||
|
||||
@@ -36,7 +36,6 @@ function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
|
||||
var styleElement = FragmentHelper.element(styleMath);
|
||||
styleElement.setAttribute("style", style);
|
||||
var styleChild = FragmentHelper.forceNonEmptyElement(styleElement);
|
||||
FragmentHelper.forceNonEmptyDescendants(styleElement);
|
||||
var styleMathBox = styleMath.getBoundingClientRect();
|
||||
var styleElementBox = styleElement.getBoundingClientRect();
|
||||
var styleChildBox = styleChild.getBoundingClientRect();
|
||||
@@ -46,7 +45,6 @@ function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
|
||||
var noStyleMath = noStyleDiv.firstElementChild;
|
||||
var noStyleElement = FragmentHelper.element(noStyleMath);
|
||||
var noStyleChild = FragmentHelper.forceNonEmptyElement(noStyleElement);
|
||||
FragmentHelper.forceNonEmptyDescendants(noStyleElement);
|
||||
var noStyleMathBox = noStyleMath.getBoundingClientRect();
|
||||
var noStyleElementBox = noStyleElement.getBoundingClientRect();
|
||||
var noStyleChildBox = noStyleChild.getBoundingClientRect();
|
||||
|
||||
@@ -156,7 +156,7 @@ var FragmentHelper = {
|
||||
return element.appendChild(el);
|
||||
}
|
||||
if (element.classList.contains("mathml-container") || allowInvalid) {
|
||||
var el = this.createElement("mtext");
|
||||
var el = this.createElement("mi");
|
||||
el.textContent = "a";
|
||||
return element.appendChild(el);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user