Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.959
diff -u -p -r1.959 common.inc
--- includes/common.inc	13 Aug 2009 03:03:03 -0000	1.959
+++ includes/common.inc	13 Aug 2009 04:25:52 -0000
@@ -4216,6 +4216,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.504
diff -u -p -r1.504 theme.inc
--- includes/theme.inc	13 Aug 2009 03:05:54 -0000	1.504
+++ includes/theme.inc	13 Aug 2009 04:25:52 -0000
@@ -2043,3 +2043,22 @@ function template_page_suggestions($args
 
   return $suggestions;
 }
+
+/**
+ * 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['blocks'] = $variables['elements']['#children'];
+  $variables['region'] = $variables['elements']['#region'];
+
+  $region = 'region-' . str_replace('_', '-', $variables['region']);
+  $variables['classes_array'][] = $region;
+  $variables['template_files'][] = $region;
+}
Index: modules/system/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v
retrieving revision 1.27
diff -u -p -r1.27 page.tpl.php
--- modules/system/page.tpl.php	3 Aug 2009 03:04:33 -0000	1.27
+++ modules/system/page.tpl.php	13 Aug 2009 04:25:52 -0000
@@ -144,11 +144,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 -->
 
@@ -171,20 +167,18 @@
         <?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
         <?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
         <?php print $help; ?>
-        <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; ?>
@@ -193,7 +187,7 @@
 
     <div id="footer"><div class="section">
       <?php print theme('links', $secondary_menu, array('id' => 'secondary-menu', 'class' => 'links clearfix')); ?>
-      <?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	6 Jul 2009 14:19:37 -0000
@@ -0,0 +1,32 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Default theme implementation to display a region.
+ *
+ * Available variables:
+ * - $blocks: The blocks for this region.
+ * - $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 $blocks ?>
+</div>
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.743
diff -u -p -r1.743 system.module
--- modules/system/system.module	12 Aug 2009 23:51:19 -0000	1.743
+++ modules/system/system.module	13 Aug 2009 04:25:52 -0000
@@ -2977,6 +2977,26 @@ function theme_system_compact_link() {
   return $output;
 }
 
+/**
+ * Implement hook_page_alter().
+ *
+ * Render regions.
+ */
+function system_page_alter($page) {
+  global $theme;
+
+  // Find all block regions.
+  $regions = system_region_list($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;
+    }
+  }
+}
 
 /**
  * Send Drupal and the major version number in the META GENERATOR HTML.
