当前位置: 首页>>代码示例>>C++>>正文


C++ nsStyleCoord::ConvertsToLength方法代码示例

本文整理汇总了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);
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例2: IsFixedOffset

static inline bool IsFixedOffset(const nsStyleCoord& aCoord)
  { return aCoord.ConvertsToLength(); }
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:2,代码来源:nsAbsoluteContainingBlock.cpp

示例3: IsFixedMarginSize

static inline bool IsFixedMarginSize(const nsStyleCoord& aCoord)
  { return aCoord.ConvertsToLength(); }
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:2,代码来源:nsAbsoluteContainingBlock.cpp


注:本文中的nsStyleCoord::ConvertsToLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。