Fix the issue with parsing @keyframes.

Also add a test case and update some test files to capture the issue with @keyframes parsing.

This fixes #7494 and #8463.