The Court was trying to find a balance that allows schools to prevent kids from going around spewing expletives all day long without consequence, while at the same time not treading too heavily on the legitimate free speech rights of students.
BTW, what do you mean when you say "nonviolent speech"? Are you referring to calls to violence, or the more recent concept (not recognized by the courts) that certain speech is itself violence?