本文整理汇总了C++中nsStyleCoord::ConvertsToLength方法的典型用法代码示例。如果您正苦于以下问题:C++ nsStyleCoord::ConvertsToLength方法的具体用法?C++ nsStyleCoord::ConvertsToLength怎么用?C++ nsStyleCoord::ConvertsToLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsStyleCoord
的用法示例。
在下文中一共展示了nsStyleCoord::ConvertsToLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
PRBool
nsIBox::AddCSSMaxSize(nsIBox* aBox, nsSize& aSize, PRBool &aWidthSet, PRBool &aHeightSet)
{
aWidthSet = PR_FALSE;
aHeightSet = PR_FALSE;
// add in the css min, max, pref
const nsStylePosition* position = aBox->GetStylePosition();
// and max
// see if the width or height was specifically set
// XXX Handle eStyleUnit_Enumerated?
// (Handling the eStyleUnit_Enumerated types requires
// GetPrefSize/GetMinSize methods that don't consider
// (min-/max-/)(width/height) properties.)
const nsStyleCoord maxWidth = position->mMaxWidth;
if (maxWidth.ConvertsToLength()) {
aSize.width = nsRuleNode::ComputeCoordPercentCalc(maxWidth, 0);
aWidthSet = PR_TRUE;
}
// percentages and calc() with percentages are treated like 'none'
const nsStyleCoord &maxHeight = position->mMaxHeight;
if (maxHeight.ConvertsToLength()) {
aSize.height = nsRuleNode::ComputeCoordPercentCalc(maxHeight, 0);
aHeightSet = PR_TRUE;
}
// percentages and calc() with percentages are treated like 'none'
nsIContent* content = aBox->GetContent();
if (content) {
nsAutoString value;
PRInt32 error;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth, value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val =
nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aSize.width = val;
aWidthSet = PR_TRUE;
}
content->GetAttr(kNameSpaceID_None, nsGkAtoms::maxheight, value);
if (!value.IsEmpty()) {
value.Trim("%");
nscoord val =
nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
aSize.height = val;
aHeightSet = PR_TRUE;
}
}
return (aWidthSet || aHeightSet);
}
示例2: IsFixedOffset
static inline bool IsFixedOffset(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
示例3: IsFixedMarginSize
static inline bool IsFixedMarginSize(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }