Example #1
0
        public override bool OnReadValue(Style styleBlock, Css.Value value, int start, out int size)
        {
            if (!Value.OnReadValue(styleBlock, value, start, out size))
            {
                size = 0;
            }

            // Ok either way:
            return(true);
        }
Example #2
0
        public override bool OnReadValue(Style styleBlock, Css.Value value, int start, out int size)
        {
            /*
             * ValueSet set=(value as Css.ValueSet);
             *
             * if(set!=null && (CommaSpacer && set.Spacer==" ")){
             *      size=0;
             *      return false;
             * }
             */

            size = 0;
            int repeatCount = 0;

            while (true)
            {
                Css.Value toCheck;
                int       checkStart;

                if (CommaSpacer)
                {
                    // Must pull a child value from 'value'.
                    toCheck    = value[repeatCount];
                    checkStart = 0;
                }
                else
                {
                    toCheck    = value;
                    checkStart = start;
                }

                int currentSize;
                if (ToRepeat.OnReadValue(styleBlock, toCheck, checkStart, out currentSize))
                {
                    // Match! Bump up rep count:
                    repeatCount++;

                    // Move start and size along:
                    start += currentSize;
                    size  += currentSize;

                    if (repeatCount == Maximum)
                    {
                        // Max number of reps - halt.
                        break;
                    }
                }
                else
                {
                    // Stop there.
                    break;
                }
            }

            // Valid if repeat count is within range (we know it's already within max):
            if (repeatCount >= Minimum)
            {
                return(true);
            }

            size = 0;
            return(false);
        }