Index: _source/skins/kama/skin.js
===================================================================
--- _source/skins/kama/skin.js	(revision 3913)
+++ _source/skins/kama/skin.js	Thu Jul 23 09:50:43 CEST 2009
@@ -22,15 +22,9 @@
 		margins		: [ 0, 0, 0, 0 ],
 		init : function( editor )
 		{
-			var menuHead;
-			function menuSetUiColor( color )
-			{
-				if ( !menuHead )
-					return null;
-
-				var uiStyle = menuHead.append('style');
-
-				var cssSrc = "/* UI Color Support */\
+			var uiColorMenus = {};
+			var uiColorRegex = /\$color/g;
+			var uiColorMenuCss = "/* UI Color Support */\
 .cke_skin_kama .cke_menuitem .cke_icon_wrapper\
 {\
 	background-color: $color !important;\
@@ -85,38 +79,42 @@
 	background-color: $color !important;\
 }";
 
-				uiStyle.setAttribute( "type", "text/css" );
-				var regex = /\$color/g;
+			function uiColorAddMenu( id, head )
+			{
+				uiColorMenus[ id ] = head.append( 'style' );
+				uiColorMenus[ id ].setAttribute( "type", "text/css" );
 
 				// We have to split CSS declarations for webkit.
 				if ( CKEDITOR.env.webkit )
 				{
-					cssSrc = cssSrc.split( '}' ).slice( 0, -1 );
-					for ( var i in cssSrc )
-							cssSrc[ i ] = cssSrc[ i ].split( '{' );
+					uiColorMenuCss = uiColorMenuCss.split( '}' ).slice( 0, -1 );
+					for ( var i in uiColorMenuCss )
+							uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' );
 				}
+			}
 
-				return ( menuSetUiColor =
-					function( color )
+			function uiColorUpdateMenus( color )
-					{
+			{
+				for ( var id in uiColorMenus )
+				{
-						if ( CKEDITOR.env.webkit )
-						{
+					if ( CKEDITOR.env.webkit )
+					{
-							for ( var i in cssSrc )
-								uiStyle.$.sheet.addRule(
-									cssSrc[ i ][ 0 ], cssSrc[ i ][ 1 ].replace( regex, color )
+						for ( var i in uiColorMenuCss )
+							uiColorMenus[ id ].$.sheet.addRule(
+								uiColorMenuCss[ i ][ 0 ], uiColorMenuCss[ i ][ 1 ].replace( uiColorRegex, color )
-								);
-						}
-						else
-						{
+							);
+					}
+					else
+					{
-							var css = cssSrc.replace( regex, color );
+						var css = uiColorMenuCss.replace( uiColorRegex, color );
 
-							if ( CKEDITOR.env.ie )
+						if ( CKEDITOR.env.ie )
-								uiStyle.$.styleSheet.cssText = css;
+							uiColorMenus[ id ].$.styleSheet.cssText = css;
-							else
+						else
-								uiStyle.setHtml( css );
+							uiColorMenus[ id ].setHtml( css );
-						}
+					}
-					})( color );
-			}
+				}
+			}
 
 			CKEDITOR.tools.extend( editor,
 			{
@@ -156,7 +154,7 @@
 							else
 								uiStyle.setHtml( cssSelectors + '{' + css + '}' );
 
-							menuSetUiColor( color );
+							uiColorUpdateMenus( color );
 						})( color );
 				}
 			});
@@ -170,11 +168,10 @@
 				{
 					old.apply( this, arguments );
 
-					if ( !menuHead && editor == this.editor )
+					if ( !uiColorMenus[ this.id ] && editor == this.editor )
 					{
-						// Save reference.
-						menuHead = this._.element.getDocument().getHead();
-						menuSetUiColor( editor.getUiColor() );
+						uiColorAddMenu( this.id, this._.element.getDocument().getHead() );
+						uiColorUpdateMenus( editor.getUiColor() );
 					}
 				};
 			}
@@ -182,35 +179,6 @@
 			// Apply UI color if specified in config.
 			if ( editor.config.uiColor )
 				editor.setUiColor( editor.config.uiColor );
-
-			// Fix editor's width. HPadding and 100% width iframe issue.
-//			if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )
-//			{
-//				editor.on( 'mode', function( event )
-//				{
-//					var container = editor.getResizable();
-//					editor.resize( container.$.offsetWidth-10, container.$.offsetHeight );
-//					event.removeListener();
-//				});
-//			}
-
-//			if ( CKEDITOR.env.ie && ( CKEDITOR.env.quirks || CKEDITOR.env.version < 7 ) )
-//			{
-//				editor.on( 'themeLoaded', function( event )
-//				{
-//					var toolbars = editor.container.getChild( [0, 0, 0, 0, 0, 0, 0] ).getChildren();
-//					for ( var i = 0 ; i < toolbars.count() ; i++ )
-//					{
-//						var toolbar = toolbars.getItem( i );
-
-//						var last = toolbar.getLast();
-//						if ( !last || !last.getPrevious().hasClass( 'cke_rcombo' ) )
-//							continue;
-//
-//						last.addClass( 'cke_toolbar_end_last' );
-//					}
-//				});
-//			}
 		}
 	};
 })() );
Index: CHANGES.html
===================================================================
--- CHANGES.html	(revision 3946)
+++ CHANGES.html	Thu Jul 23 09:48:33 CEST 2009
@@ -162,6 +162,7 @@
 			ckeditor2.html test case.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/3989">#3989</a> : Host page horizontal scrolling a lot when on having righ-to-left direction.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4001">#4001</a> : Create link around existing image result incorrect.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4048">#4048</a> : Context submenu lacks uiColor.</li>
 	</ul>
 	<h3>
 		CKEditor 3.0 RC</h3>
Index: _source/plugins/menu/plugin.js
===================================================================
--- _source/plugins/menu/plugin.js	(revision 3824)
+++ _source/plugins/menu/plugin.js	Thu Jul 23 09:24:20 CEST 2009
@@ -122,6 +122,7 @@
 
 			show : function( offsetParent, corner, offsetX, offsetY )
 			{
+				console.log( 'menu#show' )
 				var items = this.items,
 					editor = this.editor,
 					panel = this._.panel,

