コード例 #1
0
ファイル: nsCSSParser.conv.cs プロジェクト: jorik041/CsCss
 static nsCSSValueList AppendValueToList(ref nsCSSValue aContainer,
                   nsCSSValueList aTail,
                   nsCSSValue aValue)
 {
     nsCSSValueList entry;
       if (aContainer.GetUnit() == nsCSSUnit.Null) {
     Debug.Assert(aTail == null, "should not have an entry");
     entry = aContainer.SetListValue();
       } else {
     Debug.Assert(aTail.mNext == null, "should not have a next entry");
     Debug.Assert(aContainer.GetUnit() == nsCSSUnit.List, "not a list");
     entry = new nsCSSValueList();
     aTail.mNext = entry;
       }
       entry.mValue = aValue;
       return entry;
 }
コード例 #2
0
ファイル: nsCSSParser.conv.cs プロジェクト: jorik041/CsCss
        internal ParseAnimationOrTransitionShorthandResult ParseAnimationOrTransitionShorthand(
                         nsCSSProperty[] aProperties,
                         nsCSSValue[] aInitialValues,
                         ref nsCSSValue[] aValues,
                         size_t aNumProperties)
        {
            var tempValue = new nsCSSValue();
              // first see if 'inherit' or 'initial' is specified.  If one is,
              // it can be the only thing specified, so don't attempt to parse any
              // additional properties
              if (ParseVariant(ref tempValue, VARIANT_INHERIT, null)) {
            for (uint32_t i = 0; i < aNumProperties; ++i) {
              AppendValue(aProperties[i], tempValue);
            }
            return ParseAnimationOrTransitionShorthandResult.Inherit;
              }

              const size_t maxNumProperties = 7;
              Debug.Assert(aNumProperties <= maxNumProperties,
                            "can't handle this many properties");
              var cur = new nsCSSValueList[maxNumProperties];
              var parsedProperty = new bool[maxNumProperties];

              for (size_t i = 0; i < aNumProperties; ++i) {
            cur[i] = null;
              }
              bool atEOP = false; // at end of property?
              for (;;) { // loop over comma-separated transitions or animations
            // whether a particular subproperty was specified for this
            // transition or animation
            for (size_t i = 0; i < aNumProperties; ++i) {
              parsedProperty[i] = false;
            }
            for (;;) { // loop over values within a transition or animation
              bool foundProperty = false;
              // check to see if we're at the end of one full transition or
              // animation definition (either because we hit a comma or because
              // we hit the end of the property definition)
              if (ExpectSymbol(',', true))
                break;
              if (CheckEndProperty()) {
                atEOP = true;
                break;
              }

              // else, try to parse the next transition or animation sub-property
              for (uint32_t i = 0; !foundProperty && i < aNumProperties; ++i) {
                if (!parsedProperty[i]) {
                  // if we haven't found this property yet, try to parse it
                  if (ParseSingleValueProperty(ref tempValue, aProperties[i])) {
                    parsedProperty[i] = true;
                    cur[i] = AppendValueToList(ref aValues[i], cur[i], tempValue);
                    foundProperty = true;
                    break; // out of inner loop; continue looking for next sub-property
                  }
                }
              }
              if (!foundProperty) {
                // We're not at a ',' or at the end of the property, but we couldn't
                // parse any of the sub-properties, so the declaration is invalid.
                return ParseAnimationOrTransitionShorthandResult.Error;
              }
            }

            // We hit the end of the property or the end of one transition
            // or animation definition, add its components to the list.
            for (uint32_t i = 0; i < aNumProperties; ++i) {
              // If all of the subproperties were not explicitly specified, fill
              // in the missing ones with initial values.
              if (!parsedProperty[i]) {
                cur[i] = AppendValueToList(ref aValues[i], cur[i], aInitialValues[i]);
              }
            }

            if (atEOP)
              break;
            // else we just hit a ',' so continue parsing the next compound transition
              }

              return ParseAnimationOrTransitionShorthandResult.Values;
        }
コード例 #3
0
ファイル: CssParser.cs プロジェクト: jorik041/CsCss
 public BackgroundParseState(CssValue mColor, CssValueList mImage, CssValuePairList mRepeat, CssValueList mAttachment, CssValueList mClip, CssValueList mOrigin, CssValueList mPosition, CssValuePairList mSize)
 {
     this.mColor = mColor;
     this.mImage = mImage;
     this.mRepeat = mRepeat;
     this.mAttachment = mAttachment;
     this.mClip = mClip;
     this.mOrigin = mOrigin;
     this.mPosition = mPosition;
     this.mSize = mSize;
 }
コード例 #4
0
 public BackgroundParseState(CssValue mColor, CssValueList mImage, CssValuePairList mRepeat, CssValueList mAttachment, CssValueList mClip, CssValueList mOrigin, CssValueList mPosition, CssValuePairList mSize)
 {
     this.mColor      = mColor;
     this.mImage      = mImage;
     this.mRepeat     = mRepeat;
     this.mAttachment = mAttachment;
     this.mClip       = mClip;
     this.mOrigin     = mOrigin;
     this.mPosition   = mPosition;
     this.mSize       = mSize;
 }
コード例 #5
0
ファイル: CssValueList.cs プロジェクト: rexwhitten/CsCss
 // Public interface
 internal static IEnumerable<CssValue> TraverseList(CssValueList @this)
 {
     return @this.TraverseList(i => i.mNext).Select(i => i.mValue);
 }
コード例 #6
0
        // Public interface

        internal static IEnumerable <CssValue> TraverseList(CssValueList @this)
        {
            return(@this.TraverseList(i => i.mNext).Select(i => i.mValue));
        }