Index: src/wp-includes/media.php
===================================================================
--- src/wp-includes/media.php	(revision 27680)
+++ src/wp-includes/media.php	(working copy)
@@ -765,15 +765,13 @@
 	if ( ! empty( $atts['id'] ) )
 		$atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
 
-	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
+	$caption_width = $atts['width'];
+	$html5 = current_theme_supports( 'html5', 'caption' );
 
-	if ( current_theme_supports( 'html5', 'caption' ) ) {
-		return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">'
-		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
+	if ( ! $html5 ) {
+		$caption_width += 10;
 	}
 
-	$caption_width = 10 + $atts['width'];
-
 	/**
 	 * Filter the width of an image's caption.
 	 *
@@ -795,8 +793,13 @@
 	if ( $caption_width )
 		$style = 'style="width: ' . (int) $caption_width . 'px" ';
 
-	return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
-	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
+	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
+
+	$itemtag = $html5 ? 'figure' : 'div';
+	$captiontag = $html5 ? 'figcaption' : 'p';
+	
+	return "<$itemtag " . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
+	. do_shortcode( $content ) . "<$captiontag " . 'class="wp-caption-text">' . $atts['caption'] . "</$captiontag></$itemtag>";
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
Index: tests/phpunit/tests/media.php
===================================================================
--- tests/phpunit/tests/media.php	(revision 27680)
+++ tests/phpunit/tests/media.php	(working copy)
@@ -108,6 +108,30 @@
 		$this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
 	}
 
+	/**
+	 * @ticket 27292
+	 */
+	function test_new_img_caption_shortcode_new_format_html5() {
+		add_theme_support( 'html5', array( 'caption' ) );
+		add_filter( 'img_caption_shortcode_width', array( $this, 'filter_img_caption_shortcode_width' ) );
+
+		$result = img_caption_shortcode(
+			array( 'width' => 20 ),
+			$this->img_content . $this->html_content
+		);
+
+		$expected = '<figure style="width: 30px" class="wp-caption alignnone">' . $this->img_content .
+						'<figcaption class="wp-caption-text">' . $this->html_content . '</figcaption></figure>';
+		$this->assertEquals( $expected, $result );
+
+		remove_filter( 'img_caption_shortcode_width', array( $this, 'filter_img_caption_shortcode_width' ) );
+		remove_theme_support( 'html5' );
+	}
+
+	function filter_img_caption_shortcode_width( $caption_width ) {
+		return 30;
+	}
+
 	function test_add_remove_oembed_provider() {
 		wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' );
 		$this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
