Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 internal void ClearData()
 {
     AssertMutable();
     mData          = null;
     mImportantData = null;
     mOrder.Clear();
 }
Esempio n. 3
0
 internal void ClearData()
 {
     AssertMutable();
     mData = null;
     mImportantData = null;
     mOrder.Clear();
 }
Esempio n. 4
0
 public void Expand(nsCSSCompressedDataBlock aNormalBlock, nsCSSCompressedDataBlock aImportantBlock)
 {
     AssertInitialState();
     DoExpand(aNormalBlock, false);
     if (aImportantBlock != null)
         DoExpand(aImportantBlock, true);
 }
Esempio n. 5
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]);
 }
Esempio n. 6
0
 public void Expand(nsCSSCompressedDataBlock aNormalBlock, nsCSSCompressedDataBlock aImportantBlock)
 {
     AssertInitialState();
     DoExpand(aNormalBlock, false);
     if (aImportantBlock != null)
     {
         DoExpand(aImportantBlock, true);
     }
 }
Esempio n. 7
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;
     }
 }
Esempio n. 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));
        }
Esempio n. 9
0
        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;
        }
Esempio n. 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]);
 }
Esempio n. 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;
     }
 }