In the attached testcase, the bottom of the blue box should be 20px above the top of the horizontal scrollbar (assuming the intent is to position it relative to the content box of the scroll container). Instead, the bottom of the blue box is 20px below the top of the scrollbar. The same behavior holds for sticky-right positioning.
In general, sticky positioned elements appear to be positioned relative to a box that has the size of the scroll container's padding box, but the origin of the scroll container's content box. (And percentage sticky offsets also seem to be computed in terms of the padding box size.)
Created attachment 207773 [details]
Created attachment 224328 [details]
Comment on attachment 224328 [details]
Clearing flags on attachment: 224328
Committed r164324: <http://trac.webkit.org/changeset/164324>
All reviewed patches have been landed. Closing bug.