From 502d6aca8ab03b7c1eb7c58b990d500ebd186182 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sun, 10 Feb 2013 12:18:17 +0800 Subject: [PATCH] Issue #1924430: Add drupal.base library for base CSS styles. --- core/includes/theme.maintenance.inc | 5 +- core/misc/drupal.base-rtl.css | 20 ++++++++ core/misc/drupal.base.css | 73 ++++++++++++++++++++++++++++++ core/modules/overlay/overlay-child-rtl.css | 4 -- core/modules/system/system.base.css | 21 --------- core/modules/system/system.module | 16 ++++++- core/modules/system/system.theme-rtl.css | 13 ------ core/modules/system/system.theme.css | 43 ------------------ 8 files changed, 111 insertions(+), 84 deletions(-) create mode 100644 core/misc/drupal.base-rtl.css create mode 100644 core/misc/drupal.base.css diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 0b426e2..5fcb0c5 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -80,8 +80,9 @@ function _drupal_maintenance_theme() { } _drupal_theme_initialize($themes[$theme], array_reverse($base_theme), '_theme_load_offline_registry'); - // These are usually added from system_init() -except maintenance.css. - // When the database is inactive it's not called so we add it here. + // These are usually added from system_page_build(), except maintenance.css. + // When the database is inactive, it's not called so we add them here. + drupal_add_library('system', 'drupal.base'); $path = drupal_get_path('module', 'system'); drupal_add_css($path . '/system.base.css'); drupal_add_css($path . '/system.admin.css'); diff --git a/core/misc/drupal.base-rtl.css b/core/misc/drupal.base-rtl.css new file mode 100644 index 0000000..f4ad6d5 --- /dev/null +++ b/core/misc/drupal.base-rtl.css @@ -0,0 +1,20 @@ +/** + * @file + * Provides RTL base styling for HTML elements in Drupal. + */ + +html { + direction: rtl; +} + +/** + * Table elements. + */ +caption { + text-align: right; +} +th { + padding-left: 1em; + padding-right: 0; + text-align: right; +} diff --git a/core/misc/drupal.base.css b/core/misc/drupal.base.css new file mode 100644 index 0000000..46ca7b8 --- /dev/null +++ b/core/misc/drupal.base.css @@ -0,0 +1,73 @@ +/** + * @file + * Provides a base styling for HTML elements in Drupal. + */ + +/** + * Block-level HTML5 display definition. + * + * Provides display values for browsers that don't recognize the new elements + * and therefore display them inline by default. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section, +summary { + display: block; +} + +/** + * Form elements. + */ +form { + margin: 0; + padding: 0; +} +fieldset { + border: 1px solid #ccc; + margin: 1em 0; + padding: 0.5em; +} +label { + display: block; + font-weight: bold; +} + +/** + * Table elements. + */ +table { + border-collapse: collapse; + width: 100%; +} +caption { + text-align: left; /* LTR */ +} +th { + padding-right: 1em; /* LTR */ + text-align: left; /* LTR */ +} +thead > tr { + border-bottom: 1px solid #000; +} +tr { + border-bottom: 1px solid #ccc; + padding: 0.1em 0.6em; +} + +/* Miscellaneous elements. */ +hr { + border: 1px solid gray; + height: 1px; +} +img { + border: 0; +} diff --git a/core/modules/overlay/overlay-child-rtl.css b/core/modules/overlay/overlay-child-rtl.css index 4195530..d794bac 100644 --- a/core/modules/overlay/overlay-child-rtl.css +++ b/core/modules/overlay/overlay-child-rtl.css @@ -4,10 +4,6 @@ * RTL styling for Overlay child pages. */ -html { - direction: rtl; -} - #overlay-title { float: right; left: auto; diff --git a/core/modules/system/system.base.css b/core/modules/system/system.base.css index 11c9b41..a841ef8 100644 --- a/core/modules/system/system.base.css +++ b/core/modules/system/system.base.css @@ -265,24 +265,3 @@ tr .ajax-progress-throbber .throbber { display: table; clear: both; } - -/** - * Block-level HTML5 display definition. - * - * Provides display values for browsers that don't recognize the new elements - * and therefore display them inline by default. - */ -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section, -summary { - display: block; -} diff --git a/core/modules/system/system.module b/core/modules/system/system.module index afe52d0..5a75cb9 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1543,7 +1543,19 @@ function system_library_info() { 'css' => array( 'core/misc/normalize/normalize.css' => array( 'every_page' => TRUE, - 'weight' => -10, + 'weight' => CSS_BASE - 20, + ), + ), + ); + + // Drupal's base CSS. + $libraries['drupal.base'] = array( + 'title' => 'Drupal base CSS', + 'version' => VERSION, + 'css' => array( + 'core/misc/drupal.base.css' => array( + 'every_page' => TRUE, + 'weight' => CSS_BASE - 10, ), ), ); @@ -2514,6 +2526,8 @@ function system_init() { * Implements hook_page_build(). */ function system_page_build(&$page) { + // Note: ensure the same CSS is loaded in _drupal_maintenance_theme(). + $page['#attached']['library'][] = array('system', 'drupal.base'); $path = drupal_get_path('module', 'system'); // Use the CSS_AGGREGATE_SYSTEM group to load these early. $page['#attached']['css'][$path . '/system.base.css'] = array('group' => CSS_AGGREGATE_SYSTEM, 'every_page' => TRUE); diff --git a/core/modules/system/system.theme-rtl.css b/core/modules/system/system.theme-rtl.css index b2ee453..f5de071 100644 --- a/core/modules/system/system.theme-rtl.css +++ b/core/modules/system/system.theme-rtl.css @@ -1,22 +1,9 @@ - /** * @file * RTL styles for common markup. */ /** - * HTML elements. - */ -th { - text-align: right; - padding-left: 1em; - padding-right: 0; -} -caption { - text-align: right; -} - -/** * Markup generated by theme_item_list(). */ .item-list ul li { diff --git a/core/modules/system/system.theme.css b/core/modules/system/system.theme.css index dd36ce3..d6c7e39 100644 --- a/core/modules/system/system.theme.css +++ b/core/modules/system/system.theme.css @@ -1,48 +1,9 @@ - /** * @file * Basic styling for common markup. */ /** - * HTML elements. - */ -fieldset { - border: 1px solid #ccc; - margin: 1em 0; - padding: 0.5em; -} -form { - margin: 0; - padding: 0; -} -hr { - border: 1px solid gray; - height: 1px; -} -img { - border: 0; -} -table { - border-collapse: collapse; - width: 100%; -} -th { - padding-right: 1em; /* LTR */ - text-align: left; /* LTR */ -} -thead > tr { - border-bottom: 1px solid #000; -} -tr { - border-bottom: 1px solid #ccc; - padding: 0.1em 0.6em; -} -caption { - text-align: left; /* LTR */ -} - -/** * Publishing status. */ .unpublished { @@ -94,10 +55,6 @@ tr.even .form-item { .form-item .description { font-size: 0.85em; } -label { - display: block; - font-weight: bold; -} label.option { display: inline; font-weight: normal; -- 1.8.1.3