rearranged clearing zero length segments

Per WhatWG bug 23917 - moved stroking requirements into the algorithm as
a step. Since our code wasn't exact match to WhatWG, did it manually.