Index: src/wp-includes/class-wp-editor.php
===================================================================
--- src/wp-includes/class-wp-editor.php	(revision 27628)
+++ src/wp-includes/class-wp-editor.php	(working copy)
@@ -333,6 +333,7 @@
 					'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
 
 					'wpeditimage_disable_captions' => $no_captions,
+					'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ),
 					'plugins' => implode( ',', $plugins ),
 				);
 
@@ -345,7 +346,7 @@
 				$dashicons = includes_url( "css/dashicons$suffix.css?$version" );
 				$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
 				$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
-				
+
 				// WordPress default stylesheet and dashicons
 				$mce_css = array(
 					$dashicons,
Index: src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
===================================================================
--- src/wp-includes/js/tinymce/plugins/wordpress/plugin.js	(revision 27628)
+++ src/wp-includes/js/tinymce/plugins/wordpress/plugin.js	(working copy)
@@ -303,6 +303,10 @@
 			bodyClass.push('rtl');
 		}
 
+		if ( editor.getParam( 'wpeditimage_html5_captions' ) ) {
+			bodyClass.push( 'html5-caption' );
+		}
+
 		if ( env.ie ) {
 			if ( parseInt( env.ie, 10 ) === 9 ) {
 				bodyClass.push('ie9');
Index: src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
===================================================================
--- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js	(revision 27628)
+++ src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js	(working copy)
@@ -47,7 +47,10 @@
 				return c;
 			}
 
-			width = parseInt( w, 10 ) + 10;
+			width = parseInt( w, 10 );
+			if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+				width = width + 10;
+			}
 
 			return '<div class="mceTemp"><dl id="'+ id +'" class="wp-caption '+ cls +'" style="width: '+ width +'px">' +
 				'<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ cap +'</dd></dl></div>';
@@ -618,7 +621,6 @@
 
 			// Remove toolbar to avoid an orphaned toolbar when dragging an image to a new location
 			removeToolbar();
-
 		});
 
 		// Prevent IE11 from making dl.wp-caption resizable
Index: src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
===================================================================
--- src/wp-includes/js/tinymce/skins/wordpress/wp-content.css	(revision 27628)
+++ src/wp-includes/js/tinymce/skins/wordpress/wp-content.css	(working copy)
@@ -40,6 +40,10 @@
 	margin: 10px 0;
 }
 
+.html5-caption .wp-caption {
+	padding: 4px;
+}
+
 .mceIEcenter {
 	text-align: center;
 }
Index: src/wp-includes/media.php
===================================================================
--- src/wp-includes/media.php	(revision 27628)
+++ src/wp-includes/media.php	(working copy)
@@ -765,6 +765,13 @@
 	if ( ! empty( $atts['id'] ) )
 		$atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
 
+	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
+
+	if ( current_theme_supports( 'html5', 'caption' ) ) {
+		return '<figure ' . $atts['id'] . 'style="width: ' . $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">'
+		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
+	}
+
 	$caption_width = 10 + $atts['width'];
 
 	/**
@@ -788,8 +795,6 @@
 	if ( $caption_width )
 		$style = 'style="width: ' . (int) $caption_width . 'px" ';
 
-	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
-
 	return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
 	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
 }
