Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1133
diff -u -r1.1133 common.inc
--- includes/common.inc	25 Mar 2010 10:45:03 -0000	1.1133
+++ includes/common.inc	25 Mar 2010 21:41:02 -0000
@@ -2896,7 +2896,9 @@
       case 'inline':
         $css_groups[$key]['data'] = '';
         foreach ($group['items'] as $item) {
-          $css_groups[$key]['data'] .= drupal_load_stylesheet_content($item['data'], $item['preprocess']);
+          // Inline stylesheets may be preprocessed, but @import rules should
+          // never be resolved.
+          $css_groups[$key]['data'] .= drupal_load_stylesheet_content($item['data'], $item['preprocess'], FALSE);
         }
         break;
     }
@@ -3215,10 +3217,13 @@
  * @param $optimize
  *   (optional) Boolean whether CSS contents should be minified. Defaults to
  *   FALSE.
+ * @param $flatten
+ *   (internal) Boolean whether @import rules should be replaced with the actual
+ *   stylesheet content. Defaults to TRUE.
  * @return
  *   Contents of the stylesheet including the imported stylesheets.
  */
-function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
+function drupal_load_stylesheet_content($contents, $optimize = FALSE, $flatten = TRUE) {
   // Remove multiple charset declarations for standards compliance (and fixing Safari problems).
   $contents = preg_replace('/^@charset\s+[\'"](\S*)\b[\'"];/i', '', $contents);
 
@@ -3234,9 +3239,11 @@
       >x', '\1', $contents);
   }
 
-  // Replaces @import commands with the actual stylesheet content.
-  // This happens recursively but omits external files.
-  $contents = preg_replace_callback('/@import\s*(?:url\()?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\)?;/', '_drupal_load_stylesheet', $contents);
+  if ($flatten) {
+    // Replaces @import commands with the actual stylesheet content.
+    // This happens recursively but omits external files.
+    $contents = preg_replace_callback('/@import\s*(?:url\()?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\)?;/', '_drupal_load_stylesheet', $contents);
+  }
   return $contents;
 }
 
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.106
diff -u -r1.106 common.test
--- modules/simpletest/tests/common.test	21 Mar 2010 20:26:41 -0000	1.106
+++ modules/simpletest/tests/common.test	25 Mar 2010 21:41:03 -0000
@@ -567,7 +567,7 @@
    * Tests rendering inline stylesheets with preprocessing on.
    */
   function testRenderInlinePreprocess() {
-    $css = 'body { padding: 0px; }';
+    $css = '@import url(modules/system/defaults.css); body { padding: 0px; }';
     $css_preprocessed = '<style type="text/css" media="all">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
     drupal_add_css($css, 'inline');
     $styles = drupal_get_css();
@@ -576,9 +576,12 @@
 
   /**
    * Tests rendering inline stylesheets with preprocessing off.
+   *
+   * @import rules inside inline stylesheets should not be replaced with the
+   * contents of the actual stylesheet.
    */
   function testRenderInlineNoPreprocess() {
-    $css = 'body { padding: 0px; }';
+    $css = '@import url(modules/system/defaults.css); body { padding: 0px; }';
     drupal_add_css($css, array('type' => 'inline', 'preprocess' => FALSE));
     $styles = drupal_get_css();
     $this->assertTrue(strpos($styles, $css) > 0, t('Rendering non-preprocessed inline CSS adds it to the page.'));
