The thing is the following:
In 2008, Nadal takes over Federer, spank him in the final of RG, beat him in the final of Wimbledon, win the Olympic gold, the MS of Toronto and take the number one spot. In the beginning of 2009, Nadal won his first grand slam on hardcourt, defeating again Federer in the final, start to dominate the clay season.
Then Nadal has a big knee injury. Federer take the opportunity, take RG, Wimbledon, regain the number one ranking, wins the OA.
And as soon as Nadal is back to his best, he wins RG and Wimbledon like in 2008 and is back to the number one rankings.
It looks like Federer returning to the number one ranking was mainly due to Nadal injury.