mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge backout of 68362ba98c23 (bug 363706).
This commit is contained in:
commit
b658da721e
@ -1493,6 +1493,25 @@ static nscoord AddPercents(nsLayoutUtils::IntrinsicWidthType aType,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ PRBool
|
||||||
|
nsLayoutUtils::GetAbsoluteCoord(const nsStyleCoord& aStyle,
|
||||||
|
nsIRenderingContext* aRenderingContext,
|
||||||
|
nsStyleContext* aStyleContext,
|
||||||
|
nscoord& aResult)
|
||||||
|
{
|
||||||
|
nsStyleUnit unit = aStyle.GetUnit();
|
||||||
|
if (eStyleUnit_Coord == unit) {
|
||||||
|
aResult = aStyle.GetCoordValue();
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
if (eStyleUnit_Chars == unit) {
|
||||||
|
aResult = nsLayoutUtils::CharsToCoord(aStyle, aRenderingContext,
|
||||||
|
aStyleContext);
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static PRBool
|
static PRBool
|
||||||
GetPercentHeight(const nsStyleCoord& aStyle,
|
GetPercentHeight(const nsStyleCoord& aStyle,
|
||||||
nsIRenderingContext* aRenderingContext,
|
nsIRenderingContext* aRenderingContext,
|
||||||
@ -2632,6 +2651,26 @@ nsLayoutUtils::SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
|
|||||||
aRC->SetFont(font->mFont, visibility->mLangGroup);
|
aRC->SetFont(font->mFont, visibility->mLangGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nscoord
|
||||||
|
nsLayoutUtils::CharsToCoord(const nsStyleCoord& aStyle,
|
||||||
|
nsIRenderingContext* aRenderingContext,
|
||||||
|
nsStyleContext* aStyleContext)
|
||||||
|
{
|
||||||
|
NS_ASSERTION(aStyle.GetUnit() == eStyleUnit_Chars,
|
||||||
|
"Shouldn't have called this");
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFontMetrics> metrics;
|
||||||
|
aRenderingContext->GetMetricsFor(aStyleContext->GetStyleFont()->mFont,
|
||||||
|
*getter_AddRefs(metrics));
|
||||||
|
nsCOMPtr<nsIThebesFontMetrics> tfm(do_QueryInterface(metrics));
|
||||||
|
gfxFloat zeroWidth =
|
||||||
|
tfm->GetThebesFontGroup()->GetFontAt(0)->GetMetrics().zeroOrAveCharWidth;
|
||||||
|
|
||||||
|
return NSToCoordRound(aValue.GetFloatValue() *
|
||||||
|
NS_ceil(aPresContext->AppUnitsPerDevPixel() *
|
||||||
|
zeroWidth));
|
||||||
|
}
|
||||||
|
|
||||||
static PRBool NonZeroStyleCoord(const nsStyleCoord& aCoord)
|
static PRBool NonZeroStyleCoord(const nsStyleCoord& aCoord)
|
||||||
{
|
{
|
||||||
switch (aCoord.GetUnit()) {
|
switch (aCoord.GetUnit()) {
|
||||||
|
@ -589,7 +589,7 @@ public:
|
|||||||
* @param aRenderingContext the rendering context to use for font measurement
|
* @param aRenderingContext the rendering context to use for font measurement
|
||||||
* @param aFrame the frame whose style context should be used for font information
|
* @param aFrame the frame whose style context should be used for font information
|
||||||
* @param aResult the nscoord value of the style coord
|
* @param aResult the nscoord value of the style coord
|
||||||
* @return TRUE if the unit is eStyleUnit_Coord
|
* @return TRUE if the unit is eStyleUnit_Coord or eStyleUnit_Chars
|
||||||
*/
|
*/
|
||||||
static PRBool GetAbsoluteCoord(const nsStyleCoord& aStyle,
|
static PRBool GetAbsoluteCoord(const nsStyleCoord& aStyle,
|
||||||
nsIRenderingContext* aRenderingContext,
|
nsIRenderingContext* aRenderingContext,
|
||||||
@ -606,16 +606,7 @@ public:
|
|||||||
static PRBool GetAbsoluteCoord(const nsStyleCoord& aStyle,
|
static PRBool GetAbsoluteCoord(const nsStyleCoord& aStyle,
|
||||||
nsIRenderingContext* aRenderingContext,
|
nsIRenderingContext* aRenderingContext,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
nscoord& aResult)
|
nscoord& aResult);
|
||||||
{
|
|
||||||
nsStyleUnit unit = aStyle.GetUnit();
|
|
||||||
if (eStyleUnit_Coord == unit) {
|
|
||||||
aResult = aStyle.GetCoordValue();
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the contribution of aFrame to its containing block's intrinsic
|
* Get the contribution of aFrame to its containing block's intrinsic
|
||||||
* width. This considers the child's intrinsic width, its 'width',
|
* width. This considers the child's intrinsic width, its 'width',
|
||||||
@ -770,6 +761,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC);
|
static void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an eStyleUnit_Chars nsStyleCoord to an nscoord.
|
||||||
|
*
|
||||||
|
* @param aStyle the style coord
|
||||||
|
* @param aRenderingContext the rendering context to use for font measurement
|
||||||
|
* @param aStyleContext the style context to use for font infomation
|
||||||
|
*/
|
||||||
|
static nscoord CharsToCoord(const nsStyleCoord& aStyle,
|
||||||
|
nsIRenderingContext* aRenderingContext,
|
||||||
|
nsStyleContext* aStyleContext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if any style coordinate is nonzero
|
* Determine if any style coordinate is nonzero
|
||||||
* @param aCoord the style sides
|
* @param aCoord the style sides
|
||||||
|
@ -210,24 +210,26 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline PRBool IsFixedPaddingSize(nsStyleUnit aUnit) {
|
static inline PRBool IsFixedPaddingSize(nsStyleUnit aUnit) {
|
||||||
return aUnit == eStyleUnit_Coord;
|
return aUnit == eStyleUnit_Coord || aUnit == eStyleUnit_Chars;
|
||||||
}
|
}
|
||||||
static inline PRBool IsFixedMarginSize(nsStyleUnit aUnit) {
|
static inline PRBool IsFixedMarginSize(nsStyleUnit aUnit) {
|
||||||
return aUnit == eStyleUnit_Coord;
|
return aUnit == eStyleUnit_Coord || aUnit == eStyleUnit_Chars;
|
||||||
}
|
}
|
||||||
static inline PRBool IsFixedMaxSize(nsStyleUnit aUnit) {
|
static inline PRBool IsFixedMaxSize(nsStyleUnit aUnit) {
|
||||||
return aUnit == eStyleUnit_None || aUnit == eStyleUnit_Coord;
|
return aUnit == eStyleUnit_None || aUnit == eStyleUnit_Coord ||
|
||||||
|
aUnit == eStyleUnit_Chars;
|
||||||
}
|
}
|
||||||
static inline PRBool IsFixedOffset(nsStyleUnit aUnit) {
|
static inline PRBool IsFixedOffset(nsStyleUnit aUnit) {
|
||||||
return aUnit == eStyleUnit_Coord;
|
return aUnit == eStyleUnit_Coord || aUnit == eStyleUnit_Chars;
|
||||||
}
|
}
|
||||||
static inline PRBool IsFixedHeight(nsStyleUnit aUnit) {
|
static inline PRBool IsFixedHeight(nsStyleUnit aUnit) {
|
||||||
return aUnit == eStyleUnit_Coord;
|
return aUnit == eStyleUnit_Coord || aUnit == eStyleUnit_Chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PRBool IsFixedWidth(const nsStyleCoord& aCoord)
|
static inline PRBool IsFixedWidth(const nsStyleCoord& aCoord)
|
||||||
{
|
{
|
||||||
return aCoord.GetUnit() == eStyleUnit_Coord ||
|
return aCoord.GetUnit() == eStyleUnit_Coord ||
|
||||||
|
aCoord.GetUnit() == eStyleUnit_Chars ||
|
||||||
(aCoord.GetUnit() == eStyleUnit_Enumerated &&
|
(aCoord.GetUnit() == eStyleUnit_Enumerated &&
|
||||||
(aCoord.GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
(aCoord.GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
||||||
aCoord.GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT));
|
aCoord.GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT));
|
||||||
|
@ -2963,6 +2963,11 @@ AddCoord(const nsStyleCoord& aStyle,
|
|||||||
case eStyleUnit_Percent:
|
case eStyleUnit_Percent:
|
||||||
*aPercent += aStyle.GetPercentValue();
|
*aPercent += aStyle.GetPercentValue();
|
||||||
break;
|
break;
|
||||||
|
case eStyleUnit_Chars: {
|
||||||
|
*aCoord += nsLayoutUtils::CharsToCoord(aStyle, aRenderingContext,
|
||||||
|
aFrame->GetStyleContext());
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2771,6 +2771,7 @@ nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
|||||||
|
|
||||||
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
|
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
|
||||||
coord.GetUnit() == eStyleUnit_Percent ||
|
coord.GetUnit() == eStyleUnit_Percent ||
|
||||||
|
coord.GetUnit() == eStyleUnit_Chars ||
|
||||||
coord.GetUnit() == eStyleUnit_Auto,
|
coord.GetUnit() == eStyleUnit_Auto,
|
||||||
"Unexpected unit");
|
"Unexpected unit");
|
||||||
|
|
||||||
@ -3057,6 +3058,24 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
|||||||
aTable));
|
aTable));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case eStyleUnit_Chars: {
|
||||||
|
// Get a rendering context
|
||||||
|
nsCOMPtr<nsIRenderingContext> cx;
|
||||||
|
nsIFrame* frame = mPresShell->FrameManager()->GetRootFrame();
|
||||||
|
if (frame) {
|
||||||
|
mPresShell->CreateRenderingContext(frame, getter_AddRefs(cx));
|
||||||
|
}
|
||||||
|
if (cx) {
|
||||||
|
nscoord val =
|
||||||
|
nsLayoutUtils::CharsToCoord(aCoord, cx, mStyleContextHolder);
|
||||||
|
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
|
||||||
|
} else {
|
||||||
|
// Oh, well. Give up.
|
||||||
|
aValue->SetAppUnits(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case eStyleUnit_None:
|
case eStyleUnit_None:
|
||||||
aValue->SetIdent(nsGkAtoms::none);
|
aValue->SetIdent(nsGkAtoms::none);
|
||||||
break;
|
break;
|
||||||
@ -3076,6 +3095,21 @@ nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|||||||
switch (aCoord.GetUnit()) {
|
switch (aCoord.GetUnit()) {
|
||||||
case eStyleUnit_Coord:
|
case eStyleUnit_Coord:
|
||||||
return aCoord.GetCoordValue();
|
return aCoord.GetCoordValue();
|
||||||
|
case eStyleUnit_Chars:
|
||||||
|
{
|
||||||
|
// Get a rendering context
|
||||||
|
nsCOMPtr<nsIRenderingContext> cx;
|
||||||
|
nsIFrame* frame = mPresShell->FrameManager()->GetRootFrame();
|
||||||
|
if (frame) {
|
||||||
|
mPresShell->CreateRenderingContext(frame, getter_AddRefs(cx));
|
||||||
|
}
|
||||||
|
if (!cx) {
|
||||||
|
// Return the default value, I guess
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nsLayoutUtils::CharsToCoord(aCoord, cx, mStyleContextHolder);
|
||||||
|
}
|
||||||
case eStyleUnit_Percent:
|
case eStyleUnit_Percent:
|
||||||
{
|
{
|
||||||
nscoord percentageBase;
|
nscoord percentageBase;
|
||||||
|
@ -233,7 +233,8 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
|||||||
aFontSize = aStyleFont->mFont.size;
|
aFontSize = aStyleFont->mFont.size;
|
||||||
}
|
}
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case eCSSUnit_EM: {
|
case eCSSUnit_EM:
|
||||||
|
case eCSSUnit_Char: {
|
||||||
return NSToCoordRound(aValue.GetFloatValue() * float(aFontSize));
|
return NSToCoordRound(aValue.GetFloatValue() * float(aFontSize));
|
||||||
// XXX scale against font metrics height instead?
|
// XXX scale against font metrics height instead?
|
||||||
}
|
}
|
||||||
@ -253,17 +254,6 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
|||||||
nscoord capHeight = ((aFontSize / 3) * 2); // XXX HACK!
|
nscoord capHeight = ((aFontSize / 3) * 2); // XXX HACK!
|
||||||
return NSToCoordRound(aValue.GetFloatValue() * float(capHeight));
|
return NSToCoordRound(aValue.GetFloatValue() * float(capHeight));
|
||||||
}
|
}
|
||||||
case eCSSUnit_Char: {
|
|
||||||
nsFont font = aStyleFont->mFont;
|
|
||||||
font.size = aFontSize;
|
|
||||||
nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font);
|
|
||||||
nsCOMPtr<nsIThebesFontMetrics> tfm(do_QueryInterface(fm));
|
|
||||||
gfxFloat zeroWidth = tfm->GetThebesFontGroup()->GetFontAt(0)->GetMetrics().zeroOrAveCharWidth;
|
|
||||||
|
|
||||||
return NSToCoordRound(aValue.GetFloatValue() *
|
|
||||||
NS_ceil(aPresContext->AppUnitsPerDevPixel() *
|
|
||||||
zeroWidth));
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("unexpected unit");
|
NS_NOTREACHED("unexpected unit");
|
||||||
break;
|
break;
|
||||||
@ -320,6 +310,10 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
|||||||
if (aValue.GetUnit() == eCSSUnit_Null) {
|
if (aValue.GetUnit() == eCSSUnit_Null) {
|
||||||
result = PR_FALSE;
|
result = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
else if (((aMask & SETCOORD_LENGTH) != 0) &&
|
||||||
|
(aValue.GetUnit() == eCSSUnit_Char)) {
|
||||||
|
aCoord.SetIntValue(NSToIntFloor(aValue.GetFloatValue()), eStyleUnit_Chars);
|
||||||
|
}
|
||||||
else if (((aMask & SETCOORD_LENGTH) != 0) &&
|
else if (((aMask & SETCOORD_LENGTH) != 0) &&
|
||||||
aValue.IsLengthUnit()) {
|
aValue.IsLengthUnit()) {
|
||||||
aCoord.SetCoordValue(CalcLength(aValue, aStyleContext, aPresContext, aInherited));
|
aCoord.SetCoordValue(CalcLength(aValue, aStyleContext, aPresContext, aInherited));
|
||||||
@ -3729,8 +3723,15 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||||||
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
|
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
|
||||||
else if (SetCoord(value, coord, nsStyleCoord(), SETCOORD_LENGTH,
|
else if (SetCoord(value, coord, nsStyleCoord(), SETCOORD_LENGTH,
|
||||||
aContext, mPresContext, inherited)) {
|
aContext, mPresContext, inherited)) {
|
||||||
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit");
|
if (coord.GetUnit() == eStyleUnit_Coord) {
|
||||||
border->SetBorderWidth(side, coord.GetCoordValue());
|
border->SetBorderWidth(side, coord.GetCoordValue());
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
else {
|
||||||
|
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Chars, "unexpected unit");
|
||||||
|
NS_WARNING("Border set in chars; we don't handle that");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (eCSSUnit_Inherit == value.GetUnit()) {
|
else if (eCSSUnit_Inherit == value.GetUnit()) {
|
||||||
inherited = PR_TRUE;
|
inherited = PR_TRUE;
|
||||||
|
@ -129,8 +129,10 @@ void nsStyleCoord::SetCoordValue(nscoord aValue)
|
|||||||
void nsStyleCoord::SetIntValue(PRInt32 aValue, nsStyleUnit aUnit)
|
void nsStyleCoord::SetIntValue(PRInt32 aValue, nsStyleUnit aUnit)
|
||||||
{
|
{
|
||||||
NS_ASSERTION((aUnit == eStyleUnit_Enumerated) ||
|
NS_ASSERTION((aUnit == eStyleUnit_Enumerated) ||
|
||||||
|
(aUnit == eStyleUnit_Chars) ||
|
||||||
(aUnit == eStyleUnit_Integer), "not an int value");
|
(aUnit == eStyleUnit_Integer), "not an int value");
|
||||||
if ((aUnit == eStyleUnit_Enumerated) ||
|
if ((aUnit == eStyleUnit_Enumerated) ||
|
||||||
|
(aUnit == eStyleUnit_Chars) ||
|
||||||
(aUnit == eStyleUnit_Integer)) {
|
(aUnit == eStyleUnit_Integer)) {
|
||||||
mUnit = aUnit;
|
mUnit = aUnit;
|
||||||
mValue.mInt = aValue;
|
mValue.mInt = aValue;
|
||||||
@ -194,6 +196,7 @@ void nsStyleCoord::AppendToString(nsString& aBuffer) const
|
|||||||
case eStyleUnit_None: aBuffer.AppendLiteral("None"); break;
|
case eStyleUnit_None: aBuffer.AppendLiteral("None"); break;
|
||||||
case eStyleUnit_Enumerated: aBuffer.AppendLiteral("enum"); break;
|
case eStyleUnit_Enumerated: aBuffer.AppendLiteral("enum"); break;
|
||||||
case eStyleUnit_Integer: aBuffer.AppendLiteral("int"); break;
|
case eStyleUnit_Integer: aBuffer.AppendLiteral("int"); break;
|
||||||
|
case eStyleUnit_Chars: aBuffer.AppendLiteral("chars"); break;
|
||||||
}
|
}
|
||||||
aBuffer.Append(PRUnichar(' '));
|
aBuffer.Append(PRUnichar(' '));
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ enum nsStyleUnit {
|
|||||||
eStyleUnit_Factor = 11, // (float) a multiplier
|
eStyleUnit_Factor = 11, // (float) a multiplier
|
||||||
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
||||||
eStyleUnit_Integer = 30, // (int) value is simple integer
|
eStyleUnit_Integer = 30, // (int) value is simple integer
|
||||||
eStyleUnit_Enumerated = 32 // (int) value has enumerated meaning
|
eStyleUnit_Enumerated = 32, // (int) value has enumerated meaning
|
||||||
|
eStyleUnit_Chars = 33 // (int) value is number of characters
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
@ -196,8 +197,10 @@ inline PRInt32 nsStyleCoord::GetCoordValue(void) const
|
|||||||
inline PRInt32 nsStyleCoord::GetIntValue(void) const
|
inline PRInt32 nsStyleCoord::GetIntValue(void) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION((mUnit == eStyleUnit_Enumerated) ||
|
NS_ASSERTION((mUnit == eStyleUnit_Enumerated) ||
|
||||||
|
(mUnit == eStyleUnit_Chars) ||
|
||||||
(mUnit == eStyleUnit_Integer), "not an int value");
|
(mUnit == eStyleUnit_Integer), "not an int value");
|
||||||
if ((mUnit == eStyleUnit_Enumerated) ||
|
if ((mUnit == eStyleUnit_Enumerated) ||
|
||||||
|
(mUnit == eStyleUnit_Chars) ||
|
||||||
(mUnit == eStyleUnit_Integer)) {
|
(mUnit == eStyleUnit_Integer)) {
|
||||||
return mValue.mInt;
|
return mValue.mInt;
|
||||||
}
|
}
|
||||||
|
@ -231,6 +231,10 @@ static nscoord CalcCoord(const nsStyleCoord& aCoord,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case eStyleUnit_Chars:
|
||||||
|
// XXX we need a frame and a rendering context to calculate this, bug 281972, bug 282126.
|
||||||
|
NS_NOTYETIMPLEMENTED("CalcCoord: eStyleUnit_Chars");
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
NS_ERROR("bad unit type");
|
NS_ERROR("bad unit type");
|
||||||
break;
|
break;
|
||||||
|
@ -526,7 +526,7 @@ struct nsStyleOutline {
|
|||||||
aOffset = NS_ROUND_OFFSET_TO_PIXELS(offset, mTwipsPerPixel);
|
aOffset = NS_ROUND_OFFSET_TO_PIXELS(offset, mTwipsPerPixel);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
} else {
|
} else {
|
||||||
NS_ERROR("GetOutlineOffset: bad unit type");
|
NS_NOTYETIMPLEMENTED("GetOutlineOffset: eStyleUnit_Chars");
|
||||||
aOffset = 0;
|
aOffset = 0;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ GetWidthInfo(nsIRenderingContext *aRenderingContext,
|
|||||||
// XXXldb Should we consider -moz-box-sizing?
|
// XXXldb Should we consider -moz-box-sizing?
|
||||||
|
|
||||||
nsStyleUnit unit = aStylePos->mWidth.GetUnit();
|
nsStyleUnit unit = aStylePos->mWidth.GetUnit();
|
||||||
if (unit == eStyleUnit_Coord) {
|
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Chars) {
|
||||||
hasSpecifiedWidth = PR_TRUE;
|
hasSpecifiedWidth = PR_TRUE;
|
||||||
nscoord w = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
nscoord w = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||||
aFrame, 0, 0, 0, aStylePos->mWidth);
|
aFrame, 0, 0, 0, aStylePos->mWidth);
|
||||||
@ -171,7 +171,8 @@ GetWidthInfo(nsIRenderingContext *aRenderingContext,
|
|||||||
unit = maxWidth.GetUnit();
|
unit = maxWidth.GetUnit();
|
||||||
// XXX To really implement 'max-width' well, we'd need to store
|
// XXX To really implement 'max-width' well, we'd need to store
|
||||||
// it separately on the columns.
|
// it separately on the columns.
|
||||||
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Enumerated) {
|
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Chars ||
|
||||||
|
unit == eStyleUnit_Enumerated) {
|
||||||
nscoord w =
|
nscoord w =
|
||||||
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
|
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
|
||||||
0, 0, 0, maxWidth);
|
0, 0, 0, maxWidth);
|
||||||
@ -196,7 +197,8 @@ GetWidthInfo(nsIRenderingContext *aRenderingContext,
|
|||||||
eStyleUnit_Enumerated);
|
eStyleUnit_Enumerated);
|
||||||
}
|
}
|
||||||
unit = minWidth.GetUnit();
|
unit = minWidth.GetUnit();
|
||||||
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Enumerated) {
|
if (unit == eStyleUnit_Coord || unit == eStyleUnit_Chars ||
|
||||||
|
unit == eStyleUnit_Enumerated) {
|
||||||
nscoord w =
|
nscoord w =
|
||||||
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
|
nsLayoutUtils::ComputeWidthValue(aRenderingContext, aFrame,
|
||||||
0, 0, 0, minWidth);
|
0, 0, 0, minWidth);
|
||||||
|
@ -98,7 +98,8 @@ FixedTableLayoutStrategy::GetMinWidth(nsIRenderingContext* aRenderingContext)
|
|||||||
}
|
}
|
||||||
const nsStyleCoord *styleWidth =
|
const nsStyleCoord *styleWidth =
|
||||||
&colFrame->GetStylePosition()->mWidth;
|
&colFrame->GetStylePosition()->mWidth;
|
||||||
if (styleWidth->GetUnit() == eStyleUnit_Coord) {
|
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
||||||
|
styleWidth->GetUnit() == eStyleUnit_Chars) {
|
||||||
result += nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
result += nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||||
colFrame, 0, 0, 0, *styleWidth);
|
colFrame, 0, 0, 0, *styleWidth);
|
||||||
} else if (styleWidth->GetUnit() == eStyleUnit_Percent) {
|
} else if (styleWidth->GetUnit() == eStyleUnit_Percent) {
|
||||||
@ -117,6 +118,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsIRenderingContext* aRenderingContext)
|
|||||||
if (cellFrame) {
|
if (cellFrame) {
|
||||||
styleWidth = &cellFrame->GetStylePosition()->mWidth;
|
styleWidth = &cellFrame->GetStylePosition()->mWidth;
|
||||||
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
||||||
|
styleWidth->GetUnit() == eStyleUnit_Chars ||
|
||||||
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
|
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
|
||||||
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
||||||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
|
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
|
||||||
@ -214,7 +216,8 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
|
|||||||
const nsStyleCoord *styleWidth =
|
const nsStyleCoord *styleWidth =
|
||||||
&colFrame->GetStylePosition()->mWidth;
|
&colFrame->GetStylePosition()->mWidth;
|
||||||
nscoord colWidth;
|
nscoord colWidth;
|
||||||
if (styleWidth->GetUnit() == eStyleUnit_Coord) {
|
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
||||||
|
styleWidth->GetUnit() == eStyleUnit_Chars) {
|
||||||
colWidth = nsLayoutUtils::ComputeWidthValue(
|
colWidth = nsLayoutUtils::ComputeWidthValue(
|
||||||
aReflowState.rendContext,
|
aReflowState.rendContext,
|
||||||
colFrame, 0, 0, 0, *styleWidth);
|
colFrame, 0, 0, 0, *styleWidth);
|
||||||
@ -237,6 +240,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
|
|||||||
if (cellFrame) {
|
if (cellFrame) {
|
||||||
styleWidth = &cellFrame->GetStylePosition()->mWidth;
|
styleWidth = &cellFrame->GetStylePosition()->mWidth;
|
||||||
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
if (styleWidth->GetUnit() == eStyleUnit_Coord ||
|
||||||
|
styleWidth->GetUnit() == eStyleUnit_Chars ||
|
||||||
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
|
(styleWidth->GetUnit() == eStyleUnit_Enumerated &&
|
||||||
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
(styleWidth->GetIntValue() == NS_STYLE_WIDTH_MAX_CONTENT ||
|
||||||
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
|
styleWidth->GetIntValue() == NS_STYLE_WIDTH_MIN_CONTENT))) {
|
||||||
|
@ -683,6 +683,7 @@ nsIBox::AddCSSPrefSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
|||||||
aSize.height = position->mHeight.GetCoordValue();
|
aSize.height = position->mHeight.GetCoordValue();
|
||||||
heightSet = PR_TRUE;
|
heightSet = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
// XXX Handle eStyleUnit_Chars?
|
||||||
|
|
||||||
nsIContent* content = aBox->GetContent();
|
nsIContent* content = aBox->GetContent();
|
||||||
// ignore 'height' and 'width' attributes if the actual element is not XUL
|
// ignore 'height' and 'width' attributes if the actual element is not XUL
|
||||||
@ -781,6 +782,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
|||||||
aSize.height = 0;
|
aSize.height = 0;
|
||||||
heightSet = PR_TRUE;
|
heightSet = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
// XXX Handle eStyleUnit_Chars?
|
||||||
|
|
||||||
nsIContent* content = aBox->GetContent();
|
nsIContent* content = aBox->GetContent();
|
||||||
if (content) {
|
if (content) {
|
||||||
@ -839,6 +841,7 @@ nsIBox::AddCSSMaxSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
|||||||
aSize.height = max;
|
aSize.height = max;
|
||||||
heightSet = PR_TRUE;
|
heightSet = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
// XXX Handle eStyleUnit_Chars?
|
||||||
|
|
||||||
nsIContent* content = aBox->GetContent();
|
nsIContent* content = aBox->GetContent();
|
||||||
if (content) {
|
if (content) {
|
||||||
|
Loading…
Reference in New Issue
Block a user