I know that in the case of cash dividends I will get the dividend as long as I bought the stock before the ex-date but what happens in the case of an stock dividend?
Here's what Investopedia says about payouts for ex-dividend stocks:
A stock trades ex-dividend on or after the ex-dividend date (ex-date). At this point, the person who owns the security on the ex-dividend date will be awarded the payment, regardless of who currently holds the stock. After the ex-date has been declared, the stock will usually drop in price by the amount of the expected dividend.
Read more: Ex-Dividend Definition | Investopedia http://www.investopedia.com/terms/e/ex-dividend.asp#ixzz4Nl4J3s4k
I hope this helps.