Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4464)
@@ -64,4 +64,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4219">#4219</a> : Added fallback mechanism for config.language.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4194">#4194</a> : Added support for using multiple css style sheets within the editor.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4463">#4463</a> : Added inline CSS support in all places where custom stylesheet could apply.</li>
 	</ul>
 	<p>
Index: /CKEditor/branches/versions/3.1.x/_source/core/dom/document.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/dom/document.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/core/dom/document.js	(revision 4464)
@@ -53,4 +53,19 @@
 		},
 
+		appendStyleText : function( cssStyleText )
+		{
+			if ( this.$.createStyleSheet )
+			{
+				var styleSheet = this.$.createStyleSheet( "" );
+				styleSheet.cssText = cssStyleText ;
+			}
+			else
+			{
+				var style = new CKEDITOR.dom.element( 'style', this );
+				style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
+				this.getHead().append( style );
+			}
+		},
+
 		createElement : function( name, attribsAndStyles )
 		{
Index: /CKEditor/branches/versions/3.1.x/_source/core/editor.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/editor.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/core/editor.js	(revision 4464)
@@ -125,5 +125,5 @@
 
 		// Load language file.
-		loadLang( editor );
+		loadSkin( editor );
 	};
 
@@ -247,5 +247,5 @@
 						// Load the editor skin.
 						editor.fire( 'pluginsLoaded' );
-						loadSkin( editor );
+						loadTheme( editor );
 					});
 			});
@@ -256,5 +256,5 @@
 		CKEDITOR.skins.load( editor, 'editor', function()
 			{
-				loadTheme( editor );
+				loadLang( editor );
 			});
 	};
Index: /CKEditor/branches/versions/3.1.x/_source/core/resourcemanager.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/resourcemanager.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/core/resourcemanager.js	(revision 4464)
@@ -87,5 +87,6 @@
 			throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
 
-		this.registered[ name ] = definition || {};
+		CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
+				this.registered[ name ] = definition || {} );
 	},
 
Index: /CKEditor/branches/versions/3.1.x/_source/core/skins.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/skins.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/core/skins.js	(revision 4464)
@@ -44,5 +44,5 @@
 					{
 						preloaded[ skinName ] = 1;
-						loadedPart( skinName, part, callback );
+						loadPart( skinName, part, callback );
 					} );
 				return;
