Index: /CKEditor/branches/versions/3.1.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4469)
+++ /CKEditor/branches/versions/3.1.x/CHANGES.html	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/core/dom/document.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/core/editor.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/core/resourcemanager.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/core/skins.js	(revision 4470)
@@ -21,5 +21,5 @@
 	var paths = {};
 
-	var loadedPart = function( skinName, part, callback )
+	var loadPart = function( skinName, part, callback )
 	{
 		// Get the skin definition.
@@ -34,4 +34,16 @@
 		};
 
+		function fixCSSTextRelativePath( cssStyleText, baseUrl )
+		{
+			return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
+					function( match, opener, path, closer )
+					{
+						if ( /^\/|^\w?:/.test( path ) )
+							return match;
+						else
+							return 'url(' + baseUrl + opener +  path + closer + ')';
+					} );
+		}
+		
 		// Check if we need to preload images from it.
 		if ( !preloaded[ skinName ] )
@@ -44,5 +56,5 @@
 					{
 						preloaded[ skinName ] = 1;
-						loadedPart( skinName, part, callback );
+						loadPart( skinName, part, callback );
 					} );
 				return;
@@ -97,9 +109,22 @@
 			if ( !cssIsLoaded )
 			{
-				appendSkinPath( part.css );
-
-				for ( var c = 0 ; c < part.css.length ; c++ )
-					CKEDITOR.document.appendStyleSheet( part.css[ c ] );
-
+				var cssPart = part.css;
+
+				if ( CKEDITOR.tools.isArray( cssPart ) )
+				{
+					appendSkinPath( cssPart );
+					for ( var c = 0 ; c < cssPart.length ; c++ )
+						CKEDITOR.document.appendStyleSheet( cssPart[ c ] );
+				}
+				else
+				{
+					cssPart = fixCSSTextRelativePath(
+								cssPart, CKEDITOR.getUrl( paths[ skinName ] ) );
+					// Processing Inline CSS part.
+					CKEDITOR.document.appendStyleText( cssPart );
+				}
+
+				part.css = cssPart;
+				
 				cssIsLoaded = 1;
 			}
@@ -157,14 +182,5 @@
 
 			if ( loaded[ skinName ] )
-			{
-				loadedPart( skinName, skinPart, callback );
-
-				// Get the skin definition.
-				var skinDefinition = loaded[ skinName ];
-
-				// Trigger init function if any.
-				if ( skinDefinition.init )
-					skinDefinition.init( editor );
-			}
+				loadPart( skinName, skinPart, callback );
 			else
 			{
@@ -172,12 +188,12 @@
 				CKEDITOR.scriptLoader.load( skinPath + 'skin.js', function()
 						{
-							loadedPart( skinName, skinPart, callback );
-
 							// Get the skin definition.
-							var skinDefinition = loaded[ skinName ];
+							var skinDefinition = editor.skin = loaded[ skinName ];
 
 							// Trigger init function if any.
 							if ( skinDefinition.init )
 								skinDefinition.init( editor );
+
+							 loadPart( skinName, skinPart, callback );
 						});
 			}
Index: /CKEditor/branches/versions/3.1.x/_source/core/tools.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/_source/core/tools.js	(revision 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/core/tools.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/colorbutton/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/dialog/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/font/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/format/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/menu/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/panel/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/preview/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/stylescombo/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/plugins/wysiwygarea/plugin.js	(revision 4470)
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/kama/skin.js	(revision 4470)
@@ -204,5 +204,5 @@
 })() );
 
-if ( CKEDITOR.dialog )
+CKEDITOR.on( 'dialogPluginReady', function()
 {
 	CKEDITOR.dialog.on( 'resize', function( evt )
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/office2003/skin.js	(revision 4470)
@@ -24,5 +24,5 @@
 })() );
 
-if ( CKEDITOR.dialog )
+CKEDITOR.on( 'dialogPluginReady', function()
 {
 	CKEDITOR.dialog.on( 'resize', function( evt )
@@ -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 4469)
+++ /CKEditor/branches/versions/3.1.x/_source/skins/v2/skin.js	(revision 4470)
@@ -24,5 +24,5 @@
 })() );
 
-if ( CKEDITOR.dialog )
+CKEDITOR.on( 'dialogPluginReady', function()
 {
 	CKEDITOR.dialog.on( 'resize', function( evt )
@@ -70,4 +70,4 @@
 				},
 				100 );
-		});
-}
+		} );
+} );
Index: /CKEditor/branches/versions/3.1.x/config.js
===================================================================
--- /CKEditor/branches/versions/3.1.x/config.js	(revision 4469)
+++ /CKEditor/branches/versions/3.1.x/config.js	(revision 4470)
@@ -1,3 +1,3 @@
-﻿/*
+/*
 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
@@ -9,3 +9,4 @@
 	// config.language = 'fr';
 	// config.uiColor = '#AADC6E';
+	config.contentsCss = 'body { background-color:#fff; color:#222; font-family:Arial, Verdana, sans-serif; font-size:12px; } html { _overflow-y:scroll; } img:-moz-broken { -moz-force-broken-image-icon:1; height:24px; width:24px; } img,input,textarea { cursor:default; }';
 };
