зеркало из https://github.com/mozilla/pjs.git
Add API to compute length, percentage or calc() style coords. (Bug 363249) r=bzbarsky
This commit is contained in:
Родитель
48839160e2
Коммит
6d89485bb6
|
@ -559,6 +559,22 @@ nsRuleNode::ComputeComputedCalc(const nsStyleCoord& aValue,
|
|||
return css::ComputeCalc(aValue, ops);
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsRuleNode::ComputeCoordPercentCalc(const nsStyleCoord& aCoord,
|
||||
nscoord aPercentageBasis)
|
||||
{
|
||||
switch (aCoord.GetUnit()) {
|
||||
case eStyleUnit_Coord:
|
||||
return aCoord.GetCoordValue();
|
||||
case eStyleUnit_Percent:
|
||||
return NSCoordSaturatingMultiply(aPercentageBasis,
|
||||
aCoord.GetPercentValue());
|
||||
default:
|
||||
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), "unexpected unit");
|
||||
return nsRuleNode::ComputeComputedCalc(aCoord, aPercentageBasis);
|
||||
}
|
||||
}
|
||||
|
||||
#define SETCOORD_NORMAL 0x01 // N
|
||||
#define SETCOORD_AUTO 0x02 // A
|
||||
#define SETCOORD_INHERIT 0x04 // H
|
||||
|
|
|
@ -62,6 +62,8 @@ struct nsRuleDataFont;
|
|||
class nsCSSValue;
|
||||
struct nsCSSRect;
|
||||
|
||||
class nsStyleCoord;
|
||||
|
||||
struct nsInheritedStyleData
|
||||
{
|
||||
|
||||
|
@ -762,6 +764,11 @@ public:
|
|||
static nscoord ComputeComputedCalc(const nsStyleCoord& aCoord,
|
||||
nscoord aPercentageBasis);
|
||||
|
||||
// Compute the value of an nsStyleCoord that is either a coord, a
|
||||
// percent, or a calc expression.
|
||||
static nscoord ComputeCoordPercentCalc(const nsStyleCoord& aCoord,
|
||||
nscoord aPercentageBasis);
|
||||
|
||||
// Return whether the rule tree for which this node is the root has
|
||||
// cached data such that we need to do dynamic change handling for
|
||||
// changes that change the results of media queries or require
|
||||
|
|
Загрузка…
Ссылка в новой задаче