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


C# CssValue.SetRectValue方法代码示例

本文整理汇总了C#中CssValue.SetRectValue方法的典型用法代码示例。如果您正苦于以下问题:C# CssValue.SetRectValue方法的具体用法?C# CssValue.SetRectValue怎么用?C# CssValue.SetRectValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CssValue的用法示例。


在下文中一共展示了CssValue.SetRectValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseRect

        internal bool ParseRect(nsCSSProperty aPropID)
        {
            if (! GetToken(true)) {
            return false;
              }

              var val = new nsCSSValue();

              if (mToken.mType == nsCSSTokenType.Ident) {
            nsCSSKeyword keyword = nsCSSKeywords.LookupKeyword(mToken.mIdentStr);
            switch (keyword) {
              case nsCSSKeyword.auto:
                if (!ExpectEndProperty()) {
                  return false;
                }
                val.SetAutoValue();
                break;
              case nsCSSKeyword.inherit:
                if (!ExpectEndProperty()) {
                  return false;
                }
                val.SetInheritValue();
                break;
              case nsCSSKeyword.initial:
              case nsCSSKeyword._moz_initial:
                if (!ExpectEndProperty()) {
                  return false;
                }
                val.SetInitialValue();
                break;
              default:
                UngetToken();
                return false;
            }
              } else if (mToken.mType == nsCSSTokenType.Function &&
                     mToken.mIdentStr.LowerCaseEqualsLiteral("rect")) {
            nsCSSRect rect = val.SetRectValue();
            bool useCommas = false;
            for (Side side = nsStyle.SIDE_TOP; side <= nsStyle.SIDE_LEFT; side++) {
              if (! ParseVariant(rect.GetSide(side), v => rect.SetSide(side, v),
                                 VARIANT_AL, null)) {
                return false;
              }
              if (side == 0) {
                useCommas = ExpectSymbol(',', true);
              } else if (useCommas && (int)side < 3) {
                // Skip optional commas between elements, but only if the first
                // separator was a comma.
                if (!ExpectSymbol(',', true)) {
                  return false;
                }
              }
            }
            if (!ExpectSymbol(')', true)) {
              return false;
            }
            if (!ExpectEndProperty()) {
              return false;
            }
              } else {
            UngetToken();
            return false;
              }

              AppendValue(aPropID, val);
              return true;
        }
开发者ID:jorik041,项目名称:CsCss,代码行数:67,代码来源:nsCSSParser.conv.cs

示例2: SetBorderImageInitialValues

        internal void SetBorderImageInitialValues()
        {
            // border-image-source: none
              var source = new nsCSSValue();
              source.SetNoneValue();
              AppendValue(nsCSSProperty.BorderImageSource, source);

              // border-image-slice: 100%
              var sliceBoxValue = new nsCSSValue();
              nsCSSRect sliceBox = sliceBoxValue.SetRectValue();
              sliceBox.SetAllSidesTo(new nsCSSValue(1.0f, nsCSSUnit.Percent));
              var slice = new nsCSSValue();
              nsCSSValueList sliceList = slice.SetListValue();
              sliceList.mValue = sliceBoxValue;
              AppendValue(nsCSSProperty.BorderImageSlice, slice);

              // border-image-width: 1
              var width = new nsCSSValue();
              nsCSSRect widthBox = width.SetRectValue();
              widthBox.SetAllSidesTo(new nsCSSValue(1.0f, nsCSSUnit.Number));
              AppendValue(nsCSSProperty.BorderImageWidth, width);

              // border-image-outset: 0
              var outset = new nsCSSValue();
              nsCSSRect outsetBox = outset.SetRectValue();
              outsetBox.SetAllSidesTo(new nsCSSValue(0.0f, nsCSSUnit.Number));
              AppendValue(nsCSSProperty.BorderImageOutset, outset);

              // border-image-repeat: repeat
              var repeat = new nsCSSValue();
              var repeatPair = new nsCSSValuePair();
              repeatPair.SetBothValuesTo(new nsCSSValue(nsStyle.BORDER_IMAGE_REPEAT_STRETCH,
                                                nsCSSUnit.Enumerated));
              repeat.SetPairValue(repeatPair);
              AppendValue(nsCSSProperty.BorderImageRepeat, repeat);
        }
开发者ID:jorik041,项目名称:CsCss,代码行数:36,代码来源:nsCSSParser.conv.cs

示例3: ParseGroupedBoxProperty

        // Similar to ParseBoxProperties, except there is only one property
        // with the result as its value, not four. Requires values be nonnegative.
        internal bool ParseGroupedBoxProperty(int32_t aVariantMask,
                                               /** outparam */ ref nsCSSValue aValue)
        {
            nsCSSRect result = aValue.SetRectValue();

              int32_t count = 0;
              for (Side index = nsStyle.SIDE_TOP; index <= nsStyle.SIDE_LEFT; index++) {
            if (!ParseNonNegativeVariant(result.GetSide(index), v => result.SetSide(index, v),
                                         aVariantMask, null)) {
              break;
            }
            count++;
              }

              if (count == 0) {
            return false;
              }

              // Provide missing values by replicating some of the values found
              switch (count) {
            case 1: // Make right == top
              result.mRight = result.mTop;
              goto case 2;
            case 2: // Make bottom == top
              result.mBottom = result.mTop;
              goto case 3;
            case 3: // Make left == right
              result.mLeft = result.mRight;
            break;
              }

              return true;
        }
开发者ID:jorik041,项目名称:CsCss,代码行数:35,代码来源:nsCSSParser.conv.cs


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