Capital gains are included as part of your Adjusted Gross Income (AGI) and as part of your Modified Adjusted Gross Income (MAGI) when determining income limits for contributions to a Roth IRA.See this IRS website Roth IRA limits - <a rel="nofollow" target="_blank" href="https://www.irs.gov/retirement-plans/amount-of-roth-ira-contributions-that-you-can-make-for-2017">https://www.irs.gov/retirement-plans/amount-of-roth-ira-contributions-that-you-can-make-for-2017</a>
Yes. Capital gains are part of the MAGI calculation that limits your Roth IRA contribution.