public void Compress(out nsCSSCompressedDataBlock aNormalBlock, out nsCSSCompressedDataBlock aImportantBlock)
        {
            int numPropsNormal, numPropsImportant;

            ComputeNumProps(out numPropsNormal, out numPropsImportant);

            var result_normal    = new nsCSSCompressedDataBlock(numPropsNormal);
            var result_important = numPropsImportant != 0 ? new nsCSSCompressedDataBlock(numPropsImportant) : null;

            int i_normal = 0, i_important = 0;

            for (CssProperty iProp = 0; iProp < CssProperty.PropertyCountNoShorthands; iProp++)
            {
                if (!mPropertiesSet.HasProperty(iProp))
                {
                    continue;
                }
                if (mPropertiesImportant.HasProperty(iProp))
                {
                    CompressProperty(result_important, iProp, ref i_important);
                }
                else
                {
                    CompressProperty(result_normal, iProp, ref i_normal);
                }
            }

            mPropertiesSet.Empty();
            mPropertiesImportant.Empty();
            AssertInitialState();
            aNormalBlock    = result_normal;
            aImportantBlock = result_important;
        }
示例#2
0
 internal void ClearData()
 {
     AssertMutable();
     mData          = null;
     mImportantData = null;
     mOrder.Clear();
 }
示例#3
0
 internal void ClearData()
 {
     AssertMutable();
     mData = null;
     mImportantData = null;
     mOrder.Clear();
 }
 public void Expand(nsCSSCompressedDataBlock aNormalBlock, nsCSSCompressedDataBlock aImportantBlock)
 {
     AssertInitialState();
     DoExpand(aNormalBlock, false);
     if (aImportantBlock != null)
         DoExpand(aImportantBlock, true);
 }
 private void CompressProperty(nsCSSCompressedDataBlock result, CssProperty aPropID, ref int ip)
 {
     result.mData[ip].mProperty = aPropID;
     result.mData[ip].mValue    = mValues[(int)aPropID];
     mValues[(int)aPropID].Reset();
     ip++;
     result.mStyleBits |= nsCachedStyleData.GetBitForSID(nsCSSProps.kSIDTable[(int)aPropID]);
 }
 public void Expand(nsCSSCompressedDataBlock aNormalBlock, nsCSSCompressedDataBlock aImportantBlock)
 {
     AssertInitialState();
     DoExpand(aNormalBlock, false);
     if (aImportantBlock != null)
     {
         DoExpand(aImportantBlock, true);
     }
 }
 private void DoExpand(nsCSSCompressedDataBlock aBlock, bool aImportant)
 {
     foreach (CssPropertyValue pv in aBlock.mData)
     {
         CssProperty iProp = pv.mProperty;
         mPropertiesSet.AddProperty(iProp);
         if (aImportant)
         {
             mPropertiesImportant.AddProperty(iProp);
         }
         mValues[(int)iProp] = pv.mValue;
     }
 }
示例#8
0
        internal bool TryReplaceValue(CssProperty aProperty, bool aIsImportant, nsCSSExpandedDataBlock aFromBlock, ref bool aChanged)
        {
            AssertMutable();
            Debug.Assert(mData != null, "called while expanded");

            if (nsCSSProps.IsShorthand(aProperty))
            {
                aChanged = false;
                return(false);
            }
            nsCSSCompressedDataBlock block = aIsImportant ? mImportantData : mData;

            if (block == null)
            {
                aChanged = false;
                return(false);
            }
            return(block.TryReplaceValue(aProperty, aFromBlock, ref aChanged));
        }
        public void Compress(out nsCSSCompressedDataBlock aNormalBlock, out nsCSSCompressedDataBlock aImportantBlock)
        {
            int numPropsNormal, numPropsImportant;
            ComputeNumProps(out numPropsNormal, out numPropsImportant);

            var result_normal = new nsCSSCompressedDataBlock(numPropsNormal);
            var result_important = numPropsImportant != 0 ? new nsCSSCompressedDataBlock(numPropsImportant) : null;

            int i_normal = 0, i_important = 0;
            for (CssProperty iProp = 0; iProp < CssProperty.PropertyCountNoShorthands; iProp++) {
                if (!mPropertiesSet.HasProperty(iProp))
                    continue;
                if (mPropertiesImportant.HasProperty(iProp))
                    CompressProperty(result_important, iProp, ref i_important);
                else
                    CompressProperty(result_normal, iProp, ref i_normal);
            }

            mPropertiesSet.Empty();
            mPropertiesImportant.Empty();
            AssertInitialState();
            aNormalBlock = result_normal;
            aImportantBlock = result_important;
        }
示例#10
0
 private void CompressProperty(nsCSSCompressedDataBlock result, CssProperty aPropID, ref int ip)
 {
     result.mData[ip].mProperty = aPropID;
     result.mData[ip].mValue = mValues[(int)aPropID];
     mValues[(int)aPropID].Reset();
     ip++;
     result.mStyleBits |= nsCachedStyleData.GetBitForSID(nsCSSProps.kSIDTable[(int)aPropID]);
 }
示例#11
0
 private void DoExpand(nsCSSCompressedDataBlock aBlock, bool aImportant)
 {
     foreach (CssPropertyValue pv in aBlock.mData) {
         CssProperty iProp = pv.mProperty;
         mPropertiesSet.AddProperty(iProp);
         if (aImportant)
             mPropertiesImportant.AddProperty(iProp);
         mValues[(int)iProp] = pv.mValue;
     }
 }