Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.981
diff -u -p -r1.981 common.inc
--- includes/common.inc	31 Aug 2009 18:43:12 -0000	1.981
+++ includes/common.inc	1 Sep 2009 21:44:02 -0000
@@ -4486,6 +4486,10 @@ function drupal_common_theme() {
     'install_page' => array(
       'arguments' => array('content' => NULL),
     ),
+    'region' => array(
+      'arguments' => array('elements' => NULL),
+      'template' => 'region',
+    ),
     'task_list' => array(
       'arguments' => array('items' => NULL, 'active' => NULL),
     ),
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.519
diff -u -p -r1.519 theme.inc
--- includes/theme.inc	31 Aug 2009 19:50:17 -0000	1.519
+++ includes/theme.inc	1 Sep 2009 21:44:03 -0000
@@ -2292,3 +2292,22 @@ function template_preprocess_maintenance
     $variables['template_file'] = 'maintenance-page-offline';
   }
 }
+
+/**
+ * Preprocess variables for region.tpl.php
+ *
+ * Prepare the values passed to the theme_region function to be passed into a
+ * pluggable template engine. Uses the region name to generate a template file
+ * suggestions. If none are found, the default region.tpl.php is used.
+ *
+ * @see region.tpl.php
+ */
+function template_preprocess_region(&$variables) {
+  // Create the $content variable that templates expect.
+  $variables['content'] = $variables['elements']['#children'];
+  $variables['region'] = $variables['elements']['#region'];
+
+  $region = 'region-' . str_replace('_', '-', $variables['region']);
+  $variables['classes_array'][] = $region;
+  $variables['template_files'][] = $region;
+}
Index: modules/block/block-admin-display-form.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block-admin-display-form.tpl.php,v
retrieving revision 1.6
diff -u -p -r1.6 block-admin-display-form.tpl.php
--- modules/block/block-admin-display-form.tpl.php	15 May 2008 21:30:02 -0000	1.6
+++ modules/block/block-admin-display-form.tpl.php	1 Sep 2009 21:44:03 -0000
@@ -45,8 +45,8 @@
   <tbody>
     <?php $row = 0; ?>
     <?php foreach ($block_regions as $region => $title): ?>
-      <tr class="region region-<?php print $region?>">
-        <td colspan="5" class="region"><?php print $title; ?></td>
+      <tr class="region-title region-title-<?php print $region?>">
+        <td colspan="5"><?php print $title; ?></td>
       </tr>
       <tr class="region-message region-<?php print $region?>-message <?php print empty($block_listing[$region]) ? 'region-empty' : 'region-populated'; ?>">
         <td colspan="5"><em><?php print t('No blocks in this region'); ?></em></td>
Index: modules/block/block.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.css,v
retrieving revision 1.6
diff -u -p -r1.6 block.css
--- modules/block/block.css	14 Nov 2007 09:49:30 -0000	1.6
+++ modules/block/block.css	1 Sep 2009 21:44:03 -0000
@@ -1,6 +1,6 @@
 /* $Id: block.css,v 1.6 2007/11/14 09:49:30 dries Exp $ */
 
-#blocks td.region {
+#blocks tr.region-title td {
   font-weight: bold;
 }
 #blocks tr.region-message {
Index: modules/block/block.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.test,v
retrieving revision 1.27
diff -u -p -r1.27 block.test
--- modules/block/block.test	28 Aug 2009 19:44:05 -0000	1.27
+++ modules/block/block.test	1 Sep 2009 21:44:04 -0000
@@ -26,10 +26,10 @@ class BlockTestCase extends DrupalWebTes
 
     // Define the existing regions
     $this->regions = array();
-    $this->regions[] = array('name' => 'header', 'id' => 'header-region');
-    $this->regions[] = array('name' => 'sidebar_first', 'id' => 'sidebar-first');
-    $this->regions[] = array('name' => 'content', 'id' => 'center');
-    $this->regions[] = array('name' => 'sidebar_second', 'id' => 'sidebar-second');
+    $this->regions[] = array('name' => 'header', 'class' => 'region region-header clearfix');
+    $this->regions[] = array('name' => 'sidebar_first');
+    $this->regions[] = array('name' => 'content');
+    $this->regions[] = array('name' => 'sidebar_second');
     $this->regions[] = array('name' => 'footer');
   }
 
@@ -193,8 +193,8 @@ class BlockTestCase extends DrupalWebTes
 
   function moveBlockToRegion($block, $region) {
     // If an id for an region hasn't been specified, we assume it's the same as the name.
-    if (!(isset($region['id']))) {
-      $region['id'] = $region['name'];
+    if (!(isset($region['class']))) {
+      $region['class'] = 'region region-' . str_replace('_', '-', $region['name']);
     }
 
     // Set the created block to a specific region.
@@ -209,7 +209,7 @@ class BlockTestCase extends DrupalWebTes
     $this->assertText(t($block['title']), t('Block successfully being displayed on the page.'));
 
     // Confirm that the custom block was found at the proper region.
-    $xpath = '//div[@id="' . $region['id'] . '"]//div[@id="block-' . $block['module'] . '-' . $block['delta'] . '"]/*';
+    $xpath = '//div[@class="' . $region['class'] . '"]//div[@id="block-' . $block['module'] . '-' . $block['delta'] . '"]/*';
     $this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region['name'])));
   }
 }
