本文整理汇总了C++中nsStyleCoord类的典型用法代码示例。如果您正苦于以下问题:C++ nsStyleCoord类的具体用法?C++ nsStyleCoord怎么用?C++ nsStyleCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nsStyleCoord类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: InitializeTrackSize
static void
InitializeTrackSize(nscoord aPercentageBasis,
const nsStyleCoord& aMinCoord,
const nsStyleCoord& aMaxCoord,
TrackSize* aTrackSize)
{
// http://dev.w3.org/csswg/css-grid/#algo-init
nscoord& base = aTrackSize->mBase;
switch (aMaxCoord.GetUnit()) {
case eStyleUnit_Enumerated:
case eStyleUnit_FlexFraction:
base = 0;
break;
default:
base = nsRuleNode::ComputeCoordPercentCalc(aMinCoord, aPercentageBasis);
}
nscoord& limit = aTrackSize->mLimit;
switch (aMaxCoord.GetUnit()) {
case eStyleUnit_Enumerated:
limit = NS_UNCONSTRAINEDSIZE;
break;
case eStyleUnit_FlexFraction:
limit = base;
break;
default:
limit = nsRuleNode::ComputeCoordPercentCalc(aMaxCoord, aPercentageBasis);
if (limit < base) {
limit = base;
}
}
}
开发者ID:RobertJGabriel,项目名称:Waterfox,代码行数:31,代码来源:nsGridContainerFrame.cpp
示例2: IsMarginZero
static inline PRBool
IsMarginZero(nsStyleUnit aUnit, const nsStyleCoord &aCoord)
{
return (aUnit == eStyleUnit_Auto ||
(aUnit == eStyleUnit_Coord && aCoord.GetCoordValue() == 0) ||
(aUnit == eStyleUnit_Percent && aCoord.GetPercentValue() == 0.0));
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:7,代码来源:nsInlineFrame.cpp
示例3: 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);
}
开发者ID:,项目名称:,代码行数:58,代码来源:
示例4: switch
bool nsStyleCoord::operator==(const nsStyleCoord& aOther) const
{
if (mUnit != aOther.mUnit) {
return false;
}
switch (mUnit) {
case eStyleUnit_Null:
case eStyleUnit_Normal:
case eStyleUnit_Auto:
case eStyleUnit_None:
return true;
case eStyleUnit_Percent:
case eStyleUnit_Factor:
case eStyleUnit_Degree:
case eStyleUnit_Grad:
case eStyleUnit_Radian:
case eStyleUnit_Turn:
return mValue.mFloat == aOther.mValue.mFloat;
case eStyleUnit_Coord:
case eStyleUnit_Integer:
case eStyleUnit_Enumerated:
return mValue.mInt == aOther.mValue.mInt;
case eStyleUnit_Calc:
return *this->GetCalcValue() == *aOther.GetCalcValue();
}
NS_ABORT_IF_FALSE(false, "unexpected unit");
return false;
}
开发者ID:jianglu,项目名称:v8monkey,代码行数:28,代码来源:nsStyleCoord.cpp
示例5: AppUnitsToFloatCSSPixels
float
SVGContentUtils::CoordToFloat(nsSVGElement *aContent,
const nsStyleCoord &aCoord)
{
switch (aCoord.GetUnit()) {
case eStyleUnit_Factor:
// user units
return aCoord.GetFactorValue();
case eStyleUnit_Coord:
return nsPresContext::AppUnitsToFloatCSSPixels(aCoord.GetCoordValue());
case eStyleUnit_Percent: {
SVGSVGElement* ctx = aContent->GetCtx();
return ctx ? aCoord.GetPercentValue() * ctx->GetLength(SVGContentUtils::XY) : 0.0f;
}
default:
return 0.0f;
}
}
开发者ID:,项目名称:,代码行数:20,代码来源:
示例6: IsFixedOffset
static inline bool IsFixedOffset(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:2,代码来源:nsAbsoluteContainingBlock.cpp
示例7: IsFixedMarginSize
static inline bool IsFixedMarginSize(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:2,代码来源:nsAbsoluteContainingBlock.cpp
示例8: IsMarginZero
static inline bool
IsMarginZero(const nsStyleCoord &aCoord)
{
return aCoord.GetUnit() == eStyleUnit_Auto ||
nsLayoutUtils::IsMarginZero(aCoord);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:6,代码来源:nsInlineFrame.cpp
注:本文中的nsStyleCoord类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论