Exemple #1
0
 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;
 }
Exemple #2
0
        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;
        }
Exemple #3
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;
 }
Exemple #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;
 }
Exemple #5
0
 // Public interface
 internal static IEnumerable<CssValue> TraverseList(CssValueList @this)
 {
     return @this.TraverseList(i => i.mNext).Select(i => i.mValue);
 }
Exemple #6
0
        // Public interface

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