Index: modules/system/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v
retrieving revision 1.32
diff -u -p -r1.32 page.tpl.php
--- modules/system/page.tpl.php	31 Aug 2009 19:50:18 -0000	1.32
+++ modules/system/page.tpl.php	1 Sep 2009 21:44:04 -0000
@@ -146,11 +146,7 @@
         <div id="search-box"><?php print $search_box; ?></div>
       <?php endif; ?>
 
-      <?php if ($header): ?>
-        <div id="header-region" class="region">
-          <?php print $header; ?>
-        </div>
-      <?php endif; ?>
+      <?php print $header; ?>
 
     </div></div> <!-- /.section, /#header -->
 
@@ -174,20 +170,18 @@
         <?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
         <?php print $help; ?>
         <?php if ($action_links): ?><ul class="action-links"><?php print $action_links; ?></ul><?php endif; ?>
-        <div id="content-area" class="region">
-          <?php print $content; ?>
-        </div> <!-- /#content-area -->
+        <?php print $content; ?>
         <?php print $feed_icons; ?>
       </div></div> <!-- /.section, /#content -->
 
       <?php if ($sidebar_first): ?>
-        <div id="sidebar-first" class="column sidebar"><div class="section region">
+        <div id="sidebar-first" class="column sidebar"><div class="section">
           <?php print $sidebar_first; ?>
         </div></div> <!-- /.section, /#sidebar-first -->
       <?php endif; ?>
 
       <?php if ($sidebar_second): ?>
-        <div id="sidebar-second" class="column sidebar"><div class="section region">
+        <div id="sidebar-second" class="column sidebar"><div class="section">
           <?php print $sidebar_second; ?>
         </div></div> <!-- /.section, /#sidebar-second -->
       <?php endif; ?>
@@ -196,7 +190,7 @@
 
     <div id="footer"><div class="section">
       <?php print theme('links', $secondary_menu, array('id' => 'secondary-menu', 'class' => array('links', 'clearfix')), t('Secondary menu')); ?>
-      <?php if ($footer): ?><div id="footer-region" class="region"><?php print $footer; ?></div><?php endif; ?>
+      <?php print $footer; ?>
     </div></div> <!-- /.section, /#footer -->
 
   </div></div> <!-- /#page, /#page-wrapper -->
Index: modules/system/region.tpl.php
===================================================================
RCS file: modules/system/region.tpl.php
diff -N modules/system/region.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/system/region.tpl.php	26 Aug 2009 07:48:58 -0000
@@ -0,0 +1,32 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Default theme implementation to display a region.
+ *
+ * Available variables:
+ * - $content: The content for this region, typically blocks.
+ * - $classes: String of classes that can be used to style contextually through
+ *   CSS. It can be manipulated through the variable $classes_array from
+ *   preprocess functions. The default values can be one or more of the following:
+ *   - region: The current template type, i.e., "theming hook".
+ *   - region-[name]: The name of the region with underscores replaced with
+ *     dashes. For example, the page_top region would have a region-page-top class.
+ * - $region: The name of the region variable as defined in the theme's .info file.
+ *
+ * Helper variables:
+ * - $classes_array: Array of html class attribute values. It is flattened
+ *   into a string within the variable $classes.
+ * - $is_admin: Flags true when the current user is an administrator.
+ * - $is_front: Flags true when presented in the front page.
+ * - $logged_in: Flags true when the current user is a logged-in member.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_region()
+ * @see template_process()
+ */
+?>
+<div class="<?php print $classes; ?>">
+  <?php print $content; ?>
+</div>
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.784
diff -u -p -r1.784 system.module
--- modules/system/system.module	1 Sep 2009 16:50:12 -0000	1.784
+++ modules/system/system.module	1 Sep 2009 21:44:05 -0000
@@ -3022,7 +3022,6 @@ function theme_system_compact_link() {
   return $output;
 }
 
