After upgrading to version 3.5, I soon noticed that both native WP shortcodes and user-defined ones, have their content wrapped by a <p></p> tag, thus invalidating most of the markup.
The odd thing is that in my theme (self-made) I've specified that the wp_autop filter processing should not be applied to post and page's contents.
In short, the [gallery] shortcode now appears as:
<div id="gallery-n" class="...">...</div>
which is invalid.