In addition to the technical details provided by other answers, it is also because of the fact that Deng's habit of mind was scientific as the English mind was scientific in the 17th century: when orthodox theories began to lose authority, Deng resorted to experience. Deng's policy towards Hong Kong and Macao was his cat theory and feeling-the-stones theory in practice.
As opposed to Mao's nation-wide great-leap-forward style, Deng's economic reform was gradual and piece meal, starting from experiments in tiny SEZs like Shenzhen. Then by carefully studying the pros and cons of these SEZs, he slowly learned what to do and what not to do.
Reforms in the realm of opinions were very promising in the 80s. Virtually no one was persecuted for their opinions, and many outlandish and the most precious books were published during this period. Then came these student movements demanding democracy and freedom. Everything the student said sounded right except that there was no empirical evidence. Hating GLF from the bottom of his gut, Deng decide that the best thing for the students to do was to go back to classrooms. The rest of the story is well-known. History has shown that Deng was right: the collapse of the Soviet Union provided a counter example to the students' democratic ideal, which was as appealing in theory as it was disastrous in practice. The mentality that embraced democracy in 1989 was no different from the ones that embraced communism in 1921 and the ones that embarked on GLF in 1958. Many Russians today still romanticise revolutions and shock therapies, not realizing that they are just GLFs in different forms.
One consequence of the student movements was that the government learned a lesson and tightened up ideological control. If the students in 1989 had foreseen the consequences of their actions, they would have realized the irony: instead of gaining what they demanded, they lost what they already had - the freedom of opinions.
Of course, if Deng had argued like I do in this post, there would have been no need of tanks. If Deng, or any government official, had told the the students that no one knew how democracy would work out among Chinese speakers and it was better to do some experiments first, the students would have come back to their senses. Unfortunately, Deng was not sophisticated; his gut feeling was right, but he did not know how to express it. The best theory Deng could put forth was crossing the river by feeling the stones - a phase that was virtually uncouth to a college student. As a matter of fact, none of the communist revolutionists was sophisticated, otherwise they wouldn't do the revolution thing in the first place; China's ruling elites up until early 1990s consisted entirely of highly intelligent and well-experienced red necks. They still held theories in high regards, but their experiences told them something was not right; in the mist of this anguish, they were tortured by a keen sense of inferiority in front of these well-educated adversaries. Therefore, argue with my tanks!
Hong kong and Macao were basically Deng's SEZs in the realm of government. No matter what Deng's long term plan was, it was not his habit to make sudden changes, be it China going Hong Kong's way or Hong Kong reverting back to China's - this is the essence of crossing the river by feeling the stones - every policy must be field tested somewhere before it is adopted. And, if both are prosperous, there is no need to change either - this is the essence of Deng's cat theory.
Another curious fact is that, in 1989, no one in the ruling party could argue like I do today. I doubt anyone in China today can offer an argument as simple as mine.
When the dust settles, a question that naturally follows is this: how many of these bystanders cheer-leading China's democracy really wished China well?