Ejemplo n.º 1
0
        internal nsresult ParseDeclarations(string  aBuffer,
                                         Uri           aSheetURI,
                                         Uri           aBaseURI,
                                         nsIPrincipal     aSheetPrincipal,
                                         Declaration aDeclaration,
                                         ref bool           aChanged)
        {
            aChanged = false;

              if (aSheetPrincipal == null) throw new ArgumentException("Must have principal here!");

              var scanner = new nsCSSScanner(aBuffer, 0);
              var reporter = new ErrorReporter(scanner, mSheet, mChildLoader, aSheetURI);
              InitScanner(scanner, reporter, aSheetURI, aBaseURI, aSheetPrincipal);

              mSection = nsCSSSection.General;

              mData.AssertInitialState();
              aDeclaration.ClearData();
              // We could check if it was already empty, but...
              aChanged = true;

              for (;;) {
            // If we cleared the old decl, then we want to be calling
            // ValueAppended as we parse.
            if (!ParseDeclaration(aDeclaration, nsParseDeclaration.AllowImportant,
                                  true, ref aChanged)) {
              if (!SkipDeclaration(false)) {
                break;
              }
            }
              }

              aDeclaration.CompressFrom(mData);
              ReleaseScanner();
              return nsresult.OK;
        }