mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 22:48:57 +00:00
8d1a041130
- Bug 1209252: add buttons to clear session and signaling logs. r=jib, r=sicking (39d0a4b57d)
- Bug 1197673 - Use float type for SetAudioOutputVolume. r=eitan (75eae2f441)
- Bug 1188099 - (Part 4) Introduce mochitest coverage for speech global queue. r=smaug r=kdavis (fd4c804c72)
- Bug 1226015 - Have child send __delete__ in speech synth request protocol, fixes race. r=smaug (c46532745a)
- Bug 1230533 - Cancel speech when controlling window goes away. r=smaug (3dae89ffaf)
- Bug 1237176 - skip dom/media/webspeech/synth/test/test_bfcache.html on Linux and Android for frequent timeouts (0d1eabb6fb)
- Bug 1237176 - actually disable test_bfcache.html on Android (1558e0bf39)
- Bug 1240871 - Don't allow implicit "async" in IPDL (r=mccr8,billm) (1db25ace3c)
- Bug 1000040 - Part 2: Implement EthernetManager; r=vicamo (82c01ca9a7)
- Bug 1000040 - Part 3: Test cases; r=vicamo (6a967cc5d9)
- Bug 1245241 - part 2 - remove TYPE_SYSV Shmems from IPDL. r=billm (6d6a4570ca)
- Bug 1245241 - part 3 - remove unused AdoptShmem from IPDL. r=billm (2762a13841)
- Bug 1107792: Don't ask for similar if the surface has an error, and more data in crash reports. r=milan (ead5108a93)
- Bug 1231881 - Remove NativeSurfaceType::CAIRO_SURFACE. r=bas. (c0f03e02f6)
- Bug 1241163 - Replace DrawTarget::CreateSourceSurfaceFromNativeSurface(CAIRO_CONTEXT) with Factory::CreateSourceSurfaceForCairoSurface. r=jrmuizel (06a96cdce6)
- Bug 1240177 - part 1 - add helper function to make Skia image info, r=jrmuizel (6a7d05aeb7)
- Bug 1240177 - part 2 - cleanups of DrawTargetSkia and SourceSurfaceSkia creation for GPU contexts, r=jrmuizel (3211ea9c0e)
- Bug 1240177 - part 3 - make DrawTargetSkia::OptimizeSourceSurface directly upload to GPU textures, r=jrmuizel (743d57a46c)
- Bug 1240177 - part 4 - avoid GPU readbacks in SourceSurfaceSkia::DrawTargetWillChange, r=jrmuizel (f568754717)
- Bug 1240177 - fix SourceSurfaceSkia::DrawTargetWillChange deepCopyTo usage. r=mattwoodrow (2e53d13ba3)
- Bug 1239152 Memset RGBX surfaces to opaque white. r=nical (977c7d5ede)
- Bug 1245241 - part 4 - move SharedMemorySysV details into nsShmImage. r=nical (0015d3caac)
- Bug 1245241 - Force the main thread to sync with the compositor when it tries to allocate insane amounts of shmems. r=lsalzman (7683d2afa7)
- Bug 1245241 - fix SharedMemoryBasic_android CloseHandle to null out handle. r=billm a=kwierso (9fa3f93233)
- Bug 1239152 - skip memset since XShm is already initialized to zero. r=mchang (477ecf2d9a)
- Bug 1227927 Part 1 - Make nsIFrame::PrincipalChildList a const function. r=bz (d9b690a1bc)
- Bug 1214377 - Hack to solve Thunderbird's need to detect style pre-wrap. r=roc a=me (a481ba9020)
- Bug 1214377 - Hack to solve Thunderbird's need to detect style pre-wrap. rs=ehsan on a CLOSED TREE (a15dfcaeb3)
- Bug 1240372 - Don't OOM crash in nsDocumentEncoder::EncodeToStringWithMaxLength() when the string buffer allocation fails; r=bzbarsky (76bed6a40a)
- Bug 1143570 - Part 1: Use an nsBlockInFlowLineIterator to determine whether a BR frame is visible or not; r=roc (99609f6fcd)
- Bug 1064843 part 2 - Make nsSubDocumentFrame inherit nsContainerFrame. r=dholbert (070202e396)
- Bug 1064843 part 3 - Make nsFormControlFrame inherit nsContainerFrame. r=dholbert (cee5125993)
- Bug 1064843 part 4 - Add a placeholder type for top layer. r=roc (e4e564b05b)
- Bug 1064843 part 5 - Ensure frames behave properly for unknown child list id passed into SetInitialChildList. r=dholbert (540f3da6a1)
- Bug 1064843 part 6 - Add backdrop frame list. r=dholbert (79f91fc815)
- Bug 1215365 - Update ua style sheet of fullscreen element. r=heycam (b44060a518)
- Bug 1235969 - Unprefix uses of -moz-transform, -moz-transform-origin and -moz-backface-visibility in UA style sheets. r=xidorn (c7a83cdcae)
- Bug 1064843 part 7 - Add backdrop pseudo-element and add related UA stylesheet. r=heycam (1d89afa54a)
- Bug 1064843 part 8 - Add frame class for backdrop frame. r=dbaron (9146be0073)
- Bug 1064843 part 9 - Change nsCSSFrameConstructor::CreatePlaceholderFrameFor to accept parent style context. r=dbaron (bc860e67f8)
- Bug 1064843 part 10 - Create and render backdrop frame for top layer frames. r=dbaron (1c6f165769)
- Bug 1064843 part 11 - Move checkWindowPureColor helper function from top-layer test to WindowSnapshot.js. r=roc (ef274dec50)
- Bug 1064843 part 12 - Add test for ::backdrop of fullscreen. r=dholbert (b978209868)
- Bug 1227927 Part 2 - Remove nsIFrame::GetFirstPrincipalChild(). r=mats (3f4ba2ef58)
- Bug 1227927 Part 3 - Use ranged-based for-loop to rewrite some simple loops in part 2. r=mats (6b22236653)
- Bug 1227927 Part 4 - Add comment to nsFrameList::GetLength() to warn it's O(n). r=mats (a08aa9185e)
- Bug 1101817 - Part 1: Remove usages of WeakMap.prototype.clear from Gecko. r=yzen,mak,yoric,gijs,jlongster (a992931bfe)
- Bug 1101817 - Part 3: Remove WeakMap.prototype.clear usages from Addons SDK. r=mossop (e81a8c3477)
- Bug 1101817 - Part 4: Remove WeakMap.prototype.clear from web-platform test. r=Ms2ger (1be3f645a2)
- Bug 1101817 - Part 6: Remove Weak{Map,Set}.prototype.clear. r=evilpie (7a0dbffdc9)
- Bug 1235152 - [css-break] Don't apply border/padding twice on inlines with box-decoration-break:clone and direction:rtl. r=roc (e6446262c1)
450 lines
16 KiB
C++
450 lines
16 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
#include "nsMathMLmpaddedFrame.h"
|
|
#include "nsMathMLElement.h"
|
|
#include "mozilla/gfx/2D.h"
|
|
#include <algorithm>
|
|
|
|
//
|
|
// <mpadded> -- adjust space around content - implementation
|
|
//
|
|
|
|
#define NS_MATHML_SIGN_INVALID -1 // if the attribute is not there
|
|
#define NS_MATHML_SIGN_UNSPECIFIED 0
|
|
#define NS_MATHML_SIGN_MINUS 1
|
|
#define NS_MATHML_SIGN_PLUS 2
|
|
|
|
#define NS_MATHML_PSEUDO_UNIT_UNSPECIFIED 0
|
|
#define NS_MATHML_PSEUDO_UNIT_ITSELF 1 // special
|
|
#define NS_MATHML_PSEUDO_UNIT_WIDTH 2
|
|
#define NS_MATHML_PSEUDO_UNIT_HEIGHT 3
|
|
#define NS_MATHML_PSEUDO_UNIT_DEPTH 4
|
|
#define NS_MATHML_PSEUDO_UNIT_NAMEDSPACE 5
|
|
|
|
nsIFrame*
|
|
NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|
{
|
|
return new (aPresShell) nsMathMLmpaddedFrame(aContext);
|
|
}
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
|
|
|
|
nsMathMLmpaddedFrame::~nsMathMLmpaddedFrame()
|
|
{
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsMathMLmpaddedFrame::InheritAutomaticData(nsIFrame* aParent)
|
|
{
|
|
// let the base class get the default from our parent
|
|
nsMathMLContainerFrame::InheritAutomaticData(aParent);
|
|
|
|
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
nsMathMLmpaddedFrame::ProcessAttributes()
|
|
{
|
|
/*
|
|
parse the attributes
|
|
|
|
width = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace)
|
|
height = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
|
|
depth = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
|
|
lspace = [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | h-unit | namedspace)
|
|
voffset= [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | v-unit | namedspace)
|
|
*/
|
|
|
|
nsAutoString value;
|
|
|
|
// width
|
|
mWidthSign = NS_MATHML_SIGN_INVALID;
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
|
|
if (!value.IsEmpty()) {
|
|
if (!ParseAttribute(value, mWidthSign, mWidth, mWidthPseudoUnit)) {
|
|
ReportParseError(nsGkAtoms::width->GetUTF16String(), value.get());
|
|
}
|
|
}
|
|
|
|
// height
|
|
mHeightSign = NS_MATHML_SIGN_INVALID;
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::height, value);
|
|
if (!value.IsEmpty()) {
|
|
if (!ParseAttribute(value, mHeightSign, mHeight, mHeightPseudoUnit)) {
|
|
ReportParseError(nsGkAtoms::height->GetUTF16String(), value.get());
|
|
}
|
|
}
|
|
|
|
// depth
|
|
mDepthSign = NS_MATHML_SIGN_INVALID;
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::depth_, value);
|
|
if (!value.IsEmpty()) {
|
|
if (!ParseAttribute(value, mDepthSign, mDepth, mDepthPseudoUnit)) {
|
|
ReportParseError(nsGkAtoms::depth_->GetUTF16String(), value.get());
|
|
}
|
|
}
|
|
|
|
// lspace
|
|
mLeadingSpaceSign = NS_MATHML_SIGN_INVALID;
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::lspace_, value);
|
|
if (!value.IsEmpty()) {
|
|
if (!ParseAttribute(value, mLeadingSpaceSign, mLeadingSpace,
|
|
mLeadingSpacePseudoUnit)) {
|
|
ReportParseError(nsGkAtoms::lspace_->GetUTF16String(), value.get());
|
|
}
|
|
}
|
|
|
|
// voffset
|
|
mVerticalOffsetSign = NS_MATHML_SIGN_INVALID;
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::voffset_, value);
|
|
if (!value.IsEmpty()) {
|
|
if (!ParseAttribute(value, mVerticalOffsetSign, mVerticalOffset,
|
|
mVerticalOffsetPseudoUnit)) {
|
|
ReportParseError(nsGkAtoms::voffset_->GetUTF16String(), value.get());
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// parse an input string in the following format (see bug 148326 for testcases):
|
|
// [+|-] unsigned-number (% [pseudo-unit] | pseudo-unit | css-unit | namedspace)
|
|
bool
|
|
nsMathMLmpaddedFrame::ParseAttribute(nsString& aString,
|
|
int32_t& aSign,
|
|
nsCSSValue& aCSSValue,
|
|
int32_t& aPseudoUnit)
|
|
{
|
|
aCSSValue.Reset();
|
|
aSign = NS_MATHML_SIGN_INVALID;
|
|
aPseudoUnit = NS_MATHML_PSEUDO_UNIT_UNSPECIFIED;
|
|
aString.CompressWhitespace(); // aString is not a const in this code
|
|
|
|
int32_t stringLength = aString.Length();
|
|
if (!stringLength)
|
|
return false;
|
|
|
|
nsAutoString number, unit;
|
|
|
|
//////////////////////
|
|
// see if the sign is there
|
|
|
|
int32_t i = 0;
|
|
|
|
if (aString[0] == '+') {
|
|
aSign = NS_MATHML_SIGN_PLUS;
|
|
i++;
|
|
}
|
|
else if (aString[0] == '-') {
|
|
aSign = NS_MATHML_SIGN_MINUS;
|
|
i++;
|
|
}
|
|
else
|
|
aSign = NS_MATHML_SIGN_UNSPECIFIED;
|
|
|
|
// get the number
|
|
bool gotDot = false, gotPercent = false;
|
|
for (; i < stringLength; i++) {
|
|
char16_t c = aString[i];
|
|
if (gotDot && c == '.') {
|
|
// error - two dots encountered
|
|
aSign = NS_MATHML_SIGN_INVALID;
|
|
return false;
|
|
}
|
|
|
|
if (c == '.')
|
|
gotDot = true;
|
|
else if (!nsCRT::IsAsciiDigit(c)) {
|
|
break;
|
|
}
|
|
number.Append(c);
|
|
}
|
|
|
|
// catch error if we didn't enter the loop above... we could simply initialize
|
|
// floatValue = 1, to cater for cases such as width="height", but that wouldn't
|
|
// be in line with the spec which requires an explicit number
|
|
if (number.IsEmpty()) {
|
|
aSign = NS_MATHML_SIGN_INVALID;
|
|
return false;
|
|
}
|
|
|
|
nsresult errorCode;
|
|
float floatValue = number.ToFloat(&errorCode);
|
|
if (NS_FAILED(errorCode)) {
|
|
aSign = NS_MATHML_SIGN_INVALID;
|
|
return false;
|
|
}
|
|
|
|
// see if this is a percentage-based value
|
|
if (i < stringLength && aString[i] == '%') {
|
|
i++;
|
|
gotPercent = true;
|
|
}
|
|
|
|
// the remainder now should be a css-unit, or a pseudo-unit, or a named-space
|
|
aString.Right(unit, stringLength - i);
|
|
|
|
if (unit.IsEmpty()) {
|
|
if (gotPercent) {
|
|
// case ["+"|"-"] unsigned-number "%"
|
|
aCSSValue.SetPercentValue(floatValue / 100.0f);
|
|
aPseudoUnit = NS_MATHML_PSEUDO_UNIT_ITSELF;
|
|
return true;
|
|
} else {
|
|
// case ["+"|"-"] unsigned-number
|
|
// XXXfredw: should we allow non-zero unitless values? See bug 757703.
|
|
if (!floatValue) {
|
|
aCSSValue.SetFloatValue(floatValue, eCSSUnit_Number);
|
|
aPseudoUnit = NS_MATHML_PSEUDO_UNIT_ITSELF;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
else if (unit.EqualsLiteral("width")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_WIDTH;
|
|
else if (unit.EqualsLiteral("height")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_HEIGHT;
|
|
else if (unit.EqualsLiteral("depth")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_DEPTH;
|
|
else if (!gotPercent) { // percentage can only apply to a pseudo-unit
|
|
|
|
// see if the unit is a named-space
|
|
if (nsMathMLElement::ParseNamedSpaceValue(unit, aCSSValue,
|
|
nsMathMLElement::
|
|
PARSE_ALLOW_NEGATIVE)) {
|
|
// re-scale properly, and we know that the unit of the named-space is 'em'
|
|
floatValue *= aCSSValue.GetFloatValue();
|
|
aCSSValue.SetFloatValue(floatValue, eCSSUnit_EM);
|
|
aPseudoUnit = NS_MATHML_PSEUDO_UNIT_NAMEDSPACE;
|
|
return true;
|
|
}
|
|
|
|
// see if the input was just a CSS value
|
|
// We are not supposed to have a unitless, percent, negative or namedspace
|
|
// value here.
|
|
number.Append(unit); // leave the sign out if it was there
|
|
if (nsMathMLElement::ParseNumericValue(number, aCSSValue,
|
|
nsMathMLElement::
|
|
PARSE_SUPPRESS_WARNINGS, nullptr))
|
|
return true;
|
|
}
|
|
|
|
// if we enter here, we have a number that will act as a multiplier on a pseudo-unit
|
|
if (aPseudoUnit != NS_MATHML_PSEUDO_UNIT_UNSPECIFIED) {
|
|
if (gotPercent)
|
|
aCSSValue.SetPercentValue(floatValue / 100.0f);
|
|
else
|
|
aCSSValue.SetFloatValue(floatValue, eCSSUnit_Number);
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
#ifdef DEBUG
|
|
printf("mpadded: attribute with bad numeric value: %s\n",
|
|
NS_LossyConvertUTF16toASCII(aString).get());
|
|
#endif
|
|
// if we reach here, it means we encounter an unexpected input
|
|
aSign = NS_MATHML_SIGN_INVALID;
|
|
return false;
|
|
}
|
|
|
|
void
|
|
nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
|
|
int32_t aPseudoUnit,
|
|
const nsCSSValue& aCSSValue,
|
|
const nsHTMLReflowMetrics& aDesiredSize,
|
|
nscoord& aValueToUpdate,
|
|
float aFontSizeInflation) const
|
|
{
|
|
nsCSSUnit unit = aCSSValue.GetUnit();
|
|
if (NS_MATHML_SIGN_INVALID != aSign && eCSSUnit_Null != unit) {
|
|
nscoord scaler = 0, amount = 0;
|
|
|
|
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
|
|
switch(aPseudoUnit) {
|
|
case NS_MATHML_PSEUDO_UNIT_WIDTH:
|
|
scaler = aDesiredSize.Width();
|
|
break;
|
|
|
|
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
|
|
scaler = aDesiredSize.BlockStartAscent();
|
|
break;
|
|
|
|
case NS_MATHML_PSEUDO_UNIT_DEPTH:
|
|
scaler = aDesiredSize.Height() - aDesiredSize.BlockStartAscent();
|
|
break;
|
|
|
|
default:
|
|
// if we ever reach here, it would mean something is wrong
|
|
// somewhere with the setup and/or the caller
|
|
NS_ERROR("Unexpected Pseudo Unit");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (eCSSUnit_Number == unit)
|
|
amount = NSToCoordRound(float(scaler) * aCSSValue.GetFloatValue());
|
|
else if (eCSSUnit_Percent == unit)
|
|
amount = NSToCoordRound(float(scaler) * aCSSValue.GetPercentValue());
|
|
else
|
|
amount = CalcLength(PresContext(), mStyleContext, aCSSValue,
|
|
aFontSizeInflation);
|
|
|
|
if (NS_MATHML_SIGN_PLUS == aSign)
|
|
aValueToUpdate += amount;
|
|
else if (NS_MATHML_SIGN_MINUS == aSign)
|
|
aValueToUpdate -= amount;
|
|
else
|
|
aValueToUpdate = amount;
|
|
}
|
|
}
|
|
|
|
void
|
|
nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus)
|
|
{
|
|
mPresentationData.flags &= ~NS_MATHML_ERROR;
|
|
ProcessAttributes();
|
|
|
|
///////////////
|
|
// Let the base class format our content like an inferred mrow
|
|
nsMathMLContainerFrame::Reflow(aPresContext, aDesiredSize,
|
|
aReflowState, aStatus);
|
|
//NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
|
}
|
|
|
|
/* virtual */ nsresult
|
|
nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget,
|
|
bool aPlaceOrigin,
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
|
{
|
|
nsresult rv =
|
|
nsMathMLContainerFrame::Place(aDrawTarget, false, aDesiredSize);
|
|
if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) {
|
|
DidReflowChildren(PrincipalChildList().FirstChild());
|
|
return rv;
|
|
}
|
|
|
|
nscoord height = aDesiredSize.BlockStartAscent();
|
|
nscoord depth = aDesiredSize.Height() - aDesiredSize.BlockStartAscent();
|
|
// The REC says:
|
|
//
|
|
// "The lspace attribute ('leading' space) specifies the horizontal location
|
|
// of the positioning point of the child content with respect to the
|
|
// positioning point of the mpadded element. By default they coincide, and
|
|
// therefore absolute values for lspace have the same effect as relative
|
|
// values."
|
|
//
|
|
// "MathML renderers should ensure that, except for the effects of the
|
|
// attributes, the relative spacing between the contents of the mpadded
|
|
// element and surrounding MathML elements would not be modified by replacing
|
|
// an mpadded element with an mrow element with the same content, even if
|
|
// linebreaking occurs within the mpadded element."
|
|
//
|
|
// (http://www.w3.org/TR/MathML/chapter3.html#presm.mpadded)
|
|
//
|
|
// "In those discussions, the terms leading and trailing are used to specify
|
|
// a side of an object when which side to use depends on the directionality;
|
|
// ie. leading means left in LTR but right in RTL."
|
|
// (http://www.w3.org/TR/MathML/chapter3.html#presm.bidi.math)
|
|
nscoord lspace = 0;
|
|
// In MathML3, "width" will be the bounding box width and "advancewidth" will
|
|
// refer "to the horizontal distance between the positioning point of the
|
|
// mpadded and the positioning point for the following content". MathML2
|
|
// doesn't make the distinction.
|
|
nscoord width = aDesiredSize.Width();
|
|
nscoord voffset = 0;
|
|
|
|
int32_t pseudoUnit;
|
|
nscoord initialWidth = width;
|
|
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
|
|
|
// update width
|
|
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
|
? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit;
|
|
UpdateValue(mWidthSign, pseudoUnit, mWidth,
|
|
aDesiredSize, width, fontSizeInflation);
|
|
width = std::max(0, width);
|
|
|
|
// update "height" (this is the ascent in the terminology of the REC)
|
|
pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
|
? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit;
|
|
UpdateValue(mHeightSign, pseudoUnit, mHeight,
|
|
aDesiredSize, height, fontSizeInflation);
|
|
height = std::max(0, height);
|
|
|
|
// update "depth" (this is the descent in the terminology of the REC)
|
|
pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
|
|
? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit;
|
|
UpdateValue(mDepthSign, pseudoUnit, mDepth,
|
|
aDesiredSize, depth, fontSizeInflation);
|
|
depth = std::max(0, depth);
|
|
|
|
// update lspace
|
|
if (mLeadingSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
|
pseudoUnit = mLeadingSpacePseudoUnit;
|
|
UpdateValue(mLeadingSpaceSign, pseudoUnit, mLeadingSpace,
|
|
aDesiredSize, lspace, fontSizeInflation);
|
|
}
|
|
|
|
// update voffset
|
|
if (mVerticalOffsetPseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
|
|
pseudoUnit = mVerticalOffsetPseudoUnit;
|
|
UpdateValue(mVerticalOffsetSign, pseudoUnit, mVerticalOffset,
|
|
aDesiredSize, voffset, fontSizeInflation);
|
|
}
|
|
// do the padding now that we have everything
|
|
// The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,
|
|
// with no attributes) looks the same as <mrow>...</mrow>. But when there are
|
|
// attributes, tweak our metrics and move children to achieve the desired visual
|
|
// effects.
|
|
|
|
if ((StyleVisibility()->mDirection ?
|
|
mWidthSign : mLeadingSpaceSign) != NS_MATHML_SIGN_INVALID) {
|
|
// there was padding on the left. dismiss the left italic correction now
|
|
// (so that our parent won't correct us)
|
|
mBoundingMetrics.leftBearing = 0;
|
|
}
|
|
|
|
if ((StyleVisibility()->mDirection ?
|
|
mLeadingSpaceSign : mWidthSign) != NS_MATHML_SIGN_INVALID) {
|
|
// there was padding on the right. dismiss the right italic correction now
|
|
// (so that our parent won't correct us)
|
|
mBoundingMetrics.width = width;
|
|
mBoundingMetrics.rightBearing = mBoundingMetrics.width;
|
|
}
|
|
|
|
nscoord dx = (StyleVisibility()->mDirection ?
|
|
width - initialWidth - lspace : lspace);
|
|
|
|
aDesiredSize.SetBlockStartAscent(height);
|
|
aDesiredSize.Width() = mBoundingMetrics.width;
|
|
aDesiredSize.Height() = depth + aDesiredSize.BlockStartAscent();
|
|
mBoundingMetrics.ascent = height;
|
|
mBoundingMetrics.descent = depth;
|
|
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
|
|
|
mReference.x = 0;
|
|
mReference.y = aDesiredSize.BlockStartAscent();
|
|
|
|
if (aPlaceOrigin) {
|
|
// Finish reflowing child frames, positioning their origins.
|
|
PositionRowChildFrames(dx, aDesiredSize.BlockStartAscent() - voffset);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
/* virtual */ nsresult
|
|
nsMathMLmpaddedFrame::MeasureForWidth(DrawTarget* aDrawTarget,
|
|
nsHTMLReflowMetrics& aDesiredSize)
|
|
{
|
|
ProcessAttributes();
|
|
return Place(aDrawTarget, false, aDesiredSize);
|
|
}
|