  Galaxy mass and environment are known to play a key role in galaxy evolution:
looking at galaxy colors at different redshifts, fixed galaxy mass and
environment, offers a powerful diagnosis to disentangle the role of each. In
this work, we study the simulateneous dependence of the fraction of blue
galaxies fblue on secular evolution, environment and galaxy mass with a
well-controlled cluster sample. We are thus able to study the evolution and
respective role of the cessation of star formation history (SFH) in clusters
due to galaxy mass ("mass quenching") or to environment ("environmental
quenching"). We define an homogenous X-ray selected cluster sample (25 clusters
with 0 < z < 1 and one cluster at z \sim 2.2), having similar masses and
well-defined sizes. Using multicolor photometry and a large spectroscopic
sample to calibrate photometric redshifts, we carefully estimate fblue for each
cluster at different galaxy mass and cluster-centric distance bins. We then fit
with a simple model the dependence of fblue on redshift (z), environment
(r/r200) and galaxy mass (M). fblue increases with cluster-centric distance
with a slope $1.2^{+0.4}_{-0.3}$, decreases with galaxy mass with a slope
$-3.8^{+0.6}_{-0.5}$, and increases with redshift with a slope
$3.2^{+0.7}_{-0.5}$. The data also require for the first time a differential
evolution with galaxy mass of fblue with redshift, with lower mass galaxies
evolving slower by a factor $-4.1^{+1.1}_{-0.9}$. Our study shows that the
processes responsible for the cessation of star formation in clusters are
effective at all epochs (z<2.2), and more effective in denser environments and
for more massive galaxies. We found that the mass and environmental quenchings
are separable, that environmental quenching does not change with epoch, and
that mass quenching is a dynamical process, i.e. its evolutionary rate is
mass-dependent. [Abridged]
