Index: CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js
===================================================================
--- CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 6119)
+++ CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 6190)
@@ -1,3 +1,3 @@
-/*
+﻿/*
 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -39,10 +39,14 @@
 	}
 
-	function blockNeedsExtension( block, fromSource )
-	{
+	function blockNeedsExtension( block, fromSource, extendEmptyBlock )
+	{
+		if( !extendEmptyBlock ||
+			typeof extendEmptyBlock == 'function' && ( extendEmptyBlock( block ) == false ) )
+			return false;
+
         // 1. For IE version >=8,  empty blocks are displayed correctly themself in wysiwiyg;
         // 2. For the rest, at least table cell and list item need no filler space.
         // (#6248)
-        if ( fromSource && CKEDITOR.env.ie && 
+        if ( fromSource && CKEDITOR.env.ie &&
                 ( document.documentMode > 7
                 || block.name in CKEDITOR.dtd.tr
@@ -52,30 +56,25 @@
 		var lastChild = lastNoneSpaceChild( block );
 
-		return !lastChild
-			|| lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'
-			// Some of the controls in form needs extension too,
-			// to move cursor at the end of the form. (#4791)
-			|| block.name == 'form' && lastChild.name == 'input';
-	}
-
-	function extendBlockForDisplay( block )
-	{
-		trimFillers( block, true );
-
-		if ( blockNeedsExtension( block, true ) )
-		{
-			if ( CKEDITOR.env.ie )
-				block.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
-			else
-				block.add( new CKEDITOR.htmlParser.element( 'br', {} ) );
+		return !lastChild || lastChild &&
+				( lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'
+				// Some of the controls in form needs extension too,
+				// to move cursor at the end of the form. (#4791)
+				|| block.name == 'form' && lastChild.name == 'input' );
+	}
+
+	function getBlockExtension( isOutput, emptyBlockFiller )
+	{
+		return function( node )
+		{
+			trimFillers( node, !isOutput );
+
+			if ( blockNeedsExtension( node, !isOutput, emptyBlockFiller ) )
+			{
+				if ( isOutput || CKEDITOR.env.ie )
+					node.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
+				else
+					node.add( new CKEDITOR.htmlParser.element( 'br', {} ) );
+			}
 		}
-	}
-
-	function extendBlockForOutput( block )
-	{
-		trimFillers( block );
-
-		if ( blockNeedsExtension( block ) )
-			block.add( new CKEDITOR.htmlParser.text( '\xa0' ) );
 	}
 
@@ -99,5 +98,5 @@
 			// Event attributes (onXYZ) must not be directly set. They can become
 			// active in the editing area (IE|WebKit).
-			[ ( /^on/ ), '_cke_pa_on' ]
+			[ ( /^on/ ), 'data-cke-pa-on' ]
 		]
 	};
@@ -106,5 +105,5 @@
 
 	for ( i in blockLikeTags )
-		defaultDataBlockFilterRules.elements[ i ] = extendBlockForDisplay;
+		defaultDataBlockFilterRules.elements[ i ] = getBlockExtension();
 
 	var defaultHtmlFilterRules =
@@ -122,8 +121,8 @@
 			[
 				// Attributes saved for changes and protected attributes.
-				[ ( /^_cke_(saved|pa)_/ ), '' ],
-
-				// All "_cke" attributes are to be ignored.
-				[ ( /^_cke.*/ ), '' ],
+				[ ( /^data-cke-(saved|pa)-/ ), '' ],
+
+				// All "data-cke" attributes are to be ignored.
+				[ ( /^data-cke.*/ ), '' ],
 
 				[ 'hidefocus', '' ]
