Fix the out-of-bound failure in stylesheet iterator.

Rewrite the iterator as internal instead of external.
This is much easier for recursive tree traversal.
auto merge of #1137 : SimonSapin/servo/fix-stylesheet-iterator, r=metajack