I know in Canada the line is drawn at the point in what you're saying becomes harmful to the public (for instance, promoting racist ideas in a classroom) wilfully promotes hatred of an identifiable group. So for instance, I can say in public "fuck white / black / asian / brown / jewish / arab people", and at worst I'll get my ass kicked, but I'm not technically breaking the law. But if I were to be standing on a street corner, preaching this shit, and inviting people to join a group of racial supremacists, I'd now be breaking the law! Also, if I were to be releasing publications with this sort of speech, it would also be illegal.
The rules in this case are at a national level, and based upon interpretations of the Charter of Rights and Freedoms, section 1: Reasonable Limits, and applying them to s2(b) Freedom of Speech. It wasn't always this way though, it was more or less out of the mind of the public until the early 90's, when two landmark cases, R. v. Andrews, and R. v. Keegstra, were brought to the Supreme Court, and it was ruled that speech communicating hatred towards an identifiable group is unconstitutional.
It's an interesting line between freedom of speech, and protecting social welfare, and many people criticize it, but I for one think it's a great rule. For one, it does allow making hate comments in a private conversation, so people can still be racists and have those sort of discussions, but it has to be away from the public. On the other hand, it keeps that sort of speech away from the public sphere, and helps reduce the spread of that sort of toxic thinking. So in the case of facebook comments, if we applied these same rules, it would first have to be determined whether or not facebook comments would be considered public or not, and a few other determining rules.