http://en.wikipedia.org/wiki/Hong_Kong_Basic_Law
To sum it up briefly; during the Sino-British negotiations there was a baby elephant in the room, and the elephant has been in the room ever since, growing and growing. The elephant is called Democracy.
During the Sino-British negotiations in the early 80's, this elephant was only a baby; China was still Communist, without Chinese Characteristics, and the British concern, having established that Hong Kong was going back to China, was to keep Hong Kong with the rule of law, a free press, and a capitalist system.
The question of how Hong Kong would be governed was of course set out, but the design of Hong Kong's governing apparatus looked remarkably like colonial Hong Kong.
Needless to say, the mainland tends to see this as a bad outcome and some others tend to see it as a good outcome.
As noted, Hong Kong unlike other colonies had continued to muddle along with the Victorian Executive Council ("Exco") and Legislative Council ("Legco") system.
As noted earlier, in 1946 the then Governor, Sir Mark Young, had recommended the sort of overhaul of the colonial consititution that was taking place in other "advanced" colonies, with the replacement of these two antique bodies, composed of members who were either nominated by the Governor or appointed on very restricted suffrage, by a Westminster style legislature elected by direct election on the basis of adult suffrage, but the 1949 revolution in China and the tidal wave of refugees put paid to that idea. For one thing, the established population in Hong Kong did not trust the refugees with the vote (it was said of the Fifties that there were three classes in Hong Kong - British, Hong Kong Chinese and refugee Chinese).
So Exco and Legco continued.
With the Joint Declaration and the Basic Law, these became cast in stone. Indeed, so taken with the system was the PRC that it imposed the same British colonial system on the former Portuguese colony of Macao when that was returned to China!
Election to Legco was as noted either by appointment or by election by what was charmingly termed a "functional consitituency".
The idea of the functional constituencies was to ensure that groups who might be affected by legislation could have a say, so, for instance, the tourism industry, the law, banking, etc each got a seat.
This system was retained in the Basic Law, (Article 73, I think) but the British, not wanting China to gain the power of nomination that they had themselves enjoyed, persuaded the Chinese representatives at the talks that the nominated seats could be replaced by elected seats on a geographical basis, so long as these did not make up a majority of the seats.
The Functional Constituencies have often been compared, and rightly, perhaps, to the "pocket boroughs" of the English legislature before the Reform Act of 1832.
Private members bills and amendments to legislation require a simple majority of each type of member. Government bills just need a simple majority.
He did this by interpreting the legislation creatively, so as to bring in universal suffrage.
So far as China was concerned, this was the last straw.
First, Britain had set about cunningly draining all the money out of Hong Kong with the Rose Garden Project. Now Britain was infecting Hong Kong with bourgeois democracy, a deadly disease which would render Hong Kong ungovernable and which might even spread across the border and endanger China. It was all a plan to ruin Hong Kong and make China lose face.
The British said they were complying with the Joint Declaration. China said that Britain had abrogated it both financially and politically.
There was a titanic row, with Deng threatening to "restore order by force".
http://en.wikipedia.org/wiki/Tung_Chee_Hwa
As noted earlier, CY had been extremely close to the KMT, and after '49 he had split his companies between Taiwan and Hong Kong.
In the shipping crisis of the middle Eighties the Tung Group, which had over-expanded in CY's last years, ran out of money. CH, who was running the show, was unable to get further support from the Hong Kong banks and applied to the KMT government in Taiwan, but they had their hands full with the economic crisis and had no cash to spare.
At this point Henry Fok, a Hong Kong businessman with Mainland connections, offered a loan of US$ 100M. This was in fact a loan from Beijing (Cosco people will tell you that it came from Cosco) intended to secure Tung's future good will and his influence with the KMT.
The PRC reckoned the time had come to seek a return of the favour.
Tung, as Chief Executive, was to persuade the KMT into a Hong Kong style "one country, two systems" return to China.