what happened to the philippines during the colonial rule of the spaniards then of the americans?​