mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Do inheritance without layout-dependent computations, per CSS2.1. Remove eStyleUnit_Inherit and nsStyleCoord::SetInheritValue. b=205790 r+sr=bzbarsky a=asa
This commit is contained in:
parent
86e2d2c45d
commit
a012b34247
@ -290,23 +290,8 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
}
|
||||
else if (((aMask & SETCOORD_INHERIT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Inherit)) {
|
||||
nsStyleUnit unit = aParentCoord.GetUnit();
|
||||
if ((eStyleUnit_Null == unit) || // parent has explicit computed value
|
||||
(eStyleUnit_Factor == unit) ||
|
||||
(eStyleUnit_Coord == unit) ||
|
||||
(eStyleUnit_Integer == unit) ||
|
||||
(eStyleUnit_Enumerated == unit) ||
|
||||
(eStyleUnit_Normal == unit) ||
|
||||
(eStyleUnit_Chars == unit)) {
|
||||
aCoord = aParentCoord; // just inherit value from parent
|
||||
aInherited = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
aCoord.SetInheritValue(); // needs to be computed by client
|
||||
// Since this works just like being
|
||||
// specified and not inherited, that's
|
||||
// how it's treated.
|
||||
}
|
||||
aCoord = aParentCoord; // just inherit value from parent
|
||||
aInherited = PR_TRUE;
|
||||
}
|
||||
else if (((aMask & SETCOORD_NORMAL) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Normal)) {
|
||||
@ -599,7 +584,6 @@ nsRuleNode::PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode)
|
||||
struct PropertyCheckData {
|
||||
size_t offset;
|
||||
nsCSSType type;
|
||||
PRPackedBool mayHaveExplicitInherit;
|
||||
};
|
||||
|
||||
/* the information for all the properties in a style struct */
|
||||
@ -645,48 +629,6 @@ ExamineRectProperties(const nsCSSRect* aRect,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ExamineRectCoordProperties(const nsCSSRect* aRect,
|
||||
PRUint32& aSpecifiedCount,
|
||||
PRUint32& aInheritedCount,
|
||||
PRBool& aCanHaveExplicitInherit)
|
||||
{
|
||||
if (!aRect)
|
||||
return;
|
||||
|
||||
if (eCSSUnit_Null != aRect->mLeft.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mLeft.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mTop.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mTop.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mRight.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mRight.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mBottom.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mBottom.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(nsRuleNode::RuleDetail)
|
||||
CheckFontCallback(const nsRuleDataStruct& aData)
|
||||
{
|
||||
@ -725,140 +667,140 @@ CheckFontCallback(const nsRuleDataStruct& aData)
|
||||
|
||||
static const PropertyCheckData FontCheckProperties[] = {
|
||||
#define CSS_PROP_FONT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_FONT
|
||||
};
|
||||
|
||||
static const PropertyCheckData DisplayCheckProperties[] = {
|
||||
#define CSS_PROP_DISPLAY(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_DISPLAY
|
||||
};
|
||||
|
||||
static const PropertyCheckData VisibilityCheckProperties[] = {
|
||||
#define CSS_PROP_VISIBILITY(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_VISIBILITY
|
||||
};
|
||||
|
||||
static const PropertyCheckData MarginCheckProperties[] = {
|
||||
#define CSS_PROP_MARGIN(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_MARGIN
|
||||
};
|
||||
|
||||
static const PropertyCheckData BorderCheckProperties[] = {
|
||||
#define CSS_PROP_BORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_BORDER
|
||||
};
|
||||
|
||||
static const PropertyCheckData PaddingCheckProperties[] = {
|
||||
#define CSS_PROP_PADDING(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_PADDING
|
||||
};
|
||||
|
||||
static const PropertyCheckData OutlineCheckProperties[] = {
|
||||
#define CSS_PROP_OUTLINE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_OUTLINE
|
||||
};
|
||||
|
||||
static const PropertyCheckData ListCheckProperties[] = {
|
||||
#define CSS_PROP_LIST(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_LIST
|
||||
};
|
||||
|
||||
static const PropertyCheckData ColorCheckProperties[] = {
|
||||
#define CSS_PROP_COLOR(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_COLOR
|
||||
};
|
||||
|
||||
static const PropertyCheckData BackgroundCheckProperties[] = {
|
||||
#define CSS_PROP_BACKGROUND(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_BACKGROUND
|
||||
};
|
||||
|
||||
static const PropertyCheckData PositionCheckProperties[] = {
|
||||
#define CSS_PROP_POSITION(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_POSITION
|
||||
};
|
||||
|
||||
static const PropertyCheckData TableCheckProperties[] = {
|
||||
#define CSS_PROP_TABLE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TABLE
|
||||
};
|
||||
|
||||
static const PropertyCheckData TableBorderCheckProperties[] = {
|
||||
#define CSS_PROP_TABLEBORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TABLEBORDER
|
||||
};
|
||||
|
||||
static const PropertyCheckData ContentCheckProperties[] = {
|
||||
#define CSS_PROP_CONTENT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_CONTENT
|
||||
};
|
||||
|
||||
static const PropertyCheckData QuotesCheckProperties[] = {
|
||||
#define CSS_PROP_QUOTES(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_QUOTES
|
||||
};
|
||||
|
||||
static const PropertyCheckData TextCheckProperties[] = {
|
||||
#define CSS_PROP_TEXT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TEXT
|
||||
};
|
||||
|
||||
static const PropertyCheckData TextResetCheckProperties[] = {
|
||||
#define CSS_PROP_TEXTRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TEXTRESET
|
||||
};
|
||||
|
||||
static const PropertyCheckData UserInterfaceCheckProperties[] = {
|
||||
#define CSS_PROP_USERINTERFACE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_USERINTERFACE
|
||||
};
|
||||
|
||||
static const PropertyCheckData UIResetCheckProperties[] = {
|
||||
#define CSS_PROP_UIRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_UIRESET
|
||||
};
|
||||
|
||||
static const PropertyCheckData XULCheckProperties[] = {
|
||||
#define CSS_PROP_XUL(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_XUL
|
||||
};
|
||||
@ -866,7 +808,7 @@ static const PropertyCheckData XULCheckProperties[] = {
|
||||
#ifdef MOZ_SVG
|
||||
static const PropertyCheckData SVGCheckProperties[] = {
|
||||
#define CSS_PROP_SVG(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_SVG
|
||||
};
|
||||
@ -964,8 +906,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
++specified;
|
||||
if (eCSSUnit_Inherit == value.GetUnit()) {
|
||||
++inherited;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
canHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -973,13 +913,8 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
|
||||
case eCSSType_Rect:
|
||||
total += 4;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
ExamineRectCoordProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited,
|
||||
canHaveExplicitInherit);
|
||||
else
|
||||
ExamineRectProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited);
|
||||
ExamineRectProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited);
|
||||
break;
|
||||
|
||||
case eCSSType_ValueList:
|
||||
@ -991,8 +926,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
++specified;
|
||||
if (eCSSUnit_Inherit == valueList->mValue.GetUnit()) {
|
||||
++inherited;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
canHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1001,8 +934,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
case eCSSType_CounterData:
|
||||
{
|
||||
++total;
|
||||
NS_ASSERTION(!prop->mayHaveExplicitInherit,
|
||||
"counters can't be coordinates");
|
||||
const nsCSSCounterData* counterData =
|
||||
CounterDataAtOffset(aRuleDataStruct, prop->offset);
|
||||
if (counterData) {
|
||||
@ -1017,8 +948,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
case eCSSType_Quotes:
|
||||
{
|
||||
++total;
|
||||
NS_ASSERTION(!prop->mayHaveExplicitInherit,
|
||||
"quotes can't be coordinates");
|
||||
const nsCSSQuotes* quotes =
|
||||
QuotesAtOffset(aRuleDataStruct, prop->offset);
|
||||
if (quotes) {
|
||||
|
@ -1280,9 +1280,6 @@ nsComputedDOMStyle::GetZIndex(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double Check the Unit!");
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
@ -1565,9 +1562,6 @@ nsComputedDOMStyle::GetTextIndent(nsIFrame *aFrame,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
@ -2301,9 +2295,6 @@ nsComputedDOMStyle::GetHeight(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
@ -2374,9 +2365,6 @@ nsComputedDOMStyle::GetWidth(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
@ -2439,10 +2427,6 @@ nsComputedDOMStyle::GetMaxHeight(nsIFrame *aFrame,
|
||||
positionData->mMaxHeight.GetPercentValue()));
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetIdent(NS_LITERAL_STRING("none"));
|
||||
@ -2505,10 +2489,6 @@ nsComputedDOMStyle::GetMaxWidth(nsIFrame *aFrame,
|
||||
positionData->mMaxWidth.GetPercentValue()));
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetIdent(NS_LITERAL_STRING("none"));
|
||||
@ -2551,10 +2531,6 @@ nsComputedDOMStyle::GetMinHeight(nsIFrame *aFrame,
|
||||
val->SetPercent(positionData->mMinHeight.GetPercentValue());
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
@ -2597,9 +2573,6 @@ nsComputedDOMStyle::GetMinWidth(nsIFrame *aFrame,
|
||||
val->SetPercent(positionData->mMinWidth.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
@ -3203,13 +3176,6 @@ nsComputedDOMStyle::GetBorderRadiusFor(PRUint8 aSide, nsIFrame *aFrame,
|
||||
val->SetPercent(coord.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// XXX This will only happen if we are inheriting from
|
||||
// a node with a percentage style unit for its relevant
|
||||
// border radius property. Layout currently drops this
|
||||
// one inherit case, so we do the same thing here.
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_ComputedDOMStyle
|
||||
NS_WARNING("double check the border radius");
|
||||
|
@ -48,7 +48,6 @@ enum nsStyleUnit {
|
||||
eStyleUnit_Null = 0, // (no value) value is not specified
|
||||
eStyleUnit_Normal = 1, // (no value)
|
||||
eStyleUnit_Auto = 2, // (no value)
|
||||
eStyleUnit_Inherit = 3, // (no value) value should be inherited
|
||||
eStyleUnit_Percent = 10, // (float) 1.0 == 100%
|
||||
eStyleUnit_Factor = 11, // (float) a multiplier
|
||||
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
||||
@ -97,7 +96,6 @@ public:
|
||||
void SetFactorValue(float aValue);
|
||||
void SetNormalValue(void);
|
||||
void SetAutoValue(void);
|
||||
void SetInheritValue(void);
|
||||
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit);
|
||||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
|
@ -180,12 +180,6 @@ void nsStyleCoord::SetAutoValue(void)
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void nsStyleCoord::SetInheritValue(void)
|
||||
{
|
||||
mUnit = eStyleUnit_Inherit;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit)
|
||||
{
|
||||
mUnit = aUnit;
|
||||
@ -218,7 +212,6 @@ void nsStyleCoord::AppendToString(nsString& aBuffer) const
|
||||
case eStyleUnit_Factor: aBuffer.Append(NS_LITERAL_STRING("f")); break;
|
||||
case eStyleUnit_Normal: aBuffer.Append(NS_LITERAL_STRING("Normal")); break;
|
||||
case eStyleUnit_Auto: aBuffer.Append(NS_LITERAL_STRING("Auto")); break;
|
||||
case eStyleUnit_Inherit: aBuffer.Append(NS_LITERAL_STRING("Inherit")); break;
|
||||
case eStyleUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break;
|
||||
case eStyleUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break;
|
||||
case eStyleUnit_Integer: aBuffer.Append(NS_LITERAL_STRING("int")); break;
|
||||
|
@ -76,45 +76,6 @@ inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
|
||||
// Auto margins are handled by layout
|
||||
break;
|
||||
|
||||
case eStyleUnit_Inherit:
|
||||
// XXX may not be direct parent...
|
||||
if (parentFrame) {
|
||||
nsStyleContext* parentContext = parentFrame->GetStyleContext();
|
||||
if (nsnull != parentContext) {
|
||||
nsMargin parentSpacing;
|
||||
switch (aSpacing) {
|
||||
case NS_SPACING_MARGIN:
|
||||
{
|
||||
const nsStyleMargin* parentMargin = parentContext->GetStyleMargin();
|
||||
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_PADDING:
|
||||
{
|
||||
const nsStylePadding* parentPadding = parentContext->GetStylePadding();
|
||||
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_BORDER:
|
||||
{
|
||||
const nsStyleBorder* parentBorder = parentContext->GetStyleBorder();
|
||||
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
switch (aSide) {
|
||||
case NS_SIDE_LEFT: result = parentSpacing.left; break;
|
||||
case NS_SIDE_TOP: result = parentSpacing.top; break;
|
||||
case NS_SIDE_RIGHT: result = parentSpacing.right; break;
|
||||
case NS_SIDE_BOTTOM: result = parentSpacing.bottom; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Percent:
|
||||
{
|
||||
nscoord baseWidth = 0;
|
||||
|
@ -1738,8 +1738,6 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
|
||||
for(i=0;i<4;i++) {
|
||||
borderRadii[i] = 0;
|
||||
switch ( bordStyleRadius[i].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
percent = bordStyleRadius[i].GetPercentValue();
|
||||
borderRadii[i] = (nscoord)(percent * aBorderArea.width);
|
||||
@ -2129,8 +2127,6 @@ nscoord width;
|
||||
for(i=0;i<4;i++) {
|
||||
borderRadii[i] = 0;
|
||||
switch ( bordStyleRadius[i].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
percent = bordStyleRadius[i].GetPercentValue();
|
||||
borderRadii[i] = (nscoord)(percent * aBorderArea.width);
|
||||
@ -3375,9 +3371,6 @@ nsCSSRendering::PaintBackgroundColor(nsIPresContext* aPresContext,
|
||||
for (; side < 4; ++side) {
|
||||
borderRadii[side] = 0;
|
||||
switch (bordStyleRadius[side].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
// do nothing
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
borderRadii[side] = nscoord(bordStyleRadius[side].GetPercentValue() * aBgClipArea.width);
|
||||
break;
|
||||
|
@ -1043,34 +1043,8 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
const nsHTMLReflowState* rs = &aReflowState;
|
||||
if (NS_UNCONSTRAINEDSIZE == rs->mComputedWidth) {
|
||||
// XXXldb Why isn't this always true for the cases where this
|
||||
// function returns true?
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = rs->mStylePosition;
|
||||
|
||||
for (;;) {
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = rs->parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
rs = prs;
|
||||
pos = prs->mStylePosition;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
return NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth ||
|
||||
eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,13 +155,7 @@ nsBlockReflowContext::AlignBlockHorizontally(nscoord aWidth,
|
||||
|
||||
// Get style unit associated with the left and right margins
|
||||
nsStyleUnit leftUnit = mStyleMargin->mMargin.GetLeftUnit();
|
||||
if (eStyleUnit_Inherit == leftUnit) {
|
||||
leftUnit = GetRealMarginLeftUnit();
|
||||
}
|
||||
nsStyleUnit rightUnit = mStyleMargin->mMargin.GetRightUnit();
|
||||
if (eStyleUnit_Inherit == rightUnit) {
|
||||
rightUnit = GetRealMarginRightUnit();
|
||||
}
|
||||
|
||||
// Apply post-reflow horizontal alignment. When a block element
|
||||
// doesn't use it all of the available width then we need to
|
||||
@ -752,41 +746,3 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
||||
|
||||
return fits;
|
||||
}
|
||||
|
||||
// If we have an inherited margin its possible that its auto all the
|
||||
// way up to the top of the tree. If that is the case, we need to know
|
||||
// it.
|
||||
nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginLeftUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsStyleContext* sc = mFrame->GetStyleContext();
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = sc->GetStyleMargin();
|
||||
unit = margin->mMargin.GetLeftUnit();
|
||||
}
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
// If we have an inherited margin its possible that its auto all the
|
||||
// way up to the top of the tree. If that is the case, we need to know
|
||||
// it.
|
||||
nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginRightUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsStyleContext* sc = mFrame->GetStyleContext();
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = sc->GetStyleMargin();
|
||||
unit = margin->mMargin.GetRightUnit();
|
||||
}
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
@ -106,9 +106,6 @@ public:
|
||||
/* inout */ nsCollapsingMargin& aMargin);
|
||||
|
||||
protected:
|
||||
nsStyleUnit GetRealMarginLeftUnit();
|
||||
nsStyleUnit GetRealMarginRightUnit();
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
const nsHTMLReflowState& mOuterReflowState;
|
||||
|
||||
|
@ -487,13 +487,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
mComputedOffsets.left = mComputedOffsets.right = 0;
|
||||
} else {
|
||||
// 'Right' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = cbrs->mComputedOffsets.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, mStylePosition->mOffset.GetRightUnit(),
|
||||
mStylePosition->mOffset.GetRight(coord),
|
||||
mComputedOffsets.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePosition->mOffset.GetRightUnit(),
|
||||
mStylePosition->mOffset.GetRight(coord),
|
||||
mComputedOffsets.right);
|
||||
|
||||
// Computed value for 'left' is minus the value of 'right'
|
||||
mComputedOffsets.left = -mComputedOffsets.right;
|
||||
@ -503,13 +500,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
NS_ASSERTION(rightIsAuto, "unexpected specified constraint");
|
||||
|
||||
// 'Left' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = cbrs->mComputedOffsets.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, mStylePosition->mOffset.GetLeftUnit(),
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePosition->mOffset.GetLeftUnit(),
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
|
||||
// Computed value for 'right' is minus the value of 'left'
|
||||
mComputedOffsets.right = -mComputedOffsets.left;
|
||||
@ -543,13 +537,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
mComputedOffsets.top = mComputedOffsets.bottom = 0;
|
||||
} else {
|
||||
// 'Bottom' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = cbrs->mComputedOffsets.bottom;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, mStylePosition->mOffset.GetBottomUnit(),
|
||||
mStylePosition->mOffset.GetBottom(coord),
|
||||
mComputedOffsets.bottom);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight,
|
||||
mStylePosition->mOffset.GetBottomUnit(),
|
||||
mStylePosition->mOffset.GetBottom(coord),
|
||||
mComputedOffsets.bottom);
|
||||
|
||||
// Computed value for 'top' is minus the value of 'bottom'
|
||||
mComputedOffsets.top = -mComputedOffsets.bottom;
|
||||
@ -559,13 +550,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
NS_ASSERTION(bottomIsAuto, "unexpected specified constraint");
|
||||
|
||||
// 'Top' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = cbrs->mComputedOffsets.top;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, mStylePosition->mOffset.GetTopUnit(),
|
||||
mStylePosition->mOffset.GetTop(coord),
|
||||
mComputedOffsets.top);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight,
|
||||
mStylePosition->mOffset.GetTopUnit(),
|
||||
mStylePosition->mOffset.GetTop(coord),
|
||||
mComputedOffsets.top);
|
||||
|
||||
// Computed value for 'bottom' is minus the value of 'top'
|
||||
mComputedOffsets.bottom = -mComputedOffsets.top;
|
||||
@ -668,22 +656,14 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
nsStyleCoord left, right;
|
||||
|
||||
// We have to compute the left and right values
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetLeftUnit()) {
|
||||
padding.left = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
padding.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetRightUnit()) {
|
||||
padding.right = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
padding.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
padding.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
padding.right);
|
||||
}
|
||||
|
||||
// See if the style system can provide us the margin directly
|
||||
@ -691,8 +671,7 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
nsStyleCoord left, right;
|
||||
|
||||
// We have to compute the left and right values
|
||||
if ((eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) ||
|
||||
(eStyleUnit_Inherit == mStyleMargin->mMargin.GetLeftUnit())) {
|
||||
if (eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) {
|
||||
margin.left = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
@ -700,8 +679,7 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
margin.left);
|
||||
}
|
||||
if ((eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit()) ||
|
||||
(eStyleUnit_Inherit == mStyleMargin->mMargin.GetRightUnit())) {
|
||||
if (eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit()) {
|
||||
margin.right = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
@ -801,7 +779,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
|
||||
knowBoxWidth = PR_TRUE;
|
||||
}
|
||||
|
||||
} else if ((eStyleUnit_Inherit == widthUnit) || (eStyleUnit_Auto == widthUnit)) {
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
// The box width is the containing block width
|
||||
boxWidth = aBlockContentArea.right - aBlockContentArea.left;
|
||||
knowBoxWidth = PR_TRUE;
|
||||
@ -989,9 +967,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// XXX Handle new 'static-position' value...
|
||||
PRBool leftIsAuto = PR_FALSE, rightIsAuto = PR_FALSE;
|
||||
nsStyleCoord coord;
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = cbrs->mComputedOffsets.left;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = 0;
|
||||
leftIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -999,9 +975,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = cbrs->mComputedOffsets.right;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = 0;
|
||||
rightIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1018,16 +992,9 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit();
|
||||
PRBool widthIsAuto = (eStyleUnit_Auto == widthUnit);
|
||||
if (!widthIsAuto) {
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
// The inherited value comes from the parent and not the absolute
|
||||
// containing block
|
||||
mComputedWidth = blockContentArea.right - blockContentArea.left;
|
||||
|
||||
} else {
|
||||
// Use the specified value for the computed width
|
||||
ComputeHorizontalValue(containingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
// Use the specified value for the computed width
|
||||
ComputeHorizontalValue(containingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
AdjustComputedWidth();
|
||||
}
|
||||
@ -1190,9 +1157,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// Initialize the 'top' and 'bottom' computed offsets
|
||||
nsStyleUnit heightUnit = mStylePosition->mHeight.GetUnit();
|
||||
PRBool topIsAuto = PR_FALSE, bottomIsAuto = PR_FALSE;
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = cbrs->mComputedOffsets.top;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = 0;
|
||||
topIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1202,9 +1167,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
mStylePosition->mOffset.GetTop(c),
|
||||
mComputedOffsets.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = cbrs->mComputedOffsets.bottom;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = 0;
|
||||
bottomIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1218,18 +1181,9 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// Initialize the 'height' computed value
|
||||
PRBool heightIsAuto = (eStyleUnit_Auto == heightUnit);
|
||||
if (!heightIsAuto) {
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
// The inherited value comes from the parent and not the absolute
|
||||
// containing block
|
||||
mComputedHeight = blockContentArea.bottom - blockContentArea.top;
|
||||
|
||||
} else {
|
||||
// Use the specified value for the computed height
|
||||
// XXX Handle 'inherit'. The inherited value comes from the parent
|
||||
// and not the containing block
|
||||
ComputeVerticalValue(containingBlockHeight, heightUnit,
|
||||
mStylePosition->mHeight, mComputedHeight);
|
||||
}
|
||||
// Use the specified value for the computed height
|
||||
ComputeVerticalValue(containingBlockHeight, heightUnit,
|
||||
mStylePosition->mHeight, mComputedHeight);
|
||||
|
||||
AdjustComputedHeight();
|
||||
}
|
||||
@ -1631,8 +1585,7 @@ CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState,
|
||||
if (aState.parentReflowState) {
|
||||
if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) {
|
||||
nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Inherit != parentUnit) &&
|
||||
(eStyleUnit_Auto != parentUnit)) {
|
||||
if (eStyleUnit_Auto != parentUnit) {
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -1807,9 +1760,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
(NS_FRAME_REPLACED(NS_CSS_FRAME_TYPE_FLOATING) == mFrameType)) {
|
||||
// Inline replaced element and floating replaced element are basically
|
||||
// treated the same. First calculate the computed width
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
// A specified value of 'auto' uses the element's intrinsic width
|
||||
mComputedWidth = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
@ -1822,9 +1773,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
AdjustComputedWidth();
|
||||
|
||||
// Now calculate the computed height
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
// A specified value of 'auto' uses the element's intrinsic height
|
||||
mComputedHeight = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
@ -1837,9 +1786,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
|
||||
} else if (NS_CSS_FRAME_TYPE_FLOATING == mFrameType) {
|
||||
// Floating non-replaced element. First calculate the computed width
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
if ((NS_UNCONSTRAINEDSIZE == aContainingBlockWidth) &&
|
||||
(eStyleUnit_Percent == mStylePosition->mWidth.GetUnit())) {
|
||||
// The element has a percentage width, but since the containing
|
||||
@ -1882,9 +1829,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
AdjustComputedWidth();
|
||||
|
||||
// Now calculate the computed height
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
mComputedHeight = NS_AUTOHEIGHT; // let it choose its height
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, heightUnit,
|
||||
@ -1905,9 +1850,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
rowOrRowGroup = PR_TRUE;
|
||||
}
|
||||
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
mComputedWidth = availableWidth;
|
||||
|
||||
if ((mComputedWidth != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){
|
||||
@ -1930,9 +1873,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
// 'height' property doesn't apply to table columns and column groups
|
||||
heightUnit = eStyleUnit_Auto;
|
||||
}
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
mComputedHeight = NS_AUTOHEIGHT;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, heightUnit,
|
||||
@ -2048,27 +1989,10 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (eStyleUnit_Inherit == aWidthUnit) {
|
||||
// Use parent element's width. Note that if its width was
|
||||
// 'inherit', then it already did this so we don't need to
|
||||
// recurse upwards.
|
||||
//
|
||||
// We use the containing block's width here for the "parent"
|
||||
// elements width, because we want to skip over any intervening
|
||||
// inline elements (since width doesn't apply to them).
|
||||
if (NS_UNCONSTRAINEDSIZE != aContainingBlockWidth) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
}
|
||||
else {
|
||||
mComputedWidth = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
AdjustComputedWidth();
|
||||
|
||||
@ -2077,20 +2001,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Compute the content height
|
||||
if (eStyleUnit_Inherit == aHeightUnit) {
|
||||
// Use parent elements height (note that if its height was inherit
|
||||
// then it already did this so we don't need to recurse upwards).
|
||||
//
|
||||
// We use the containing blocks height here for the "parent"
|
||||
// elements height because we want to skip over any interveening
|
||||
// inline elements (since height doesn't apply to them).
|
||||
if (NS_UNCONSTRAINEDSIZE != aContainingBlockHeight) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
}
|
||||
else {
|
||||
mComputedHeight = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
} else if (eStyleUnit_Auto == aHeightUnit) {
|
||||
if (eStyleUnit_Auto == aHeightUnit) {
|
||||
if (NS_FRAME_IS_REPLACED(mFrameType)) {
|
||||
// For replaced elements use the intrinsic size for "auto"
|
||||
mComputedHeight = NS_INTRINSICSIZE;
|
||||
@ -2366,7 +2277,6 @@ nsHTMLReflowState::ComputeHorizontalValue(nscoord aContainingBlockWidth,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult)
|
||||
{
|
||||
NS_PRECONDITION(eStyleUnit_Inherit != aUnit, "unexpected unit");
|
||||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
if (NS_UNCONSTRAINEDSIZE == aContainingBlockWidth) {
|
||||
@ -2400,7 +2310,6 @@ nsHTMLReflowState::ComputeVerticalValue(nscoord aContainingBlockHeight,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult)
|
||||
{
|
||||
NS_PRECONDITION(eStyleUnit_Inherit != aUnit, "unexpected unit");
|
||||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
// Verify no one is trying to calculate a percentage based height against
|
||||
@ -2448,22 +2357,14 @@ nsHTMLReflowState::ComputeMargin(nscoord aContainingBlockWidth,
|
||||
} else {
|
||||
nsStyleCoord left, right;
|
||||
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetLeftUnit()) {
|
||||
mComputedMargin.left = aContainingBlockRS->mComputedMargin.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeftUnit(),
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
mComputedMargin.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetRightUnit()) {
|
||||
mComputedMargin.right = aContainingBlockRS->mComputedMargin.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRightUnit(),
|
||||
mStyleMargin->mMargin.GetRight(right),
|
||||
mComputedMargin.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeftUnit(),
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
mComputedMargin.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRightUnit(),
|
||||
mStyleMargin->mMargin.GetRight(right),
|
||||
mComputedMargin.right);
|
||||
}
|
||||
|
||||
const nsHTMLReflowState* rs2 = GetPageBoxReflowState(parentReflowState);
|
||||
@ -2472,43 +2373,27 @@ nsHTMLReflowState::ComputeMargin(nscoord aContainingBlockWidth,
|
||||
// According to the CSS2 spec, margin percentages are
|
||||
// calculated with respect to the *height* of the containing
|
||||
// block when in a paginated context.
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetTopUnit()) {
|
||||
mComputedMargin.top = aContainingBlockRS->mComputedMargin.top;
|
||||
} else {
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetBottomUnit()) {
|
||||
mComputedMargin.bottom = aContainingBlockRS->mComputedMargin.bottom;
|
||||
} else {
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
else {
|
||||
// According to the CSS2 spec, margin percentages are
|
||||
// calculated with respect to the *width* of the containing
|
||||
// block, even for margin-top and margin-bottom.
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetTopUnit()) {
|
||||
mComputedMargin.top = aContainingBlockRS->mComputedMargin.top;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetBottomUnit()) {
|
||||
mComputedMargin.bottom = aContainingBlockRS->mComputedMargin.bottom;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2523,41 +2408,25 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth,
|
||||
// We have to compute the value
|
||||
nsStyleCoord left, right, top, bottom;
|
||||
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetLeftUnit()) {
|
||||
mComputedPadding.left = aContainingBlockRS->mComputedPadding.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
mComputedPadding.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetRightUnit()) {
|
||||
mComputedPadding.right = aContainingBlockRS->mComputedPadding.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
mComputedPadding.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
mComputedPadding.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
mComputedPadding.right);
|
||||
|
||||
// According to the CSS2 spec, percentages are calculated with respect to
|
||||
// containing block width for padding-top and padding-bottom
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetTopUnit()) {
|
||||
mComputedPadding.top = aContainingBlockRS->mComputedPadding.top;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetTopUnit(),
|
||||
mStylePadding->mPadding.GetTop(top),
|
||||
mComputedPadding.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetBottomUnit()) {
|
||||
mComputedPadding.bottom = aContainingBlockRS->mComputedPadding.bottom;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetBottomUnit(),
|
||||
mStylePadding->mPadding.GetBottom(bottom),
|
||||
mComputedPadding.bottom);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetTopUnit(),
|
||||
mStylePadding->mPadding.GetTop(top),
|
||||
mComputedPadding.top);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetBottomUnit(),
|
||||
mStylePadding->mPadding.GetBottom(bottom),
|
||||
mComputedPadding.bottom);
|
||||
}
|
||||
// a table row/col group, row/col doesn't have padding
|
||||
if (frame) {
|
||||
@ -2580,16 +2449,10 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS)
|
||||
{
|
||||
nsStyleUnit minWidthUnit = mStylePosition->mMinWidth.GetUnit();
|
||||
if (eStyleUnit_Inherit == minWidthUnit) {
|
||||
mComputedMinWidth = aContainingBlockRS->mComputedMinWidth;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, minWidthUnit,
|
||||
mStylePosition->mMinWidth, mComputedMinWidth);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth, minWidthUnit,
|
||||
mStylePosition->mMinWidth, mComputedMinWidth);
|
||||
nsStyleUnit maxWidthUnit = mStylePosition->mMaxWidth.GetUnit();
|
||||
if (eStyleUnit_Inherit == maxWidthUnit) {
|
||||
mComputedMaxWidth = aContainingBlockRS->mComputedMaxWidth;
|
||||
} else if (eStyleUnit_Null == maxWidthUnit) {
|
||||
if (eStyleUnit_Null == maxWidthUnit) {
|
||||
// Specified value of 'none'
|
||||
mComputedMaxWidth = NS_UNCONSTRAINEDSIZE; // no limit
|
||||
} else {
|
||||
@ -2604,23 +2467,17 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
}
|
||||
|
||||
nsStyleUnit minHeightUnit = mStylePosition->mMinHeight.GetUnit();
|
||||
if (eStyleUnit_Inherit == minHeightUnit) {
|
||||
mComputedMinHeight = aContainingBlockRS->mComputedMinHeight;
|
||||
// Check for percentage based values and a containing block height that
|
||||
// depends on the content height. Treat them like 'auto'
|
||||
if ((NS_AUTOHEIGHT == aContainingBlockHeight) &&
|
||||
(eStyleUnit_Percent == minHeightUnit)) {
|
||||
mComputedMinHeight = 0;
|
||||
} else {
|
||||
// Check for percentage based values and a containing block height that
|
||||
// depends on the content height. Treat them like 'auto'
|
||||
if ((NS_AUTOHEIGHT == aContainingBlockHeight) &&
|
||||
(eStyleUnit_Percent == minHeightUnit)) {
|
||||
mComputedMinHeight = 0;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, minHeightUnit,
|
||||
mStylePosition->mMinHeight, mComputedMinHeight);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight, minHeightUnit,
|
||||
mStylePosition->mMinHeight, mComputedMinHeight);
|
||||
}
|
||||
nsStyleUnit maxHeightUnit = mStylePosition->mMaxHeight.GetUnit();
|
||||
if (eStyleUnit_Inherit == maxHeightUnit) {
|
||||
mComputedMaxHeight = aContainingBlockRS->mComputedMaxHeight;
|
||||
} else if (eStyleUnit_Null == maxHeightUnit) {
|
||||
if (eStyleUnit_Null == maxHeightUnit) {
|
||||
// Specified value of 'none'
|
||||
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE; // no limit
|
||||
} else {
|
||||
|
@ -2189,13 +2189,6 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
// Get vertical-align property
|
||||
const nsStyleTextReset* textStyle = frame->GetStyleTextReset();
|
||||
nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit();
|
||||
#ifdef DEBUG
|
||||
if (eStyleUnit_Inherit == verticalAlignUnit) {
|
||||
printf("XXX: vertical-align: inherit not implemented for ");
|
||||
nsFrame::ListTag(stdout, frame);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef NOISY_VERTICAL_ALIGN
|
||||
printf(" [frame]");
|
||||
nsFrame::ListTag(stdout, frame);
|
||||
|
@ -1043,34 +1043,8 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
|
||||
static PRBool
|
||||
HaveAutoWidth(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
const nsHTMLReflowState* rs = &aReflowState;
|
||||
if (NS_UNCONSTRAINEDSIZE == rs->mComputedWidth) {
|
||||
// XXXldb Why isn't this always true for the cases where this
|
||||
// function returns true?
|
||||
return PR_TRUE;
|
||||
}
|
||||
const nsStylePosition* pos = rs->mStylePosition;
|
||||
|
||||
for (;;) {
|
||||
if (!pos) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
nsStyleUnit widthUnit = pos->mWidth.GetUnit();
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (eStyleUnit_Inherit != widthUnit) {
|
||||
break;
|
||||
}
|
||||
const nsHTMLReflowState* prs = rs->parentReflowState;
|
||||
if (!prs) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
rs = prs;
|
||||
pos = prs->mStylePosition;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
return NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth ||
|
||||
eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,13 +155,7 @@ nsBlockReflowContext::AlignBlockHorizontally(nscoord aWidth,
|
||||
|
||||
// Get style unit associated with the left and right margins
|
||||
nsStyleUnit leftUnit = mStyleMargin->mMargin.GetLeftUnit();
|
||||
if (eStyleUnit_Inherit == leftUnit) {
|
||||
leftUnit = GetRealMarginLeftUnit();
|
||||
}
|
||||
nsStyleUnit rightUnit = mStyleMargin->mMargin.GetRightUnit();
|
||||
if (eStyleUnit_Inherit == rightUnit) {
|
||||
rightUnit = GetRealMarginRightUnit();
|
||||
}
|
||||
|
||||
// Apply post-reflow horizontal alignment. When a block element
|
||||
// doesn't use it all of the available width then we need to
|
||||
@ -752,41 +746,3 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
||||
|
||||
return fits;
|
||||
}
|
||||
|
||||
// If we have an inherited margin its possible that its auto all the
|
||||
// way up to the top of the tree. If that is the case, we need to know
|
||||
// it.
|
||||
nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginLeftUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsStyleContext* sc = mFrame->GetStyleContext();
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = sc->GetStyleMargin();
|
||||
unit = margin->mMargin.GetLeftUnit();
|
||||
}
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
// If we have an inherited margin its possible that its auto all the
|
||||
// way up to the top of the tree. If that is the case, we need to know
|
||||
// it.
|
||||
nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginRightUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsStyleContext* sc = mFrame->GetStyleContext();
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = sc->GetStyleMargin();
|
||||
unit = margin->mMargin.GetRightUnit();
|
||||
}
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
@ -106,9 +106,6 @@ public:
|
||||
/* inout */ nsCollapsingMargin& aMargin);
|
||||
|
||||
protected:
|
||||
nsStyleUnit GetRealMarginLeftUnit();
|
||||
nsStyleUnit GetRealMarginRightUnit();
|
||||
|
||||
nsIPresContext* mPresContext;
|
||||
const nsHTMLReflowState& mOuterReflowState;
|
||||
|
||||
|
@ -487,13 +487,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
mComputedOffsets.left = mComputedOffsets.right = 0;
|
||||
} else {
|
||||
// 'Right' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = cbrs->mComputedOffsets.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, mStylePosition->mOffset.GetRightUnit(),
|
||||
mStylePosition->mOffset.GetRight(coord),
|
||||
mComputedOffsets.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePosition->mOffset.GetRightUnit(),
|
||||
mStylePosition->mOffset.GetRight(coord),
|
||||
mComputedOffsets.right);
|
||||
|
||||
// Computed value for 'left' is minus the value of 'right'
|
||||
mComputedOffsets.left = -mComputedOffsets.right;
|
||||
@ -503,13 +500,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
NS_ASSERTION(rightIsAuto, "unexpected specified constraint");
|
||||
|
||||
// 'Left' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = cbrs->mComputedOffsets.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, mStylePosition->mOffset.GetLeftUnit(),
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePosition->mOffset.GetLeftUnit(),
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
|
||||
// Computed value for 'right' is minus the value of 'left'
|
||||
mComputedOffsets.right = -mComputedOffsets.left;
|
||||
@ -543,13 +537,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
mComputedOffsets.top = mComputedOffsets.bottom = 0;
|
||||
} else {
|
||||
// 'Bottom' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = cbrs->mComputedOffsets.bottom;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, mStylePosition->mOffset.GetBottomUnit(),
|
||||
mStylePosition->mOffset.GetBottom(coord),
|
||||
mComputedOffsets.bottom);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight,
|
||||
mStylePosition->mOffset.GetBottomUnit(),
|
||||
mStylePosition->mOffset.GetBottom(coord),
|
||||
mComputedOffsets.bottom);
|
||||
|
||||
// Computed value for 'top' is minus the value of 'bottom'
|
||||
mComputedOffsets.top = -mComputedOffsets.bottom;
|
||||
@ -559,13 +550,10 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
NS_ASSERTION(bottomIsAuto, "unexpected specified constraint");
|
||||
|
||||
// 'Top' isn't 'auto' so compute its value
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = cbrs->mComputedOffsets.top;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, mStylePosition->mOffset.GetTopUnit(),
|
||||
mStylePosition->mOffset.GetTop(coord),
|
||||
mComputedOffsets.top);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight,
|
||||
mStylePosition->mOffset.GetTopUnit(),
|
||||
mStylePosition->mOffset.GetTop(coord),
|
||||
mComputedOffsets.top);
|
||||
|
||||
// Computed value for 'bottom' is minus the value of 'top'
|
||||
mComputedOffsets.bottom = -mComputedOffsets.top;
|
||||
@ -668,22 +656,14 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
nsStyleCoord left, right;
|
||||
|
||||
// We have to compute the left and right values
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetLeftUnit()) {
|
||||
padding.left = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
padding.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetRightUnit()) {
|
||||
padding.right = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
padding.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
padding.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
padding.right);
|
||||
}
|
||||
|
||||
// See if the style system can provide us the margin directly
|
||||
@ -691,8 +671,7 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
nsStyleCoord left, right;
|
||||
|
||||
// We have to compute the left and right values
|
||||
if ((eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) ||
|
||||
(eStyleUnit_Inherit == mStyleMargin->mMargin.GetLeftUnit())) {
|
||||
if (eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) {
|
||||
margin.left = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
@ -700,8 +679,7 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
margin.left);
|
||||
}
|
||||
if ((eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit()) ||
|
||||
(eStyleUnit_Inherit == mStyleMargin->mMargin.GetRightUnit())) {
|
||||
if (eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit()) {
|
||||
margin.right = 0; // just ignore
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
@ -801,7 +779,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
|
||||
knowBoxWidth = PR_TRUE;
|
||||
}
|
||||
|
||||
} else if ((eStyleUnit_Inherit == widthUnit) || (eStyleUnit_Auto == widthUnit)) {
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
// The box width is the containing block width
|
||||
boxWidth = aBlockContentArea.right - aBlockContentArea.left;
|
||||
knowBoxWidth = PR_TRUE;
|
||||
@ -989,9 +967,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// XXX Handle new 'static-position' value...
|
||||
PRBool leftIsAuto = PR_FALSE, rightIsAuto = PR_FALSE;
|
||||
nsStyleCoord coord;
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = cbrs->mComputedOffsets.left;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) {
|
||||
mComputedOffsets.left = 0;
|
||||
leftIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -999,9 +975,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
mStylePosition->mOffset.GetLeft(coord),
|
||||
mComputedOffsets.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = cbrs->mComputedOffsets.right;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
|
||||
mComputedOffsets.right = 0;
|
||||
rightIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1018,16 +992,9 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit();
|
||||
PRBool widthIsAuto = (eStyleUnit_Auto == widthUnit);
|
||||
if (!widthIsAuto) {
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
// The inherited value comes from the parent and not the absolute
|
||||
// containing block
|
||||
mComputedWidth = blockContentArea.right - blockContentArea.left;
|
||||
|
||||
} else {
|
||||
// Use the specified value for the computed width
|
||||
ComputeHorizontalValue(containingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
// Use the specified value for the computed width
|
||||
ComputeHorizontalValue(containingBlockWidth, widthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
AdjustComputedWidth();
|
||||
}
|
||||
@ -1190,9 +1157,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// Initialize the 'top' and 'bottom' computed offsets
|
||||
nsStyleUnit heightUnit = mStylePosition->mHeight.GetUnit();
|
||||
PRBool topIsAuto = PR_FALSE, bottomIsAuto = PR_FALSE;
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = cbrs->mComputedOffsets.top;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) {
|
||||
mComputedOffsets.top = 0;
|
||||
topIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1202,9 +1167,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
mStylePosition->mOffset.GetTop(c),
|
||||
mComputedOffsets.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = cbrs->mComputedOffsets.bottom;
|
||||
} else if (eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
if (eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()) {
|
||||
mComputedOffsets.bottom = 0;
|
||||
bottomIsAuto = PR_TRUE;
|
||||
} else {
|
||||
@ -1218,18 +1181,9 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
// Initialize the 'height' computed value
|
||||
PRBool heightIsAuto = (eStyleUnit_Auto == heightUnit);
|
||||
if (!heightIsAuto) {
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
// The inherited value comes from the parent and not the absolute
|
||||
// containing block
|
||||
mComputedHeight = blockContentArea.bottom - blockContentArea.top;
|
||||
|
||||
} else {
|
||||
// Use the specified value for the computed height
|
||||
// XXX Handle 'inherit'. The inherited value comes from the parent
|
||||
// and not the containing block
|
||||
ComputeVerticalValue(containingBlockHeight, heightUnit,
|
||||
mStylePosition->mHeight, mComputedHeight);
|
||||
}
|
||||
// Use the specified value for the computed height
|
||||
ComputeVerticalValue(containingBlockHeight, heightUnit,
|
||||
mStylePosition->mHeight, mComputedHeight);
|
||||
|
||||
AdjustComputedHeight();
|
||||
}
|
||||
@ -1631,8 +1585,7 @@ CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState,
|
||||
if (aState.parentReflowState) {
|
||||
if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) {
|
||||
nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Inherit != parentUnit) &&
|
||||
(eStyleUnit_Auto != parentUnit)) {
|
||||
if (eStyleUnit_Auto != parentUnit) {
|
||||
aState.mFlags.mTableDerivedComputedWidth = PR_FALSE;
|
||||
}
|
||||
}
|
||||
@ -1807,9 +1760,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
(NS_FRAME_REPLACED(NS_CSS_FRAME_TYPE_FLOATING) == mFrameType)) {
|
||||
// Inline replaced element and floating replaced element are basically
|
||||
// treated the same. First calculate the computed width
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
// A specified value of 'auto' uses the element's intrinsic width
|
||||
mComputedWidth = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
@ -1822,9 +1773,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
AdjustComputedWidth();
|
||||
|
||||
// Now calculate the computed height
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
// A specified value of 'auto' uses the element's intrinsic height
|
||||
mComputedHeight = NS_INTRINSICSIZE;
|
||||
} else {
|
||||
@ -1837,9 +1786,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
|
||||
} else if (NS_CSS_FRAME_TYPE_FLOATING == mFrameType) {
|
||||
// Floating non-replaced element. First calculate the computed width
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
if ((NS_UNCONSTRAINEDSIZE == aContainingBlockWidth) &&
|
||||
(eStyleUnit_Percent == mStylePosition->mWidth.GetUnit())) {
|
||||
// The element has a percentage width, but since the containing
|
||||
@ -1882,9 +1829,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
AdjustComputedWidth();
|
||||
|
||||
// Now calculate the computed height
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
mComputedHeight = NS_AUTOHEIGHT; // let it choose its height
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, heightUnit,
|
||||
@ -1905,9 +1850,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
rowOrRowGroup = PR_TRUE;
|
||||
}
|
||||
|
||||
if (eStyleUnit_Inherit == widthUnit) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
} else if (eStyleUnit_Auto == widthUnit) {
|
||||
if (eStyleUnit_Auto == widthUnit) {
|
||||
mComputedWidth = availableWidth;
|
||||
|
||||
if ((mComputedWidth != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){
|
||||
@ -1930,9 +1873,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
||||
// 'height' property doesn't apply to table columns and column groups
|
||||
heightUnit = eStyleUnit_Auto;
|
||||
}
|
||||
if (eStyleUnit_Inherit == heightUnit) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
} else if (eStyleUnit_Auto == heightUnit) {
|
||||
if (eStyleUnit_Auto == heightUnit) {
|
||||
mComputedHeight = NS_AUTOHEIGHT;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, heightUnit,
|
||||
@ -2048,27 +1989,10 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (eStyleUnit_Inherit == aWidthUnit) {
|
||||
// Use parent element's width. Note that if its width was
|
||||
// 'inherit', then it already did this so we don't need to
|
||||
// recurse upwards.
|
||||
//
|
||||
// We use the containing block's width here for the "parent"
|
||||
// elements width, because we want to skip over any intervening
|
||||
// inline elements (since width doesn't apply to them).
|
||||
if (NS_UNCONSTRAINEDSIZE != aContainingBlockWidth) {
|
||||
mComputedWidth = aContainingBlockWidth;
|
||||
}
|
||||
else {
|
||||
mComputedWidth = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
}
|
||||
if (mFlags.mTableDerivedComputedWidth)
|
||||
CheckResetTableDerivedComputedWidth(*this, aWidthUnit);
|
||||
ComputeHorizontalValue(aContainingBlockWidth, aWidthUnit,
|
||||
mStylePosition->mWidth, mComputedWidth);
|
||||
|
||||
AdjustComputedWidth();
|
||||
|
||||
@ -2077,20 +2001,7 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Compute the content height
|
||||
if (eStyleUnit_Inherit == aHeightUnit) {
|
||||
// Use parent elements height (note that if its height was inherit
|
||||
// then it already did this so we don't need to recurse upwards).
|
||||
//
|
||||
// We use the containing blocks height here for the "parent"
|
||||
// elements height because we want to skip over any interveening
|
||||
// inline elements (since height doesn't apply to them).
|
||||
if (NS_UNCONSTRAINEDSIZE != aContainingBlockHeight) {
|
||||
mComputedHeight = aContainingBlockHeight;
|
||||
}
|
||||
else {
|
||||
mComputedHeight = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
} else if (eStyleUnit_Auto == aHeightUnit) {
|
||||
if (eStyleUnit_Auto == aHeightUnit) {
|
||||
if (NS_FRAME_IS_REPLACED(mFrameType)) {
|
||||
// For replaced elements use the intrinsic size for "auto"
|
||||
mComputedHeight = NS_INTRINSICSIZE;
|
||||
@ -2366,7 +2277,6 @@ nsHTMLReflowState::ComputeHorizontalValue(nscoord aContainingBlockWidth,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult)
|
||||
{
|
||||
NS_PRECONDITION(eStyleUnit_Inherit != aUnit, "unexpected unit");
|
||||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
if (NS_UNCONSTRAINEDSIZE == aContainingBlockWidth) {
|
||||
@ -2400,7 +2310,6 @@ nsHTMLReflowState::ComputeVerticalValue(nscoord aContainingBlockHeight,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult)
|
||||
{
|
||||
NS_PRECONDITION(eStyleUnit_Inherit != aUnit, "unexpected unit");
|
||||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
// Verify no one is trying to calculate a percentage based height against
|
||||
@ -2448,22 +2357,14 @@ nsHTMLReflowState::ComputeMargin(nscoord aContainingBlockWidth,
|
||||
} else {
|
||||
nsStyleCoord left, right;
|
||||
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetLeftUnit()) {
|
||||
mComputedMargin.left = aContainingBlockRS->mComputedMargin.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeftUnit(),
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
mComputedMargin.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetRightUnit()) {
|
||||
mComputedMargin.right = aContainingBlockRS->mComputedMargin.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRightUnit(),
|
||||
mStyleMargin->mMargin.GetRight(right),
|
||||
mComputedMargin.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetLeftUnit(),
|
||||
mStyleMargin->mMargin.GetLeft(left),
|
||||
mComputedMargin.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetRightUnit(),
|
||||
mStyleMargin->mMargin.GetRight(right),
|
||||
mComputedMargin.right);
|
||||
}
|
||||
|
||||
const nsHTMLReflowState* rs2 = GetPageBoxReflowState(parentReflowState);
|
||||
@ -2472,43 +2373,27 @@ nsHTMLReflowState::ComputeMargin(nscoord aContainingBlockWidth,
|
||||
// According to the CSS2 spec, margin percentages are
|
||||
// calculated with respect to the *height* of the containing
|
||||
// block when in a paginated context.
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetTopUnit()) {
|
||||
mComputedMargin.top = aContainingBlockRS->mComputedMargin.top;
|
||||
} else {
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetBottomUnit()) {
|
||||
mComputedMargin.bottom = aContainingBlockRS->mComputedMargin.bottom;
|
||||
} else {
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
ComputeVerticalValue(rs2->mComputedHeight,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
else {
|
||||
// According to the CSS2 spec, margin percentages are
|
||||
// calculated with respect to the *width* of the containing
|
||||
// block, even for margin-top and margin-bottom.
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetTopUnit()) {
|
||||
mComputedMargin.top = aContainingBlockRS->mComputedMargin.top;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStyleMargin->mMargin.GetBottomUnit()) {
|
||||
mComputedMargin.bottom = aContainingBlockRS->mComputedMargin.bottom;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetTopUnit(),
|
||||
mStyleMargin->mMargin.GetTop(top),
|
||||
mComputedMargin.top);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStyleMargin->mMargin.GetBottomUnit(),
|
||||
mStyleMargin->mMargin.GetBottom(bottom),
|
||||
mComputedMargin.bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2523,41 +2408,25 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth,
|
||||
// We have to compute the value
|
||||
nsStyleCoord left, right, top, bottom;
|
||||
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetLeftUnit()) {
|
||||
mComputedPadding.left = aContainingBlockRS->mComputedPadding.left;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
mComputedPadding.left);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetRightUnit()) {
|
||||
mComputedPadding.right = aContainingBlockRS->mComputedPadding.right;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
mComputedPadding.right);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetLeftUnit(),
|
||||
mStylePadding->mPadding.GetLeft(left),
|
||||
mComputedPadding.left);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetRightUnit(),
|
||||
mStylePadding->mPadding.GetRight(right),
|
||||
mComputedPadding.right);
|
||||
|
||||
// According to the CSS2 spec, percentages are calculated with respect to
|
||||
// containing block width for padding-top and padding-bottom
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetTopUnit()) {
|
||||
mComputedPadding.top = aContainingBlockRS->mComputedPadding.top;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetTopUnit(),
|
||||
mStylePadding->mPadding.GetTop(top),
|
||||
mComputedPadding.top);
|
||||
}
|
||||
if (eStyleUnit_Inherit == mStylePadding->mPadding.GetBottomUnit()) {
|
||||
mComputedPadding.bottom = aContainingBlockRS->mComputedPadding.bottom;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetBottomUnit(),
|
||||
mStylePadding->mPadding.GetBottom(bottom),
|
||||
mComputedPadding.bottom);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetTopUnit(),
|
||||
mStylePadding->mPadding.GetTop(top),
|
||||
mComputedPadding.top);
|
||||
ComputeHorizontalValue(aContainingBlockWidth,
|
||||
mStylePadding->mPadding.GetBottomUnit(),
|
||||
mStylePadding->mPadding.GetBottom(bottom),
|
||||
mComputedPadding.bottom);
|
||||
}
|
||||
// a table row/col group, row/col doesn't have padding
|
||||
if (frame) {
|
||||
@ -2580,16 +2449,10 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS)
|
||||
{
|
||||
nsStyleUnit minWidthUnit = mStylePosition->mMinWidth.GetUnit();
|
||||
if (eStyleUnit_Inherit == minWidthUnit) {
|
||||
mComputedMinWidth = aContainingBlockRS->mComputedMinWidth;
|
||||
} else {
|
||||
ComputeHorizontalValue(aContainingBlockWidth, minWidthUnit,
|
||||
mStylePosition->mMinWidth, mComputedMinWidth);
|
||||
}
|
||||
ComputeHorizontalValue(aContainingBlockWidth, minWidthUnit,
|
||||
mStylePosition->mMinWidth, mComputedMinWidth);
|
||||
nsStyleUnit maxWidthUnit = mStylePosition->mMaxWidth.GetUnit();
|
||||
if (eStyleUnit_Inherit == maxWidthUnit) {
|
||||
mComputedMaxWidth = aContainingBlockRS->mComputedMaxWidth;
|
||||
} else if (eStyleUnit_Null == maxWidthUnit) {
|
||||
if (eStyleUnit_Null == maxWidthUnit) {
|
||||
// Specified value of 'none'
|
||||
mComputedMaxWidth = NS_UNCONSTRAINEDSIZE; // no limit
|
||||
} else {
|
||||
@ -2604,23 +2467,17 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
}
|
||||
|
||||
nsStyleUnit minHeightUnit = mStylePosition->mMinHeight.GetUnit();
|
||||
if (eStyleUnit_Inherit == minHeightUnit) {
|
||||
mComputedMinHeight = aContainingBlockRS->mComputedMinHeight;
|
||||
// Check for percentage based values and a containing block height that
|
||||
// depends on the content height. Treat them like 'auto'
|
||||
if ((NS_AUTOHEIGHT == aContainingBlockHeight) &&
|
||||
(eStyleUnit_Percent == minHeightUnit)) {
|
||||
mComputedMinHeight = 0;
|
||||
} else {
|
||||
// Check for percentage based values and a containing block height that
|
||||
// depends on the content height. Treat them like 'auto'
|
||||
if ((NS_AUTOHEIGHT == aContainingBlockHeight) &&
|
||||
(eStyleUnit_Percent == minHeightUnit)) {
|
||||
mComputedMinHeight = 0;
|
||||
} else {
|
||||
ComputeVerticalValue(aContainingBlockHeight, minHeightUnit,
|
||||
mStylePosition->mMinHeight, mComputedMinHeight);
|
||||
}
|
||||
ComputeVerticalValue(aContainingBlockHeight, minHeightUnit,
|
||||
mStylePosition->mMinHeight, mComputedMinHeight);
|
||||
}
|
||||
nsStyleUnit maxHeightUnit = mStylePosition->mMaxHeight.GetUnit();
|
||||
if (eStyleUnit_Inherit == maxHeightUnit) {
|
||||
mComputedMaxHeight = aContainingBlockRS->mComputedMaxHeight;
|
||||
} else if (eStyleUnit_Null == maxHeightUnit) {
|
||||
if (eStyleUnit_Null == maxHeightUnit) {
|
||||
// Specified value of 'none'
|
||||
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE; // no limit
|
||||
} else {
|
||||
|
@ -2189,13 +2189,6 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
// Get vertical-align property
|
||||
const nsStyleTextReset* textStyle = frame->GetStyleTextReset();
|
||||
nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit();
|
||||
#ifdef DEBUG
|
||||
if (eStyleUnit_Inherit == verticalAlignUnit) {
|
||||
printf("XXX: vertical-align: inherit not implemented for ");
|
||||
nsFrame::ListTag(stdout, frame);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef NOISY_VERTICAL_ALIGN
|
||||
printf(" [frame]");
|
||||
nsFrame::ListTag(stdout, frame);
|
||||
|
@ -1738,8 +1738,6 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
|
||||
for(i=0;i<4;i++) {
|
||||
borderRadii[i] = 0;
|
||||
switch ( bordStyleRadius[i].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
percent = bordStyleRadius[i].GetPercentValue();
|
||||
borderRadii[i] = (nscoord)(percent * aBorderArea.width);
|
||||
@ -2129,8 +2127,6 @@ nscoord width;
|
||||
for(i=0;i<4;i++) {
|
||||
borderRadii[i] = 0;
|
||||
switch ( bordStyleRadius[i].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
percent = bordStyleRadius[i].GetPercentValue();
|
||||
borderRadii[i] = (nscoord)(percent * aBorderArea.width);
|
||||
@ -3375,9 +3371,6 @@ nsCSSRendering::PaintBackgroundColor(nsIPresContext* aPresContext,
|
||||
for (; side < 4; ++side) {
|
||||
borderRadii[side] = 0;
|
||||
switch (bordStyleRadius[side].GetUnit()) {
|
||||
case eStyleUnit_Inherit:
|
||||
// do nothing
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
borderRadii[side] = nscoord(bordStyleRadius[side].GetPercentValue() * aBgClipArea.width);
|
||||
break;
|
||||
|
@ -107,15 +107,9 @@ nsTableColFrame::SetIsAnonymous(PRBool aIsAnonymous)
|
||||
// XXX what about other style besides width
|
||||
nsStyleCoord nsTableColFrame::GetStyleWidth() const
|
||||
{
|
||||
const nsStylePosition* position = GetStylePosition();
|
||||
nsStyleCoord styleWidth = position->mWidth;
|
||||
// the following is necessary because inheritance happens on computed
|
||||
// values, which the style system does not know.
|
||||
if (eStyleUnit_Auto == styleWidth.GetUnit() ||
|
||||
eStyleUnit_Inherit == styleWidth.GetUnit()) {
|
||||
nsIFrame* parent = GetParent();
|
||||
position = parent->GetStylePosition();
|
||||
styleWidth = position->mWidth;
|
||||
nsStyleCoord styleWidth = GetStylePosition()->mWidth;
|
||||
if (eStyleUnit_Auto == styleWidth.GetUnit()) {
|
||||
styleWidth = GetParent()->GetStylePosition()->mWidth;
|
||||
}
|
||||
|
||||
nsStyleCoord returnWidth;
|
||||
|
@ -4126,10 +4126,6 @@ nsTableFrame::IsAutoHeight()
|
||||
case eStyleUnit_Auto: // specified auto width
|
||||
case eStyleUnit_Proportional: // illegal for table, so ignored
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// get width of parent and see if it is a specified value or not
|
||||
// XXX for now, just return true
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
isAuto = PR_FALSE;
|
||||
break;
|
||||
|
@ -1224,10 +1224,6 @@ nsTableOuterFrame::IsAutoWidth(nsIFrame& aTableOrCaption,
|
||||
case eStyleUnit_Auto: // specified auto width
|
||||
case eStyleUnit_Proportional: // illegal for table, so ignored
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// get width of parent and see if it is a specified value or not
|
||||
// XXX for now, just return true
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
isAuto = PR_FALSE;
|
||||
break;
|
||||
|
@ -663,7 +663,6 @@ nsTableRowFrame::CalculateCellActualSize(nsIFrame* aCellFrame,
|
||||
// pct heights are handled when all of the cells are finished, so don't set specifiedHeight
|
||||
break;
|
||||
}
|
||||
case eStyleUnit_Inherit:
|
||||
case eStyleUnit_Auto:
|
||||
default:
|
||||
break;
|
||||
|
@ -1280,9 +1280,6 @@ nsComputedDOMStyle::GetZIndex(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double Check the Unit!");
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
@ -1565,9 +1562,6 @@ nsComputedDOMStyle::GetTextIndent(nsIFrame *aFrame,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
@ -2301,9 +2295,6 @@ nsComputedDOMStyle::GetHeight(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
@ -2374,9 +2365,6 @@ nsComputedDOMStyle::GetWidth(nsIFrame *aFrame,
|
||||
case eStyleUnit_Auto:
|
||||
val->SetIdent(NS_LITERAL_STRING("auto"));
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
@ -2439,10 +2427,6 @@ nsComputedDOMStyle::GetMaxHeight(nsIFrame *aFrame,
|
||||
positionData->mMaxHeight.GetPercentValue()));
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetIdent(NS_LITERAL_STRING("none"));
|
||||
@ -2505,10 +2489,6 @@ nsComputedDOMStyle::GetMaxWidth(nsIFrame *aFrame,
|
||||
positionData->mMaxWidth.GetPercentValue()));
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetIdent(NS_LITERAL_STRING("none"));
|
||||
@ -2551,10 +2531,6 @@ nsComputedDOMStyle::GetMinHeight(nsIFrame *aFrame,
|
||||
val->SetPercent(positionData->mMinHeight.GetPercentValue());
|
||||
}
|
||||
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
@ -2597,9 +2573,6 @@ nsComputedDOMStyle::GetMinWidth(nsIFrame *aFrame,
|
||||
val->SetPercent(positionData->mMinWidth.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
@ -3203,13 +3176,6 @@ nsComputedDOMStyle::GetBorderRadiusFor(PRUint8 aSide, nsIFrame *aFrame,
|
||||
val->SetPercent(coord.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// XXX This will only happen if we are inheriting from
|
||||
// a node with a percentage style unit for its relevant
|
||||
// border radius property. Layout currently drops this
|
||||
// one inherit case, so we do the same thing here.
|
||||
val->SetIdent(NS_LITERAL_STRING("inherit"));
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_ComputedDOMStyle
|
||||
NS_WARNING("double check the border radius");
|
||||
|
@ -290,23 +290,8 @@ static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
}
|
||||
else if (((aMask & SETCOORD_INHERIT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Inherit)) {
|
||||
nsStyleUnit unit = aParentCoord.GetUnit();
|
||||
if ((eStyleUnit_Null == unit) || // parent has explicit computed value
|
||||
(eStyleUnit_Factor == unit) ||
|
||||
(eStyleUnit_Coord == unit) ||
|
||||
(eStyleUnit_Integer == unit) ||
|
||||
(eStyleUnit_Enumerated == unit) ||
|
||||
(eStyleUnit_Normal == unit) ||
|
||||
(eStyleUnit_Chars == unit)) {
|
||||
aCoord = aParentCoord; // just inherit value from parent
|
||||
aInherited = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
aCoord.SetInheritValue(); // needs to be computed by client
|
||||
// Since this works just like being
|
||||
// specified and not inherited, that's
|
||||
// how it's treated.
|
||||
}
|
||||
aCoord = aParentCoord; // just inherit value from parent
|
||||
aInherited = PR_TRUE;
|
||||
}
|
||||
else if (((aMask & SETCOORD_NORMAL) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Normal)) {
|
||||
@ -599,7 +584,6 @@ nsRuleNode::PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode)
|
||||
struct PropertyCheckData {
|
||||
size_t offset;
|
||||
nsCSSType type;
|
||||
PRPackedBool mayHaveExplicitInherit;
|
||||
};
|
||||
|
||||
/* the information for all the properties in a style struct */
|
||||
@ -645,48 +629,6 @@ ExamineRectProperties(const nsCSSRect* aRect,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ExamineRectCoordProperties(const nsCSSRect* aRect,
|
||||
PRUint32& aSpecifiedCount,
|
||||
PRUint32& aInheritedCount,
|
||||
PRBool& aCanHaveExplicitInherit)
|
||||
{
|
||||
if (!aRect)
|
||||
return;
|
||||
|
||||
if (eCSSUnit_Null != aRect->mLeft.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mLeft.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mTop.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mTop.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mRight.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mRight.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (eCSSUnit_Null != aRect->mBottom.GetUnit()) {
|
||||
aSpecifiedCount++;
|
||||
if (eCSSUnit_Inherit == aRect->mBottom.GetUnit()) {
|
||||
aInheritedCount++;
|
||||
aCanHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(nsRuleNode::RuleDetail)
|
||||
CheckFontCallback(const nsRuleDataStruct& aData)
|
||||
{
|
||||
@ -725,140 +667,140 @@ CheckFontCallback(const nsRuleDataStruct& aData)
|
||||
|
||||
static const PropertyCheckData FontCheckProperties[] = {
|
||||
#define CSS_PROP_FONT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_FONT
|
||||
};
|
||||
|
||||
static const PropertyCheckData DisplayCheckProperties[] = {
|
||||
#define CSS_PROP_DISPLAY(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_DISPLAY
|
||||
};
|
||||
|
||||
static const PropertyCheckData VisibilityCheckProperties[] = {
|
||||
#define CSS_PROP_VISIBILITY(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_VISIBILITY
|
||||
};
|
||||
|
||||
static const PropertyCheckData MarginCheckProperties[] = {
|
||||
#define CSS_PROP_MARGIN(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_MARGIN
|
||||
};
|
||||
|
||||
static const PropertyCheckData BorderCheckProperties[] = {
|
||||
#define CSS_PROP_BORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_BORDER
|
||||
};
|
||||
|
||||
static const PropertyCheckData PaddingCheckProperties[] = {
|
||||
#define CSS_PROP_PADDING(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_PADDING
|
||||
};
|
||||
|
||||
static const PropertyCheckData OutlineCheckProperties[] = {
|
||||
#define CSS_PROP_OUTLINE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_OUTLINE
|
||||
};
|
||||
|
||||
static const PropertyCheckData ListCheckProperties[] = {
|
||||
#define CSS_PROP_LIST(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_LIST
|
||||
};
|
||||
|
||||
static const PropertyCheckData ColorCheckProperties[] = {
|
||||
#define CSS_PROP_COLOR(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_COLOR
|
||||
};
|
||||
|
||||
static const PropertyCheckData BackgroundCheckProperties[] = {
|
||||
#define CSS_PROP_BACKGROUND(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_BACKGROUND
|
||||
};
|
||||
|
||||
static const PropertyCheckData PositionCheckProperties[] = {
|
||||
#define CSS_PROP_POSITION(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_POSITION
|
||||
};
|
||||
|
||||
static const PropertyCheckData TableCheckProperties[] = {
|
||||
#define CSS_PROP_TABLE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TABLE
|
||||
};
|
||||
|
||||
static const PropertyCheckData TableBorderCheckProperties[] = {
|
||||
#define CSS_PROP_TABLEBORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TABLEBORDER
|
||||
};
|
||||
|
||||
static const PropertyCheckData ContentCheckProperties[] = {
|
||||
#define CSS_PROP_CONTENT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_CONTENT
|
||||
};
|
||||
|
||||
static const PropertyCheckData QuotesCheckProperties[] = {
|
||||
#define CSS_PROP_QUOTES(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_QUOTES
|
||||
};
|
||||
|
||||
static const PropertyCheckData TextCheckProperties[] = {
|
||||
#define CSS_PROP_TEXT(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TEXT
|
||||
};
|
||||
|
||||
static const PropertyCheckData TextResetCheckProperties[] = {
|
||||
#define CSS_PROP_TEXTRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_TEXTRESET
|
||||
};
|
||||
|
||||
static const PropertyCheckData UserInterfaceCheckProperties[] = {
|
||||
#define CSS_PROP_USERINTERFACE(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_USERINTERFACE
|
||||
};
|
||||
|
||||
static const PropertyCheckData UIResetCheckProperties[] = {
|
||||
#define CSS_PROP_UIRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_UIRESET
|
||||
};
|
||||
|
||||
static const PropertyCheckData XULCheckProperties[] = {
|
||||
#define CSS_PROP_XUL(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_XUL
|
||||
};
|
||||
@ -866,7 +808,7 @@ static const PropertyCheckData XULCheckProperties[] = {
|
||||
#ifdef MOZ_SVG
|
||||
static const PropertyCheckData SVGCheckProperties[] = {
|
||||
#define CSS_PROP_SVG(name_, id_, method_, datastruct_, member_, type_, iscoord_) \
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_, iscoord_ },
|
||||
{ offsetof(nsRuleData##datastruct_, member_), type_ },
|
||||
#include "nsCSSPropList.h"
|
||||
#undef CSS_PROP_SVG
|
||||
};
|
||||
@ -964,8 +906,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
++specified;
|
||||
if (eCSSUnit_Inherit == value.GetUnit()) {
|
||||
++inherited;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
canHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -973,13 +913,8 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
|
||||
case eCSSType_Rect:
|
||||
total += 4;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
ExamineRectCoordProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited,
|
||||
canHaveExplicitInherit);
|
||||
else
|
||||
ExamineRectProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited);
|
||||
ExamineRectProperties(RectAtOffset(aRuleDataStruct, prop->offset),
|
||||
specified, inherited);
|
||||
break;
|
||||
|
||||
case eCSSType_ValueList:
|
||||
@ -991,8 +926,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
++specified;
|
||||
if (eCSSUnit_Inherit == valueList->mValue.GetUnit()) {
|
||||
++inherited;
|
||||
if (prop->mayHaveExplicitInherit)
|
||||
canHaveExplicitInherit = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1001,8 +934,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
case eCSSType_CounterData:
|
||||
{
|
||||
++total;
|
||||
NS_ASSERTION(!prop->mayHaveExplicitInherit,
|
||||
"counters can't be coordinates");
|
||||
const nsCSSCounterData* counterData =
|
||||
CounterDataAtOffset(aRuleDataStruct, prop->offset);
|
||||
if (counterData) {
|
||||
@ -1017,8 +948,6 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
|
||||
case eCSSType_Quotes:
|
||||
{
|
||||
++total;
|
||||
NS_ASSERTION(!prop->mayHaveExplicitInherit,
|
||||
"quotes can't be coordinates");
|
||||
const nsCSSQuotes* quotes =
|
||||
QuotesAtOffset(aRuleDataStruct, prop->offset);
|
||||
if (quotes) {
|
||||
|
@ -180,12 +180,6 @@ void nsStyleCoord::SetAutoValue(void)
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void nsStyleCoord::SetInheritValue(void)
|
||||
{
|
||||
mUnit = eStyleUnit_Inherit;
|
||||
mValue.mInt = 0;
|
||||
}
|
||||
|
||||
void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit)
|
||||
{
|
||||
mUnit = aUnit;
|
||||
@ -218,7 +212,6 @@ void nsStyleCoord::AppendToString(nsString& aBuffer) const
|
||||
case eStyleUnit_Factor: aBuffer.Append(NS_LITERAL_STRING("f")); break;
|
||||
case eStyleUnit_Normal: aBuffer.Append(NS_LITERAL_STRING("Normal")); break;
|
||||
case eStyleUnit_Auto: aBuffer.Append(NS_LITERAL_STRING("Auto")); break;
|
||||
case eStyleUnit_Inherit: aBuffer.Append(NS_LITERAL_STRING("Inherit")); break;
|
||||
case eStyleUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break;
|
||||
case eStyleUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break;
|
||||
case eStyleUnit_Integer: aBuffer.Append(NS_LITERAL_STRING("int")); break;
|
||||
|
@ -48,7 +48,6 @@ enum nsStyleUnit {
|
||||
eStyleUnit_Null = 0, // (no value) value is not specified
|
||||
eStyleUnit_Normal = 1, // (no value)
|
||||
eStyleUnit_Auto = 2, // (no value)
|
||||
eStyleUnit_Inherit = 3, // (no value) value should be inherited
|
||||
eStyleUnit_Percent = 10, // (float) 1.0 == 100%
|
||||
eStyleUnit_Factor = 11, // (float) a multiplier
|
||||
eStyleUnit_Coord = 20, // (nscoord) value is twips
|
||||
@ -97,7 +96,6 @@ public:
|
||||
void SetFactorValue(float aValue);
|
||||
void SetNormalValue(void);
|
||||
void SetAutoValue(void);
|
||||
void SetInheritValue(void);
|
||||
void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit);
|
||||
|
||||
void AppendToString(nsString& aBuffer) const;
|
||||
|
@ -76,45 +76,6 @@ inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
|
||||
// Auto margins are handled by layout
|
||||
break;
|
||||
|
||||
case eStyleUnit_Inherit:
|
||||
// XXX may not be direct parent...
|
||||
if (parentFrame) {
|
||||
nsStyleContext* parentContext = parentFrame->GetStyleContext();
|
||||
if (nsnull != parentContext) {
|
||||
nsMargin parentSpacing;
|
||||
switch (aSpacing) {
|
||||
case NS_SPACING_MARGIN:
|
||||
{
|
||||
const nsStyleMargin* parentMargin = parentContext->GetStyleMargin();
|
||||
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_PADDING:
|
||||
{
|
||||
const nsStylePadding* parentPadding = parentContext->GetStylePadding();
|
||||
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_BORDER:
|
||||
{
|
||||
const nsStyleBorder* parentBorder = parentContext->GetStyleBorder();
|
||||
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
switch (aSide) {
|
||||
case NS_SIDE_LEFT: result = parentSpacing.left; break;
|
||||
case NS_SIDE_TOP: result = parentSpacing.top; break;
|
||||
case NS_SIDE_RIGHT: result = parentSpacing.right; break;
|
||||
case NS_SIDE_BOTTOM: result = parentSpacing.bottom; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Percent:
|
||||
{
|
||||
nscoord baseWidth = 0;
|
||||
|
@ -107,15 +107,9 @@ nsTableColFrame::SetIsAnonymous(PRBool aIsAnonymous)
|
||||
// XXX what about other style besides width
|
||||
nsStyleCoord nsTableColFrame::GetStyleWidth() const
|
||||
{
|
||||
const nsStylePosition* position = GetStylePosition();
|
||||
nsStyleCoord styleWidth = position->mWidth;
|
||||
// the following is necessary because inheritance happens on computed
|
||||
// values, which the style system does not know.
|
||||
if (eStyleUnit_Auto == styleWidth.GetUnit() ||
|
||||
eStyleUnit_Inherit == styleWidth.GetUnit()) {
|
||||
nsIFrame* parent = GetParent();
|
||||
position = parent->GetStylePosition();
|
||||
styleWidth = position->mWidth;
|
||||
nsStyleCoord styleWidth = GetStylePosition()->mWidth;
|
||||
if (eStyleUnit_Auto == styleWidth.GetUnit()) {
|
||||
styleWidth = GetParent()->GetStylePosition()->mWidth;
|
||||
}
|
||||
|
||||
nsStyleCoord returnWidth;
|
||||
|
@ -4126,10 +4126,6 @@ nsTableFrame::IsAutoHeight()
|
||||
case eStyleUnit_Auto: // specified auto width
|
||||
case eStyleUnit_Proportional: // illegal for table, so ignored
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// get width of parent and see if it is a specified value or not
|
||||
// XXX for now, just return true
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
isAuto = PR_FALSE;
|
||||
break;
|
||||
|
@ -1224,10 +1224,6 @@ nsTableOuterFrame::IsAutoWidth(nsIFrame& aTableOrCaption,
|
||||
case eStyleUnit_Auto: // specified auto width
|
||||
case eStyleUnit_Proportional: // illegal for table, so ignored
|
||||
break;
|
||||
case eStyleUnit_Inherit:
|
||||
// get width of parent and see if it is a specified value or not
|
||||
// XXX for now, just return true
|
||||
break;
|
||||
case eStyleUnit_Coord:
|
||||
isAuto = PR_FALSE;
|
||||
break;
|
||||
|
@ -663,7 +663,6 @@ nsTableRowFrame::CalculateCellActualSize(nsIFrame* aCellFrame,
|
||||
// pct heights are handled when all of the cells are finished, so don't set specifiedHeight
|
||||
break;
|
||||
}
|
||||
case eStyleUnit_Inherit:
|
||||
case eStyleUnit_Auto:
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user