@@ -139,5 +138,5 @@
 					{
 						// Elements marked as temporary are to be ignored.
-						if ( attribs.cke_temp )
+						if ( attribs[ 'data-cke-temp' ] )
 							return false;
 
@@ -147,5 +146,5 @@
 						for ( var i = 0 ; i < attributeNames.length ; i++ )
 						{
-							savedAttributeName = '_cke_saved_' + attributeNames[ i ];
+							savedAttributeName = 'data-cke-saved-' + attributeNames[ i ];
 							savedAttributeName in attribs && ( delete attribs[ attributeNames[ i ] ] );
 						}
@@ -182,5 +181,5 @@
 					if ( !( element.children.length ||
 							element.attributes.name ||
-							element.attributes._cke_saved_name ) )
+							element.attributes[ 'data-cke-saved-name' ] ) )
 					{
 						return false;
@@ -188,4 +187,11 @@
 				},
 
+				// Remove dummy span in webkit.
+				span: function( element )
+				{
+					if ( element.attributes[ 'class' ] == 'Apple-style-span' )
+						delete element.name;
+				},
+
 				html : function( element )
 				{
@@ -212,5 +218,5 @@
 				{
 					var titleText = element.children[ 0 ];
-					titleText && ( titleText.value = element.attributes[ '_cke_title' ] || '' );
+					titleText && ( titleText.value = element.attributes[ 'data-cke-title' ] || '' );
 				}
 			},
@@ -243,9 +249,4 @@
 		};
 
-	var defaultHtmlBlockFilterRules = { elements : {} };
-
-	for ( i in blockLikeTags )
-		defaultHtmlBlockFilterRules.elements[ i ] = extendBlockForOutput;
-
 	if ( CKEDITOR.env.ie )
 	{
@@ -274,5 +275,5 @@
 
 	var protectAttributeRegex = /<((?:a|area|img|input)\b[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi,
-		findSavedSrcRegex = /\s_cke_saved_src\s*=/;
+		findSavedSrcRegex = /\sdata-cke-saved-src\s*=/;
 
 	var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
@@ -292,5 +293,5 @@
 					return tag;
 				else
-					return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>';
+					return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>';
 			});
 	}
@@ -413,5 +414,15 @@
 			dataProcessor.dataFilter.addRules( defaultDataBlockFilterRules );
 			dataProcessor.htmlFilter.addRules( defaultHtmlFilterRules );
+
+			var defaultHtmlBlockFilterRules = { elements : {} };
+			for ( i in blockLikeTags )
+				defaultHtmlBlockFilterRules.elements[ i ] = getBlockExtension( true, editor.config.fillEmptyBlocks );
+
 			dataProcessor.htmlFilter.addRules( defaultHtmlBlockFilterRules );
+		},
+		
+		onLoad : function()
+		{
+			! ( 'fillEmptyBlocks' in CKEDITOR.config ) && ( CKEDITOR.config.fillEmptyBlocks = 1 );
 		}
 	});
@@ -505,4 +516,5 @@
  * W3C XHTML 1.0 standards (<a href="http://www.w3.org/TR/xhtml1/#C_12">C.12, XHTML 1.0</a>).
  * @name CKEDITOR.config.forceSimpleAmpersand
+ * @name CKEDITOR.config.forceSimpleAmpersand
  * @type Boolean
  * @default false
@@ -510,2 +522,23 @@
  * config.forceSimpleAmpersand = false;
  */
+
+/**
+ * Whether a filler text (non-breaking space entity - &nbsp;) will be inserted into empty block elements in HTML output,
+ * this is used to render block elements properly with line-height; When a function is instead specified,
+ * it'll be passed a {@link CKEDITOR.htmlParser.element} to decide whether adding the filler text
+ * by expecting a boolean return value.
+ * @name CKEDITOR.config.fillEmptyBlocks;
+ * @since 3.5
+ * @type Boolean
+ * @default true
+ * @example
+ * config.fillEmptyBlocks = false;	// Prevent filler nodes in all empty blocks.
+ *
+ * // Prevent filler node only in float cleaners.
+ * config.fillEmptyBlocks = function( element )
+ * {
+ * 	if ( element.attributes[ 'class' ].indexOf ( 'clear-both' ) != -1 )
+ * 		return false;
+ * }
+ */
+
