Polynomial extensions of IDF-domains and of IDPF-domains