@@ -97,5 +97,5 @@
 			if ( !cssIsLoaded )
 			{
-				appendSkinPath( part.css );
+				var cssPart = part.css;
 
 				for ( var c = 0 ; c < part.css.length ; c++ )
Index: /CKEditor/branches/versions/3.1.x/_source/core/tools.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/tools.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/core/tools.js	(revision 4464)
@@ -99,4 +99,13 @@
 
 		/**
+		 * Turn the first letter of string to upper-case.
+		 * @param {String} str
+		 */
+		capitalize: function( str )
+		{
+			return str.charAt( 0 ).toUpperCase() + str.substring( 1 ).toLowerCase();
+		},
+
+		/**
 		 * Copy the properties from one object to another. By default, properties
 		 * already present in the target object <strong>are not</strong> overwritten.
@@ -230,4 +239,25 @@
 
 		/**
+		 * Build the HTML snippet of a set of <style>/<link>.
+		 * @param css {String|Array} Each of which are url (absolute) of a CSS file or
+		 * a trunk of style text.
+		 */
+		buildStyleHtml : function ( css )
+		{
+			css = [].concat( css );
+			var item, retval = [];
+			for ( var i = 0; i < css.length; i++ )
+			{
+				item = css[ i ];
+				// Is CSS style text ?
+				if ( /@import|[{}]/.test(item) )
+					retval.push('<style>' + item + '</style>');
+				else
+					retval.push('<link type="text/css" rel=stylesheet href="' + item + '">');
+			}
+			return retval.join( '' );
+		},
+
+		/**
 		 * Replace special HTML characters in a string with their relative HTML
 		 * entity values.
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/colorbutton/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/colorbutton/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/colorbutton/plugin.js	(revision 4464)
@@ -32,5 +32,5 @@
 					panel :
 					{
-						css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ]
+						css : editor.skin.editor.css
 					},
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4464)
@@ -7,9 +7,4 @@
  * @fileOverview The floating dialog plugin.
  */
-
-CKEDITOR.plugins.add( 'dialog',
-	{
-		requires : [ 'dialogui' ]
-	});
 
 /**
@@ -73,7 +68,4 @@
 		return null;
 	}
-
-	// Stores dialog related data from skin definitions. e.g. margin sizes.
-	var skinData = {};
 
 	/**
@@ -1438,5 +1430,5 @@
 			editor = dialog.getParentEditor(),
 			magnetDistance = editor.config.dialog_magnetDistance,
-			margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ];
+			margins = editor.skin.margins || [ 0, 0, 0, 0 ];
 
 		if ( typeof magnetDistance == 'undefined' )
@@ -1516,5 +1508,5 @@
 			minHeight = definition.minHeight || 0,
 			resizable = definition.resizable,
-			margins = skinData[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ];
+			margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ];
 
 		function topSizer( coords, dy )
@@ -2673,15 +2665,4 @@
 		};
 	})();
-
-	// Grab the margin data from skin definition and store it away.
-	CKEDITOR.skins.add = ( function()
-	{
-		var original = CKEDITOR.skins.add;
-		return function( skinName, skinDefinition )
-		{
-			skinData[ skinName ] = { margins : skinDefinition.margins };
-			return original.apply( this, arguments );
-		};
-	} )();
 })();
 
@@ -2735,4 +2716,9 @@
 			return null;
 		}
+	});
+
+CKEDITOR.plugins.add( 'dialog',
+	{
+		requires : [ 'dialogui' ]
 	});
 
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/font/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/font/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/font/plugin.js	(revision 4464)
@@ -37,5 +37,5 @@
 				panel :
 				{
-					css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
+					css : editor.skin.editor.css.concat( config.contentsCss ),
 					voiceLabel : lang.panelVoiceLabel
 				},
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/format/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/format/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/format/plugin.js	(revision 4464)
@@ -34,5 +34,5 @@
 				panel :
 				{
-					css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
+					css : editor.skin.editor.css.concat( config.contentsCss ),
 					voiceLabel : lang.panelVoiceLabel
 				},
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js	(revision 4464)
@@ -133,5 +133,5 @@
 					panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),
 						{
-							css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],
+							css : editor.skin.editor.css,
 							level : this._.level - 1,
 							className : editor.skinClass + ' cke_contextmenu'
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/panel/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/panel/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/panel/plugin.js	(revision 4464)
@@ -161,5 +161,5 @@
 						// after <body>, so it (body) becames immediatelly
 						// available. (#3031)
-						'<link type="text/css" rel=stylesheet href="' + this.css.join( '"><link type="text/css" rel="stylesheet" href="' ) + '">' +
+						CKEDITOR.tools.buildStyleHtml( this.css ) +
 					'<\/html>' );
 				doc.$.close();
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/preview/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/preview/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/preview/plugin.js	(revision 4464)
@@ -38,7 +38,5 @@
 					baseTag +
 					'<title>' + editor.lang.preview + '</title>' +
-					'<link type="text/css" rel="stylesheet" href="' +
-					[].concat( editor.config.contentsCss ).join( '"><link type="text/css" rel="stylesheet" href="' ) +
-					'">' +
+					CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
 					'</head>' + bodyHtml +
 					editor.getData() +
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/stylescombo/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/stylescombo/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/stylescombo/plugin.js	(revision 4464)
@@ -27,5 +27,5 @@
 					panel :
 					{
-						css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ].concat( config.contentsCss ),
+						css : editor.skin.editor.css.concat( config.contentsCss ),
 						voiceLabel : lang.panelVoiceLabel
 					},
Index: /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4464)
@@ -564,7 +564,5 @@
 									'<html dir="' + editor.config.contentsLangDirection + '">' +
 									'<head>' +
-										'<link type="text/css" rel="stylesheet" href="' +
-										[].concat( editor.config.contentsCss ).join( '"><link type="text/css" rel="stylesheet" href="' ) +
-										'">' +
+										CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
 										'<style type="text/css" _fcktemp="true">' +
 											editor._.styles.join( '\n' ) +
Index: /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js	(revision 4464)
@@ -259,6 +259,6 @@
 				},
 				100 );
-		});
-}
+		} );
+} );
 
 /**
Index: /CKEditor/branches/versions/3.1.x/_source/skins/office2003/skin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/office2003/skin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/office2003/skin.js	(revision 4464)
@@ -74,4 +74,4 @@
 			if ( evt.editor.lang.dir == 'rtl' )
 				setTimeout( fixSize, 1000 );
-		});
-}
+		} );
+} );
Index: /CKEditor/branches/versions/3.1.x/_source/skins/v2/skin.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/skins/v2/skin.js	(revision 4463)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/v2/skin.js	(revision 4464)
@@ -70,4 +70,4 @@
 				},
 				100 );
-		});
-}
+		} );
+} );