-
 /**
  * Send Drupal and the major version number in the META GENERATOR HTML.
  *
@@ -3108,6 +3107,18 @@ function system_page_build(&$page) {
       '#markup' => theme('system_run_cron_image', 'system/run-cron-image'),
     );
   }
+
+  // Find all block regions so they can be rendered.
+  $regions = system_region_list($GLOBALS['theme']);
+
+  // Load all region content assigned via blocks.
+  foreach (array_keys($regions) as $region) {
+    // Don't render empty regions.
+    if (!empty($page[$region])) {
+      $page[$region]['#theme_wrappers'][] = 'region';
+      $page[$region]['#region'] = $region;
+    }
+  }
 }
 
 /**
Index: themes/garland/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/page.tpl.php,v
retrieving revision 1.32
diff -u -p -r1.32 page.tpl.php
--- themes/garland/page.tpl.php	22 Aug 2009 19:58:28 -0000	1.32
+++ themes/garland/page.tpl.php	1 Sep 2009 21:44:05 -0000
@@ -17,7 +17,7 @@
 
   <?php print $page_top; ?>
 
-  <div id="header-region" class="clearfix"><?php print $header ?></div>
+  <?php print $header; ?>
 
   <div id="wrapper">
     <div id="container" class="clearfix">
@@ -59,7 +59,7 @@
             <?php print $content ?>
           </div>
           <?php print $feed_icons ?>
-          <div id="footer"><?php print $footer ?></div>
+          <?php print $footer ?>
       </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
 
       <?php if ($sidebar_second): ?>
Index: themes/garland/style-rtl.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/style-rtl.css,v
retrieving revision 1.15
diff -u -p -r1.15 style-rtl.css
--- themes/garland/style-rtl.css	6 Aug 2009 05:06:00 -0000	1.15
+++ themes/garland/style-rtl.css	1 Sep 2009 21:44:05 -0000
@@ -72,7 +72,7 @@ dl dd {
   margin: 2em 0 1em 0.5em;
 }
 
-#header-region h2 {
+.region-header h2 {
   margin: 0 0 0 1em;
 }
 
Index: themes/garland/style.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/style.css,v
retrieving revision 1.64
diff -u -p -r1.64 style.css
--- themes/garland/style.css	31 Aug 2009 17:40:03 -0000	1.64
+++ themes/garland/style.css	1 Sep 2009 21:44:05 -0000
@@ -218,7 +218,7 @@ tr.even td.active {
   background-color: #e6f1f7;
 }
 
-td.region, td.module, td.container, td.category {
+td.region-title, td.module, td.container, td.category {
   border-top: 1.5em solid #fff;
   border-bottom: 1px solid #b4d7f0;
   background-color: #d4e7f3;
@@ -226,7 +226,7 @@ td.region, td.module, td.container, td.c
   font-weight: bold;
 }
 
-tr:first-child td.region, tr:first-child td.module, tr:first-child td.container, tr:first-child td.category {
+tr:first-child td.region-title, tr:first-child td.module, tr:first-child td.container, tr:first-child td.category {
   border-top-width: 0;
 }
 
@@ -293,17 +293,17 @@ table .form-button, table .form-submit {
 /**
  * Layout
  */
-#header-region {
+.region-header {
   min-height: 1em;
   background: #d2e6f3 url(images/bg-navigation.png) repeat-x 50% 100%;
 }
 
-#header-region .block {
+.region-header .block {
   display: block;
   margin: 0 1em;
 }
 
-#header-region .block-region {
+.region-header .block-region {
   display: block;
   margin: 0 0.5em 1em;
   padding: 0.5em;
@@ -311,7 +311,7 @@ table .form-button, table .form-submit {
   top: 0.5em;
 }
 
-#header-region * {
+.region-header * {
   display: inline;
   line-height: 1.5em;
   margin-top: 0;
@@ -319,19 +319,19 @@ table .form-button, table .form-submit {
 }
 
 /* Prevent the previous directive from showing the content of script elements in Mozilla browsers. */
-#header-region script {
+.region-header script {
   display: none;
 }
 
-#header-region p, #header-region img {
+.region-header p, .region-header img {
   margin-top: 0.5em;
 }
 
-#header-region h2 {
+.region-header h2 {
   margin: 0 1em 0 0; /* LTR */
 }
 
-#header-region h3, #header-region label, #header-region li {
+.region-header h3, .region-header label, .region-header li {
   margin: 0 1em;
   padding: 0;
   background: none;
@@ -471,7 +471,7 @@ body.two-sidebars #squeeze {
   min-height: 400px;
 }
 
-#wrapper #container #footer {
+#wrapper #container .region-footer {
   float: none;
   clear: both;
   text-align: center;
@@ -486,15 +486,15 @@ body.two-sidebars #squeeze {
   z-index: 3;
 }
 
-body.sidebar-first #footer {
+body.sidebar-first .region-footer {
   margin-left: -210px;
 }
 
-body.sidebar-second #footer {
+body.sidebar-second .region-footer {
   margin-right: -210px;
 }
 
-body.two-sidebars #footer {
+body.two-sidebars .region-footer {
   margin: 0 -210px;
 }
 
Index: themes/garland/template.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/template.php,v
retrieving revision 1.29
diff -u -p -r1.29 template.php
--- themes/garland/template.php	1 Sep 2009 20:39:55 -0000	1.29
+++ themes/garland/template.php	1 Sep 2009 21:44:05 -0000
@@ -78,6 +78,15 @@ function garland_process_page(&$vars) {
 }
 
 /**
+ * Override or insert variables into the region template.
+ */
+function garland_preprocess_region(&$vars) {
+  if ($vars['region'] == 'header') {
+    $vars['classes_array'][] = 'clearfix';
+  }
+}
+
+/**
  * Returns the rendered local tasks. The default implementation renders
  * them as tabs. Overridden to split the secondary tasks.
  */
