Necessary and sufficient conditions for path-independence of Girsanov transformation for infinite-dimensional stochastic evolution equations