From da5359a4d4688d6b50501928cf50271d4429560e Mon Sep 17 00:00:00 2001 From: "jband%netscape.com" Date: Tue, 22 Aug 2000 06:57:32 +0000 Subject: [PATCH] Use hastable based nsStaticNameTable rather than slower and fatter AVLTree for static names. fix bug 48855. r=harishd,attinasi --- content/html/style/src/nsCSSKeywordList.h | 626 +++++++++++----------- content/html/style/src/nsCSSKeywords.h | 59 -- content/html/style/src/nsCSSPropList.h | 334 ++++++------ content/html/style/src/nsCSSProps.h | 2 +- content/shared/public/nsCSSKeywordList.h | 626 +++++++++++----------- content/shared/public/nsCSSKeywords.h | 2 +- content/shared/public/nsCSSPropList.h | 334 ++++++------ content/shared/public/nsCSSProps.h | 2 +- content/shared/src/nsCSSKeywords.cpp | 125 ++--- content/shared/src/nsCSSProps.cpp | 134 ++--- gfx/src/nsColorNames.cpp | 120 ++--- htmlparser/src/nsHTMLTagList.h | 154 ------ htmlparser/src/nsHTMLTags.cpp | 159 +++--- layout/html/style/src/nsCSSKeywordList.h | 626 +++++++++++----------- layout/html/style/src/nsCSSKeywords.cpp | 150 ------ layout/html/style/src/nsCSSKeywords.h | 59 -- layout/html/style/src/nsCSSPropList.h | 334 ++++++------ layout/html/style/src/nsCSSProps.cpp | 134 ++--- layout/html/style/src/nsCSSProps.h | 2 +- layout/style/nsCSSKeywordList.h | 626 +++++++++++----------- layout/style/nsCSSKeywords.cpp | 125 ++--- layout/style/nsCSSKeywords.h | 2 +- layout/style/nsCSSPropList.h | 334 ++++++------ layout/style/nsCSSProps.cpp | 134 ++--- layout/style/nsCSSProps.h | 2 +- parser/htmlparser/src/nsHTMLTagList.h | 154 ------ parser/htmlparser/src/nsHTMLTags.cpp | 159 +++--- 27 files changed, 2347 insertions(+), 3171 deletions(-) diff --git a/content/html/style/src/nsCSSKeywordList.h b/content/html/style/src/nsCSSKeywordList.h index 6cef8af569e..072d822669a 100644 --- a/content/html/style/src/nsCSSKeywordList.h +++ b/content/html/style/src/nsCSSKeywordList.h @@ -34,315 +34,323 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in keywords are automagically converted into hyphens + Requirements: + + Entries are in the form: (name,id). 'id' must always be the same as 'name' + except that all hyphens ('-') in 'name' are converted to underscores ('_') + in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** ******/ - -CSS_KEY(_moz_all) -CSS_KEY(_moz_bg_inset) -CSS_KEY(_moz_bg_outset) -CSS_KEY(_moz_center) -CSS_KEY(_moz_right) -CSS_KEY(_moz_pre_wrap) -CSS_KEY(_moz_scrollbars_none) -CSS_KEY(_moz_scrollbars_horizontal) -CSS_KEY(_moz_scrollbars_vertical) -CSS_KEY(above) -CSS_KEY(absolute) -CSS_KEY(activeborder) -CSS_KEY(activecaption) -CSS_KEY(alias) -CSS_KEY(all) -CSS_KEY(always) -CSS_KEY(appworkspace) -CSS_KEY(arabic_indic) -CSS_KEY(armenian) -CSS_KEY(auto) -CSS_KEY(avoid) -CSS_KEY(background) -CSS_KEY(baseline) -CSS_KEY(behind) -CSS_KEY(below) -CSS_KEY(bengali) -CSS_KEY(bidi_override) -CSS_KEY(blink) -CSS_KEY(block) -CSS_KEY(bold) -CSS_KEY(bolder) -CSS_KEY(border_box) -CSS_KEY(both) -CSS_KEY(bottom) -CSS_KEY(button) -CSS_KEY(buttonface) -CSS_KEY(buttonhighlight) -CSS_KEY(buttonshadow) -CSS_KEY(buttontext) -CSS_KEY(capitalize) -CSS_KEY(caption) -CSS_KEY(captiontext) -CSS_KEY(cell) -CSS_KEY(center) -CSS_KEY(center_left) -CSS_KEY(center_right) -CSS_KEY(ch) -CSS_KEY(circle) -CSS_KEY(cjk_earthly_branch) -CSS_KEY(cjk_heavenly_stem) -CSS_KEY(cjk_ideographic) -CSS_KEY(close_quote) -CSS_KEY(cm) -CSS_KEY(code) -CSS_KEY(collapse) -CSS_KEY(compact) -CSS_KEY(condensed) -CSS_KEY(content_box) -CSS_KEY(context_menu) -CSS_KEY(continuous) -CSS_KEY(copy) -CSS_KEY(count_down) -CSS_KEY(count_up) -CSS_KEY(count_up_down) -CSS_KEY(crop) -CSS_KEY(cross) -CSS_KEY(crosshair) -CSS_KEY(dashed) -CSS_KEY(decimal) -CSS_KEY(decimal_leading_zero) -CSS_KEY(default) -CSS_KEY(deg) -CSS_KEY(desktop) -CSS_KEY(devanagari) -CSS_KEY(dialog) -CSS_KEY(digits) -CSS_KEY(disabled) -CSS_KEY(disc) -CSS_KEY(document) -CSS_KEY(dotted) -CSS_KEY(double) -CSS_KEY(e_resize) -CSS_KEY(element) -CSS_KEY(elements) -CSS_KEY(em) -CSS_KEY(embed) -CSS_KEY(enabled) -CSS_KEY(ex) -CSS_KEY(expanded) -CSS_KEY(extra_condensed) -CSS_KEY(extra_expanded) -CSS_KEY(far_left) -CSS_KEY(far_right) -CSS_KEY(fast) -CSS_KEY(faster) -CSS_KEY(field) -CSS_KEY(fixed) -CSS_KEY(georgian) -CSS_KEY(grab) -CSS_KEY(grabbing) -CSS_KEY(grad) -CSS_KEY(graytext) -CSS_KEY(groove) -CSS_KEY(gujarati) -CSS_KEY(gurmukhi) -CSS_KEY(hebrew) -CSS_KEY(help) -CSS_KEY(hidden) -CSS_KEY(hide) -CSS_KEY(high) -CSS_KEY(higher) -CSS_KEY(highlight) -CSS_KEY(highlighttext) -CSS_KEY(hiragana) -CSS_KEY(hiragana_iroha) -CSS_KEY(horizontal) -CSS_KEY(hz) -CSS_KEY(icon) -CSS_KEY(ignore) -CSS_KEY(in) -CSS_KEY(inactiveborder) -CSS_KEY(inactivecaption) -CSS_KEY(inactivecaptiontext) -CSS_KEY(info) -CSS_KEY(infobackground) -CSS_KEY(infotext) -CSS_KEY(inherit) -CSS_KEY(inline) -CSS_KEY(inline_block) -CSS_KEY(inline_table) -CSS_KEY(inset) -CSS_KEY(inside) -CSS_KEY(invert) -CSS_KEY(italic) -CSS_KEY(japanese_formal) -CSS_KEY(japanese_informal) -CSS_KEY(justify) -CSS_KEY(kannada) -CSS_KEY(katakana) -CSS_KEY(katakana_iroha) -CSS_KEY(khmer) -CSS_KEY(khz) -CSS_KEY(landscape) -CSS_KEY(lao) -CSS_KEY(large) -CSS_KEY(larger) -CSS_KEY(left) -CSS_KEY(left_side) -CSS_KEY(leftwards) -CSS_KEY(level) -CSS_KEY(lighter) -CSS_KEY(line_through) -CSS_KEY(list) -CSS_KEY(list_item) -CSS_KEY(loud) -CSS_KEY(low) -CSS_KEY(lower) -CSS_KEY(lower_alpha) -CSS_KEY(lower_greek) -CSS_KEY(lower_latin) -CSS_KEY(lower_roman) -CSS_KEY(lowercase) -CSS_KEY(ltr) -CSS_KEY(malayalam) -CSS_KEY(margin_box) -CSS_KEY(marker) -CSS_KEY(medium) -CSS_KEY(menu) -CSS_KEY(menutext) -CSS_KEY(message_box) -CSS_KEY(middle) -CSS_KEY(mix) -CSS_KEY(mm) -CSS_KEY(move) -CSS_KEY(ms) -CSS_KEY(myanmar) -CSS_KEY(n_resize) -CSS_KEY(narrower) -CSS_KEY(ne_resize) -CSS_KEY(no_close_quote) -CSS_KEY(no_open_quote) -CSS_KEY(no_repeat) -CSS_KEY(none) -CSS_KEY(normal) -CSS_KEY(noshade) -CSS_KEY(nowrap) -CSS_KEY(nw_resize) -CSS_KEY(oblique) -CSS_KEY(once) -CSS_KEY(open_quote) -CSS_KEY(oriya) -CSS_KEY(outset) -CSS_KEY(outside) -CSS_KEY(overline) -CSS_KEY(padding_box) -CSS_KEY(paragraph) -CSS_KEY(pc) -CSS_KEY(persian) -CSS_KEY(pointer) -CSS_KEY(portrait) -CSS_KEY(pre) -CSS_KEY(pt) -CSS_KEY(pull_down_menu) -CSS_KEY(px) -CSS_KEY(rad) -CSS_KEY(read_only) -CSS_KEY(read_write) -CSS_KEY(relative) -CSS_KEY(repeat) -CSS_KEY(repeat_x) -CSS_KEY(repeat_y) -CSS_KEY(ridge) -CSS_KEY(right) -CSS_KEY(right_side) -CSS_KEY(rightwards) -CSS_KEY(rtl) -CSS_KEY(run_in) -CSS_KEY(s) -CSS_KEY(s_resize) -CSS_KEY(scroll) -CSS_KEY(scrollbar) -CSS_KEY(se_resize) -CSS_KEY(select_all) -CSS_KEY(select_before) -CSS_KEY(select_after) -CSS_KEY(select_same) -CSS_KEY(select_menu) -CSS_KEY(semi_condensed) -CSS_KEY(semi_expanded) -CSS_KEY(separate) -CSS_KEY(show) -CSS_KEY(silent) -CSS_KEY(simp_chinese_formal) -CSS_KEY(simp_chinese_informal) -CSS_KEY(slow) -CSS_KEY(slower) -CSS_KEY(small) -CSS_KEY(small_caps) -CSS_KEY(small_caption) -CSS_KEY(smaller) -CSS_KEY(soft) -CSS_KEY(solid) -CSS_KEY(spell_out) -CSS_KEY(spinning) -CSS_KEY(square) -CSS_KEY(start) -CSS_KEY(static) -CSS_KEY(status_bar) -CSS_KEY(sub) -CSS_KEY(super) -CSS_KEY(sw_resize) -CSS_KEY(table) -CSS_KEY(table_caption) -CSS_KEY(table_cell) -CSS_KEY(table_column) -CSS_KEY(table_column_group) -CSS_KEY(table_footer_group) -CSS_KEY(table_header_group) -CSS_KEY(table_row) -CSS_KEY(table_row_group) -CSS_KEY(tamil) -CSS_KEY(telugu) -CSS_KEY(text) -CSS_KEY(text_bottom) -CSS_KEY(text_top) -CSS_KEY(thai) -CSS_KEY(thick) -CSS_KEY(thin) -CSS_KEY(threeddarkshadow) -CSS_KEY(threedface) -CSS_KEY(threedhighlight) -CSS_KEY(threedlightshadow) -CSS_KEY(threedshadow) -CSS_KEY(toggle) -CSS_KEY(top) -CSS_KEY(trad_chinese_formal) -CSS_KEY(trad_chinese_informal) -CSS_KEY(transparent) -CSS_KEY(tri_state) -CSS_KEY(ultra_condensed) -CSS_KEY(ultra_expanded) -CSS_KEY(underline) -CSS_KEY(upper_alpha) -CSS_KEY(upper_latin) -CSS_KEY(upper_roman) -CSS_KEY(uppercase) -CSS_KEY(urdu) -CSS_KEY(vertical) -CSS_KEY(visible) -CSS_KEY(w_resize) -CSS_KEY(wait) -CSS_KEY(wider) -CSS_KEY(window) -CSS_KEY(windowframe) -CSS_KEY(windowtext) -CSS_KEY(workspace) -CSS_KEY(write_only) -CSS_KEY(x_fast) -CSS_KEY(x_high) -CSS_KEY(x_large) -CSS_KEY(x_loud) -CSS_KEY(x_low) -CSS_KEY(x_slow) -CSS_KEY(x_small) -CSS_KEY(x_soft) -CSS_KEY(xx_large) -CSS_KEY(xx_small) +CSS_KEY(-moz-all, _moz_all) +CSS_KEY(-moz-bg-inset, _moz_bg_inset) +CSS_KEY(-moz-bg-outset, _moz_bg_outset) +CSS_KEY(-moz-center, _moz_center) +CSS_KEY(-moz-right, _moz_right) +CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) +CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) +CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) +CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) +CSS_KEY(above, above) +CSS_KEY(absolute, absolute) +CSS_KEY(activeborder, activeborder) +CSS_KEY(activecaption, activecaption) +CSS_KEY(alias, alias) +CSS_KEY(all, all) +CSS_KEY(always, always) +CSS_KEY(appworkspace, appworkspace) +CSS_KEY(arabic-indic, arabic_indic) +CSS_KEY(armenian, armenian) +CSS_KEY(auto, auto) +CSS_KEY(avoid, avoid) +CSS_KEY(background, background) +CSS_KEY(baseline, baseline) +CSS_KEY(behind, behind) +CSS_KEY(below, below) +CSS_KEY(bengali, bengali) +CSS_KEY(bidi-override, bidi_override) +CSS_KEY(blink, blink) +CSS_KEY(block, block) +CSS_KEY(bold, bold) +CSS_KEY(bolder, bolder) +CSS_KEY(border-box, border_box) +CSS_KEY(both, both) +CSS_KEY(bottom, bottom) +CSS_KEY(button, button) +CSS_KEY(buttonface, buttonface) +CSS_KEY(buttonhighlight, buttonhighlight) +CSS_KEY(buttonshadow, buttonshadow) +CSS_KEY(buttontext, buttontext) +CSS_KEY(capitalize, capitalize) +CSS_KEY(caption, caption) +CSS_KEY(captiontext, captiontext) +CSS_KEY(cell, cell) +CSS_KEY(center, center) +CSS_KEY(center-left, center_left) +CSS_KEY(center-right, center_right) +CSS_KEY(ch, ch) +CSS_KEY(circle, circle) +CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) +CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) +CSS_KEY(cjk-ideographic, cjk_ideographic) +CSS_KEY(close-quote, close_quote) +CSS_KEY(cm, cm) +CSS_KEY(code, code) +CSS_KEY(collapse, collapse) +CSS_KEY(compact, compact) +CSS_KEY(condensed, condensed) +CSS_KEY(content-box, content_box) +CSS_KEY(context-menu, context_menu) +CSS_KEY(continuous, continuous) +CSS_KEY(copy, copy) +CSS_KEY(count-down, count_down) +CSS_KEY(count-up, count_up) +CSS_KEY(count-up-down, count_up_down) +CSS_KEY(crop, crop) +CSS_KEY(cross, cross) +CSS_KEY(crosshair, crosshair) +CSS_KEY(dashed, dashed) +CSS_KEY(decimal, decimal) +CSS_KEY(decimal-leading-zero, decimal_leading_zero) +CSS_KEY(default, default) +CSS_KEY(deg, deg) +CSS_KEY(desktop, desktop) +CSS_KEY(devanagari, devanagari) +CSS_KEY(dialog, dialog) +CSS_KEY(digits, digits) +CSS_KEY(disabled, disabled) +CSS_KEY(disc, disc) +CSS_KEY(document, document) +CSS_KEY(dotted, dotted) +CSS_KEY(double, double) +CSS_KEY(e-resize, e_resize) +CSS_KEY(element, element) +CSS_KEY(elements, elements) +CSS_KEY(em, em) +CSS_KEY(embed, embed) +CSS_KEY(enabled, enabled) +CSS_KEY(ex, ex) +CSS_KEY(expanded, expanded) +CSS_KEY(extra-condensed, extra_condensed) +CSS_KEY(extra-expanded, extra_expanded) +CSS_KEY(far-left, far_left) +CSS_KEY(far-right, far_right) +CSS_KEY(fast, fast) +CSS_KEY(faster, faster) +CSS_KEY(field, field) +CSS_KEY(fixed, fixed) +CSS_KEY(georgian, georgian) +CSS_KEY(grab, grab) +CSS_KEY(grabbing, grabbing) +CSS_KEY(grad, grad) +CSS_KEY(graytext, graytext) +CSS_KEY(groove, groove) +CSS_KEY(gujarati, gujarati) +CSS_KEY(gurmukhi, gurmukhi) +CSS_KEY(hebrew, hebrew) +CSS_KEY(help, help) +CSS_KEY(hidden, hidden) +CSS_KEY(hide, hide) +CSS_KEY(high, high) +CSS_KEY(higher, higher) +CSS_KEY(highlight, highlight) +CSS_KEY(highlighttext, highlighttext) +CSS_KEY(hiragana, hiragana) +CSS_KEY(hiragana-iroha, hiragana_iroha) +CSS_KEY(horizontal, horizontal) +CSS_KEY(hz, hz) +CSS_KEY(icon, icon) +CSS_KEY(ignore, ignore) +CSS_KEY(in, in) +CSS_KEY(inactiveborder, inactiveborder) +CSS_KEY(inactivecaption, inactivecaption) +CSS_KEY(inactivecaptiontext, inactivecaptiontext) +CSS_KEY(info, info) +CSS_KEY(infobackground, infobackground) +CSS_KEY(infotext, infotext) +CSS_KEY(inherit, inherit) +CSS_KEY(inline, inline) +CSS_KEY(inline-block, inline_block) +CSS_KEY(inline-table, inline_table) +CSS_KEY(inset, inset) +CSS_KEY(inside, inside) +CSS_KEY(invert, invert) +CSS_KEY(italic, italic) +CSS_KEY(japanese-formal, japanese_formal) +CSS_KEY(japanese-informal, japanese_informal) +CSS_KEY(justify, justify) +CSS_KEY(kannada, kannada) +CSS_KEY(katakana, katakana) +CSS_KEY(katakana-iroha, katakana_iroha) +CSS_KEY(khmer, khmer) +CSS_KEY(khz, khz) +CSS_KEY(landscape, landscape) +CSS_KEY(lao, lao) +CSS_KEY(large, large) +CSS_KEY(larger, larger) +CSS_KEY(left, left) +CSS_KEY(left-side, left_side) +CSS_KEY(leftwards, leftwards) +CSS_KEY(level, level) +CSS_KEY(lighter, lighter) +CSS_KEY(line-through, line_through) +CSS_KEY(list, list) +CSS_KEY(list-item, list_item) +CSS_KEY(loud, loud) +CSS_KEY(low, low) +CSS_KEY(lower, lower) +CSS_KEY(lower-alpha, lower_alpha) +CSS_KEY(lower-greek, lower_greek) +CSS_KEY(lower-latin, lower_latin) +CSS_KEY(lower-roman, lower_roman) +CSS_KEY(lowercase, lowercase) +CSS_KEY(ltr, ltr) +CSS_KEY(malayalam, malayalam) +CSS_KEY(margin-box, margin_box) +CSS_KEY(marker, marker) +CSS_KEY(medium, medium) +CSS_KEY(menu, menu) +CSS_KEY(menutext, menutext) +CSS_KEY(message-box, message_box) +CSS_KEY(middle, middle) +CSS_KEY(mix, mix) +CSS_KEY(mm, mm) +CSS_KEY(move, move) +CSS_KEY(ms, ms) +CSS_KEY(myanmar, myanmar) +CSS_KEY(n-resize, n_resize) +CSS_KEY(narrower, narrower) +CSS_KEY(ne-resize, ne_resize) +CSS_KEY(no-close-quote, no_close_quote) +CSS_KEY(no-open-quote, no_open_quote) +CSS_KEY(no-repeat, no_repeat) +CSS_KEY(none, none) +CSS_KEY(normal, normal) +CSS_KEY(noshade, noshade) +CSS_KEY(nowrap, nowrap) +CSS_KEY(nw-resize, nw_resize) +CSS_KEY(oblique, oblique) +CSS_KEY(once, once) +CSS_KEY(open-quote, open_quote) +CSS_KEY(oriya, oriya) +CSS_KEY(outset, outset) +CSS_KEY(outside, outside) +CSS_KEY(overline, overline) +CSS_KEY(padding-box, padding_box) +CSS_KEY(paragraph, paragraph) +CSS_KEY(pc, pc) +CSS_KEY(persian, persian) +CSS_KEY(pointer, pointer) +CSS_KEY(portrait, portrait) +CSS_KEY(pre, pre) +CSS_KEY(pt, pt) +CSS_KEY(pull-down-menu, pull_down_menu) +CSS_KEY(px, px) +CSS_KEY(rad, rad) +CSS_KEY(read-only, read_only) +CSS_KEY(read-write, read_write) +CSS_KEY(relative, relative) +CSS_KEY(repeat, repeat) +CSS_KEY(repeat-x, repeat_x) +CSS_KEY(repeat-y, repeat_y) +CSS_KEY(ridge, ridge) +CSS_KEY(right, right) +CSS_KEY(right-side, right_side) +CSS_KEY(rightwards, rightwards) +CSS_KEY(rtl, rtl) +CSS_KEY(run-in, run_in) +CSS_KEY(s, s) +CSS_KEY(s-resize, s_resize) +CSS_KEY(scroll, scroll) +CSS_KEY(scrollbar, scrollbar) +CSS_KEY(se-resize, se_resize) +CSS_KEY(select-all, select_all) +CSS_KEY(select-before, select_before) +CSS_KEY(select-after, select_after) +CSS_KEY(select-same, select_same) +CSS_KEY(select-menu, select_menu) +CSS_KEY(semi-condensed, semi_condensed) +CSS_KEY(semi-expanded, semi_expanded) +CSS_KEY(separate, separate) +CSS_KEY(show, show) +CSS_KEY(silent, silent) +CSS_KEY(simp-chinese-formal, simp_chinese_formal) +CSS_KEY(simp-chinese-informal, simp_chinese_informal) +CSS_KEY(slow, slow) +CSS_KEY(slower, slower) +CSS_KEY(small, small) +CSS_KEY(small-caps, small_caps) +CSS_KEY(small-caption, small_caption) +CSS_KEY(smaller, smaller) +CSS_KEY(soft, soft) +CSS_KEY(solid, solid) +CSS_KEY(spell-out, spell_out) +CSS_KEY(spinning, spinning) +CSS_KEY(square, square) +CSS_KEY(start, start) +CSS_KEY(static, static) +CSS_KEY(status-bar, status_bar) +CSS_KEY(sub, sub) +CSS_KEY(super, super) +CSS_KEY(sw-resize, sw_resize) +CSS_KEY(table, table) +CSS_KEY(table-caption, table_caption) +CSS_KEY(table-cell, table_cell) +CSS_KEY(table-column, table_column) +CSS_KEY(table-column-group, table_column_group) +CSS_KEY(table-footer-group, table_footer_group) +CSS_KEY(table-header-group, table_header_group) +CSS_KEY(table-row, table_row) +CSS_KEY(table-row-group, table_row_group) +CSS_KEY(tamil, tamil) +CSS_KEY(telugu, telugu) +CSS_KEY(text, text) +CSS_KEY(text-bottom, text_bottom) +CSS_KEY(text-top, text_top) +CSS_KEY(thai, thai) +CSS_KEY(thick, thick) +CSS_KEY(thin, thin) +CSS_KEY(threeddarkshadow, threeddarkshadow) +CSS_KEY(threedface, threedface) +CSS_KEY(threedhighlight, threedhighlight) +CSS_KEY(threedlightshadow, threedlightshadow) +CSS_KEY(threedshadow, threedshadow) +CSS_KEY(toggle, toggle) +CSS_KEY(top, top) +CSS_KEY(trad-chinese-formal, trad_chinese_formal) +CSS_KEY(trad-chinese-informal, trad_chinese_informal) +CSS_KEY(transparent, transparent) +CSS_KEY(tri-state, tri_state) +CSS_KEY(ultra-condensed, ultra_condensed) +CSS_KEY(ultra-expanded, ultra_expanded) +CSS_KEY(underline, underline) +CSS_KEY(upper-alpha, upper_alpha) +CSS_KEY(upper-latin, upper_latin) +CSS_KEY(upper-roman, upper_roman) +CSS_KEY(uppercase, uppercase) +CSS_KEY(urdu, urdu) +CSS_KEY(vertical, vertical) +CSS_KEY(visible, visible) +CSS_KEY(w-resize, w_resize) +CSS_KEY(wait, wait) +CSS_KEY(wider, wider) +CSS_KEY(window, window) +CSS_KEY(windowframe, windowframe) +CSS_KEY(windowtext, windowtext) +CSS_KEY(workspace, workspace) +CSS_KEY(write-only, write_only) +CSS_KEY(x-fast, x_fast) +CSS_KEY(x-high, x_high) +CSS_KEY(x-large, x_large) +CSS_KEY(x-loud, x_loud) +CSS_KEY(x-low, x_low) +CSS_KEY(x-slow, x_slow) +CSS_KEY(x-small, x_small) +CSS_KEY(x-soft, x_soft) +CSS_KEY(xx-large, xx_large) +CSS_KEY(xx-small, xx_small) diff --git a/content/html/style/src/nsCSSKeywords.h b/content/html/style/src/nsCSSKeywords.h index 4473a0c3bac..e69de29bb2d 100644 --- a/content/html/style/src/nsCSSKeywords.h +++ b/content/html/style/src/nsCSSKeywords.h @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSKeywords_h___ -#define nsCSSKeywords_h___ - -#include "nslayout.h" - -class nsString; -class nsCString; - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSKeyword_foo" (where foo is the keyword) - - To change the list of keywords, see nsCSSKeywordList.h - - */ -#define CSS_KEY(_key) eCSSKeyword_##_key, -enum nsCSSKeyword { - eCSSKeyword_UNKNOWN = -1, -#include "nsCSSKeywordList.h" - eCSSKeyword_COUNT -}; -#undef CSS_KEY - - -class NS_LAYOUT nsCSSKeywords { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a keyword string, return the enum value - static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); - static nsCSSKeyword LookupKeyword(const nsString& aKeyword); - - // Given a keyword enum, get the string value - static const nsCString& GetStringValue(nsCSSKeyword aKeyword); -}; - -#endif /* nsCSSKeywords_h___ */ diff --git a/content/html/style/src/nsCSSPropList.h b/content/html/style/src/nsCSSPropList.h index 2430d27798d..a7dd2d34ffa 100644 --- a/content/html/style/src/nsCSSPropList.h +++ b/content/html/style/src/nsCSSPropList.h @@ -34,171 +34,177 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in properties are automagically converted into hyphens + Requirements: - The first argument to CSS_PROP is both the enum identifier of the property - and the string value - The second argument is the style impact resultant in a change to the property + Entries are in the form: (name,id,impact). 'id' must always be the same as + 'name' except that all hyphens ('-') in 'name' are converted to underscores + ('_') in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** + + The third argument is the style impact resultant in a change to the property ******/ -CSS_PROP(_moz_border_radius, VISUAL) -CSS_PROP(_moz_border_radius_topLeft, VISUAL) -CSS_PROP(_moz_border_radius_topRight, VISUAL) -CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_border_radius_bottomRight, VISUAL) -CSS_PROP(_moz_outline_radius, VISUAL) -CSS_PROP(_moz_outline_radius_topLeft, VISUAL) -CSS_PROP(_moz_outline_radius_topRight, VISUAL) -CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) -CSS_PROP(azimuth, AURAL) -CSS_PROP(background, VISUAL) -CSS_PROP(background_attachment, VISUAL) -CSS_PROP(background_color, VISUAL) -CSS_PROP(background_image, VISUAL) -CSS_PROP(background_position, VISUAL) -CSS_PROP(background_repeat, VISUAL) -CSS_PROP(background_x_position, VISUAL) -CSS_PROP(background_y_position, VISUAL) -CSS_PROP(behavior, REFLOW) -CSS_PROP(border, REFLOW) -CSS_PROP(border_bottom, REFLOW) -CSS_PROP(border_bottom_color, VISUAL) -CSS_PROP(border_bottom_style, REFLOW) // on/off will need reflow -CSS_PROP(border_bottom_width, REFLOW) -CSS_PROP(border_collapse, REFLOW) -CSS_PROP(border_color, VISUAL) -CSS_PROP(border_left, REFLOW) -CSS_PROP(border_left_color, VISUAL) -CSS_PROP(border_left_style, REFLOW) // on/off will need reflow -CSS_PROP(border_left_width, REFLOW) -CSS_PROP(border_right, REFLOW) -CSS_PROP(border_right_color, VISUAL) -CSS_PROP(border_right_style, REFLOW) // on/off will need reflow -CSS_PROP(border_right_width, REFLOW) -CSS_PROP(border_spacing, REFLOW) -CSS_PROP(border_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top, REFLOW) -CSS_PROP(border_top_color, VISUAL) -CSS_PROP(border_top_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top_width, REFLOW) -CSS_PROP(border_width, REFLOW) -CSS_PROP(border_x_spacing, REFLOW) -CSS_PROP(border_y_spacing, REFLOW) -CSS_PROP(bottom, REFLOW) -CSS_PROP(box_sizing, REFLOW) -CSS_PROP(caption_side, REFLOW) -CSS_PROP(clear, REFLOW) -CSS_PROP(clip, VISUAL) -CSS_PROP(clip_bottom, VISUAL) -CSS_PROP(clip_left, VISUAL) -CSS_PROP(clip_right, VISUAL) -CSS_PROP(clip_top, VISUAL) -CSS_PROP(color, VISUAL) -CSS_PROP(content, FRAMECHANGE) -CSS_PROP(counter_increment, REFLOW) -CSS_PROP(counter_reset, REFLOW) -CSS_PROP(cue, AURAL) -CSS_PROP(cue_after, AURAL) -CSS_PROP(cue_before, AURAL) -CSS_PROP(cursor, VISUAL) -CSS_PROP(direction, REFLOW) -CSS_PROP(display, FRAMECHANGE) -CSS_PROP(elevation, AURAL) -CSS_PROP(empty_cells, VISUAL) -CSS_PROP(float, FRAMECHANGE) -CSS_PROP(float_edge, REFLOW) -CSS_PROP(font, REFLOW) -CSS_PROP(font_family, REFLOW) -CSS_PROP(font_size, REFLOW) -CSS_PROP(font_size_adjust, REFLOW) -CSS_PROP(font_stretch, REFLOW) -CSS_PROP(font_style, REFLOW) -CSS_PROP(font_variant, REFLOW) -CSS_PROP(font_weight, REFLOW) -CSS_PROP(height, REFLOW) -CSS_PROP(key_equivalent, CONTENT) // This will need some other notification, but what? -CSS_PROP(left, REFLOW) -CSS_PROP(letter_spacing, REFLOW) -CSS_PROP(line_height, REFLOW) -CSS_PROP(list_style, REFLOW) -CSS_PROP(list_style_image, REFLOW) -CSS_PROP(list_style_position, REFLOW) -CSS_PROP(list_style_type, REFLOW) -CSS_PROP(margin, REFLOW) -CSS_PROP(margin_bottom, REFLOW) -CSS_PROP(margin_left, REFLOW) -CSS_PROP(margin_right, REFLOW) -CSS_PROP(margin_top, REFLOW) -CSS_PROP(marker_offset, REFLOW) -CSS_PROP(marks, VISUAL) -CSS_PROP(max_height, REFLOW) -CSS_PROP(max_width, REFLOW) -CSS_PROP(min_height, REFLOW) -CSS_PROP(min_width, REFLOW) -CSS_PROP(opacity, VISUAL) -CSS_PROP(orphans, REFLOW) -CSS_PROP(outline, VISUAL) -CSS_PROP(outline_color, VISUAL) -CSS_PROP(outline_style, VISUAL) -CSS_PROP(outline_width, VISUAL) -CSS_PROP(overflow, FRAMECHANGE) -CSS_PROP(padding, REFLOW) -CSS_PROP(padding_bottom, REFLOW) -CSS_PROP(padding_left, REFLOW) -CSS_PROP(padding_right, REFLOW) -CSS_PROP(padding_top, REFLOW) -CSS_PROP(page, REFLOW) -CSS_PROP(page_break_after, REFLOW) -CSS_PROP(page_break_before, REFLOW) -CSS_PROP(page_break_inside, REFLOW) -CSS_PROP(pause, AURAL) -CSS_PROP(pause_after, AURAL) -CSS_PROP(pause_before, AURAL) -CSS_PROP(pitch, AURAL) -CSS_PROP(pitch_range, AURAL) -CSS_PROP(play_during, AURAL) -CSS_PROP(play_during_flags, AURAL) -CSS_PROP(position, FRAMECHANGE) -CSS_PROP(quotes, REFLOW) -CSS_PROP(quotes_close, REFLOW) -CSS_PROP(quotes_open, REFLOW) -CSS_PROP(resizer, FRAMECHANGE) -CSS_PROP(richness, AURAL) -CSS_PROP(right, REFLOW) -CSS_PROP(size, REFLOW) -CSS_PROP(size_height, REFLOW) -CSS_PROP(size_width, REFLOW) -CSS_PROP(speak, AURAL) -CSS_PROP(speak_header, AURAL) -CSS_PROP(speak_numeral, AURAL) -CSS_PROP(speak_punctuation, AURAL) -CSS_PROP(speech_rate, AURAL) -CSS_PROP(stress, AURAL) -CSS_PROP(table_layout, REFLOW) -CSS_PROP(text_align, REFLOW) -CSS_PROP(text_decoration, VISUAL) -CSS_PROP(text_indent, REFLOW) -CSS_PROP(text_shadow, VISUAL) -CSS_PROP(text_shadow_color, VISUAL) -CSS_PROP(text_shadow_radius, VISUAL) -CSS_PROP(text_shadow_x, VISUAL) -CSS_PROP(text_shadow_y, VISUAL) -CSS_PROP(text_transform, REFLOW) -CSS_PROP(top, REFLOW) -CSS_PROP(unicode_bidi, REFLOW) -CSS_PROP(user_focus, CONTENT) -CSS_PROP(user_input, FRAMECHANGE) // XXX ??? -CSS_PROP(user_modify, FRAMECHANGE) -CSS_PROP(user_select, CONTENT) -CSS_PROP(vertical_align, REFLOW) -CSS_PROP(visibility, REFLOW) // reflow for collapse -CSS_PROP(voice_family, AURAL) -CSS_PROP(volume, AURAL) -CSS_PROP(white_space, REFLOW) -CSS_PROP(widows, REFLOW) -CSS_PROP(width, REFLOW) -CSS_PROP(word_spacing, REFLOW) -CSS_PROP(z_index, REFLOW) - +CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL) +CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL) +CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL) +CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL) +CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL) +CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL) +CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL) +CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL) +CSS_PROP(azimuth, azimuth, AURAL) +CSS_PROP(background, background, VISUAL) +CSS_PROP(background-attachment, background_attachment, VISUAL) +CSS_PROP(background-color, background_color, VISUAL) +CSS_PROP(background-image, background_image, VISUAL) +CSS_PROP(background-position, background_position, VISUAL) +CSS_PROP(background-repeat, background_repeat, VISUAL) +CSS_PROP(background-x-position, background_x_position, VISUAL) +CSS_PROP(background-y-position, background_y_position, VISUAL) +CSS_PROP(behavior, behavior, REFLOW) +CSS_PROP(border, border, REFLOW) +CSS_PROP(border-bottom, border_bottom, REFLOW) +CSS_PROP(border-bottom-color, border_bottom_color, VISUAL) +CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow +CSS_PROP(border-bottom-width, border_bottom_width, REFLOW) +CSS_PROP(border-collapse, border_collapse, REFLOW) +CSS_PROP(border-color, border_color, VISUAL) +CSS_PROP(border-left, border_left, REFLOW) +CSS_PROP(border-left-color, border_left_color, VISUAL) +CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow +CSS_PROP(border-left-width, border_left_width, REFLOW) +CSS_PROP(border-right, border_right, REFLOW) +CSS_PROP(border-right-color, border_right_color, VISUAL) +CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow +CSS_PROP(border-right-width, border_right_width, REFLOW) +CSS_PROP(border-spacing, border_spacing, REFLOW) +CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top, border_top, REFLOW) +CSS_PROP(border-top-color, border_top_color, VISUAL) +CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top-width, border_top_width, REFLOW) +CSS_PROP(border-width, border_width, REFLOW) +CSS_PROP(border-x-spacing, border_x_spacing, REFLOW) +CSS_PROP(border-y-spacing, border_y_spacing, REFLOW) +CSS_PROP(bottom, bottom, REFLOW) +CSS_PROP(box-sizing, box_sizing, REFLOW) +CSS_PROP(caption-side, caption_side, REFLOW) +CSS_PROP(clear, clear, REFLOW) +CSS_PROP(clip, clip, VISUAL) +CSS_PROP(clip-bottom, clip_bottom, VISUAL) +CSS_PROP(clip-left, clip_left, VISUAL) +CSS_PROP(clip-right, clip_right, VISUAL) +CSS_PROP(clip-top, clip_top, VISUAL) +CSS_PROP(color, color, VISUAL) +CSS_PROP(content, content, FRAMECHANGE) +CSS_PROP(counter-increment, counter_increment, REFLOW) +CSS_PROP(counter-reset, counter_reset, REFLOW) +CSS_PROP(cue, cue, AURAL) +CSS_PROP(cue-after, cue_after, AURAL) +CSS_PROP(cue-before, cue_before, AURAL) +CSS_PROP(cursor, cursor, VISUAL) +CSS_PROP(direction, direction, REFLOW) +CSS_PROP(display, display, FRAMECHANGE) +CSS_PROP(elevation, elevation, AURAL) +CSS_PROP(empty-cells, empty_cells, VISUAL) +CSS_PROP(float, float, FRAMECHANGE) +CSS_PROP(float-edge, float_edge, REFLOW) +CSS_PROP(font, font, REFLOW) +CSS_PROP(font-family, font_family, REFLOW) +CSS_PROP(font-size, font_size, REFLOW) +CSS_PROP(font-size-adjust, font_size_adjust, REFLOW) +CSS_PROP(font-stretch, font_stretch, REFLOW) +CSS_PROP(font-style, font_style, REFLOW) +CSS_PROP(font-variant, font_variant, REFLOW) +CSS_PROP(font-weight, font_weight, REFLOW) +CSS_PROP(height, height, REFLOW) +CSS_PROP(key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? +CSS_PROP(left, left, REFLOW) +CSS_PROP(letter-spacing, letter_spacing, REFLOW) +CSS_PROP(line-height, line_height, REFLOW) +CSS_PROP(list-style, list_style, REFLOW) +CSS_PROP(list-style-image, list_style_image, REFLOW) +CSS_PROP(list-style-position, list_style_position, REFLOW) +CSS_PROP(list-style-type, list_style_type, REFLOW) +CSS_PROP(margin, margin, REFLOW) +CSS_PROP(margin-bottom, margin_bottom, REFLOW) +CSS_PROP(margin-left, margin_left, REFLOW) +CSS_PROP(margin-right, margin_right, REFLOW) +CSS_PROP(margin-top, margin_top, REFLOW) +CSS_PROP(marker-offset, marker_offset, REFLOW) +CSS_PROP(marks, marks, VISUAL) +CSS_PROP(max-height, max_height, REFLOW) +CSS_PROP(max-width, max_width, REFLOW) +CSS_PROP(min-height, min_height, REFLOW) +CSS_PROP(min-width, min_width, REFLOW) +CSS_PROP(opacity, opacity, VISUAL) +CSS_PROP(orphans, orphans, REFLOW) +CSS_PROP(outline, outline, VISUAL) +CSS_PROP(outline-color, outline_color, VISUAL) +CSS_PROP(outline-style, outline_style, VISUAL) +CSS_PROP(outline-width, outline_width, VISUAL) +CSS_PROP(overflow, overflow, FRAMECHANGE) +CSS_PROP(padding, padding, REFLOW) +CSS_PROP(padding-bottom, padding_bottom, REFLOW) +CSS_PROP(padding-left, padding_left, REFLOW) +CSS_PROP(padding-right, padding_right, REFLOW) +CSS_PROP(padding-top, padding_top, REFLOW) +CSS_PROP(page, page, REFLOW) +CSS_PROP(page-break-after, page_break_after, REFLOW) +CSS_PROP(page-break-before, page_break_before, REFLOW) +CSS_PROP(page-break-inside, page_break_inside, REFLOW) +CSS_PROP(pause, pause, AURAL) +CSS_PROP(pause-after, pause_after, AURAL) +CSS_PROP(pause-before, pause_before, AURAL) +CSS_PROP(pitch, pitch, AURAL) +CSS_PROP(pitch-range, pitch_range, AURAL) +CSS_PROP(play-during, play_during, AURAL) +CSS_PROP(play-during-flags, play_during_flags, AURAL) +CSS_PROP(position, position, FRAMECHANGE) +CSS_PROP(quotes, quotes, REFLOW) +CSS_PROP(quotes-close, quotes_close, REFLOW) +CSS_PROP(quotes-open, quotes_open, REFLOW) +CSS_PROP(resizer, resizer, FRAMECHANGE) +CSS_PROP(richness, richness, AURAL) +CSS_PROP(right, right, REFLOW) +CSS_PROP(size, size, REFLOW) +CSS_PROP(size-height, size_height, REFLOW) +CSS_PROP(size-width, size_width, REFLOW) +CSS_PROP(speak, speak, AURAL) +CSS_PROP(speak-header, speak_header, AURAL) +CSS_PROP(speak-numeral, speak_numeral, AURAL) +CSS_PROP(speak-punctuation, speak_punctuation, AURAL) +CSS_PROP(speech-rate, speech_rate, AURAL) +CSS_PROP(stress, stress, AURAL) +CSS_PROP(table-layout, table_layout, REFLOW) +CSS_PROP(text-align, text_align, REFLOW) +CSS_PROP(text-decoration, text_decoration, VISUAL) +CSS_PROP(text-indent, text_indent, REFLOW) +CSS_PROP(text-shadow, text_shadow, VISUAL) +CSS_PROP(text-shadow-color, text_shadow_color, VISUAL) +CSS_PROP(text-shadow-radius, text_shadow_radius, VISUAL) +CSS_PROP(text-shadow-x, text_shadow_x, VISUAL) +CSS_PROP(text-shadow-y, text_shadow_y, VISUAL) +CSS_PROP(text-transform, text_transform, REFLOW) +CSS_PROP(top, top, REFLOW) +CSS_PROP(unicode-bidi, unicode_bidi, REFLOW) +CSS_PROP(user-focus, user_focus, CONTENT) +CSS_PROP(user-input, user_input, FRAMECHANGE) // XXX ??? +CSS_PROP(user-modify, user_modify, FRAMECHANGE) +CSS_PROP(user-select, user_select, CONTENT) +CSS_PROP(vertical-align, vertical_align, REFLOW) +CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse +CSS_PROP(voice-family, voice_family, AURAL) +CSS_PROP(volume, volume, AURAL) +CSS_PROP(white-space, white_space, REFLOW) +CSS_PROP(widows, widows, REFLOW) +CSS_PROP(width, width, REFLOW) +CSS_PROP(word-spacing, word_spacing, REFLOW) +CSS_PROP(z-index, z_index, REFLOW) diff --git a/content/html/style/src/nsCSSProps.h b/content/html/style/src/nsCSSProps.h index 81778dd3ff8..316d3506d38 100644 --- a/content/html/style/src/nsCSSProps.h +++ b/content/html/style/src/nsCSSProps.h @@ -34,7 +34,7 @@ class nsString; To change the list of properties, see nsCSSPropList.h */ -#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, enum nsCSSProperty { eCSSProperty_UNKNOWN = -1, #include "nsCSSPropList.h" diff --git a/content/shared/public/nsCSSKeywordList.h b/content/shared/public/nsCSSKeywordList.h index 6cef8af569e..072d822669a 100644 --- a/content/shared/public/nsCSSKeywordList.h +++ b/content/shared/public/nsCSSKeywordList.h @@ -34,315 +34,323 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in keywords are automagically converted into hyphens + Requirements: + + Entries are in the form: (name,id). 'id' must always be the same as 'name' + except that all hyphens ('-') in 'name' are converted to underscores ('_') + in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** ******/ - -CSS_KEY(_moz_all) -CSS_KEY(_moz_bg_inset) -CSS_KEY(_moz_bg_outset) -CSS_KEY(_moz_center) -CSS_KEY(_moz_right) -CSS_KEY(_moz_pre_wrap) -CSS_KEY(_moz_scrollbars_none) -CSS_KEY(_moz_scrollbars_horizontal) -CSS_KEY(_moz_scrollbars_vertical) -CSS_KEY(above) -CSS_KEY(absolute) -CSS_KEY(activeborder) -CSS_KEY(activecaption) -CSS_KEY(alias) -CSS_KEY(all) -CSS_KEY(always) -CSS_KEY(appworkspace) -CSS_KEY(arabic_indic) -CSS_KEY(armenian) -CSS_KEY(auto) -CSS_KEY(avoid) -CSS_KEY(background) -CSS_KEY(baseline) -CSS_KEY(behind) -CSS_KEY(below) -CSS_KEY(bengali) -CSS_KEY(bidi_override) -CSS_KEY(blink) -CSS_KEY(block) -CSS_KEY(bold) -CSS_KEY(bolder) -CSS_KEY(border_box) -CSS_KEY(both) -CSS_KEY(bottom) -CSS_KEY(button) -CSS_KEY(buttonface) -CSS_KEY(buttonhighlight) -CSS_KEY(buttonshadow) -CSS_KEY(buttontext) -CSS_KEY(capitalize) -CSS_KEY(caption) -CSS_KEY(captiontext) -CSS_KEY(cell) -CSS_KEY(center) -CSS_KEY(center_left) -CSS_KEY(center_right) -CSS_KEY(ch) -CSS_KEY(circle) -CSS_KEY(cjk_earthly_branch) -CSS_KEY(cjk_heavenly_stem) -CSS_KEY(cjk_ideographic) -CSS_KEY(close_quote) -CSS_KEY(cm) -CSS_KEY(code) -CSS_KEY(collapse) -CSS_KEY(compact) -CSS_KEY(condensed) -CSS_KEY(content_box) -CSS_KEY(context_menu) -CSS_KEY(continuous) -CSS_KEY(copy) -CSS_KEY(count_down) -CSS_KEY(count_up) -CSS_KEY(count_up_down) -CSS_KEY(crop) -CSS_KEY(cross) -CSS_KEY(crosshair) -CSS_KEY(dashed) -CSS_KEY(decimal) -CSS_KEY(decimal_leading_zero) -CSS_KEY(default) -CSS_KEY(deg) -CSS_KEY(desktop) -CSS_KEY(devanagari) -CSS_KEY(dialog) -CSS_KEY(digits) -CSS_KEY(disabled) -CSS_KEY(disc) -CSS_KEY(document) -CSS_KEY(dotted) -CSS_KEY(double) -CSS_KEY(e_resize) -CSS_KEY(element) -CSS_KEY(elements) -CSS_KEY(em) -CSS_KEY(embed) -CSS_KEY(enabled) -CSS_KEY(ex) -CSS_KEY(expanded) -CSS_KEY(extra_condensed) -CSS_KEY(extra_expanded) -CSS_KEY(far_left) -CSS_KEY(far_right) -CSS_KEY(fast) -CSS_KEY(faster) -CSS_KEY(field) -CSS_KEY(fixed) -CSS_KEY(georgian) -CSS_KEY(grab) -CSS_KEY(grabbing) -CSS_KEY(grad) -CSS_KEY(graytext) -CSS_KEY(groove) -CSS_KEY(gujarati) -CSS_KEY(gurmukhi) -CSS_KEY(hebrew) -CSS_KEY(help) -CSS_KEY(hidden) -CSS_KEY(hide) -CSS_KEY(high) -CSS_KEY(higher) -CSS_KEY(highlight) -CSS_KEY(highlighttext) -CSS_KEY(hiragana) -CSS_KEY(hiragana_iroha) -CSS_KEY(horizontal) -CSS_KEY(hz) -CSS_KEY(icon) -CSS_KEY(ignore) -CSS_KEY(in) -CSS_KEY(inactiveborder) -CSS_KEY(inactivecaption) -CSS_KEY(inactivecaptiontext) -CSS_KEY(info) -CSS_KEY(infobackground) -CSS_KEY(infotext) -CSS_KEY(inherit) -CSS_KEY(inline) -CSS_KEY(inline_block) -CSS_KEY(inline_table) -CSS_KEY(inset) -CSS_KEY(inside) -CSS_KEY(invert) -CSS_KEY(italic) -CSS_KEY(japanese_formal) -CSS_KEY(japanese_informal) -CSS_KEY(justify) -CSS_KEY(kannada) -CSS_KEY(katakana) -CSS_KEY(katakana_iroha) -CSS_KEY(khmer) -CSS_KEY(khz) -CSS_KEY(landscape) -CSS_KEY(lao) -CSS_KEY(large) -CSS_KEY(larger) -CSS_KEY(left) -CSS_KEY(left_side) -CSS_KEY(leftwards) -CSS_KEY(level) -CSS_KEY(lighter) -CSS_KEY(line_through) -CSS_KEY(list) -CSS_KEY(list_item) -CSS_KEY(loud) -CSS_KEY(low) -CSS_KEY(lower) -CSS_KEY(lower_alpha) -CSS_KEY(lower_greek) -CSS_KEY(lower_latin) -CSS_KEY(lower_roman) -CSS_KEY(lowercase) -CSS_KEY(ltr) -CSS_KEY(malayalam) -CSS_KEY(margin_box) -CSS_KEY(marker) -CSS_KEY(medium) -CSS_KEY(menu) -CSS_KEY(menutext) -CSS_KEY(message_box) -CSS_KEY(middle) -CSS_KEY(mix) -CSS_KEY(mm) -CSS_KEY(move) -CSS_KEY(ms) -CSS_KEY(myanmar) -CSS_KEY(n_resize) -CSS_KEY(narrower) -CSS_KEY(ne_resize) -CSS_KEY(no_close_quote) -CSS_KEY(no_open_quote) -CSS_KEY(no_repeat) -CSS_KEY(none) -CSS_KEY(normal) -CSS_KEY(noshade) -CSS_KEY(nowrap) -CSS_KEY(nw_resize) -CSS_KEY(oblique) -CSS_KEY(once) -CSS_KEY(open_quote) -CSS_KEY(oriya) -CSS_KEY(outset) -CSS_KEY(outside) -CSS_KEY(overline) -CSS_KEY(padding_box) -CSS_KEY(paragraph) -CSS_KEY(pc) -CSS_KEY(persian) -CSS_KEY(pointer) -CSS_KEY(portrait) -CSS_KEY(pre) -CSS_KEY(pt) -CSS_KEY(pull_down_menu) -CSS_KEY(px) -CSS_KEY(rad) -CSS_KEY(read_only) -CSS_KEY(read_write) -CSS_KEY(relative) -CSS_KEY(repeat) -CSS_KEY(repeat_x) -CSS_KEY(repeat_y) -CSS_KEY(ridge) -CSS_KEY(right) -CSS_KEY(right_side) -CSS_KEY(rightwards) -CSS_KEY(rtl) -CSS_KEY(run_in) -CSS_KEY(s) -CSS_KEY(s_resize) -CSS_KEY(scroll) -CSS_KEY(scrollbar) -CSS_KEY(se_resize) -CSS_KEY(select_all) -CSS_KEY(select_before) -CSS_KEY(select_after) -CSS_KEY(select_same) -CSS_KEY(select_menu) -CSS_KEY(semi_condensed) -CSS_KEY(semi_expanded) -CSS_KEY(separate) -CSS_KEY(show) -CSS_KEY(silent) -CSS_KEY(simp_chinese_formal) -CSS_KEY(simp_chinese_informal) -CSS_KEY(slow) -CSS_KEY(slower) -CSS_KEY(small) -CSS_KEY(small_caps) -CSS_KEY(small_caption) -CSS_KEY(smaller) -CSS_KEY(soft) -CSS_KEY(solid) -CSS_KEY(spell_out) -CSS_KEY(spinning) -CSS_KEY(square) -CSS_KEY(start) -CSS_KEY(static) -CSS_KEY(status_bar) -CSS_KEY(sub) -CSS_KEY(super) -CSS_KEY(sw_resize) -CSS_KEY(table) -CSS_KEY(table_caption) -CSS_KEY(table_cell) -CSS_KEY(table_column) -CSS_KEY(table_column_group) -CSS_KEY(table_footer_group) -CSS_KEY(table_header_group) -CSS_KEY(table_row) -CSS_KEY(table_row_group) -CSS_KEY(tamil) -CSS_KEY(telugu) -CSS_KEY(text) -CSS_KEY(text_bottom) -CSS_KEY(text_top) -CSS_KEY(thai) -CSS_KEY(thick) -CSS_KEY(thin) -CSS_KEY(threeddarkshadow) -CSS_KEY(threedface) -CSS_KEY(threedhighlight) -CSS_KEY(threedlightshadow) -CSS_KEY(threedshadow) -CSS_KEY(toggle) -CSS_KEY(top) -CSS_KEY(trad_chinese_formal) -CSS_KEY(trad_chinese_informal) -CSS_KEY(transparent) -CSS_KEY(tri_state) -CSS_KEY(ultra_condensed) -CSS_KEY(ultra_expanded) -CSS_KEY(underline) -CSS_KEY(upper_alpha) -CSS_KEY(upper_latin) -CSS_KEY(upper_roman) -CSS_KEY(uppercase) -CSS_KEY(urdu) -CSS_KEY(vertical) -CSS_KEY(visible) -CSS_KEY(w_resize) -CSS_KEY(wait) -CSS_KEY(wider) -CSS_KEY(window) -CSS_KEY(windowframe) -CSS_KEY(windowtext) -CSS_KEY(workspace) -CSS_KEY(write_only) -CSS_KEY(x_fast) -CSS_KEY(x_high) -CSS_KEY(x_large) -CSS_KEY(x_loud) -CSS_KEY(x_low) -CSS_KEY(x_slow) -CSS_KEY(x_small) -CSS_KEY(x_soft) -CSS_KEY(xx_large) -CSS_KEY(xx_small) +CSS_KEY(-moz-all, _moz_all) +CSS_KEY(-moz-bg-inset, _moz_bg_inset) +CSS_KEY(-moz-bg-outset, _moz_bg_outset) +CSS_KEY(-moz-center, _moz_center) +CSS_KEY(-moz-right, _moz_right) +CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) +CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) +CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) +CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) +CSS_KEY(above, above) +CSS_KEY(absolute, absolute) +CSS_KEY(activeborder, activeborder) +CSS_KEY(activecaption, activecaption) +CSS_KEY(alias, alias) +CSS_KEY(all, all) +CSS_KEY(always, always) +CSS_KEY(appworkspace, appworkspace) +CSS_KEY(arabic-indic, arabic_indic) +CSS_KEY(armenian, armenian) +CSS_KEY(auto, auto) +CSS_KEY(avoid, avoid) +CSS_KEY(background, background) +CSS_KEY(baseline, baseline) +CSS_KEY(behind, behind) +CSS_KEY(below, below) +CSS_KEY(bengali, bengali) +CSS_KEY(bidi-override, bidi_override) +CSS_KEY(blink, blink) +CSS_KEY(block, block) +CSS_KEY(bold, bold) +CSS_KEY(bolder, bolder) +CSS_KEY(border-box, border_box) +CSS_KEY(both, both) +CSS_KEY(bottom, bottom) +CSS_KEY(button, button) +CSS_KEY(buttonface, buttonface) +CSS_KEY(buttonhighlight, buttonhighlight) +CSS_KEY(buttonshadow, buttonshadow) +CSS_KEY(buttontext, buttontext) +CSS_KEY(capitalize, capitalize) +CSS_KEY(caption, caption) +CSS_KEY(captiontext, captiontext) +CSS_KEY(cell, cell) +CSS_KEY(center, center) +CSS_KEY(center-left, center_left) +CSS_KEY(center-right, center_right) +CSS_KEY(ch, ch) +CSS_KEY(circle, circle) +CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) +CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) +CSS_KEY(cjk-ideographic, cjk_ideographic) +CSS_KEY(close-quote, close_quote) +CSS_KEY(cm, cm) +CSS_KEY(code, code) +CSS_KEY(collapse, collapse) +CSS_KEY(compact, compact) +CSS_KEY(condensed, condensed) +CSS_KEY(content-box, content_box) +CSS_KEY(context-menu, context_menu) +CSS_KEY(continuous, continuous) +CSS_KEY(copy, copy) +CSS_KEY(count-down, count_down) +CSS_KEY(count-up, count_up) +CSS_KEY(count-up-down, count_up_down) +CSS_KEY(crop, crop) +CSS_KEY(cross, cross) +CSS_KEY(crosshair, crosshair) +CSS_KEY(dashed, dashed) +CSS_KEY(decimal, decimal) +CSS_KEY(decimal-leading-zero, decimal_leading_zero) +CSS_KEY(default, default) +CSS_KEY(deg, deg) +CSS_KEY(desktop, desktop) +CSS_KEY(devanagari, devanagari) +CSS_KEY(dialog, dialog) +CSS_KEY(digits, digits) +CSS_KEY(disabled, disabled) +CSS_KEY(disc, disc) +CSS_KEY(document, document) +CSS_KEY(dotted, dotted) +CSS_KEY(double, double) +CSS_KEY(e-resize, e_resize) +CSS_KEY(element, element) +CSS_KEY(elements, elements) +CSS_KEY(em, em) +CSS_KEY(embed, embed) +CSS_KEY(enabled, enabled) +CSS_KEY(ex, ex) +CSS_KEY(expanded, expanded) +CSS_KEY(extra-condensed, extra_condensed) +CSS_KEY(extra-expanded, extra_expanded) +CSS_KEY(far-left, far_left) +CSS_KEY(far-right, far_right) +CSS_KEY(fast, fast) +CSS_KEY(faster, faster) +CSS_KEY(field, field) +CSS_KEY(fixed, fixed) +CSS_KEY(georgian, georgian) +CSS_KEY(grab, grab) +CSS_KEY(grabbing, grabbing) +CSS_KEY(grad, grad) +CSS_KEY(graytext, graytext) +CSS_KEY(groove, groove) +CSS_KEY(gujarati, gujarati) +CSS_KEY(gurmukhi, gurmukhi) +CSS_KEY(hebrew, hebrew) +CSS_KEY(help, help) +CSS_KEY(hidden, hidden) +CSS_KEY(hide, hide) +CSS_KEY(high, high) +CSS_KEY(higher, higher) +CSS_KEY(highlight, highlight) +CSS_KEY(highlighttext, highlighttext) +CSS_KEY(hiragana, hiragana) +CSS_KEY(hiragana-iroha, hiragana_iroha) +CSS_KEY(horizontal, horizontal) +CSS_KEY(hz, hz) +CSS_KEY(icon, icon) +CSS_KEY(ignore, ignore) +CSS_KEY(in, in) +CSS_KEY(inactiveborder, inactiveborder) +CSS_KEY(inactivecaption, inactivecaption) +CSS_KEY(inactivecaptiontext, inactivecaptiontext) +CSS_KEY(info, info) +CSS_KEY(infobackground, infobackground) +CSS_KEY(infotext, infotext) +CSS_KEY(inherit, inherit) +CSS_KEY(inline, inline) +CSS_KEY(inline-block, inline_block) +CSS_KEY(inline-table, inline_table) +CSS_KEY(inset, inset) +CSS_KEY(inside, inside) +CSS_KEY(invert, invert) +CSS_KEY(italic, italic) +CSS_KEY(japanese-formal, japanese_formal) +CSS_KEY(japanese-informal, japanese_informal) +CSS_KEY(justify, justify) +CSS_KEY(kannada, kannada) +CSS_KEY(katakana, katakana) +CSS_KEY(katakana-iroha, katakana_iroha) +CSS_KEY(khmer, khmer) +CSS_KEY(khz, khz) +CSS_KEY(landscape, landscape) +CSS_KEY(lao, lao) +CSS_KEY(large, large) +CSS_KEY(larger, larger) +CSS_KEY(left, left) +CSS_KEY(left-side, left_side) +CSS_KEY(leftwards, leftwards) +CSS_KEY(level, level) +CSS_KEY(lighter, lighter) +CSS_KEY(line-through, line_through) +CSS_KEY(list, list) +CSS_KEY(list-item, list_item) +CSS_KEY(loud, loud) +CSS_KEY(low, low) +CSS_KEY(lower, lower) +CSS_KEY(lower-alpha, lower_alpha) +CSS_KEY(lower-greek, lower_greek) +CSS_KEY(lower-latin, lower_latin) +CSS_KEY(lower-roman, lower_roman) +CSS_KEY(lowercase, lowercase) +CSS_KEY(ltr, ltr) +CSS_KEY(malayalam, malayalam) +CSS_KEY(margin-box, margin_box) +CSS_KEY(marker, marker) +CSS_KEY(medium, medium) +CSS_KEY(menu, menu) +CSS_KEY(menutext, menutext) +CSS_KEY(message-box, message_box) +CSS_KEY(middle, middle) +CSS_KEY(mix, mix) +CSS_KEY(mm, mm) +CSS_KEY(move, move) +CSS_KEY(ms, ms) +CSS_KEY(myanmar, myanmar) +CSS_KEY(n-resize, n_resize) +CSS_KEY(narrower, narrower) +CSS_KEY(ne-resize, ne_resize) +CSS_KEY(no-close-quote, no_close_quote) +CSS_KEY(no-open-quote, no_open_quote) +CSS_KEY(no-repeat, no_repeat) +CSS_KEY(none, none) +CSS_KEY(normal, normal) +CSS_KEY(noshade, noshade) +CSS_KEY(nowrap, nowrap) +CSS_KEY(nw-resize, nw_resize) +CSS_KEY(oblique, oblique) +CSS_KEY(once, once) +CSS_KEY(open-quote, open_quote) +CSS_KEY(oriya, oriya) +CSS_KEY(outset, outset) +CSS_KEY(outside, outside) +CSS_KEY(overline, overline) +CSS_KEY(padding-box, padding_box) +CSS_KEY(paragraph, paragraph) +CSS_KEY(pc, pc) +CSS_KEY(persian, persian) +CSS_KEY(pointer, pointer) +CSS_KEY(portrait, portrait) +CSS_KEY(pre, pre) +CSS_KEY(pt, pt) +CSS_KEY(pull-down-menu, pull_down_menu) +CSS_KEY(px, px) +CSS_KEY(rad, rad) +CSS_KEY(read-only, read_only) +CSS_KEY(read-write, read_write) +CSS_KEY(relative, relative) +CSS_KEY(repeat, repeat) +CSS_KEY(repeat-x, repeat_x) +CSS_KEY(repeat-y, repeat_y) +CSS_KEY(ridge, ridge) +CSS_KEY(right, right) +CSS_KEY(right-side, right_side) +CSS_KEY(rightwards, rightwards) +CSS_KEY(rtl, rtl) +CSS_KEY(run-in, run_in) +CSS_KEY(s, s) +CSS_KEY(s-resize, s_resize) +CSS_KEY(scroll, scroll) +CSS_KEY(scrollbar, scrollbar) +CSS_KEY(se-resize, se_resize) +CSS_KEY(select-all, select_all) +CSS_KEY(select-before, select_before) +CSS_KEY(select-after, select_after) +CSS_KEY(select-same, select_same) +CSS_KEY(select-menu, select_menu) +CSS_KEY(semi-condensed, semi_condensed) +CSS_KEY(semi-expanded, semi_expanded) +CSS_KEY(separate, separate) +CSS_KEY(show, show) +CSS_KEY(silent, silent) +CSS_KEY(simp-chinese-formal, simp_chinese_formal) +CSS_KEY(simp-chinese-informal, simp_chinese_informal) +CSS_KEY(slow, slow) +CSS_KEY(slower, slower) +CSS_KEY(small, small) +CSS_KEY(small-caps, small_caps) +CSS_KEY(small-caption, small_caption) +CSS_KEY(smaller, smaller) +CSS_KEY(soft, soft) +CSS_KEY(solid, solid) +CSS_KEY(spell-out, spell_out) +CSS_KEY(spinning, spinning) +CSS_KEY(square, square) +CSS_KEY(start, start) +CSS_KEY(static, static) +CSS_KEY(status-bar, status_bar) +CSS_KEY(sub, sub) +CSS_KEY(super, super) +CSS_KEY(sw-resize, sw_resize) +CSS_KEY(table, table) +CSS_KEY(table-caption, table_caption) +CSS_KEY(table-cell, table_cell) +CSS_KEY(table-column, table_column) +CSS_KEY(table-column-group, table_column_group) +CSS_KEY(table-footer-group, table_footer_group) +CSS_KEY(table-header-group, table_header_group) +CSS_KEY(table-row, table_row) +CSS_KEY(table-row-group, table_row_group) +CSS_KEY(tamil, tamil) +CSS_KEY(telugu, telugu) +CSS_KEY(text, text) +CSS_KEY(text-bottom, text_bottom) +CSS_KEY(text-top, text_top) +CSS_KEY(thai, thai) +CSS_KEY(thick, thick) +CSS_KEY(thin, thin) +CSS_KEY(threeddarkshadow, threeddarkshadow) +CSS_KEY(threedface, threedface) +CSS_KEY(threedhighlight, threedhighlight) +CSS_KEY(threedlightshadow, threedlightshadow) +CSS_KEY(threedshadow, threedshadow) +CSS_KEY(toggle, toggle) +CSS_KEY(top, top) +CSS_KEY(trad-chinese-formal, trad_chinese_formal) +CSS_KEY(trad-chinese-informal, trad_chinese_informal) +CSS_KEY(transparent, transparent) +CSS_KEY(tri-state, tri_state) +CSS_KEY(ultra-condensed, ultra_condensed) +CSS_KEY(ultra-expanded, ultra_expanded) +CSS_KEY(underline, underline) +CSS_KEY(upper-alpha, upper_alpha) +CSS_KEY(upper-latin, upper_latin) +CSS_KEY(upper-roman, upper_roman) +CSS_KEY(uppercase, uppercase) +CSS_KEY(urdu, urdu) +CSS_KEY(vertical, vertical) +CSS_KEY(visible, visible) +CSS_KEY(w-resize, w_resize) +CSS_KEY(wait, wait) +CSS_KEY(wider, wider) +CSS_KEY(window, window) +CSS_KEY(windowframe, windowframe) +CSS_KEY(windowtext, windowtext) +CSS_KEY(workspace, workspace) +CSS_KEY(write-only, write_only) +CSS_KEY(x-fast, x_fast) +CSS_KEY(x-high, x_high) +CSS_KEY(x-large, x_large) +CSS_KEY(x-loud, x_loud) +CSS_KEY(x-low, x_low) +CSS_KEY(x-slow, x_slow) +CSS_KEY(x-small, x_small) +CSS_KEY(x-soft, x_soft) +CSS_KEY(xx-large, xx_large) +CSS_KEY(xx-small, xx_small) diff --git a/content/shared/public/nsCSSKeywords.h b/content/shared/public/nsCSSKeywords.h index 4473a0c3bac..504b4512f3c 100644 --- a/content/shared/public/nsCSSKeywords.h +++ b/content/shared/public/nsCSSKeywords.h @@ -34,7 +34,7 @@ class nsCString; To change the list of keywords, see nsCSSKeywordList.h */ -#define CSS_KEY(_key) eCSSKeyword_##_key, +#define CSS_KEY(_name,_id) eCSSKeyword_##_id, enum nsCSSKeyword { eCSSKeyword_UNKNOWN = -1, #include "nsCSSKeywordList.h" diff --git a/content/shared/public/nsCSSPropList.h b/content/shared/public/nsCSSPropList.h index 2430d27798d..a7dd2d34ffa 100644 --- a/content/shared/public/nsCSSPropList.h +++ b/content/shared/public/nsCSSPropList.h @@ -34,171 +34,177 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in properties are automagically converted into hyphens + Requirements: - The first argument to CSS_PROP is both the enum identifier of the property - and the string value - The second argument is the style impact resultant in a change to the property + Entries are in the form: (name,id,impact). 'id' must always be the same as + 'name' except that all hyphens ('-') in 'name' are converted to underscores + ('_') in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** + + The third argument is the style impact resultant in a change to the property ******/ -CSS_PROP(_moz_border_radius, VISUAL) -CSS_PROP(_moz_border_radius_topLeft, VISUAL) -CSS_PROP(_moz_border_radius_topRight, VISUAL) -CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_border_radius_bottomRight, VISUAL) -CSS_PROP(_moz_outline_radius, VISUAL) -CSS_PROP(_moz_outline_radius_topLeft, VISUAL) -CSS_PROP(_moz_outline_radius_topRight, VISUAL) -CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) -CSS_PROP(azimuth, AURAL) -CSS_PROP(background, VISUAL) -CSS_PROP(background_attachment, VISUAL) -CSS_PROP(background_color, VISUAL) -CSS_PROP(background_image, VISUAL) -CSS_PROP(background_position, VISUAL) -CSS_PROP(background_repeat, VISUAL) -CSS_PROP(background_x_position, VISUAL) -CSS_PROP(background_y_position, VISUAL) -CSS_PROP(behavior, REFLOW) -CSS_PROP(border, REFLOW) -CSS_PROP(border_bottom, REFLOW) -CSS_PROP(border_bottom_color, VISUAL) -CSS_PROP(border_bottom_style, REFLOW) // on/off will need reflow -CSS_PROP(border_bottom_width, REFLOW) -CSS_PROP(border_collapse, REFLOW) -CSS_PROP(border_color, VISUAL) -CSS_PROP(border_left, REFLOW) -CSS_PROP(border_left_color, VISUAL) -CSS_PROP(border_left_style, REFLOW) // on/off will need reflow -CSS_PROP(border_left_width, REFLOW) -CSS_PROP(border_right, REFLOW) -CSS_PROP(border_right_color, VISUAL) -CSS_PROP(border_right_style, REFLOW) // on/off will need reflow -CSS_PROP(border_right_width, REFLOW) -CSS_PROP(border_spacing, REFLOW) -CSS_PROP(border_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top, REFLOW) -CSS_PROP(border_top_color, VISUAL) -CSS_PROP(border_top_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top_width, REFLOW) -CSS_PROP(border_width, REFLOW) -CSS_PROP(border_x_spacing, REFLOW) -CSS_PROP(border_y_spacing, REFLOW) -CSS_PROP(bottom, REFLOW) -CSS_PROP(box_sizing, REFLOW) -CSS_PROP(caption_side, REFLOW) -CSS_PROP(clear, REFLOW) -CSS_PROP(clip, VISUAL) -CSS_PROP(clip_bottom, VISUAL) -CSS_PROP(clip_left, VISUAL) -CSS_PROP(clip_right, VISUAL) -CSS_PROP(clip_top, VISUAL) -CSS_PROP(color, VISUAL) -CSS_PROP(content, FRAMECHANGE) -CSS_PROP(counter_increment, REFLOW) -CSS_PROP(counter_reset, REFLOW) -CSS_PROP(cue, AURAL) -CSS_PROP(cue_after, AURAL) -CSS_PROP(cue_before, AURAL) -CSS_PROP(cursor, VISUAL) -CSS_PROP(direction, REFLOW) -CSS_PROP(display, FRAMECHANGE) -CSS_PROP(elevation, AURAL) -CSS_PROP(empty_cells, VISUAL) -CSS_PROP(float, FRAMECHANGE) -CSS_PROP(float_edge, REFLOW) -CSS_PROP(font, REFLOW) -CSS_PROP(font_family, REFLOW) -CSS_PROP(font_size, REFLOW) -CSS_PROP(font_size_adjust, REFLOW) -CSS_PROP(font_stretch, REFLOW) -CSS_PROP(font_style, REFLOW) -CSS_PROP(font_variant, REFLOW) -CSS_PROP(font_weight, REFLOW) -CSS_PROP(height, REFLOW) -CSS_PROP(key_equivalent, CONTENT) // This will need some other notification, but what? -CSS_PROP(left, REFLOW) -CSS_PROP(letter_spacing, REFLOW) -CSS_PROP(line_height, REFLOW) -CSS_PROP(list_style, REFLOW) -CSS_PROP(list_style_image, REFLOW) -CSS_PROP(list_style_position, REFLOW) -CSS_PROP(list_style_type, REFLOW) -CSS_PROP(margin, REFLOW) -CSS_PROP(margin_bottom, REFLOW) -CSS_PROP(margin_left, REFLOW) -CSS_PROP(margin_right, REFLOW) -CSS_PROP(margin_top, REFLOW) -CSS_PROP(marker_offset, REFLOW) -CSS_PROP(marks, VISUAL) -CSS_PROP(max_height, REFLOW) -CSS_PROP(max_width, REFLOW) -CSS_PROP(min_height, REFLOW) -CSS_PROP(min_width, REFLOW) -CSS_PROP(opacity, VISUAL) -CSS_PROP(orphans, REFLOW) -CSS_PROP(outline, VISUAL) -CSS_PROP(outline_color, VISUAL) -CSS_PROP(outline_style, VISUAL) -CSS_PROP(outline_width, VISUAL) -CSS_PROP(overflow, FRAMECHANGE) -CSS_PROP(padding, REFLOW) -CSS_PROP(padding_bottom, REFLOW) -CSS_PROP(padding_left, REFLOW) -CSS_PROP(padding_right, REFLOW) -CSS_PROP(padding_top, REFLOW) -CSS_PROP(page, REFLOW) -CSS_PROP(page_break_after, REFLOW) -CSS_PROP(page_break_before, REFLOW) -CSS_PROP(page_break_inside, REFLOW) -CSS_PROP(pause, AURAL) -CSS_PROP(pause_after, AURAL) -CSS_PROP(pause_before, AURAL) -CSS_PROP(pitch, AURAL) -CSS_PROP(pitch_range, AURAL) -CSS_PROP(play_during, AURAL) -CSS_PROP(play_during_flags, AURAL) -CSS_PROP(position, FRAMECHANGE) -CSS_PROP(quotes, REFLOW) -CSS_PROP(quotes_close, REFLOW) -CSS_PROP(quotes_open, REFLOW) -CSS_PROP(resizer, FRAMECHANGE) -CSS_PROP(richness, AURAL) -CSS_PROP(right, REFLOW) -CSS_PROP(size, REFLOW) -CSS_PROP(size_height, REFLOW) -CSS_PROP(size_width, REFLOW) -CSS_PROP(speak, AURAL) -CSS_PROP(speak_header, AURAL) -CSS_PROP(speak_numeral, AURAL) -CSS_PROP(speak_punctuation, AURAL) -CSS_PROP(speech_rate, AURAL) -CSS_PROP(stress, AURAL) -CSS_PROP(table_layout, REFLOW) -CSS_PROP(text_align, REFLOW) -CSS_PROP(text_decoration, VISUAL) -CSS_PROP(text_indent, REFLOW) -CSS_PROP(text_shadow, VISUAL) -CSS_PROP(text_shadow_color, VISUAL) -CSS_PROP(text_shadow_radius, VISUAL) -CSS_PROP(text_shadow_x, VISUAL) -CSS_PROP(text_shadow_y, VISUAL) -CSS_PROP(text_transform, REFLOW) -CSS_PROP(top, REFLOW) -CSS_PROP(unicode_bidi, REFLOW) -CSS_PROP(user_focus, CONTENT) -CSS_PROP(user_input, FRAMECHANGE) // XXX ??? -CSS_PROP(user_modify, FRAMECHANGE) -CSS_PROP(user_select, CONTENT) -CSS_PROP(vertical_align, REFLOW) -CSS_PROP(visibility, REFLOW) // reflow for collapse -CSS_PROP(voice_family, AURAL) -CSS_PROP(volume, AURAL) -CSS_PROP(white_space, REFLOW) -CSS_PROP(widows, REFLOW) -CSS_PROP(width, REFLOW) -CSS_PROP(word_spacing, REFLOW) -CSS_PROP(z_index, REFLOW) - +CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL) +CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL) +CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL) +CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL) +CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL) +CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL) +CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL) +CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL) +CSS_PROP(azimuth, azimuth, AURAL) +CSS_PROP(background, background, VISUAL) +CSS_PROP(background-attachment, background_attachment, VISUAL) +CSS_PROP(background-color, background_color, VISUAL) +CSS_PROP(background-image, background_image, VISUAL) +CSS_PROP(background-position, background_position, VISUAL) +CSS_PROP(background-repeat, background_repeat, VISUAL) +CSS_PROP(background-x-position, background_x_position, VISUAL) +CSS_PROP(background-y-position, background_y_position, VISUAL) +CSS_PROP(behavior, behavior, REFLOW) +CSS_PROP(border, border, REFLOW) +CSS_PROP(border-bottom, border_bottom, REFLOW) +CSS_PROP(border-bottom-color, border_bottom_color, VISUAL) +CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow +CSS_PROP(border-bottom-width, border_bottom_width, REFLOW) +CSS_PROP(border-collapse, border_collapse, REFLOW) +CSS_PROP(border-color, border_color, VISUAL) +CSS_PROP(border-left, border_left, REFLOW) +CSS_PROP(border-left-color, border_left_color, VISUAL) +CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow +CSS_PROP(border-left-width, border_left_width, REFLOW) +CSS_PROP(border-right, border_right, REFLOW) +CSS_PROP(border-right-color, border_right_color, VISUAL) +CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow +CSS_PROP(border-right-width, border_right_width, REFLOW) +CSS_PROP(border-spacing, border_spacing, REFLOW) +CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top, border_top, REFLOW) +CSS_PROP(border-top-color, border_top_color, VISUAL) +CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top-width, border_top_width, REFLOW) +CSS_PROP(border-width, border_width, REFLOW) +CSS_PROP(border-x-spacing, border_x_spacing, REFLOW) +CSS_PROP(border-y-spacing, border_y_spacing, REFLOW) +CSS_PROP(bottom, bottom, REFLOW) +CSS_PROP(box-sizing, box_sizing, REFLOW) +CSS_PROP(caption-side, caption_side, REFLOW) +CSS_PROP(clear, clear, REFLOW) +CSS_PROP(clip, clip, VISUAL) +CSS_PROP(clip-bottom, clip_bottom, VISUAL) +CSS_PROP(clip-left, clip_left, VISUAL) +CSS_PROP(clip-right, clip_right, VISUAL) +CSS_PROP(clip-top, clip_top, VISUAL) +CSS_PROP(color, color, VISUAL) +CSS_PROP(content, content, FRAMECHANGE) +CSS_PROP(counter-increment, counter_increment, REFLOW) +CSS_PROP(counter-reset, counter_reset, REFLOW) +CSS_PROP(cue, cue, AURAL) +CSS_PROP(cue-after, cue_after, AURAL) +CSS_PROP(cue-before, cue_before, AURAL) +CSS_PROP(cursor, cursor, VISUAL) +CSS_PROP(direction, direction, REFLOW) +CSS_PROP(display, display, FRAMECHANGE) +CSS_PROP(elevation, elevation, AURAL) +CSS_PROP(empty-cells, empty_cells, VISUAL) +CSS_PROP(float, float, FRAMECHANGE) +CSS_PROP(float-edge, float_edge, REFLOW) +CSS_PROP(font, font, REFLOW) +CSS_PROP(font-family, font_family, REFLOW) +CSS_PROP(font-size, font_size, REFLOW) +CSS_PROP(font-size-adjust, font_size_adjust, REFLOW) +CSS_PROP(font-stretch, font_stretch, REFLOW) +CSS_PROP(font-style, font_style, REFLOW) +CSS_PROP(font-variant, font_variant, REFLOW) +CSS_PROP(font-weight, font_weight, REFLOW) +CSS_PROP(height, height, REFLOW) +CSS_PROP(key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? +CSS_PROP(left, left, REFLOW) +CSS_PROP(letter-spacing, letter_spacing, REFLOW) +CSS_PROP(line-height, line_height, REFLOW) +CSS_PROP(list-style, list_style, REFLOW) +CSS_PROP(list-style-image, list_style_image, REFLOW) +CSS_PROP(list-style-position, list_style_position, REFLOW) +CSS_PROP(list-style-type, list_style_type, REFLOW) +CSS_PROP(margin, margin, REFLOW) +CSS_PROP(margin-bottom, margin_bottom, REFLOW) +CSS_PROP(margin-left, margin_left, REFLOW) +CSS_PROP(margin-right, margin_right, REFLOW) +CSS_PROP(margin-top, margin_top, REFLOW) +CSS_PROP(marker-offset, marker_offset, REFLOW) +CSS_PROP(marks, marks, VISUAL) +CSS_PROP(max-height, max_height, REFLOW) +CSS_PROP(max-width, max_width, REFLOW) +CSS_PROP(min-height, min_height, REFLOW) +CSS_PROP(min-width, min_width, REFLOW) +CSS_PROP(opacity, opacity, VISUAL) +CSS_PROP(orphans, orphans, REFLOW) +CSS_PROP(outline, outline, VISUAL) +CSS_PROP(outline-color, outline_color, VISUAL) +CSS_PROP(outline-style, outline_style, VISUAL) +CSS_PROP(outline-width, outline_width, VISUAL) +CSS_PROP(overflow, overflow, FRAMECHANGE) +CSS_PROP(padding, padding, REFLOW) +CSS_PROP(padding-bottom, padding_bottom, REFLOW) +CSS_PROP(padding-left, padding_left, REFLOW) +CSS_PROP(padding-right, padding_right, REFLOW) +CSS_PROP(padding-top, padding_top, REFLOW) +CSS_PROP(page, page, REFLOW) +CSS_PROP(page-break-after, page_break_after, REFLOW) +CSS_PROP(page-break-before, page_break_before, REFLOW) +CSS_PROP(page-break-inside, page_break_inside, REFLOW) +CSS_PROP(pause, pause, AURAL) +CSS_PROP(pause-after, pause_after, AURAL) +CSS_PROP(pause-before, pause_before, AURAL) +CSS_PROP(pitch, pitch, AURAL) +CSS_PROP(pitch-range, pitch_range, AURAL) +CSS_PROP(play-during, play_during, AURAL) +CSS_PROP(play-during-flags, play_during_flags, AURAL) +CSS_PROP(position, position, FRAMECHANGE) +CSS_PROP(quotes, quotes, REFLOW) +CSS_PROP(quotes-close, quotes_close, REFLOW) +CSS_PROP(quotes-open, quotes_open, REFLOW) +CSS_PROP(resizer, resizer, FRAMECHANGE) +CSS_PROP(richness, richness, AURAL) +CSS_PROP(right, right, REFLOW) +CSS_PROP(size, size, REFLOW) +CSS_PROP(size-height, size_height, REFLOW) +CSS_PROP(size-width, size_width, REFLOW) +CSS_PROP(speak, speak, AURAL) +CSS_PROP(speak-header, speak_header, AURAL) +CSS_PROP(speak-numeral, speak_numeral, AURAL) +CSS_PROP(speak-punctuation, speak_punctuation, AURAL) +CSS_PROP(speech-rate, speech_rate, AURAL) +CSS_PROP(stress, stress, AURAL) +CSS_PROP(table-layout, table_layout, REFLOW) +CSS_PROP(text-align, text_align, REFLOW) +CSS_PROP(text-decoration, text_decoration, VISUAL) +CSS_PROP(text-indent, text_indent, REFLOW) +CSS_PROP(text-shadow, text_shadow, VISUAL) +CSS_PROP(text-shadow-color, text_shadow_color, VISUAL) +CSS_PROP(text-shadow-radius, text_shadow_radius, VISUAL) +CSS_PROP(text-shadow-x, text_shadow_x, VISUAL) +CSS_PROP(text-shadow-y, text_shadow_y, VISUAL) +CSS_PROP(text-transform, text_transform, REFLOW) +CSS_PROP(top, top, REFLOW) +CSS_PROP(unicode-bidi, unicode_bidi, REFLOW) +CSS_PROP(user-focus, user_focus, CONTENT) +CSS_PROP(user-input, user_input, FRAMECHANGE) // XXX ??? +CSS_PROP(user-modify, user_modify, FRAMECHANGE) +CSS_PROP(user-select, user_select, CONTENT) +CSS_PROP(vertical-align, vertical_align, REFLOW) +CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse +CSS_PROP(voice-family, voice_family, AURAL) +CSS_PROP(volume, volume, AURAL) +CSS_PROP(white-space, white_space, REFLOW) +CSS_PROP(widows, widows, REFLOW) +CSS_PROP(width, width, REFLOW) +CSS_PROP(word-spacing, word_spacing, REFLOW) +CSS_PROP(z-index, z_index, REFLOW) diff --git a/content/shared/public/nsCSSProps.h b/content/shared/public/nsCSSProps.h index 81778dd3ff8..316d3506d38 100644 --- a/content/shared/public/nsCSSProps.h +++ b/content/shared/public/nsCSSProps.h @@ -34,7 +34,7 @@ class nsString; To change the list of properties, see nsCSSPropList.h */ -#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, enum nsCSSProperty { eCSSProperty_UNKNOWN = -1, #include "nsCSSPropList.h" diff --git a/content/shared/src/nsCSSKeywords.cpp b/content/shared/src/nsCSSKeywords.cpp index df81aba2e10..d58e9f86420 100644 --- a/content/shared/src/nsCSSKeywords.cpp +++ b/content/shared/src/nsCSSKeywords.cpp @@ -22,73 +22,39 @@ #include "nsCSSKeywords.h" #include "nsString.h" -#include "nsAVLTree.h" - +#include "nsStaticNameTable.h" // define an array of all CSS keywords -#define CSS_KEY(_key) #_key, +#define CSS_KEY(_name,_id) #_name, const char* kCSSRawKeywords[] = { #include "nsCSSKeywordList.h" }; #undef CSS_KEY -struct KeywordNode { - KeywordNode(void) - : mStr(), - mEnum(eCSSKeyword_UNKNOWN) - {} - - KeywordNode(const nsStr& aStringValue, nsCSSKeyword aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSKeyword mEnum; -}; - -class KeywordComparitor: public nsAVLNodeComparitor { -public: - virtual ~KeywordComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - KeywordNode* one = (KeywordNode*)anItem1; - KeywordNode* two = (KeywordNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static KeywordNode* gKeywordArray; -static nsAVLTree* gKeywordTree; -static KeywordComparitor* gComparitor; -static nsCString* kNullStr; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gKeywordTable; void nsCSSKeywords::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gKeywordArray) { - gKeywordArray = new KeywordNode[eCSSKeyword_COUNT]; - gComparitor = new KeywordComparitor(); - if (gComparitor) { - gKeywordTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gKeywordArray && gKeywordTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSKeyword_COUNT)) { - gKeywordArray[index].mStr = kCSSRawKeywords[index]; - gKeywordArray[index].mStr.ReplaceChar('_', '-'); - gKeywordArray[index].mEnum = nsCSSKeyword(index); - gKeywordTree->AddItem(&(gKeywordArray[index])); - } + NS_ASSERTION(!gKeywordTable, "pre existing array!"); + gKeywordTable = new nsStaticCaseInsensitiveNameTable(); + if (gKeywordTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) { + nsCAutoString temp1(kCSSRawKeywords[index]); + nsCAutoString temp2(kCSSRawKeywords[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); + NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); } } - kNullStr = new nsCString(); +#endif + gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT); + } } } @@ -96,55 +62,42 @@ void nsCSSKeywords::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gKeywordArray) { - delete [] gKeywordArray; - gKeywordArray = nsnull; + if (gKeywordTable) { + delete gKeywordTable; + gKeywordTable = nsnull; } - if (gKeywordTree) { - delete gKeywordTree; - gKeywordTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; } } - nsCSSKeyword nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) { - NS_ASSERTION(gKeywordTree, "no lookup table, needs addref"); - if (gKeywordTree) { - KeywordNode node(aKeyword, eCSSKeyword_UNKNOWN); - KeywordNode* found = (KeywordNode*)gKeywordTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aKeyword), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); + } return eCSSKeyword_UNKNOWN; } nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsString& aKeyword) { - nsCAutoString theKeyword; theKeyword.AssignWithConversion(aKeyword); - return LookupKeyword(theKeyword); +nsCSSKeywords::LookupKeyword(const nsString& aKeyword) +{ + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); + } + return eCSSKeyword_UNKNOWN; } - const nsCString& nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) { - NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); - if ((eCSSKeyword_UNKNOWN < aKeyword) && - (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { - return gKeywordArray[aKeyword].mStr; - } - else { - return *kNullStr; + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return gKeywordTable->GetStringValue(PRInt32(aKeyword)); + } else { + static nsCString kNullStr; + return kNullStr; } } diff --git a/content/shared/src/nsCSSProps.cpp b/content/shared/src/nsCSSProps.cpp index 3f7b9d3a201..8b4c3180d96 100644 --- a/content/shared/src/nsCSSProps.cpp +++ b/content/shared/src/nsCSSProps.cpp @@ -27,73 +27,40 @@ #include "nsILookAndFeel.h" // for system colors #include "nsString.h" -#include "nsAVLTree.h" - +#include "nsStaticNameTable.h" // define an array of all CSS properties -#define CSS_PROP(_prop, _hint) #_prop, +#define CSS_PROP(_name, _id, _hint) #_name, const char* kCSSRawProperties[] = { #include "nsCSSPropList.h" }; #undef CSS_PROP -struct PropertyNode { - PropertyNode(void) - : mStr(), - mEnum(eCSSProperty_UNKNOWN) - {} - PropertyNode(const nsStr& aStringValue, nsCSSProperty aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSProperty mEnum; -}; - -class PropertyComparitor: public nsAVLNodeComparitor { -public: - virtual ~PropertyComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - PropertyNode* one = (PropertyNode*)anItem1; - PropertyNode* two = (PropertyNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static PropertyNode* gPropertyArray; -static nsAVLTree* gPropertyTree; -static PropertyComparitor* gComparitor; -static nsCString* kNullStr; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gPropertyTable; void nsCSSProps::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gPropertyArray) { - gPropertyArray= new PropertyNode[eCSSProperty_COUNT]; - gComparitor = new PropertyComparitor(); - if (gComparitor) { - gPropertyTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gPropertyArray && gPropertyTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSProperty_COUNT)) { - gPropertyArray[index].mStr = kCSSRawProperties[index]; - gPropertyArray[index].mStr.ReplaceChar('_', '-'); - gPropertyArray[index].mEnum = nsCSSProperty(index); - gPropertyTree->AddItem(&(gPropertyArray[index])); - } + NS_ASSERTION(!gPropertyTable, "pre existing array!"); + gPropertyTable = new nsStaticCaseInsensitiveNameTable(); + if (gPropertyTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eCSSProperty_COUNT; ++index) { + nsCAutoString temp1(kCSSRawProperties[index]); + nsCAutoString temp2(kCSSRawProperties[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); + NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); } } - kNullStr = new nsCString(); +#endif + gPropertyTable->Init(kCSSRawProperties, eCSSProperty_COUNT); + } } } @@ -101,60 +68,47 @@ void nsCSSProps::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gPropertyArray) { - delete [] gPropertyArray; - gPropertyArray = nsnull; + if (gPropertyTable) { + delete gPropertyTable; + gPropertyTable = nsnull; } - if (gPropertyTree) { - delete gPropertyTree; - gPropertyTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; } } - nsCSSProperty nsCSSProps::LookupProperty(const nsCString& aProperty) { - NS_ASSERTION(gPropertyTree, "no lookup table, needs addref"); - if (gPropertyTree) { - PropertyNode node(aProperty, eCSSProperty_UNKNOWN); - PropertyNode* found = (PropertyNode*)gPropertyTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aProperty), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } return eCSSProperty_UNKNOWN; } - nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) { - nsCAutoString theProp; theProp.AssignWithConversion(aProperty); - return LookupProperty(theProp); +nsCSSProps::LookupProperty(const nsString& aProperty) +{ + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } + return eCSSProperty_UNKNOWN; } - const nsCString& nsCSSProps::GetStringValue(nsCSSProperty aProperty) { - NS_ASSERTION(gPropertyArray, "no lookup table, needs addref"); - if ((eCSSProperty_UNKNOWN < aProperty) && - (aProperty < eCSSProperty_COUNT) && gPropertyArray) { - return gPropertyArray[aProperty].mStr; - } - else { - return *kNullStr; + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return gPropertyTable->GetStringValue(PRInt32(aProperty)); + } else { + static nsCString sNullStr; + return sNullStr; } } +/***************************************************************************/ // Keyword id tables for variant/enum parsing const PRInt32 nsCSSProps::kAzimuthKTable[] = { @@ -726,7 +680,8 @@ SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) { PRInt32 i = SearchKeywordTableInt(aValue, aTable); if (i < 0) { - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } else { return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); } @@ -1083,7 +1038,8 @@ static const PRInt32 kBackgroundYPositionKTable[] = { NS_ERROR("invalid property"); break; } - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) @@ -1105,7 +1061,7 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) } // define array of all CSS property hints -#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +#define CSS_PROP(_name, _id, _hint) NS_STYLE_HINT_##_hint, const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { #include "nsCSSPropList.h" }; diff --git a/gfx/src/nsColorNames.cpp b/gfx/src/nsColorNames.cpp index 3ad61070e70..95ddb9a4fb4 100644 --- a/gfx/src/nsColorNames.cpp +++ b/gfx/src/nsColorNames.cpp @@ -22,7 +22,7 @@ #include "nsColorNames.h" #include "nsString.h" -#include "nsAVLTree.h" +#include "nsStaticNameTable.h" // define an array of all color names @@ -39,60 +39,29 @@ const nscolor nsColorNames::kColors[] = { }; #undef GFX_COLOR -struct ColorNode { - ColorNode(void) - : mStr(), - mEnum(eColorName_UNKNOWN) - {} - - ColorNode(const nsStr& aStringValue, nsColorName aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsColorName mEnum; -}; - -class ColorComparitor: public nsAVLNodeComparitor { -public: - virtual ~ColorComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - ColorNode* one = (ColorNode*)anItem1; - ColorNode* two = (ColorNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static ColorNode* gColorArray; -static nsAVLTree* gColorTree; -static ColorComparitor* gComparitor; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gColorTable; void nsColorNames::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gColorArray) { - gColorArray = new ColorNode[eColorName_COUNT]; - gComparitor = new ColorComparitor(); - if (gComparitor) { - gColorTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gColorArray && gColorTree) { - PRInt32 index = -1; - while (++index < PRInt32(eColorName_COUNT)) { - gColorArray[index].mStr = kColorNames[index]; - gColorArray[index].mEnum = nsColorName(index); - gColorTree->AddItem(&(gColorArray[index])); - } + NS_ASSERTION(!gColorTable, "pre existing array!"); + gColorTable = new nsStaticCaseInsensitiveNameTable(); + if (gColorTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eColorName_COUNT; ++index) { + nsCAutoString temp1(kColorNames[index]); + nsCAutoString temp2(kColorNames[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); } } +#endif + gColorTable->Init(kColorNames, eColorName_COUNT); + } } } @@ -100,54 +69,41 @@ void nsColorNames::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gColorArray) { - delete [] gColorArray; - gColorArray = nsnull; - } - if (gColorTree) { - delete gColorTree; - gColorTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; + if (gColorTable) { + delete gColorTable; + gColorTable = nsnull; } } } - nsColorName -nsColorNames::LookupName(const nsCString& aColorName) +nsColorNames::LookupName(const nsCString& aColor) { - NS_ASSERTION(gColorTree, "no lookup table, needs addref"); - if (gColorTree) { - ColorNode node(aColorName, eColorName_UNKNOWN); - ColorNode* found = (ColorNode*)gColorTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aColorName), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gColorTable, "no lookup table, needs addref"); + if (gColorTable) { + return nsColorName(gColorTable->Lookup(aColor)); + } return eColorName_UNKNOWN; } nsColorName -nsColorNames::LookupName(const nsString& aColorName) { - nsCAutoString theName; theName.AssignWithConversion(aColorName); - return LookupName(theName); +nsColorNames::LookupName(const nsString& aColor) +{ + NS_ASSERTION(gColorTable, "no lookup table, needs addref"); + if (gColorTable) { + return nsColorName(gColorTable->Lookup(aColor)); + } + return eColorName_UNKNOWN; } - const nsCString& -nsColorNames::GetStringValue(nsColorName aColorName) +nsColorNames::GetStringValue(nsColorName aColor) { - NS_ASSERTION(gColorArray, "no lookup table, needs addref"); - if ((eColorName_UNKNOWN < aColorName) && - (aColorName < eColorName_COUNT) && gColorArray) { - return gColorArray[aColorName].mStr; - } - else { - static const nsCString kNullStr; + NS_ASSERTION(gColorTable, "no lookup table, needs addref"); + if (gColorTable) { + return gColorTable->GetStringValue(PRInt32(aColor)); + } else { + static nsCString kNullStr; return kNullStr; } } diff --git a/htmlparser/src/nsHTMLTagList.h b/htmlparser/src/nsHTMLTagList.h index ca1fa3fd5d7..e69de29bb2d 100644 --- a/htmlparser/src/nsHTMLTagList.h +++ b/htmlparser/src/nsHTMLTagList.h @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all HTML tags - See nsHTMLTags.h for access to the enum values for tags - - It is designed to be used as inline input to nsHTMLTags.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro HTML_TAG which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to HTML_TAG is both the enum identifier of the property - and the string value - - ******/ - -HTML_TAG(a) -HTML_TAG(abbr) -HTML_TAG(acronym) -HTML_TAG(address) -HTML_TAG(applet) -HTML_TAG(area) -HTML_TAG(b) -HTML_TAG(base) -HTML_TAG(basefont) -HTML_TAG(bdo) -HTML_TAG(bgsound) -HTML_TAG(big) -HTML_TAG(blink) -HTML_TAG(blockquote) -HTML_TAG(body) -HTML_TAG(br) -HTML_TAG(button) -HTML_TAG(caption) -HTML_TAG(center) -HTML_TAG(cite) -HTML_TAG(code) -HTML_TAG(col) -HTML_TAG(colgroup) -HTML_TAG(counter) -HTML_TAG(dd) -HTML_TAG(del) -HTML_TAG(dfn) -HTML_TAG(dir) -HTML_TAG(div) -HTML_TAG(dl) -HTML_TAG(dt) -HTML_TAG(em) -HTML_TAG(embed) -HTML_TAG(endnote) -HTML_TAG(fieldset) -HTML_TAG(font) -HTML_TAG(form) -HTML_TAG(frame) -HTML_TAG(frameset) -HTML_TAG(h1) -HTML_TAG(h2) -HTML_TAG(h3) -HTML_TAG(h4) -HTML_TAG(h5) -HTML_TAG(h6) -HTML_TAG(head) -HTML_TAG(hr) -HTML_TAG(html) -HTML_TAG(i) -HTML_TAG(iframe) -HTML_TAG(ilayer) -HTML_TAG(image) -HTML_TAG(img) -HTML_TAG(input) -HTML_TAG(ins) -HTML_TAG(isindex) -HTML_TAG(kbd) -HTML_TAG(keygen) -HTML_TAG(label) -HTML_TAG(layer) -HTML_TAG(legend) -HTML_TAG(li) -HTML_TAG(link) -HTML_TAG(listing) -HTML_TAG(map) -HTML_TAG(menu) -HTML_TAG(meta) -HTML_TAG(multicol) -HTML_TAG(nobr) -HTML_TAG(noembed) -HTML_TAG(noframes) -HTML_TAG(nolayer) -HTML_TAG(noscript) -HTML_TAG(object) -HTML_TAG(ol) -HTML_TAG(optgroup) -HTML_TAG(option) -HTML_TAG(p) -HTML_TAG(param) -HTML_TAG(parsererror) -HTML_TAG(plaintext) -HTML_TAG(pre) -HTML_TAG(q) -HTML_TAG(s) -HTML_TAG(samp) -HTML_TAG(script) -HTML_TAG(select) -HTML_TAG(server) -HTML_TAG(small) -HTML_TAG(sound) -HTML_TAG(sourcetext) -HTML_TAG(spacer) -HTML_TAG(span) -HTML_TAG(strike) -HTML_TAG(strong) -HTML_TAG(style) -HTML_TAG(sub) -HTML_TAG(sup) -HTML_TAG(table) -HTML_TAG(tbody) -HTML_TAG(td) -HTML_TAG(textarea) -HTML_TAG(tfoot) -HTML_TAG(th) -HTML_TAG(thead) -HTML_TAG(title) -HTML_TAG(tr) -HTML_TAG(tt) -HTML_TAG(u) -HTML_TAG(ul) -HTML_TAG(var) -HTML_TAG(wbr) -HTML_TAG(xmp) diff --git a/htmlparser/src/nsHTMLTags.cpp b/htmlparser/src/nsHTMLTags.cpp index af3848d568d..dba7c101def 100644 --- a/htmlparser/src/nsHTMLTags.cpp +++ b/htmlparser/src/nsHTMLTags.cpp @@ -23,7 +23,7 @@ #include "nsHTMLTags.h" #include "nsString.h" -#include "nsAVLTree.h" +#include "nsStaticNameTable.h" // define an array of all HTML tags #define HTML_TAG(_tag) #_tag, @@ -32,55 +32,29 @@ static const char* kTagTable[] = { }; #undef HTML_TAG - -struct TagNode { - TagNode(void) - : mStr(), - mEnum(eHTMLTag_unknown) - {} - - TagNode(const nsCString& aString) : mStr(aString), mEnum(eHTMLTag_unknown) { - } - - nsCAutoString mStr; - nsHTMLTag mEnum; -}; - -class TagComparitor: public nsAVLNodeComparitor { -public: - virtual ~TagComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - TagNode* one = (TagNode*)anItem1; - TagNode* two = (TagNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static TagNode* gTagArray; -static nsAVLTree* gTagTree; -static TagComparitor* gComparitor; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gTagTable; void nsHTMLTags::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gTagArray) { - gTagArray= new TagNode[NS_HTML_TAG_MAX]; - gComparitor = new TagComparitor(); - if (gComparitor) { - gTagTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gTagArray && gTagTree) { - PRInt32 index = -1; - while (++index < NS_HTML_TAG_MAX) { - gTagArray[index].mStr = kTagTable[index]; - gTagArray[index].mEnum = nsHTMLTag(index + 1); // 1 based - gTagTree->AddItem(&(gTagArray[index])); - } + NS_ASSERTION(!gTagTable, "pre existing array!"); + gTagTable = new nsStaticCaseInsensitiveNameTable(); + if (gTagTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < NS_HTML_TAG_MAX; ++index) { + nsCAutoString temp1(kTagTable[index]); + nsCAutoString temp2(kTagTable[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); } } +#endif + gTagTable->Init(kTagTable, NS_HTML_TAG_MAX); + } } } @@ -88,75 +62,85 @@ void nsHTMLTags::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gTagArray) { - delete [] gTagArray; - gTagArray = nsnull; - } - if (gTagTree) { - delete gTagTree; - gTagTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; + if (gTagTable) { + delete gTagTable; + gTagTable = nsnull; } } } - nsHTMLTag nsHTMLTags::LookupTag(const nsCString& aTag) { - NS_ASSERTION(gTagTree, "no lookup table, needs addref"); - if (gTagTree) { - TagNode node(aTag); - TagNode* found = (TagNode*)gTagTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsWithConversion(aTag,IGNORE_CASE), "bad tree"); - return found->mEnum; - } - else { + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + nsHTMLTag tag = nsHTMLTag(gTagTable->Lookup(aTag)+1); + // hack: this can come out when rickg provides a way for the editor to ask // CanContain() questions without having to first fetch the parsers // internal enum values for a tag name. - if (aTag.Equals("__moz_text")) - return eHTMLTag_text; + + if (tag == eHTMLTag_unknown) { + if(aTag.Equals("__moz_text")) { + tag = eHTMLTag_text; + } + else { + tag = eHTMLTag_userdefined; + } } - } + return tag; + } return eHTMLTag_userdefined; } nsHTMLTag -nsHTMLTags::LookupTag(const nsString& aTag) { - nsCAutoString theTag; theTag.AssignWithConversion(aTag); - return LookupTag(theTag); +nsHTMLTags::LookupTag(const nsString& aTag) +{ + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + nsHTMLTag tag = nsHTMLTag(gTagTable->Lookup(aTag)+1); + + // hack: this can come out when rickg provides a way for the editor to ask + // CanContain() questions without having to first fetch the parsers + // internal enum values for a tag name. + + if (tag == eHTMLTag_unknown) { + nsCAutoString theTag; + theTag.AssignWithConversion(aTag); + if (theTag.Equals("__moz_text")) { + tag = eHTMLTag_text; + } + else { + tag = eHTMLTag_userdefined; + } + } + return tag; + } + return eHTMLTag_userdefined; } - - const nsCString& nsHTMLTags::GetStringValue(nsHTMLTag aTag) { - NS_ASSERTION(gTagArray, "no lookup table, needs addref"); - // Note: NS_HTML_TAG_MAX=113 - if ((eHTMLTag_unknown < aTag) && - (aTag <= NS_HTML_TAG_MAX) && gTagArray) { - return gTagArray[aTag - 1].mStr; - } - else { - static const nsCString* kNullStr=0; - if(!kNullStr) - kNullStr=new nsCString(""); - return *kNullStr; + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + return gTagTable->GetStringValue(PRInt32(aTag)-1); + } else { + static nsCString kNullStr; + return kNullStr; } } -const char* nsHTMLTags::GetCStringValue(nsHTMLTag aTag) { - NS_ASSERTION(gTagArray, "no lookup table, needs addref"); +const char* +nsHTMLTags::GetCStringValue(nsHTMLTag aTag) { + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); // Note: NS_HTML_TAG_MAX=113 if ((eHTMLTag_unknown < aTag) && - (aTag <= NS_HTML_TAG_MAX) && gTagArray) { - return gTagArray[aTag - 1].mStr.mStr; + (aTag <= NS_HTML_TAG_MAX)) { + return kTagTable[PRInt32(aTag)-1]; } else { static const char* kNullStr=""; @@ -203,4 +187,3 @@ public: }; //nsTestTagTable validateTagTable; #endif - diff --git a/layout/html/style/src/nsCSSKeywordList.h b/layout/html/style/src/nsCSSKeywordList.h index 6cef8af569e..072d822669a 100644 --- a/layout/html/style/src/nsCSSKeywordList.h +++ b/layout/html/style/src/nsCSSKeywordList.h @@ -34,315 +34,323 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in keywords are automagically converted into hyphens + Requirements: + + Entries are in the form: (name,id). 'id' must always be the same as 'name' + except that all hyphens ('-') in 'name' are converted to underscores ('_') + in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** ******/ - -CSS_KEY(_moz_all) -CSS_KEY(_moz_bg_inset) -CSS_KEY(_moz_bg_outset) -CSS_KEY(_moz_center) -CSS_KEY(_moz_right) -CSS_KEY(_moz_pre_wrap) -CSS_KEY(_moz_scrollbars_none) -CSS_KEY(_moz_scrollbars_horizontal) -CSS_KEY(_moz_scrollbars_vertical) -CSS_KEY(above) -CSS_KEY(absolute) -CSS_KEY(activeborder) -CSS_KEY(activecaption) -CSS_KEY(alias) -CSS_KEY(all) -CSS_KEY(always) -CSS_KEY(appworkspace) -CSS_KEY(arabic_indic) -CSS_KEY(armenian) -CSS_KEY(auto) -CSS_KEY(avoid) -CSS_KEY(background) -CSS_KEY(baseline) -CSS_KEY(behind) -CSS_KEY(below) -CSS_KEY(bengali) -CSS_KEY(bidi_override) -CSS_KEY(blink) -CSS_KEY(block) -CSS_KEY(bold) -CSS_KEY(bolder) -CSS_KEY(border_box) -CSS_KEY(both) -CSS_KEY(bottom) -CSS_KEY(button) -CSS_KEY(buttonface) -CSS_KEY(buttonhighlight) -CSS_KEY(buttonshadow) -CSS_KEY(buttontext) -CSS_KEY(capitalize) -CSS_KEY(caption) -CSS_KEY(captiontext) -CSS_KEY(cell) -CSS_KEY(center) -CSS_KEY(center_left) -CSS_KEY(center_right) -CSS_KEY(ch) -CSS_KEY(circle) -CSS_KEY(cjk_earthly_branch) -CSS_KEY(cjk_heavenly_stem) -CSS_KEY(cjk_ideographic) -CSS_KEY(close_quote) -CSS_KEY(cm) -CSS_KEY(code) -CSS_KEY(collapse) -CSS_KEY(compact) -CSS_KEY(condensed) -CSS_KEY(content_box) -CSS_KEY(context_menu) -CSS_KEY(continuous) -CSS_KEY(copy) -CSS_KEY(count_down) -CSS_KEY(count_up) -CSS_KEY(count_up_down) -CSS_KEY(crop) -CSS_KEY(cross) -CSS_KEY(crosshair) -CSS_KEY(dashed) -CSS_KEY(decimal) -CSS_KEY(decimal_leading_zero) -CSS_KEY(default) -CSS_KEY(deg) -CSS_KEY(desktop) -CSS_KEY(devanagari) -CSS_KEY(dialog) -CSS_KEY(digits) -CSS_KEY(disabled) -CSS_KEY(disc) -CSS_KEY(document) -CSS_KEY(dotted) -CSS_KEY(double) -CSS_KEY(e_resize) -CSS_KEY(element) -CSS_KEY(elements) -CSS_KEY(em) -CSS_KEY(embed) -CSS_KEY(enabled) -CSS_KEY(ex) -CSS_KEY(expanded) -CSS_KEY(extra_condensed) -CSS_KEY(extra_expanded) -CSS_KEY(far_left) -CSS_KEY(far_right) -CSS_KEY(fast) -CSS_KEY(faster) -CSS_KEY(field) -CSS_KEY(fixed) -CSS_KEY(georgian) -CSS_KEY(grab) -CSS_KEY(grabbing) -CSS_KEY(grad) -CSS_KEY(graytext) -CSS_KEY(groove) -CSS_KEY(gujarati) -CSS_KEY(gurmukhi) -CSS_KEY(hebrew) -CSS_KEY(help) -CSS_KEY(hidden) -CSS_KEY(hide) -CSS_KEY(high) -CSS_KEY(higher) -CSS_KEY(highlight) -CSS_KEY(highlighttext) -CSS_KEY(hiragana) -CSS_KEY(hiragana_iroha) -CSS_KEY(horizontal) -CSS_KEY(hz) -CSS_KEY(icon) -CSS_KEY(ignore) -CSS_KEY(in) -CSS_KEY(inactiveborder) -CSS_KEY(inactivecaption) -CSS_KEY(inactivecaptiontext) -CSS_KEY(info) -CSS_KEY(infobackground) -CSS_KEY(infotext) -CSS_KEY(inherit) -CSS_KEY(inline) -CSS_KEY(inline_block) -CSS_KEY(inline_table) -CSS_KEY(inset) -CSS_KEY(inside) -CSS_KEY(invert) -CSS_KEY(italic) -CSS_KEY(japanese_formal) -CSS_KEY(japanese_informal) -CSS_KEY(justify) -CSS_KEY(kannada) -CSS_KEY(katakana) -CSS_KEY(katakana_iroha) -CSS_KEY(khmer) -CSS_KEY(khz) -CSS_KEY(landscape) -CSS_KEY(lao) -CSS_KEY(large) -CSS_KEY(larger) -CSS_KEY(left) -CSS_KEY(left_side) -CSS_KEY(leftwards) -CSS_KEY(level) -CSS_KEY(lighter) -CSS_KEY(line_through) -CSS_KEY(list) -CSS_KEY(list_item) -CSS_KEY(loud) -CSS_KEY(low) -CSS_KEY(lower) -CSS_KEY(lower_alpha) -CSS_KEY(lower_greek) -CSS_KEY(lower_latin) -CSS_KEY(lower_roman) -CSS_KEY(lowercase) -CSS_KEY(ltr) -CSS_KEY(malayalam) -CSS_KEY(margin_box) -CSS_KEY(marker) -CSS_KEY(medium) -CSS_KEY(menu) -CSS_KEY(menutext) -CSS_KEY(message_box) -CSS_KEY(middle) -CSS_KEY(mix) -CSS_KEY(mm) -CSS_KEY(move) -CSS_KEY(ms) -CSS_KEY(myanmar) -CSS_KEY(n_resize) -CSS_KEY(narrower) -CSS_KEY(ne_resize) -CSS_KEY(no_close_quote) -CSS_KEY(no_open_quote) -CSS_KEY(no_repeat) -CSS_KEY(none) -CSS_KEY(normal) -CSS_KEY(noshade) -CSS_KEY(nowrap) -CSS_KEY(nw_resize) -CSS_KEY(oblique) -CSS_KEY(once) -CSS_KEY(open_quote) -CSS_KEY(oriya) -CSS_KEY(outset) -CSS_KEY(outside) -CSS_KEY(overline) -CSS_KEY(padding_box) -CSS_KEY(paragraph) -CSS_KEY(pc) -CSS_KEY(persian) -CSS_KEY(pointer) -CSS_KEY(portrait) -CSS_KEY(pre) -CSS_KEY(pt) -CSS_KEY(pull_down_menu) -CSS_KEY(px) -CSS_KEY(rad) -CSS_KEY(read_only) -CSS_KEY(read_write) -CSS_KEY(relative) -CSS_KEY(repeat) -CSS_KEY(repeat_x) -CSS_KEY(repeat_y) -CSS_KEY(ridge) -CSS_KEY(right) -CSS_KEY(right_side) -CSS_KEY(rightwards) -CSS_KEY(rtl) -CSS_KEY(run_in) -CSS_KEY(s) -CSS_KEY(s_resize) -CSS_KEY(scroll) -CSS_KEY(scrollbar) -CSS_KEY(se_resize) -CSS_KEY(select_all) -CSS_KEY(select_before) -CSS_KEY(select_after) -CSS_KEY(select_same) -CSS_KEY(select_menu) -CSS_KEY(semi_condensed) -CSS_KEY(semi_expanded) -CSS_KEY(separate) -CSS_KEY(show) -CSS_KEY(silent) -CSS_KEY(simp_chinese_formal) -CSS_KEY(simp_chinese_informal) -CSS_KEY(slow) -CSS_KEY(slower) -CSS_KEY(small) -CSS_KEY(small_caps) -CSS_KEY(small_caption) -CSS_KEY(smaller) -CSS_KEY(soft) -CSS_KEY(solid) -CSS_KEY(spell_out) -CSS_KEY(spinning) -CSS_KEY(square) -CSS_KEY(start) -CSS_KEY(static) -CSS_KEY(status_bar) -CSS_KEY(sub) -CSS_KEY(super) -CSS_KEY(sw_resize) -CSS_KEY(table) -CSS_KEY(table_caption) -CSS_KEY(table_cell) -CSS_KEY(table_column) -CSS_KEY(table_column_group) -CSS_KEY(table_footer_group) -CSS_KEY(table_header_group) -CSS_KEY(table_row) -CSS_KEY(table_row_group) -CSS_KEY(tamil) -CSS_KEY(telugu) -CSS_KEY(text) -CSS_KEY(text_bottom) -CSS_KEY(text_top) -CSS_KEY(thai) -CSS_KEY(thick) -CSS_KEY(thin) -CSS_KEY(threeddarkshadow) -CSS_KEY(threedface) -CSS_KEY(threedhighlight) -CSS_KEY(threedlightshadow) -CSS_KEY(threedshadow) -CSS_KEY(toggle) -CSS_KEY(top) -CSS_KEY(trad_chinese_formal) -CSS_KEY(trad_chinese_informal) -CSS_KEY(transparent) -CSS_KEY(tri_state) -CSS_KEY(ultra_condensed) -CSS_KEY(ultra_expanded) -CSS_KEY(underline) -CSS_KEY(upper_alpha) -CSS_KEY(upper_latin) -CSS_KEY(upper_roman) -CSS_KEY(uppercase) -CSS_KEY(urdu) -CSS_KEY(vertical) -CSS_KEY(visible) -CSS_KEY(w_resize) -CSS_KEY(wait) -CSS_KEY(wider) -CSS_KEY(window) -CSS_KEY(windowframe) -CSS_KEY(windowtext) -CSS_KEY(workspace) -CSS_KEY(write_only) -CSS_KEY(x_fast) -CSS_KEY(x_high) -CSS_KEY(x_large) -CSS_KEY(x_loud) -CSS_KEY(x_low) -CSS_KEY(x_slow) -CSS_KEY(x_small) -CSS_KEY(x_soft) -CSS_KEY(xx_large) -CSS_KEY(xx_small) +CSS_KEY(-moz-all, _moz_all) +CSS_KEY(-moz-bg-inset, _moz_bg_inset) +CSS_KEY(-moz-bg-outset, _moz_bg_outset) +CSS_KEY(-moz-center, _moz_center) +CSS_KEY(-moz-right, _moz_right) +CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) +CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) +CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) +CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) +CSS_KEY(above, above) +CSS_KEY(absolute, absolute) +CSS_KEY(activeborder, activeborder) +CSS_KEY(activecaption, activecaption) +CSS_KEY(alias, alias) +CSS_KEY(all, all) +CSS_KEY(always, always) +CSS_KEY(appworkspace, appworkspace) +CSS_KEY(arabic-indic, arabic_indic) +CSS_KEY(armenian, armenian) +CSS_KEY(auto, auto) +CSS_KEY(avoid, avoid) +CSS_KEY(background, background) +CSS_KEY(baseline, baseline) +CSS_KEY(behind, behind) +CSS_KEY(below, below) +CSS_KEY(bengali, bengali) +CSS_KEY(bidi-override, bidi_override) +CSS_KEY(blink, blink) +CSS_KEY(block, block) +CSS_KEY(bold, bold) +CSS_KEY(bolder, bolder) +CSS_KEY(border-box, border_box) +CSS_KEY(both, both) +CSS_KEY(bottom, bottom) +CSS_KEY(button, button) +CSS_KEY(buttonface, buttonface) +CSS_KEY(buttonhighlight, buttonhighlight) +CSS_KEY(buttonshadow, buttonshadow) +CSS_KEY(buttontext, buttontext) +CSS_KEY(capitalize, capitalize) +CSS_KEY(caption, caption) +CSS_KEY(captiontext, captiontext) +CSS_KEY(cell, cell) +CSS_KEY(center, center) +CSS_KEY(center-left, center_left) +CSS_KEY(center-right, center_right) +CSS_KEY(ch, ch) +CSS_KEY(circle, circle) +CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) +CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) +CSS_KEY(cjk-ideographic, cjk_ideographic) +CSS_KEY(close-quote, close_quote) +CSS_KEY(cm, cm) +CSS_KEY(code, code) +CSS_KEY(collapse, collapse) +CSS_KEY(compact, compact) +CSS_KEY(condensed, condensed) +CSS_KEY(content-box, content_box) +CSS_KEY(context-menu, context_menu) +CSS_KEY(continuous, continuous) +CSS_KEY(copy, copy) +CSS_KEY(count-down, count_down) +CSS_KEY(count-up, count_up) +CSS_KEY(count-up-down, count_up_down) +CSS_KEY(crop, crop) +CSS_KEY(cross, cross) +CSS_KEY(crosshair, crosshair) +CSS_KEY(dashed, dashed) +CSS_KEY(decimal, decimal) +CSS_KEY(decimal-leading-zero, decimal_leading_zero) +CSS_KEY(default, default) +CSS_KEY(deg, deg) +CSS_KEY(desktop, desktop) +CSS_KEY(devanagari, devanagari) +CSS_KEY(dialog, dialog) +CSS_KEY(digits, digits) +CSS_KEY(disabled, disabled) +CSS_KEY(disc, disc) +CSS_KEY(document, document) +CSS_KEY(dotted, dotted) +CSS_KEY(double, double) +CSS_KEY(e-resize, e_resize) +CSS_KEY(element, element) +CSS_KEY(elements, elements) +CSS_KEY(em, em) +CSS_KEY(embed, embed) +CSS_KEY(enabled, enabled) +CSS_KEY(ex, ex) +CSS_KEY(expanded, expanded) +CSS_KEY(extra-condensed, extra_condensed) +CSS_KEY(extra-expanded, extra_expanded) +CSS_KEY(far-left, far_left) +CSS_KEY(far-right, far_right) +CSS_KEY(fast, fast) +CSS_KEY(faster, faster) +CSS_KEY(field, field) +CSS_KEY(fixed, fixed) +CSS_KEY(georgian, georgian) +CSS_KEY(grab, grab) +CSS_KEY(grabbing, grabbing) +CSS_KEY(grad, grad) +CSS_KEY(graytext, graytext) +CSS_KEY(groove, groove) +CSS_KEY(gujarati, gujarati) +CSS_KEY(gurmukhi, gurmukhi) +CSS_KEY(hebrew, hebrew) +CSS_KEY(help, help) +CSS_KEY(hidden, hidden) +CSS_KEY(hide, hide) +CSS_KEY(high, high) +CSS_KEY(higher, higher) +CSS_KEY(highlight, highlight) +CSS_KEY(highlighttext, highlighttext) +CSS_KEY(hiragana, hiragana) +CSS_KEY(hiragana-iroha, hiragana_iroha) +CSS_KEY(horizontal, horizontal) +CSS_KEY(hz, hz) +CSS_KEY(icon, icon) +CSS_KEY(ignore, ignore) +CSS_KEY(in, in) +CSS_KEY(inactiveborder, inactiveborder) +CSS_KEY(inactivecaption, inactivecaption) +CSS_KEY(inactivecaptiontext, inactivecaptiontext) +CSS_KEY(info, info) +CSS_KEY(infobackground, infobackground) +CSS_KEY(infotext, infotext) +CSS_KEY(inherit, inherit) +CSS_KEY(inline, inline) +CSS_KEY(inline-block, inline_block) +CSS_KEY(inline-table, inline_table) +CSS_KEY(inset, inset) +CSS_KEY(inside, inside) +CSS_KEY(invert, invert) +CSS_KEY(italic, italic) +CSS_KEY(japanese-formal, japanese_formal) +CSS_KEY(japanese-informal, japanese_informal) +CSS_KEY(justify, justify) +CSS_KEY(kannada, kannada) +CSS_KEY(katakana, katakana) +CSS_KEY(katakana-iroha, katakana_iroha) +CSS_KEY(khmer, khmer) +CSS_KEY(khz, khz) +CSS_KEY(landscape, landscape) +CSS_KEY(lao, lao) +CSS_KEY(large, large) +CSS_KEY(larger, larger) +CSS_KEY(left, left) +CSS_KEY(left-side, left_side) +CSS_KEY(leftwards, leftwards) +CSS_KEY(level, level) +CSS_KEY(lighter, lighter) +CSS_KEY(line-through, line_through) +CSS_KEY(list, list) +CSS_KEY(list-item, list_item) +CSS_KEY(loud, loud) +CSS_KEY(low, low) +CSS_KEY(lower, lower) +CSS_KEY(lower-alpha, lower_alpha) +CSS_KEY(lower-greek, lower_greek) +CSS_KEY(lower-latin, lower_latin) +CSS_KEY(lower-roman, lower_roman) +CSS_KEY(lowercase, lowercase) +CSS_KEY(ltr, ltr) +CSS_KEY(malayalam, malayalam) +CSS_KEY(margin-box, margin_box) +CSS_KEY(marker, marker) +CSS_KEY(medium, medium) +CSS_KEY(menu, menu) +CSS_KEY(menutext, menutext) +CSS_KEY(message-box, message_box) +CSS_KEY(middle, middle) +CSS_KEY(mix, mix) +CSS_KEY(mm, mm) +CSS_KEY(move, move) +CSS_KEY(ms, ms) +CSS_KEY(myanmar, myanmar) +CSS_KEY(n-resize, n_resize) +CSS_KEY(narrower, narrower) +CSS_KEY(ne-resize, ne_resize) +CSS_KEY(no-close-quote, no_close_quote) +CSS_KEY(no-open-quote, no_open_quote) +CSS_KEY(no-repeat, no_repeat) +CSS_KEY(none, none) +CSS_KEY(normal, normal) +CSS_KEY(noshade, noshade) +CSS_KEY(nowrap, nowrap) +CSS_KEY(nw-resize, nw_resize) +CSS_KEY(oblique, oblique) +CSS_KEY(once, once) +CSS_KEY(open-quote, open_quote) +CSS_KEY(oriya, oriya) +CSS_KEY(outset, outset) +CSS_KEY(outside, outside) +CSS_KEY(overline, overline) +CSS_KEY(padding-box, padding_box) +CSS_KEY(paragraph, paragraph) +CSS_KEY(pc, pc) +CSS_KEY(persian, persian) +CSS_KEY(pointer, pointer) +CSS_KEY(portrait, portrait) +CSS_KEY(pre, pre) +CSS_KEY(pt, pt) +CSS_KEY(pull-down-menu, pull_down_menu) +CSS_KEY(px, px) +CSS_KEY(rad, rad) +CSS_KEY(read-only, read_only) +CSS_KEY(read-write, read_write) +CSS_KEY(relative, relative) +CSS_KEY(repeat, repeat) +CSS_KEY(repeat-x, repeat_x) +CSS_KEY(repeat-y, repeat_y) +CSS_KEY(ridge, ridge) +CSS_KEY(right, right) +CSS_KEY(right-side, right_side) +CSS_KEY(rightwards, rightwards) +CSS_KEY(rtl, rtl) +CSS_KEY(run-in, run_in) +CSS_KEY(s, s) +CSS_KEY(s-resize, s_resize) +CSS_KEY(scroll, scroll) +CSS_KEY(scrollbar, scrollbar) +CSS_KEY(se-resize, se_resize) +CSS_KEY(select-all, select_all) +CSS_KEY(select-before, select_before) +CSS_KEY(select-after, select_after) +CSS_KEY(select-same, select_same) +CSS_KEY(select-menu, select_menu) +CSS_KEY(semi-condensed, semi_condensed) +CSS_KEY(semi-expanded, semi_expanded) +CSS_KEY(separate, separate) +CSS_KEY(show, show) +CSS_KEY(silent, silent) +CSS_KEY(simp-chinese-formal, simp_chinese_formal) +CSS_KEY(simp-chinese-informal, simp_chinese_informal) +CSS_KEY(slow, slow) +CSS_KEY(slower, slower) +CSS_KEY(small, small) +CSS_KEY(small-caps, small_caps) +CSS_KEY(small-caption, small_caption) +CSS_KEY(smaller, smaller) +CSS_KEY(soft, soft) +CSS_KEY(solid, solid) +CSS_KEY(spell-out, spell_out) +CSS_KEY(spinning, spinning) +CSS_KEY(square, square) +CSS_KEY(start, start) +CSS_KEY(static, static) +CSS_KEY(status-bar, status_bar) +CSS_KEY(sub, sub) +CSS_KEY(super, super) +CSS_KEY(sw-resize, sw_resize) +CSS_KEY(table, table) +CSS_KEY(table-caption, table_caption) +CSS_KEY(table-cell, table_cell) +CSS_KEY(table-column, table_column) +CSS_KEY(table-column-group, table_column_group) +CSS_KEY(table-footer-group, table_footer_group) +CSS_KEY(table-header-group, table_header_group) +CSS_KEY(table-row, table_row) +CSS_KEY(table-row-group, table_row_group) +CSS_KEY(tamil, tamil) +CSS_KEY(telugu, telugu) +CSS_KEY(text, text) +CSS_KEY(text-bottom, text_bottom) +CSS_KEY(text-top, text_top) +CSS_KEY(thai, thai) +CSS_KEY(thick, thick) +CSS_KEY(thin, thin) +CSS_KEY(threeddarkshadow, threeddarkshadow) +CSS_KEY(threedface, threedface) +CSS_KEY(threedhighlight, threedhighlight) +CSS_KEY(threedlightshadow, threedlightshadow) +CSS_KEY(threedshadow, threedshadow) +CSS_KEY(toggle, toggle) +CSS_KEY(top, top) +CSS_KEY(trad-chinese-formal, trad_chinese_formal) +CSS_KEY(trad-chinese-informal, trad_chinese_informal) +CSS_KEY(transparent, transparent) +CSS_KEY(tri-state, tri_state) +CSS_KEY(ultra-condensed, ultra_condensed) +CSS_KEY(ultra-expanded, ultra_expanded) +CSS_KEY(underline, underline) +CSS_KEY(upper-alpha, upper_alpha) +CSS_KEY(upper-latin, upper_latin) +CSS_KEY(upper-roman, upper_roman) +CSS_KEY(uppercase, uppercase) +CSS_KEY(urdu, urdu) +CSS_KEY(vertical, vertical) +CSS_KEY(visible, visible) +CSS_KEY(w-resize, w_resize) +CSS_KEY(wait, wait) +CSS_KEY(wider, wider) +CSS_KEY(window, window) +CSS_KEY(windowframe, windowframe) +CSS_KEY(windowtext, windowtext) +CSS_KEY(workspace, workspace) +CSS_KEY(write-only, write_only) +CSS_KEY(x-fast, x_fast) +CSS_KEY(x-high, x_high) +CSS_KEY(x-large, x_large) +CSS_KEY(x-loud, x_loud) +CSS_KEY(x-low, x_low) +CSS_KEY(x-slow, x_slow) +CSS_KEY(x-small, x_small) +CSS_KEY(x-soft, x_soft) +CSS_KEY(xx-large, xx_large) +CSS_KEY(xx-small, xx_small) diff --git a/layout/html/style/src/nsCSSKeywords.cpp b/layout/html/style/src/nsCSSKeywords.cpp index df81aba2e10..e69de29bb2d 100644 --- a/layout/html/style/src/nsCSSKeywords.cpp +++ b/layout/html/style/src/nsCSSKeywords.cpp @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCSSKeywords.h" -#include "nsString.h" -#include "nsAVLTree.h" - - -// define an array of all CSS keywords -#define CSS_KEY(_key) #_key, -const char* kCSSRawKeywords[] = { -#include "nsCSSKeywordList.h" -}; -#undef CSS_KEY - -struct KeywordNode { - KeywordNode(void) - : mStr(), - mEnum(eCSSKeyword_UNKNOWN) - {} - - KeywordNode(const nsStr& aStringValue, nsCSSKeyword aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSKeyword mEnum; -}; - -class KeywordComparitor: public nsAVLNodeComparitor { -public: - virtual ~KeywordComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - KeywordNode* one = (KeywordNode*)anItem1; - KeywordNode* two = (KeywordNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static KeywordNode* gKeywordArray; -static nsAVLTree* gKeywordTree; -static KeywordComparitor* gComparitor; -static nsCString* kNullStr; - -void -nsCSSKeywords::AddRefTable(void) -{ - if (0 == gTableRefCount++) { - if (! gKeywordArray) { - gKeywordArray = new KeywordNode[eCSSKeyword_COUNT]; - gComparitor = new KeywordComparitor(); - if (gComparitor) { - gKeywordTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gKeywordArray && gKeywordTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSKeyword_COUNT)) { - gKeywordArray[index].mStr = kCSSRawKeywords[index]; - gKeywordArray[index].mStr.ReplaceChar('_', '-'); - gKeywordArray[index].mEnum = nsCSSKeyword(index); - gKeywordTree->AddItem(&(gKeywordArray[index])); - } - } - } - kNullStr = new nsCString(); - } -} - -void -nsCSSKeywords::ReleaseTable(void) -{ - if (0 == --gTableRefCount) { - if (gKeywordArray) { - delete [] gKeywordArray; - gKeywordArray = nsnull; - } - if (gKeywordTree) { - delete gKeywordTree; - gKeywordTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; - } -} - - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) -{ - NS_ASSERTION(gKeywordTree, "no lookup table, needs addref"); - if (gKeywordTree) { - KeywordNode node(aKeyword, eCSSKeyword_UNKNOWN); - KeywordNode* found = (KeywordNode*)gKeywordTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aKeyword), "bad tree"); - return found->mEnum; - } - } - return eCSSKeyword_UNKNOWN; -} - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsString& aKeyword) { - nsCAutoString theKeyword; theKeyword.AssignWithConversion(aKeyword); - return LookupKeyword(theKeyword); -} - - -const nsCString& -nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) -{ - NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); - if ((eCSSKeyword_UNKNOWN < aKeyword) && - (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { - return gKeywordArray[aKeyword].mStr; - } - else { - return *kNullStr; - } -} - diff --git a/layout/html/style/src/nsCSSKeywords.h b/layout/html/style/src/nsCSSKeywords.h index 4473a0c3bac..e69de29bb2d 100644 --- a/layout/html/style/src/nsCSSKeywords.h +++ b/layout/html/style/src/nsCSSKeywords.h @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSKeywords_h___ -#define nsCSSKeywords_h___ - -#include "nslayout.h" - -class nsString; -class nsCString; - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSKeyword_foo" (where foo is the keyword) - - To change the list of keywords, see nsCSSKeywordList.h - - */ -#define CSS_KEY(_key) eCSSKeyword_##_key, -enum nsCSSKeyword { - eCSSKeyword_UNKNOWN = -1, -#include "nsCSSKeywordList.h" - eCSSKeyword_COUNT -}; -#undef CSS_KEY - - -class NS_LAYOUT nsCSSKeywords { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a keyword string, return the enum value - static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); - static nsCSSKeyword LookupKeyword(const nsString& aKeyword); - - // Given a keyword enum, get the string value - static const nsCString& GetStringValue(nsCSSKeyword aKeyword); -}; - -#endif /* nsCSSKeywords_h___ */ diff --git a/layout/html/style/src/nsCSSPropList.h b/layout/html/style/src/nsCSSPropList.h index 2430d27798d..a7dd2d34ffa 100644 --- a/layout/html/style/src/nsCSSPropList.h +++ b/layout/html/style/src/nsCSSPropList.h @@ -34,171 +34,177 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in properties are automagically converted into hyphens + Requirements: - The first argument to CSS_PROP is both the enum identifier of the property - and the string value - The second argument is the style impact resultant in a change to the property + Entries are in the form: (name,id,impact). 'id' must always be the same as + 'name' except that all hyphens ('-') in 'name' are converted to underscores + ('_') in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** + + The third argument is the style impact resultant in a change to the property ******/ -CSS_PROP(_moz_border_radius, VISUAL) -CSS_PROP(_moz_border_radius_topLeft, VISUAL) -CSS_PROP(_moz_border_radius_topRight, VISUAL) -CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_border_radius_bottomRight, VISUAL) -CSS_PROP(_moz_outline_radius, VISUAL) -CSS_PROP(_moz_outline_radius_topLeft, VISUAL) -CSS_PROP(_moz_outline_radius_topRight, VISUAL) -CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) -CSS_PROP(azimuth, AURAL) -CSS_PROP(background, VISUAL) -CSS_PROP(background_attachment, VISUAL) -CSS_PROP(background_color, VISUAL) -CSS_PROP(background_image, VISUAL) -CSS_PROP(background_position, VISUAL) -CSS_PROP(background_repeat, VISUAL) -CSS_PROP(background_x_position, VISUAL) -CSS_PROP(background_y_position, VISUAL) -CSS_PROP(behavior, REFLOW) -CSS_PROP(border, REFLOW) -CSS_PROP(border_bottom, REFLOW) -CSS_PROP(border_bottom_color, VISUAL) -CSS_PROP(border_bottom_style, REFLOW) // on/off will need reflow -CSS_PROP(border_bottom_width, REFLOW) -CSS_PROP(border_collapse, REFLOW) -CSS_PROP(border_color, VISUAL) -CSS_PROP(border_left, REFLOW) -CSS_PROP(border_left_color, VISUAL) -CSS_PROP(border_left_style, REFLOW) // on/off will need reflow -CSS_PROP(border_left_width, REFLOW) -CSS_PROP(border_right, REFLOW) -CSS_PROP(border_right_color, VISUAL) -CSS_PROP(border_right_style, REFLOW) // on/off will need reflow -CSS_PROP(border_right_width, REFLOW) -CSS_PROP(border_spacing, REFLOW) -CSS_PROP(border_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top, REFLOW) -CSS_PROP(border_top_color, VISUAL) -CSS_PROP(border_top_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top_width, REFLOW) -CSS_PROP(border_width, REFLOW) -CSS_PROP(border_x_spacing, REFLOW) -CSS_PROP(border_y_spacing, REFLOW) -CSS_PROP(bottom, REFLOW) -CSS_PROP(box_sizing, REFLOW) -CSS_PROP(caption_side, REFLOW) -CSS_PROP(clear, REFLOW) -CSS_PROP(clip, VISUAL) -CSS_PROP(clip_bottom, VISUAL) -CSS_PROP(clip_left, VISUAL) -CSS_PROP(clip_right, VISUAL) -CSS_PROP(clip_top, VISUAL) -CSS_PROP(color, VISUAL) -CSS_PROP(content, FRAMECHANGE) -CSS_PROP(counter_increment, REFLOW) -CSS_PROP(counter_reset, REFLOW) -CSS_PROP(cue, AURAL) -CSS_PROP(cue_after, AURAL) -CSS_PROP(cue_before, AURAL) -CSS_PROP(cursor, VISUAL) -CSS_PROP(direction, REFLOW) -CSS_PROP(display, FRAMECHANGE) -CSS_PROP(elevation, AURAL) -CSS_PROP(empty_cells, VISUAL) -CSS_PROP(float, FRAMECHANGE) -CSS_PROP(float_edge, REFLOW) -CSS_PROP(font, REFLOW) -CSS_PROP(font_family, REFLOW) -CSS_PROP(font_size, REFLOW) -CSS_PROP(font_size_adjust, REFLOW) -CSS_PROP(font_stretch, REFLOW) -CSS_PROP(font_style, REFLOW) -CSS_PROP(font_variant, REFLOW) -CSS_PROP(font_weight, REFLOW) -CSS_PROP(height, REFLOW) -CSS_PROP(key_equivalent, CONTENT) // This will need some other notification, but what? -CSS_PROP(left, REFLOW) -CSS_PROP(letter_spacing, REFLOW) -CSS_PROP(line_height, REFLOW) -CSS_PROP(list_style, REFLOW) -CSS_PROP(list_style_image, REFLOW) -CSS_PROP(list_style_position, REFLOW) -CSS_PROP(list_style_type, REFLOW) -CSS_PROP(margin, REFLOW) -CSS_PROP(margin_bottom, REFLOW) -CSS_PROP(margin_left, REFLOW) -CSS_PROP(margin_right, REFLOW) -CSS_PROP(margin_top, REFLOW) -CSS_PROP(marker_offset, REFLOW) -CSS_PROP(marks, VISUAL) -CSS_PROP(max_height, REFLOW) -CSS_PROP(max_width, REFLOW) -CSS_PROP(min_height, REFLOW) -CSS_PROP(min_width, REFLOW) -CSS_PROP(opacity, VISUAL) -CSS_PROP(orphans, REFLOW) -CSS_PROP(outline, VISUAL) -CSS_PROP(outline_color, VISUAL) -CSS_PROP(outline_style, VISUAL) -CSS_PROP(outline_width, VISUAL) -CSS_PROP(overflow, FRAMECHANGE) -CSS_PROP(padding, REFLOW) -CSS_PROP(padding_bottom, REFLOW) -CSS_PROP(padding_left, REFLOW) -CSS_PROP(padding_right, REFLOW) -CSS_PROP(padding_top, REFLOW) -CSS_PROP(page, REFLOW) -CSS_PROP(page_break_after, REFLOW) -CSS_PROP(page_break_before, REFLOW) -CSS_PROP(page_break_inside, REFLOW) -CSS_PROP(pause, AURAL) -CSS_PROP(pause_after, AURAL) -CSS_PROP(pause_before, AURAL) -CSS_PROP(pitch, AURAL) -CSS_PROP(pitch_range, AURAL) -CSS_PROP(play_during, AURAL) -CSS_PROP(play_during_flags, AURAL) -CSS_PROP(position, FRAMECHANGE) -CSS_PROP(quotes, REFLOW) -CSS_PROP(quotes_close, REFLOW) -CSS_PROP(quotes_open, REFLOW) -CSS_PROP(resizer, FRAMECHANGE) -CSS_PROP(richness, AURAL) -CSS_PROP(right, REFLOW) -CSS_PROP(size, REFLOW) -CSS_PROP(size_height, REFLOW) -CSS_PROP(size_width, REFLOW) -CSS_PROP(speak, AURAL) -CSS_PROP(speak_header, AURAL) -CSS_PROP(speak_numeral, AURAL) -CSS_PROP(speak_punctuation, AURAL) -CSS_PROP(speech_rate, AURAL) -CSS_PROP(stress, AURAL) -CSS_PROP(table_layout, REFLOW) -CSS_PROP(text_align, REFLOW) -CSS_PROP(text_decoration, VISUAL) -CSS_PROP(text_indent, REFLOW) -CSS_PROP(text_shadow, VISUAL) -CSS_PROP(text_shadow_color, VISUAL) -CSS_PROP(text_shadow_radius, VISUAL) -CSS_PROP(text_shadow_x, VISUAL) -CSS_PROP(text_shadow_y, VISUAL) -CSS_PROP(text_transform, REFLOW) -CSS_PROP(top, REFLOW) -CSS_PROP(unicode_bidi, REFLOW) -CSS_PROP(user_focus, CONTENT) -CSS_PROP(user_input, FRAMECHANGE) // XXX ??? -CSS_PROP(user_modify, FRAMECHANGE) -CSS_PROP(user_select, CONTENT) -CSS_PROP(vertical_align, REFLOW) -CSS_PROP(visibility, REFLOW) // reflow for collapse -CSS_PROP(voice_family, AURAL) -CSS_PROP(volume, AURAL) -CSS_PROP(white_space, REFLOW) -CSS_PROP(widows, REFLOW) -CSS_PROP(width, REFLOW) -CSS_PROP(word_spacing, REFLOW) -CSS_PROP(z_index, REFLOW) - +CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL) +CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL) +CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL) +CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL) +CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL) +CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL) +CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL) +CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL) +CSS_PROP(azimuth, azimuth, AURAL) +CSS_PROP(background, background, VISUAL) +CSS_PROP(background-attachment, background_attachment, VISUAL) +CSS_PROP(background-color, background_color, VISUAL) +CSS_PROP(background-image, background_image, VISUAL) +CSS_PROP(background-position, background_position, VISUAL) +CSS_PROP(background-repeat, background_repeat, VISUAL) +CSS_PROP(background-x-position, background_x_position, VISUAL) +CSS_PROP(background-y-position, background_y_position, VISUAL) +CSS_PROP(behavior, behavior, REFLOW) +CSS_PROP(border, border, REFLOW) +CSS_PROP(border-bottom, border_bottom, REFLOW) +CSS_PROP(border-bottom-color, border_bottom_color, VISUAL) +CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow +CSS_PROP(border-bottom-width, border_bottom_width, REFLOW) +CSS_PROP(border-collapse, border_collapse, REFLOW) +CSS_PROP(border-color, border_color, VISUAL) +CSS_PROP(border-left, border_left, REFLOW) +CSS_PROP(border-left-color, border_left_color, VISUAL) +CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow +CSS_PROP(border-left-width, border_left_width, REFLOW) +CSS_PROP(border-right, border_right, REFLOW) +CSS_PROP(border-right-color, border_right_color, VISUAL) +CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow +CSS_PROP(border-right-width, border_right_width, REFLOW) +CSS_PROP(border-spacing, border_spacing, REFLOW) +CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top, border_top, REFLOW) +CSS_PROP(border-top-color, border_top_color, VISUAL) +CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top-width, border_top_width, REFLOW) +CSS_PROP(border-width, border_width, REFLOW) +CSS_PROP(border-x-spacing, border_x_spacing, REFLOW) +CSS_PROP(border-y-spacing, border_y_spacing, REFLOW) +CSS_PROP(bottom, bottom, REFLOW) +CSS_PROP(box-sizing, box_sizing, REFLOW) +CSS_PROP(caption-side, caption_side, REFLOW) +CSS_PROP(clear, clear, REFLOW) +CSS_PROP(clip, clip, VISUAL) +CSS_PROP(clip-bottom, clip_bottom, VISUAL) +CSS_PROP(clip-left, clip_left, VISUAL) +CSS_PROP(clip-right, clip_right, VISUAL) +CSS_PROP(clip-top, clip_top, VISUAL) +CSS_PROP(color, color, VISUAL) +CSS_PROP(content, content, FRAMECHANGE) +CSS_PROP(counter-increment, counter_increment, REFLOW) +CSS_PROP(counter-reset, counter_reset, REFLOW) +CSS_PROP(cue, cue, AURAL) +CSS_PROP(cue-after, cue_after, AURAL) +CSS_PROP(cue-before, cue_before, AURAL) +CSS_PROP(cursor, cursor, VISUAL) +CSS_PROP(direction, direction, REFLOW) +CSS_PROP(display, display, FRAMECHANGE) +CSS_PROP(elevation, elevation, AURAL) +CSS_PROP(empty-cells, empty_cells, VISUAL) +CSS_PROP(float, float, FRAMECHANGE) +CSS_PROP(float-edge, float_edge, REFLOW) +CSS_PROP(font, font, REFLOW) +CSS_PROP(font-family, font_family, REFLOW) +CSS_PROP(font-size, font_size, REFLOW) +CSS_PROP(font-size-adjust, font_size_adjust, REFLOW) +CSS_PROP(font-stretch, font_stretch, REFLOW) +CSS_PROP(font-style, font_style, REFLOW) +CSS_PROP(font-variant, font_variant, REFLOW) +CSS_PROP(font-weight, font_weight, REFLOW) +CSS_PROP(height, height, REFLOW) +CSS_PROP(key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? +CSS_PROP(left, left, REFLOW) +CSS_PROP(letter-spacing, letter_spacing, REFLOW) +CSS_PROP(line-height, line_height, REFLOW) +CSS_PROP(list-style, list_style, REFLOW) +CSS_PROP(list-style-image, list_style_image, REFLOW) +CSS_PROP(list-style-position, list_style_position, REFLOW) +CSS_PROP(list-style-type, list_style_type, REFLOW) +CSS_PROP(margin, margin, REFLOW) +CSS_PROP(margin-bottom, margin_bottom, REFLOW) +CSS_PROP(margin-left, margin_left, REFLOW) +CSS_PROP(margin-right, margin_right, REFLOW) +CSS_PROP(margin-top, margin_top, REFLOW) +CSS_PROP(marker-offset, marker_offset, REFLOW) +CSS_PROP(marks, marks, VISUAL) +CSS_PROP(max-height, max_height, REFLOW) +CSS_PROP(max-width, max_width, REFLOW) +CSS_PROP(min-height, min_height, REFLOW) +CSS_PROP(min-width, min_width, REFLOW) +CSS_PROP(opacity, opacity, VISUAL) +CSS_PROP(orphans, orphans, REFLOW) +CSS_PROP(outline, outline, VISUAL) +CSS_PROP(outline-color, outline_color, VISUAL) +CSS_PROP(outline-style, outline_style, VISUAL) +CSS_PROP(outline-width, outline_width, VISUAL) +CSS_PROP(overflow, overflow, FRAMECHANGE) +CSS_PROP(padding, padding, REFLOW) +CSS_PROP(padding-bottom, padding_bottom, REFLOW) +CSS_PROP(padding-left, padding_left, REFLOW) +CSS_PROP(padding-right, padding_right, REFLOW) +CSS_PROP(padding-top, padding_top, REFLOW) +CSS_PROP(page, page, REFLOW) +CSS_PROP(page-break-after, page_break_after, REFLOW) +CSS_PROP(page-break-before, page_break_before, REFLOW) +CSS_PROP(page-break-inside, page_break_inside, REFLOW) +CSS_PROP(pause, pause, AURAL) +CSS_PROP(pause-after, pause_after, AURAL) +CSS_PROP(pause-before, pause_before, AURAL) +CSS_PROP(pitch, pitch, AURAL) +CSS_PROP(pitch-range, pitch_range, AURAL) +CSS_PROP(play-during, play_during, AURAL) +CSS_PROP(play-during-flags, play_during_flags, AURAL) +CSS_PROP(position, position, FRAMECHANGE) +CSS_PROP(quotes, quotes, REFLOW) +CSS_PROP(quotes-close, quotes_close, REFLOW) +CSS_PROP(quotes-open, quotes_open, REFLOW) +CSS_PROP(resizer, resizer, FRAMECHANGE) +CSS_PROP(richness, richness, AURAL) +CSS_PROP(right, right, REFLOW) +CSS_PROP(size, size, REFLOW) +CSS_PROP(size-height, size_height, REFLOW) +CSS_PROP(size-width, size_width, REFLOW) +CSS_PROP(speak, speak, AURAL) +CSS_PROP(speak-header, speak_header, AURAL) +CSS_PROP(speak-numeral, speak_numeral, AURAL) +CSS_PROP(speak-punctuation, speak_punctuation, AURAL) +CSS_PROP(speech-rate, speech_rate, AURAL) +CSS_PROP(stress, stress, AURAL) +CSS_PROP(table-layout, table_layout, REFLOW) +CSS_PROP(text-align, text_align, REFLOW) +CSS_PROP(text-decoration, text_decoration, VISUAL) +CSS_PROP(text-indent, text_indent, REFLOW) +CSS_PROP(text-shadow, text_shadow, VISUAL) +CSS_PROP(text-shadow-color, text_shadow_color, VISUAL) +CSS_PROP(text-shadow-radius, text_shadow_radius, VISUAL) +CSS_PROP(text-shadow-x, text_shadow_x, VISUAL) +CSS_PROP(text-shadow-y, text_shadow_y, VISUAL) +CSS_PROP(text-transform, text_transform, REFLOW) +CSS_PROP(top, top, REFLOW) +CSS_PROP(unicode-bidi, unicode_bidi, REFLOW) +CSS_PROP(user-focus, user_focus, CONTENT) +CSS_PROP(user-input, user_input, FRAMECHANGE) // XXX ??? +CSS_PROP(user-modify, user_modify, FRAMECHANGE) +CSS_PROP(user-select, user_select, CONTENT) +CSS_PROP(vertical-align, vertical_align, REFLOW) +CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse +CSS_PROP(voice-family, voice_family, AURAL) +CSS_PROP(volume, volume, AURAL) +CSS_PROP(white-space, white_space, REFLOW) +CSS_PROP(widows, widows, REFLOW) +CSS_PROP(width, width, REFLOW) +CSS_PROP(word-spacing, word_spacing, REFLOW) +CSS_PROP(z-index, z_index, REFLOW) diff --git a/layout/html/style/src/nsCSSProps.cpp b/layout/html/style/src/nsCSSProps.cpp index 3f7b9d3a201..8b4c3180d96 100644 --- a/layout/html/style/src/nsCSSProps.cpp +++ b/layout/html/style/src/nsCSSProps.cpp @@ -27,73 +27,40 @@ #include "nsILookAndFeel.h" // for system colors #include "nsString.h" -#include "nsAVLTree.h" - +#include "nsStaticNameTable.h" // define an array of all CSS properties -#define CSS_PROP(_prop, _hint) #_prop, +#define CSS_PROP(_name, _id, _hint) #_name, const char* kCSSRawProperties[] = { #include "nsCSSPropList.h" }; #undef CSS_PROP -struct PropertyNode { - PropertyNode(void) - : mStr(), - mEnum(eCSSProperty_UNKNOWN) - {} - PropertyNode(const nsStr& aStringValue, nsCSSProperty aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSProperty mEnum; -}; - -class PropertyComparitor: public nsAVLNodeComparitor { -public: - virtual ~PropertyComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - PropertyNode* one = (PropertyNode*)anItem1; - PropertyNode* two = (PropertyNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static PropertyNode* gPropertyArray; -static nsAVLTree* gPropertyTree; -static PropertyComparitor* gComparitor; -static nsCString* kNullStr; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gPropertyTable; void nsCSSProps::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gPropertyArray) { - gPropertyArray= new PropertyNode[eCSSProperty_COUNT]; - gComparitor = new PropertyComparitor(); - if (gComparitor) { - gPropertyTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gPropertyArray && gPropertyTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSProperty_COUNT)) { - gPropertyArray[index].mStr = kCSSRawProperties[index]; - gPropertyArray[index].mStr.ReplaceChar('_', '-'); - gPropertyArray[index].mEnum = nsCSSProperty(index); - gPropertyTree->AddItem(&(gPropertyArray[index])); - } + NS_ASSERTION(!gPropertyTable, "pre existing array!"); + gPropertyTable = new nsStaticCaseInsensitiveNameTable(); + if (gPropertyTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eCSSProperty_COUNT; ++index) { + nsCAutoString temp1(kCSSRawProperties[index]); + nsCAutoString temp2(kCSSRawProperties[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); + NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); } } - kNullStr = new nsCString(); +#endif + gPropertyTable->Init(kCSSRawProperties, eCSSProperty_COUNT); + } } } @@ -101,60 +68,47 @@ void nsCSSProps::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gPropertyArray) { - delete [] gPropertyArray; - gPropertyArray = nsnull; + if (gPropertyTable) { + delete gPropertyTable; + gPropertyTable = nsnull; } - if (gPropertyTree) { - delete gPropertyTree; - gPropertyTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; } } - nsCSSProperty nsCSSProps::LookupProperty(const nsCString& aProperty) { - NS_ASSERTION(gPropertyTree, "no lookup table, needs addref"); - if (gPropertyTree) { - PropertyNode node(aProperty, eCSSProperty_UNKNOWN); - PropertyNode* found = (PropertyNode*)gPropertyTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aProperty), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } return eCSSProperty_UNKNOWN; } - nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) { - nsCAutoString theProp; theProp.AssignWithConversion(aProperty); - return LookupProperty(theProp); +nsCSSProps::LookupProperty(const nsString& aProperty) +{ + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } + return eCSSProperty_UNKNOWN; } - const nsCString& nsCSSProps::GetStringValue(nsCSSProperty aProperty) { - NS_ASSERTION(gPropertyArray, "no lookup table, needs addref"); - if ((eCSSProperty_UNKNOWN < aProperty) && - (aProperty < eCSSProperty_COUNT) && gPropertyArray) { - return gPropertyArray[aProperty].mStr; - } - else { - return *kNullStr; + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return gPropertyTable->GetStringValue(PRInt32(aProperty)); + } else { + static nsCString sNullStr; + return sNullStr; } } +/***************************************************************************/ // Keyword id tables for variant/enum parsing const PRInt32 nsCSSProps::kAzimuthKTable[] = { @@ -726,7 +680,8 @@ SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) { PRInt32 i = SearchKeywordTableInt(aValue, aTable); if (i < 0) { - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } else { return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); } @@ -1083,7 +1038,8 @@ static const PRInt32 kBackgroundYPositionKTable[] = { NS_ERROR("invalid property"); break; } - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) @@ -1105,7 +1061,7 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) } // define array of all CSS property hints -#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +#define CSS_PROP(_name, _id, _hint) NS_STYLE_HINT_##_hint, const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { #include "nsCSSPropList.h" }; diff --git a/layout/html/style/src/nsCSSProps.h b/layout/html/style/src/nsCSSProps.h index 81778dd3ff8..316d3506d38 100644 --- a/layout/html/style/src/nsCSSProps.h +++ b/layout/html/style/src/nsCSSProps.h @@ -34,7 +34,7 @@ class nsString; To change the list of properties, see nsCSSPropList.h */ -#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, enum nsCSSProperty { eCSSProperty_UNKNOWN = -1, #include "nsCSSPropList.h" diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 6cef8af569e..072d822669a 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -34,315 +34,323 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in keywords are automagically converted into hyphens + Requirements: + + Entries are in the form: (name,id). 'id' must always be the same as 'name' + except that all hyphens ('-') in 'name' are converted to underscores ('_') + in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** ******/ - -CSS_KEY(_moz_all) -CSS_KEY(_moz_bg_inset) -CSS_KEY(_moz_bg_outset) -CSS_KEY(_moz_center) -CSS_KEY(_moz_right) -CSS_KEY(_moz_pre_wrap) -CSS_KEY(_moz_scrollbars_none) -CSS_KEY(_moz_scrollbars_horizontal) -CSS_KEY(_moz_scrollbars_vertical) -CSS_KEY(above) -CSS_KEY(absolute) -CSS_KEY(activeborder) -CSS_KEY(activecaption) -CSS_KEY(alias) -CSS_KEY(all) -CSS_KEY(always) -CSS_KEY(appworkspace) -CSS_KEY(arabic_indic) -CSS_KEY(armenian) -CSS_KEY(auto) -CSS_KEY(avoid) -CSS_KEY(background) -CSS_KEY(baseline) -CSS_KEY(behind) -CSS_KEY(below) -CSS_KEY(bengali) -CSS_KEY(bidi_override) -CSS_KEY(blink) -CSS_KEY(block) -CSS_KEY(bold) -CSS_KEY(bolder) -CSS_KEY(border_box) -CSS_KEY(both) -CSS_KEY(bottom) -CSS_KEY(button) -CSS_KEY(buttonface) -CSS_KEY(buttonhighlight) -CSS_KEY(buttonshadow) -CSS_KEY(buttontext) -CSS_KEY(capitalize) -CSS_KEY(caption) -CSS_KEY(captiontext) -CSS_KEY(cell) -CSS_KEY(center) -CSS_KEY(center_left) -CSS_KEY(center_right) -CSS_KEY(ch) -CSS_KEY(circle) -CSS_KEY(cjk_earthly_branch) -CSS_KEY(cjk_heavenly_stem) -CSS_KEY(cjk_ideographic) -CSS_KEY(close_quote) -CSS_KEY(cm) -CSS_KEY(code) -CSS_KEY(collapse) -CSS_KEY(compact) -CSS_KEY(condensed) -CSS_KEY(content_box) -CSS_KEY(context_menu) -CSS_KEY(continuous) -CSS_KEY(copy) -CSS_KEY(count_down) -CSS_KEY(count_up) -CSS_KEY(count_up_down) -CSS_KEY(crop) -CSS_KEY(cross) -CSS_KEY(crosshair) -CSS_KEY(dashed) -CSS_KEY(decimal) -CSS_KEY(decimal_leading_zero) -CSS_KEY(default) -CSS_KEY(deg) -CSS_KEY(desktop) -CSS_KEY(devanagari) -CSS_KEY(dialog) -CSS_KEY(digits) -CSS_KEY(disabled) -CSS_KEY(disc) -CSS_KEY(document) -CSS_KEY(dotted) -CSS_KEY(double) -CSS_KEY(e_resize) -CSS_KEY(element) -CSS_KEY(elements) -CSS_KEY(em) -CSS_KEY(embed) -CSS_KEY(enabled) -CSS_KEY(ex) -CSS_KEY(expanded) -CSS_KEY(extra_condensed) -CSS_KEY(extra_expanded) -CSS_KEY(far_left) -CSS_KEY(far_right) -CSS_KEY(fast) -CSS_KEY(faster) -CSS_KEY(field) -CSS_KEY(fixed) -CSS_KEY(georgian) -CSS_KEY(grab) -CSS_KEY(grabbing) -CSS_KEY(grad) -CSS_KEY(graytext) -CSS_KEY(groove) -CSS_KEY(gujarati) -CSS_KEY(gurmukhi) -CSS_KEY(hebrew) -CSS_KEY(help) -CSS_KEY(hidden) -CSS_KEY(hide) -CSS_KEY(high) -CSS_KEY(higher) -CSS_KEY(highlight) -CSS_KEY(highlighttext) -CSS_KEY(hiragana) -CSS_KEY(hiragana_iroha) -CSS_KEY(horizontal) -CSS_KEY(hz) -CSS_KEY(icon) -CSS_KEY(ignore) -CSS_KEY(in) -CSS_KEY(inactiveborder) -CSS_KEY(inactivecaption) -CSS_KEY(inactivecaptiontext) -CSS_KEY(info) -CSS_KEY(infobackground) -CSS_KEY(infotext) -CSS_KEY(inherit) -CSS_KEY(inline) -CSS_KEY(inline_block) -CSS_KEY(inline_table) -CSS_KEY(inset) -CSS_KEY(inside) -CSS_KEY(invert) -CSS_KEY(italic) -CSS_KEY(japanese_formal) -CSS_KEY(japanese_informal) -CSS_KEY(justify) -CSS_KEY(kannada) -CSS_KEY(katakana) -CSS_KEY(katakana_iroha) -CSS_KEY(khmer) -CSS_KEY(khz) -CSS_KEY(landscape) -CSS_KEY(lao) -CSS_KEY(large) -CSS_KEY(larger) -CSS_KEY(left) -CSS_KEY(left_side) -CSS_KEY(leftwards) -CSS_KEY(level) -CSS_KEY(lighter) -CSS_KEY(line_through) -CSS_KEY(list) -CSS_KEY(list_item) -CSS_KEY(loud) -CSS_KEY(low) -CSS_KEY(lower) -CSS_KEY(lower_alpha) -CSS_KEY(lower_greek) -CSS_KEY(lower_latin) -CSS_KEY(lower_roman) -CSS_KEY(lowercase) -CSS_KEY(ltr) -CSS_KEY(malayalam) -CSS_KEY(margin_box) -CSS_KEY(marker) -CSS_KEY(medium) -CSS_KEY(menu) -CSS_KEY(menutext) -CSS_KEY(message_box) -CSS_KEY(middle) -CSS_KEY(mix) -CSS_KEY(mm) -CSS_KEY(move) -CSS_KEY(ms) -CSS_KEY(myanmar) -CSS_KEY(n_resize) -CSS_KEY(narrower) -CSS_KEY(ne_resize) -CSS_KEY(no_close_quote) -CSS_KEY(no_open_quote) -CSS_KEY(no_repeat) -CSS_KEY(none) -CSS_KEY(normal) -CSS_KEY(noshade) -CSS_KEY(nowrap) -CSS_KEY(nw_resize) -CSS_KEY(oblique) -CSS_KEY(once) -CSS_KEY(open_quote) -CSS_KEY(oriya) -CSS_KEY(outset) -CSS_KEY(outside) -CSS_KEY(overline) -CSS_KEY(padding_box) -CSS_KEY(paragraph) -CSS_KEY(pc) -CSS_KEY(persian) -CSS_KEY(pointer) -CSS_KEY(portrait) -CSS_KEY(pre) -CSS_KEY(pt) -CSS_KEY(pull_down_menu) -CSS_KEY(px) -CSS_KEY(rad) -CSS_KEY(read_only) -CSS_KEY(read_write) -CSS_KEY(relative) -CSS_KEY(repeat) -CSS_KEY(repeat_x) -CSS_KEY(repeat_y) -CSS_KEY(ridge) -CSS_KEY(right) -CSS_KEY(right_side) -CSS_KEY(rightwards) -CSS_KEY(rtl) -CSS_KEY(run_in) -CSS_KEY(s) -CSS_KEY(s_resize) -CSS_KEY(scroll) -CSS_KEY(scrollbar) -CSS_KEY(se_resize) -CSS_KEY(select_all) -CSS_KEY(select_before) -CSS_KEY(select_after) -CSS_KEY(select_same) -CSS_KEY(select_menu) -CSS_KEY(semi_condensed) -CSS_KEY(semi_expanded) -CSS_KEY(separate) -CSS_KEY(show) -CSS_KEY(silent) -CSS_KEY(simp_chinese_formal) -CSS_KEY(simp_chinese_informal) -CSS_KEY(slow) -CSS_KEY(slower) -CSS_KEY(small) -CSS_KEY(small_caps) -CSS_KEY(small_caption) -CSS_KEY(smaller) -CSS_KEY(soft) -CSS_KEY(solid) -CSS_KEY(spell_out) -CSS_KEY(spinning) -CSS_KEY(square) -CSS_KEY(start) -CSS_KEY(static) -CSS_KEY(status_bar) -CSS_KEY(sub) -CSS_KEY(super) -CSS_KEY(sw_resize) -CSS_KEY(table) -CSS_KEY(table_caption) -CSS_KEY(table_cell) -CSS_KEY(table_column) -CSS_KEY(table_column_group) -CSS_KEY(table_footer_group) -CSS_KEY(table_header_group) -CSS_KEY(table_row) -CSS_KEY(table_row_group) -CSS_KEY(tamil) -CSS_KEY(telugu) -CSS_KEY(text) -CSS_KEY(text_bottom) -CSS_KEY(text_top) -CSS_KEY(thai) -CSS_KEY(thick) -CSS_KEY(thin) -CSS_KEY(threeddarkshadow) -CSS_KEY(threedface) -CSS_KEY(threedhighlight) -CSS_KEY(threedlightshadow) -CSS_KEY(threedshadow) -CSS_KEY(toggle) -CSS_KEY(top) -CSS_KEY(trad_chinese_formal) -CSS_KEY(trad_chinese_informal) -CSS_KEY(transparent) -CSS_KEY(tri_state) -CSS_KEY(ultra_condensed) -CSS_KEY(ultra_expanded) -CSS_KEY(underline) -CSS_KEY(upper_alpha) -CSS_KEY(upper_latin) -CSS_KEY(upper_roman) -CSS_KEY(uppercase) -CSS_KEY(urdu) -CSS_KEY(vertical) -CSS_KEY(visible) -CSS_KEY(w_resize) -CSS_KEY(wait) -CSS_KEY(wider) -CSS_KEY(window) -CSS_KEY(windowframe) -CSS_KEY(windowtext) -CSS_KEY(workspace) -CSS_KEY(write_only) -CSS_KEY(x_fast) -CSS_KEY(x_high) -CSS_KEY(x_large) -CSS_KEY(x_loud) -CSS_KEY(x_low) -CSS_KEY(x_slow) -CSS_KEY(x_small) -CSS_KEY(x_soft) -CSS_KEY(xx_large) -CSS_KEY(xx_small) +CSS_KEY(-moz-all, _moz_all) +CSS_KEY(-moz-bg-inset, _moz_bg_inset) +CSS_KEY(-moz-bg-outset, _moz_bg_outset) +CSS_KEY(-moz-center, _moz_center) +CSS_KEY(-moz-right, _moz_right) +CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) +CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) +CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) +CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) +CSS_KEY(above, above) +CSS_KEY(absolute, absolute) +CSS_KEY(activeborder, activeborder) +CSS_KEY(activecaption, activecaption) +CSS_KEY(alias, alias) +CSS_KEY(all, all) +CSS_KEY(always, always) +CSS_KEY(appworkspace, appworkspace) +CSS_KEY(arabic-indic, arabic_indic) +CSS_KEY(armenian, armenian) +CSS_KEY(auto, auto) +CSS_KEY(avoid, avoid) +CSS_KEY(background, background) +CSS_KEY(baseline, baseline) +CSS_KEY(behind, behind) +CSS_KEY(below, below) +CSS_KEY(bengali, bengali) +CSS_KEY(bidi-override, bidi_override) +CSS_KEY(blink, blink) +CSS_KEY(block, block) +CSS_KEY(bold, bold) +CSS_KEY(bolder, bolder) +CSS_KEY(border-box, border_box) +CSS_KEY(both, both) +CSS_KEY(bottom, bottom) +CSS_KEY(button, button) +CSS_KEY(buttonface, buttonface) +CSS_KEY(buttonhighlight, buttonhighlight) +CSS_KEY(buttonshadow, buttonshadow) +CSS_KEY(buttontext, buttontext) +CSS_KEY(capitalize, capitalize) +CSS_KEY(caption, caption) +CSS_KEY(captiontext, captiontext) +CSS_KEY(cell, cell) +CSS_KEY(center, center) +CSS_KEY(center-left, center_left) +CSS_KEY(center-right, center_right) +CSS_KEY(ch, ch) +CSS_KEY(circle, circle) +CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) +CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) +CSS_KEY(cjk-ideographic, cjk_ideographic) +CSS_KEY(close-quote, close_quote) +CSS_KEY(cm, cm) +CSS_KEY(code, code) +CSS_KEY(collapse, collapse) +CSS_KEY(compact, compact) +CSS_KEY(condensed, condensed) +CSS_KEY(content-box, content_box) +CSS_KEY(context-menu, context_menu) +CSS_KEY(continuous, continuous) +CSS_KEY(copy, copy) +CSS_KEY(count-down, count_down) +CSS_KEY(count-up, count_up) +CSS_KEY(count-up-down, count_up_down) +CSS_KEY(crop, crop) +CSS_KEY(cross, cross) +CSS_KEY(crosshair, crosshair) +CSS_KEY(dashed, dashed) +CSS_KEY(decimal, decimal) +CSS_KEY(decimal-leading-zero, decimal_leading_zero) +CSS_KEY(default, default) +CSS_KEY(deg, deg) +CSS_KEY(desktop, desktop) +CSS_KEY(devanagari, devanagari) +CSS_KEY(dialog, dialog) +CSS_KEY(digits, digits) +CSS_KEY(disabled, disabled) +CSS_KEY(disc, disc) +CSS_KEY(document, document) +CSS_KEY(dotted, dotted) +CSS_KEY(double, double) +CSS_KEY(e-resize, e_resize) +CSS_KEY(element, element) +CSS_KEY(elements, elements) +CSS_KEY(em, em) +CSS_KEY(embed, embed) +CSS_KEY(enabled, enabled) +CSS_KEY(ex, ex) +CSS_KEY(expanded, expanded) +CSS_KEY(extra-condensed, extra_condensed) +CSS_KEY(extra-expanded, extra_expanded) +CSS_KEY(far-left, far_left) +CSS_KEY(far-right, far_right) +CSS_KEY(fast, fast) +CSS_KEY(faster, faster) +CSS_KEY(field, field) +CSS_KEY(fixed, fixed) +CSS_KEY(georgian, georgian) +CSS_KEY(grab, grab) +CSS_KEY(grabbing, grabbing) +CSS_KEY(grad, grad) +CSS_KEY(graytext, graytext) +CSS_KEY(groove, groove) +CSS_KEY(gujarati, gujarati) +CSS_KEY(gurmukhi, gurmukhi) +CSS_KEY(hebrew, hebrew) +CSS_KEY(help, help) +CSS_KEY(hidden, hidden) +CSS_KEY(hide, hide) +CSS_KEY(high, high) +CSS_KEY(higher, higher) +CSS_KEY(highlight, highlight) +CSS_KEY(highlighttext, highlighttext) +CSS_KEY(hiragana, hiragana) +CSS_KEY(hiragana-iroha, hiragana_iroha) +CSS_KEY(horizontal, horizontal) +CSS_KEY(hz, hz) +CSS_KEY(icon, icon) +CSS_KEY(ignore, ignore) +CSS_KEY(in, in) +CSS_KEY(inactiveborder, inactiveborder) +CSS_KEY(inactivecaption, inactivecaption) +CSS_KEY(inactivecaptiontext, inactivecaptiontext) +CSS_KEY(info, info) +CSS_KEY(infobackground, infobackground) +CSS_KEY(infotext, infotext) +CSS_KEY(inherit, inherit) +CSS_KEY(inline, inline) +CSS_KEY(inline-block, inline_block) +CSS_KEY(inline-table, inline_table) +CSS_KEY(inset, inset) +CSS_KEY(inside, inside) +CSS_KEY(invert, invert) +CSS_KEY(italic, italic) +CSS_KEY(japanese-formal, japanese_formal) +CSS_KEY(japanese-informal, japanese_informal) +CSS_KEY(justify, justify) +CSS_KEY(kannada, kannada) +CSS_KEY(katakana, katakana) +CSS_KEY(katakana-iroha, katakana_iroha) +CSS_KEY(khmer, khmer) +CSS_KEY(khz, khz) +CSS_KEY(landscape, landscape) +CSS_KEY(lao, lao) +CSS_KEY(large, large) +CSS_KEY(larger, larger) +CSS_KEY(left, left) +CSS_KEY(left-side, left_side) +CSS_KEY(leftwards, leftwards) +CSS_KEY(level, level) +CSS_KEY(lighter, lighter) +CSS_KEY(line-through, line_through) +CSS_KEY(list, list) +CSS_KEY(list-item, list_item) +CSS_KEY(loud, loud) +CSS_KEY(low, low) +CSS_KEY(lower, lower) +CSS_KEY(lower-alpha, lower_alpha) +CSS_KEY(lower-greek, lower_greek) +CSS_KEY(lower-latin, lower_latin) +CSS_KEY(lower-roman, lower_roman) +CSS_KEY(lowercase, lowercase) +CSS_KEY(ltr, ltr) +CSS_KEY(malayalam, malayalam) +CSS_KEY(margin-box, margin_box) +CSS_KEY(marker, marker) +CSS_KEY(medium, medium) +CSS_KEY(menu, menu) +CSS_KEY(menutext, menutext) +CSS_KEY(message-box, message_box) +CSS_KEY(middle, middle) +CSS_KEY(mix, mix) +CSS_KEY(mm, mm) +CSS_KEY(move, move) +CSS_KEY(ms, ms) +CSS_KEY(myanmar, myanmar) +CSS_KEY(n-resize, n_resize) +CSS_KEY(narrower, narrower) +CSS_KEY(ne-resize, ne_resize) +CSS_KEY(no-close-quote, no_close_quote) +CSS_KEY(no-open-quote, no_open_quote) +CSS_KEY(no-repeat, no_repeat) +CSS_KEY(none, none) +CSS_KEY(normal, normal) +CSS_KEY(noshade, noshade) +CSS_KEY(nowrap, nowrap) +CSS_KEY(nw-resize, nw_resize) +CSS_KEY(oblique, oblique) +CSS_KEY(once, once) +CSS_KEY(open-quote, open_quote) +CSS_KEY(oriya, oriya) +CSS_KEY(outset, outset) +CSS_KEY(outside, outside) +CSS_KEY(overline, overline) +CSS_KEY(padding-box, padding_box) +CSS_KEY(paragraph, paragraph) +CSS_KEY(pc, pc) +CSS_KEY(persian, persian) +CSS_KEY(pointer, pointer) +CSS_KEY(portrait, portrait) +CSS_KEY(pre, pre) +CSS_KEY(pt, pt) +CSS_KEY(pull-down-menu, pull_down_menu) +CSS_KEY(px, px) +CSS_KEY(rad, rad) +CSS_KEY(read-only, read_only) +CSS_KEY(read-write, read_write) +CSS_KEY(relative, relative) +CSS_KEY(repeat, repeat) +CSS_KEY(repeat-x, repeat_x) +CSS_KEY(repeat-y, repeat_y) +CSS_KEY(ridge, ridge) +CSS_KEY(right, right) +CSS_KEY(right-side, right_side) +CSS_KEY(rightwards, rightwards) +CSS_KEY(rtl, rtl) +CSS_KEY(run-in, run_in) +CSS_KEY(s, s) +CSS_KEY(s-resize, s_resize) +CSS_KEY(scroll, scroll) +CSS_KEY(scrollbar, scrollbar) +CSS_KEY(se-resize, se_resize) +CSS_KEY(select-all, select_all) +CSS_KEY(select-before, select_before) +CSS_KEY(select-after, select_after) +CSS_KEY(select-same, select_same) +CSS_KEY(select-menu, select_menu) +CSS_KEY(semi-condensed, semi_condensed) +CSS_KEY(semi-expanded, semi_expanded) +CSS_KEY(separate, separate) +CSS_KEY(show, show) +CSS_KEY(silent, silent) +CSS_KEY(simp-chinese-formal, simp_chinese_formal) +CSS_KEY(simp-chinese-informal, simp_chinese_informal) +CSS_KEY(slow, slow) +CSS_KEY(slower, slower) +CSS_KEY(small, small) +CSS_KEY(small-caps, small_caps) +CSS_KEY(small-caption, small_caption) +CSS_KEY(smaller, smaller) +CSS_KEY(soft, soft) +CSS_KEY(solid, solid) +CSS_KEY(spell-out, spell_out) +CSS_KEY(spinning, spinning) +CSS_KEY(square, square) +CSS_KEY(start, start) +CSS_KEY(static, static) +CSS_KEY(status-bar, status_bar) +CSS_KEY(sub, sub) +CSS_KEY(super, super) +CSS_KEY(sw-resize, sw_resize) +CSS_KEY(table, table) +CSS_KEY(table-caption, table_caption) +CSS_KEY(table-cell, table_cell) +CSS_KEY(table-column, table_column) +CSS_KEY(table-column-group, table_column_group) +CSS_KEY(table-footer-group, table_footer_group) +CSS_KEY(table-header-group, table_header_group) +CSS_KEY(table-row, table_row) +CSS_KEY(table-row-group, table_row_group) +CSS_KEY(tamil, tamil) +CSS_KEY(telugu, telugu) +CSS_KEY(text, text) +CSS_KEY(text-bottom, text_bottom) +CSS_KEY(text-top, text_top) +CSS_KEY(thai, thai) +CSS_KEY(thick, thick) +CSS_KEY(thin, thin) +CSS_KEY(threeddarkshadow, threeddarkshadow) +CSS_KEY(threedface, threedface) +CSS_KEY(threedhighlight, threedhighlight) +CSS_KEY(threedlightshadow, threedlightshadow) +CSS_KEY(threedshadow, threedshadow) +CSS_KEY(toggle, toggle) +CSS_KEY(top, top) +CSS_KEY(trad-chinese-formal, trad_chinese_formal) +CSS_KEY(trad-chinese-informal, trad_chinese_informal) +CSS_KEY(transparent, transparent) +CSS_KEY(tri-state, tri_state) +CSS_KEY(ultra-condensed, ultra_condensed) +CSS_KEY(ultra-expanded, ultra_expanded) +CSS_KEY(underline, underline) +CSS_KEY(upper-alpha, upper_alpha) +CSS_KEY(upper-latin, upper_latin) +CSS_KEY(upper-roman, upper_roman) +CSS_KEY(uppercase, uppercase) +CSS_KEY(urdu, urdu) +CSS_KEY(vertical, vertical) +CSS_KEY(visible, visible) +CSS_KEY(w-resize, w_resize) +CSS_KEY(wait, wait) +CSS_KEY(wider, wider) +CSS_KEY(window, window) +CSS_KEY(windowframe, windowframe) +CSS_KEY(windowtext, windowtext) +CSS_KEY(workspace, workspace) +CSS_KEY(write-only, write_only) +CSS_KEY(x-fast, x_fast) +CSS_KEY(x-high, x_high) +CSS_KEY(x-large, x_large) +CSS_KEY(x-loud, x_loud) +CSS_KEY(x-low, x_low) +CSS_KEY(x-slow, x_slow) +CSS_KEY(x-small, x_small) +CSS_KEY(x-soft, x_soft) +CSS_KEY(xx-large, xx_large) +CSS_KEY(xx-small, xx_small) diff --git a/layout/style/nsCSSKeywords.cpp b/layout/style/nsCSSKeywords.cpp index df81aba2e10..d58e9f86420 100644 --- a/layout/style/nsCSSKeywords.cpp +++ b/layout/style/nsCSSKeywords.cpp @@ -22,73 +22,39 @@ #include "nsCSSKeywords.h" #include "nsString.h" -#include "nsAVLTree.h" - +#include "nsStaticNameTable.h" // define an array of all CSS keywords -#define CSS_KEY(_key) #_key, +#define CSS_KEY(_name,_id) #_name, const char* kCSSRawKeywords[] = { #include "nsCSSKeywordList.h" }; #undef CSS_KEY -struct KeywordNode { - KeywordNode(void) - : mStr(), - mEnum(eCSSKeyword_UNKNOWN) - {} - - KeywordNode(const nsStr& aStringValue, nsCSSKeyword aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSKeyword mEnum; -}; - -class KeywordComparitor: public nsAVLNodeComparitor { -public: - virtual ~KeywordComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - KeywordNode* one = (KeywordNode*)anItem1; - KeywordNode* two = (KeywordNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static KeywordNode* gKeywordArray; -static nsAVLTree* gKeywordTree; -static KeywordComparitor* gComparitor; -static nsCString* kNullStr; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gKeywordTable; void nsCSSKeywords::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gKeywordArray) { - gKeywordArray = new KeywordNode[eCSSKeyword_COUNT]; - gComparitor = new KeywordComparitor(); - if (gComparitor) { - gKeywordTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gKeywordArray && gKeywordTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSKeyword_COUNT)) { - gKeywordArray[index].mStr = kCSSRawKeywords[index]; - gKeywordArray[index].mStr.ReplaceChar('_', '-'); - gKeywordArray[index].mEnum = nsCSSKeyword(index); - gKeywordTree->AddItem(&(gKeywordArray[index])); - } + NS_ASSERTION(!gKeywordTable, "pre existing array!"); + gKeywordTable = new nsStaticCaseInsensitiveNameTable(); + if (gKeywordTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) { + nsCAutoString temp1(kCSSRawKeywords[index]); + nsCAutoString temp2(kCSSRawKeywords[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); + NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); } } - kNullStr = new nsCString(); +#endif + gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT); + } } } @@ -96,55 +62,42 @@ void nsCSSKeywords::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gKeywordArray) { - delete [] gKeywordArray; - gKeywordArray = nsnull; + if (gKeywordTable) { + delete gKeywordTable; + gKeywordTable = nsnull; } - if (gKeywordTree) { - delete gKeywordTree; - gKeywordTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; } } - nsCSSKeyword nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) { - NS_ASSERTION(gKeywordTree, "no lookup table, needs addref"); - if (gKeywordTree) { - KeywordNode node(aKeyword, eCSSKeyword_UNKNOWN); - KeywordNode* found = (KeywordNode*)gKeywordTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aKeyword), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); + } return eCSSKeyword_UNKNOWN; } nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsString& aKeyword) { - nsCAutoString theKeyword; theKeyword.AssignWithConversion(aKeyword); - return LookupKeyword(theKeyword); +nsCSSKeywords::LookupKeyword(const nsString& aKeyword) +{ + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); + } + return eCSSKeyword_UNKNOWN; } - const nsCString& nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) { - NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); - if ((eCSSKeyword_UNKNOWN < aKeyword) && - (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { - return gKeywordArray[aKeyword].mStr; - } - else { - return *kNullStr; + NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); + if (gKeywordTable) { + return gKeywordTable->GetStringValue(PRInt32(aKeyword)); + } else { + static nsCString kNullStr; + return kNullStr; } } diff --git a/layout/style/nsCSSKeywords.h b/layout/style/nsCSSKeywords.h index 4473a0c3bac..504b4512f3c 100644 --- a/layout/style/nsCSSKeywords.h +++ b/layout/style/nsCSSKeywords.h @@ -34,7 +34,7 @@ class nsCString; To change the list of keywords, see nsCSSKeywordList.h */ -#define CSS_KEY(_key) eCSSKeyword_##_key, +#define CSS_KEY(_name,_id) eCSSKeyword_##_id, enum nsCSSKeyword { eCSSKeyword_UNKNOWN = -1, #include "nsCSSKeywordList.h" diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 2430d27798d..a7dd2d34ffa 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -34,171 +34,177 @@ It is recommended (but not strictly necessary) to keep all entries in alphabetical order - Underbars in properties are automagically converted into hyphens + Requirements: - The first argument to CSS_PROP is both the enum identifier of the property - and the string value - The second argument is the style impact resultant in a change to the property + Entries are in the form: (name,id,impact). 'id' must always be the same as + 'name' except that all hyphens ('-') in 'name' are converted to underscores + ('_') in 'id'. This lets us do nice things with the macros without having to + copy/convert strings at runtime. + + 'name' entries *must* use only lowercase characters. + + ** Break these invarient and bad things will happen. ** + + The third argument is the style impact resultant in a change to the property ******/ -CSS_PROP(_moz_border_radius, VISUAL) -CSS_PROP(_moz_border_radius_topLeft, VISUAL) -CSS_PROP(_moz_border_radius_topRight, VISUAL) -CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_border_radius_bottomRight, VISUAL) -CSS_PROP(_moz_outline_radius, VISUAL) -CSS_PROP(_moz_outline_radius_topLeft, VISUAL) -CSS_PROP(_moz_outline_radius_topRight, VISUAL) -CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) -CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) -CSS_PROP(azimuth, AURAL) -CSS_PROP(background, VISUAL) -CSS_PROP(background_attachment, VISUAL) -CSS_PROP(background_color, VISUAL) -CSS_PROP(background_image, VISUAL) -CSS_PROP(background_position, VISUAL) -CSS_PROP(background_repeat, VISUAL) -CSS_PROP(background_x_position, VISUAL) -CSS_PROP(background_y_position, VISUAL) -CSS_PROP(behavior, REFLOW) -CSS_PROP(border, REFLOW) -CSS_PROP(border_bottom, REFLOW) -CSS_PROP(border_bottom_color, VISUAL) -CSS_PROP(border_bottom_style, REFLOW) // on/off will need reflow -CSS_PROP(border_bottom_width, REFLOW) -CSS_PROP(border_collapse, REFLOW) -CSS_PROP(border_color, VISUAL) -CSS_PROP(border_left, REFLOW) -CSS_PROP(border_left_color, VISUAL) -CSS_PROP(border_left_style, REFLOW) // on/off will need reflow -CSS_PROP(border_left_width, REFLOW) -CSS_PROP(border_right, REFLOW) -CSS_PROP(border_right_color, VISUAL) -CSS_PROP(border_right_style, REFLOW) // on/off will need reflow -CSS_PROP(border_right_width, REFLOW) -CSS_PROP(border_spacing, REFLOW) -CSS_PROP(border_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top, REFLOW) -CSS_PROP(border_top_color, VISUAL) -CSS_PROP(border_top_style, REFLOW) // on/off will need reflow -CSS_PROP(border_top_width, REFLOW) -CSS_PROP(border_width, REFLOW) -CSS_PROP(border_x_spacing, REFLOW) -CSS_PROP(border_y_spacing, REFLOW) -CSS_PROP(bottom, REFLOW) -CSS_PROP(box_sizing, REFLOW) -CSS_PROP(caption_side, REFLOW) -CSS_PROP(clear, REFLOW) -CSS_PROP(clip, VISUAL) -CSS_PROP(clip_bottom, VISUAL) -CSS_PROP(clip_left, VISUAL) -CSS_PROP(clip_right, VISUAL) -CSS_PROP(clip_top, VISUAL) -CSS_PROP(color, VISUAL) -CSS_PROP(content, FRAMECHANGE) -CSS_PROP(counter_increment, REFLOW) -CSS_PROP(counter_reset, REFLOW) -CSS_PROP(cue, AURAL) -CSS_PROP(cue_after, AURAL) -CSS_PROP(cue_before, AURAL) -CSS_PROP(cursor, VISUAL) -CSS_PROP(direction, REFLOW) -CSS_PROP(display, FRAMECHANGE) -CSS_PROP(elevation, AURAL) -CSS_PROP(empty_cells, VISUAL) -CSS_PROP(float, FRAMECHANGE) -CSS_PROP(float_edge, REFLOW) -CSS_PROP(font, REFLOW) -CSS_PROP(font_family, REFLOW) -CSS_PROP(font_size, REFLOW) -CSS_PROP(font_size_adjust, REFLOW) -CSS_PROP(font_stretch, REFLOW) -CSS_PROP(font_style, REFLOW) -CSS_PROP(font_variant, REFLOW) -CSS_PROP(font_weight, REFLOW) -CSS_PROP(height, REFLOW) -CSS_PROP(key_equivalent, CONTENT) // This will need some other notification, but what? -CSS_PROP(left, REFLOW) -CSS_PROP(letter_spacing, REFLOW) -CSS_PROP(line_height, REFLOW) -CSS_PROP(list_style, REFLOW) -CSS_PROP(list_style_image, REFLOW) -CSS_PROP(list_style_position, REFLOW) -CSS_PROP(list_style_type, REFLOW) -CSS_PROP(margin, REFLOW) -CSS_PROP(margin_bottom, REFLOW) -CSS_PROP(margin_left, REFLOW) -CSS_PROP(margin_right, REFLOW) -CSS_PROP(margin_top, REFLOW) -CSS_PROP(marker_offset, REFLOW) -CSS_PROP(marks, VISUAL) -CSS_PROP(max_height, REFLOW) -CSS_PROP(max_width, REFLOW) -CSS_PROP(min_height, REFLOW) -CSS_PROP(min_width, REFLOW) -CSS_PROP(opacity, VISUAL) -CSS_PROP(orphans, REFLOW) -CSS_PROP(outline, VISUAL) -CSS_PROP(outline_color, VISUAL) -CSS_PROP(outline_style, VISUAL) -CSS_PROP(outline_width, VISUAL) -CSS_PROP(overflow, FRAMECHANGE) -CSS_PROP(padding, REFLOW) -CSS_PROP(padding_bottom, REFLOW) -CSS_PROP(padding_left, REFLOW) -CSS_PROP(padding_right, REFLOW) -CSS_PROP(padding_top, REFLOW) -CSS_PROP(page, REFLOW) -CSS_PROP(page_break_after, REFLOW) -CSS_PROP(page_break_before, REFLOW) -CSS_PROP(page_break_inside, REFLOW) -CSS_PROP(pause, AURAL) -CSS_PROP(pause_after, AURAL) -CSS_PROP(pause_before, AURAL) -CSS_PROP(pitch, AURAL) -CSS_PROP(pitch_range, AURAL) -CSS_PROP(play_during, AURAL) -CSS_PROP(play_during_flags, AURAL) -CSS_PROP(position, FRAMECHANGE) -CSS_PROP(quotes, REFLOW) -CSS_PROP(quotes_close, REFLOW) -CSS_PROP(quotes_open, REFLOW) -CSS_PROP(resizer, FRAMECHANGE) -CSS_PROP(richness, AURAL) -CSS_PROP(right, REFLOW) -CSS_PROP(size, REFLOW) -CSS_PROP(size_height, REFLOW) -CSS_PROP(size_width, REFLOW) -CSS_PROP(speak, AURAL) -CSS_PROP(speak_header, AURAL) -CSS_PROP(speak_numeral, AURAL) -CSS_PROP(speak_punctuation, AURAL) -CSS_PROP(speech_rate, AURAL) -CSS_PROP(stress, AURAL) -CSS_PROP(table_layout, REFLOW) -CSS_PROP(text_align, REFLOW) -CSS_PROP(text_decoration, VISUAL) -CSS_PROP(text_indent, REFLOW) -CSS_PROP(text_shadow, VISUAL) -CSS_PROP(text_shadow_color, VISUAL) -CSS_PROP(text_shadow_radius, VISUAL) -CSS_PROP(text_shadow_x, VISUAL) -CSS_PROP(text_shadow_y, VISUAL) -CSS_PROP(text_transform, REFLOW) -CSS_PROP(top, REFLOW) -CSS_PROP(unicode_bidi, REFLOW) -CSS_PROP(user_focus, CONTENT) -CSS_PROP(user_input, FRAMECHANGE) // XXX ??? -CSS_PROP(user_modify, FRAMECHANGE) -CSS_PROP(user_select, CONTENT) -CSS_PROP(vertical_align, REFLOW) -CSS_PROP(visibility, REFLOW) // reflow for collapse -CSS_PROP(voice_family, AURAL) -CSS_PROP(volume, AURAL) -CSS_PROP(white_space, REFLOW) -CSS_PROP(widows, REFLOW) -CSS_PROP(width, REFLOW) -CSS_PROP(word_spacing, REFLOW) -CSS_PROP(z_index, REFLOW) - +CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL) +CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL) +CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL) +CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL) +CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL) +CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL) +CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL) +CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL) +CSS_PROP(azimuth, azimuth, AURAL) +CSS_PROP(background, background, VISUAL) +CSS_PROP(background-attachment, background_attachment, VISUAL) +CSS_PROP(background-color, background_color, VISUAL) +CSS_PROP(background-image, background_image, VISUAL) +CSS_PROP(background-position, background_position, VISUAL) +CSS_PROP(background-repeat, background_repeat, VISUAL) +CSS_PROP(background-x-position, background_x_position, VISUAL) +CSS_PROP(background-y-position, background_y_position, VISUAL) +CSS_PROP(behavior, behavior, REFLOW) +CSS_PROP(border, border, REFLOW) +CSS_PROP(border-bottom, border_bottom, REFLOW) +CSS_PROP(border-bottom-color, border_bottom_color, VISUAL) +CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow +CSS_PROP(border-bottom-width, border_bottom_width, REFLOW) +CSS_PROP(border-collapse, border_collapse, REFLOW) +CSS_PROP(border-color, border_color, VISUAL) +CSS_PROP(border-left, border_left, REFLOW) +CSS_PROP(border-left-color, border_left_color, VISUAL) +CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow +CSS_PROP(border-left-width, border_left_width, REFLOW) +CSS_PROP(border-right, border_right, REFLOW) +CSS_PROP(border-right-color, border_right_color, VISUAL) +CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow +CSS_PROP(border-right-width, border_right_width, REFLOW) +CSS_PROP(border-spacing, border_spacing, REFLOW) +CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top, border_top, REFLOW) +CSS_PROP(border-top-color, border_top_color, VISUAL) +CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow +CSS_PROP(border-top-width, border_top_width, REFLOW) +CSS_PROP(border-width, border_width, REFLOW) +CSS_PROP(border-x-spacing, border_x_spacing, REFLOW) +CSS_PROP(border-y-spacing, border_y_spacing, REFLOW) +CSS_PROP(bottom, bottom, REFLOW) +CSS_PROP(box-sizing, box_sizing, REFLOW) +CSS_PROP(caption-side, caption_side, REFLOW) +CSS_PROP(clear, clear, REFLOW) +CSS_PROP(clip, clip, VISUAL) +CSS_PROP(clip-bottom, clip_bottom, VISUAL) +CSS_PROP(clip-left, clip_left, VISUAL) +CSS_PROP(clip-right, clip_right, VISUAL) +CSS_PROP(clip-top, clip_top, VISUAL) +CSS_PROP(color, color, VISUAL) +CSS_PROP(content, content, FRAMECHANGE) +CSS_PROP(counter-increment, counter_increment, REFLOW) +CSS_PROP(counter-reset, counter_reset, REFLOW) +CSS_PROP(cue, cue, AURAL) +CSS_PROP(cue-after, cue_after, AURAL) +CSS_PROP(cue-before, cue_before, AURAL) +CSS_PROP(cursor, cursor, VISUAL) +CSS_PROP(direction, direction, REFLOW) +CSS_PROP(display, display, FRAMECHANGE) +CSS_PROP(elevation, elevation, AURAL) +CSS_PROP(empty-cells, empty_cells, VISUAL) +CSS_PROP(float, float, FRAMECHANGE) +CSS_PROP(float-edge, float_edge, REFLOW) +CSS_PROP(font, font, REFLOW) +CSS_PROP(font-family, font_family, REFLOW) +CSS_PROP(font-size, font_size, REFLOW) +CSS_PROP(font-size-adjust, font_size_adjust, REFLOW) +CSS_PROP(font-stretch, font_stretch, REFLOW) +CSS_PROP(font-style, font_style, REFLOW) +CSS_PROP(font-variant, font_variant, REFLOW) +CSS_PROP(font-weight, font_weight, REFLOW) +CSS_PROP(height, height, REFLOW) +CSS_PROP(key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? +CSS_PROP(left, left, REFLOW) +CSS_PROP(letter-spacing, letter_spacing, REFLOW) +CSS_PROP(line-height, line_height, REFLOW) +CSS_PROP(list-style, list_style, REFLOW) +CSS_PROP(list-style-image, list_style_image, REFLOW) +CSS_PROP(list-style-position, list_style_position, REFLOW) +CSS_PROP(list-style-type, list_style_type, REFLOW) +CSS_PROP(margin, margin, REFLOW) +CSS_PROP(margin-bottom, margin_bottom, REFLOW) +CSS_PROP(margin-left, margin_left, REFLOW) +CSS_PROP(margin-right, margin_right, REFLOW) +CSS_PROP(margin-top, margin_top, REFLOW) +CSS_PROP(marker-offset, marker_offset, REFLOW) +CSS_PROP(marks, marks, VISUAL) +CSS_PROP(max-height, max_height, REFLOW) +CSS_PROP(max-width, max_width, REFLOW) +CSS_PROP(min-height, min_height, REFLOW) +CSS_PROP(min-width, min_width, REFLOW) +CSS_PROP(opacity, opacity, VISUAL) +CSS_PROP(orphans, orphans, REFLOW) +CSS_PROP(outline, outline, VISUAL) +CSS_PROP(outline-color, outline_color, VISUAL) +CSS_PROP(outline-style, outline_style, VISUAL) +CSS_PROP(outline-width, outline_width, VISUAL) +CSS_PROP(overflow, overflow, FRAMECHANGE) +CSS_PROP(padding, padding, REFLOW) +CSS_PROP(padding-bottom, padding_bottom, REFLOW) +CSS_PROP(padding-left, padding_left, REFLOW) +CSS_PROP(padding-right, padding_right, REFLOW) +CSS_PROP(padding-top, padding_top, REFLOW) +CSS_PROP(page, page, REFLOW) +CSS_PROP(page-break-after, page_break_after, REFLOW) +CSS_PROP(page-break-before, page_break_before, REFLOW) +CSS_PROP(page-break-inside, page_break_inside, REFLOW) +CSS_PROP(pause, pause, AURAL) +CSS_PROP(pause-after, pause_after, AURAL) +CSS_PROP(pause-before, pause_before, AURAL) +CSS_PROP(pitch, pitch, AURAL) +CSS_PROP(pitch-range, pitch_range, AURAL) +CSS_PROP(play-during, play_during, AURAL) +CSS_PROP(play-during-flags, play_during_flags, AURAL) +CSS_PROP(position, position, FRAMECHANGE) +CSS_PROP(quotes, quotes, REFLOW) +CSS_PROP(quotes-close, quotes_close, REFLOW) +CSS_PROP(quotes-open, quotes_open, REFLOW) +CSS_PROP(resizer, resizer, FRAMECHANGE) +CSS_PROP(richness, richness, AURAL) +CSS_PROP(right, right, REFLOW) +CSS_PROP(size, size, REFLOW) +CSS_PROP(size-height, size_height, REFLOW) +CSS_PROP(size-width, size_width, REFLOW) +CSS_PROP(speak, speak, AURAL) +CSS_PROP(speak-header, speak_header, AURAL) +CSS_PROP(speak-numeral, speak_numeral, AURAL) +CSS_PROP(speak-punctuation, speak_punctuation, AURAL) +CSS_PROP(speech-rate, speech_rate, AURAL) +CSS_PROP(stress, stress, AURAL) +CSS_PROP(table-layout, table_layout, REFLOW) +CSS_PROP(text-align, text_align, REFLOW) +CSS_PROP(text-decoration, text_decoration, VISUAL) +CSS_PROP(text-indent, text_indent, REFLOW) +CSS_PROP(text-shadow, text_shadow, VISUAL) +CSS_PROP(text-shadow-color, text_shadow_color, VISUAL) +CSS_PROP(text-shadow-radius, text_shadow_radius, VISUAL) +CSS_PROP(text-shadow-x, text_shadow_x, VISUAL) +CSS_PROP(text-shadow-y, text_shadow_y, VISUAL) +CSS_PROP(text-transform, text_transform, REFLOW) +CSS_PROP(top, top, REFLOW) +CSS_PROP(unicode-bidi, unicode_bidi, REFLOW) +CSS_PROP(user-focus, user_focus, CONTENT) +CSS_PROP(user-input, user_input, FRAMECHANGE) // XXX ??? +CSS_PROP(user-modify, user_modify, FRAMECHANGE) +CSS_PROP(user-select, user_select, CONTENT) +CSS_PROP(vertical-align, vertical_align, REFLOW) +CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse +CSS_PROP(voice-family, voice_family, AURAL) +CSS_PROP(volume, volume, AURAL) +CSS_PROP(white-space, white_space, REFLOW) +CSS_PROP(widows, widows, REFLOW) +CSS_PROP(width, width, REFLOW) +CSS_PROP(word-spacing, word_spacing, REFLOW) +CSS_PROP(z-index, z_index, REFLOW) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 3f7b9d3a201..8b4c3180d96 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -27,73 +27,40 @@ #include "nsILookAndFeel.h" // for system colors #include "nsString.h" -#include "nsAVLTree.h" - +#include "nsStaticNameTable.h" // define an array of all CSS properties -#define CSS_PROP(_prop, _hint) #_prop, +#define CSS_PROP(_name, _id, _hint) #_name, const char* kCSSRawProperties[] = { #include "nsCSSPropList.h" }; #undef CSS_PROP -struct PropertyNode { - PropertyNode(void) - : mStr(), - mEnum(eCSSProperty_UNKNOWN) - {} - PropertyNode(const nsStr& aStringValue, nsCSSProperty aEnumValue) - : mStr(), - mEnum(aEnumValue) - { // point to the incomming buffer - // note that the incomming buffer may really be 2 byte - nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity, - aStringValue.mLength, aStringValue.mCharSize, PR_FALSE); - } - - nsCAutoString mStr; - nsCSSProperty mEnum; -}; - -class PropertyComparitor: public nsAVLNodeComparitor { -public: - virtual ~PropertyComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - PropertyNode* one = (PropertyNode*)anItem1; - PropertyNode* two = (PropertyNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static PropertyNode* gPropertyArray; -static nsAVLTree* gPropertyTree; -static PropertyComparitor* gComparitor; -static nsCString* kNullStr; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gPropertyTable; void nsCSSProps::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gPropertyArray) { - gPropertyArray= new PropertyNode[eCSSProperty_COUNT]; - gComparitor = new PropertyComparitor(); - if (gComparitor) { - gPropertyTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gPropertyArray && gPropertyTree) { - PRInt32 index = -1; - while (++index < PRInt32(eCSSProperty_COUNT)) { - gPropertyArray[index].mStr = kCSSRawProperties[index]; - gPropertyArray[index].mStr.ReplaceChar('_', '-'); - gPropertyArray[index].mEnum = nsCSSProperty(index); - gPropertyTree->AddItem(&(gPropertyArray[index])); - } + NS_ASSERTION(!gPropertyTable, "pre existing array!"); + gPropertyTable = new nsStaticCaseInsensitiveNameTable(); + if (gPropertyTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < eCSSProperty_COUNT; ++index) { + nsCAutoString temp1(kCSSRawProperties[index]); + nsCAutoString temp2(kCSSRawProperties[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); + NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); } } - kNullStr = new nsCString(); +#endif + gPropertyTable->Init(kCSSRawProperties, eCSSProperty_COUNT); + } } } @@ -101,60 +68,47 @@ void nsCSSProps::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gPropertyArray) { - delete [] gPropertyArray; - gPropertyArray = nsnull; + if (gPropertyTable) { + delete gPropertyTable; + gPropertyTable = nsnull; } - if (gPropertyTree) { - delete gPropertyTree; - gPropertyTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; - } - delete kNullStr; } } - nsCSSProperty nsCSSProps::LookupProperty(const nsCString& aProperty) { - NS_ASSERTION(gPropertyTree, "no lookup table, needs addref"); - if (gPropertyTree) { - PropertyNode node(aProperty, eCSSProperty_UNKNOWN); - PropertyNode* found = (PropertyNode*)gPropertyTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsIgnoreCase(aProperty), "bad tree"); - return found->mEnum; - } - } + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } return eCSSProperty_UNKNOWN; } - nsCSSProperty -nsCSSProps::LookupProperty(const nsString& aProperty) { - nsCAutoString theProp; theProp.AssignWithConversion(aProperty); - return LookupProperty(theProp); +nsCSSProps::LookupProperty(const nsString& aProperty) +{ + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return nsCSSProperty(gPropertyTable->Lookup(aProperty)); + } + return eCSSProperty_UNKNOWN; } - const nsCString& nsCSSProps::GetStringValue(nsCSSProperty aProperty) { - NS_ASSERTION(gPropertyArray, "no lookup table, needs addref"); - if ((eCSSProperty_UNKNOWN < aProperty) && - (aProperty < eCSSProperty_COUNT) && gPropertyArray) { - return gPropertyArray[aProperty].mStr; - } - else { - return *kNullStr; + NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); + if (gPropertyTable) { + return gPropertyTable->GetStringValue(PRInt32(aProperty)); + } else { + static nsCString sNullStr; + return sNullStr; } } +/***************************************************************************/ // Keyword id tables for variant/enum parsing const PRInt32 nsCSSProps::kAzimuthKTable[] = { @@ -726,7 +680,8 @@ SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) { PRInt32 i = SearchKeywordTableInt(aValue, aTable); if (i < 0) { - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } else { return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); } @@ -1083,7 +1038,8 @@ static const PRInt32 kBackgroundYPositionKTable[] = { NS_ERROR("invalid property"); break; } - return *kNullStr; + static nsCString sNullStr; + return sNullStr; } PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) @@ -1105,7 +1061,7 @@ PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) } // define array of all CSS property hints -#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +#define CSS_PROP(_name, _id, _hint) NS_STYLE_HINT_##_hint, const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { #include "nsCSSPropList.h" }; diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 81778dd3ff8..316d3506d38 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -34,7 +34,7 @@ class nsString; To change the list of properties, see nsCSSPropList.h */ -#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, enum nsCSSProperty { eCSSProperty_UNKNOWN = -1, #include "nsCSSPropList.h" diff --git a/parser/htmlparser/src/nsHTMLTagList.h b/parser/htmlparser/src/nsHTMLTagList.h index ca1fa3fd5d7..e69de29bb2d 100644 --- a/parser/htmlparser/src/nsHTMLTagList.h +++ b/parser/htmlparser/src/nsHTMLTagList.h @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all HTML tags - See nsHTMLTags.h for access to the enum values for tags - - It is designed to be used as inline input to nsHTMLTags.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro HTML_TAG which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to HTML_TAG is both the enum identifier of the property - and the string value - - ******/ - -HTML_TAG(a) -HTML_TAG(abbr) -HTML_TAG(acronym) -HTML_TAG(address) -HTML_TAG(applet) -HTML_TAG(area) -HTML_TAG(b) -HTML_TAG(base) -HTML_TAG(basefont) -HTML_TAG(bdo) -HTML_TAG(bgsound) -HTML_TAG(big) -HTML_TAG(blink) -HTML_TAG(blockquote) -HTML_TAG(body) -HTML_TAG(br) -HTML_TAG(button) -HTML_TAG(caption) -HTML_TAG(center) -HTML_TAG(cite) -HTML_TAG(code) -HTML_TAG(col) -HTML_TAG(colgroup) -HTML_TAG(counter) -HTML_TAG(dd) -HTML_TAG(del) -HTML_TAG(dfn) -HTML_TAG(dir) -HTML_TAG(div) -HTML_TAG(dl) -HTML_TAG(dt) -HTML_TAG(em) -HTML_TAG(embed) -HTML_TAG(endnote) -HTML_TAG(fieldset) -HTML_TAG(font) -HTML_TAG(form) -HTML_TAG(frame) -HTML_TAG(frameset) -HTML_TAG(h1) -HTML_TAG(h2) -HTML_TAG(h3) -HTML_TAG(h4) -HTML_TAG(h5) -HTML_TAG(h6) -HTML_TAG(head) -HTML_TAG(hr) -HTML_TAG(html) -HTML_TAG(i) -HTML_TAG(iframe) -HTML_TAG(ilayer) -HTML_TAG(image) -HTML_TAG(img) -HTML_TAG(input) -HTML_TAG(ins) -HTML_TAG(isindex) -HTML_TAG(kbd) -HTML_TAG(keygen) -HTML_TAG(label) -HTML_TAG(layer) -HTML_TAG(legend) -HTML_TAG(li) -HTML_TAG(link) -HTML_TAG(listing) -HTML_TAG(map) -HTML_TAG(menu) -HTML_TAG(meta) -HTML_TAG(multicol) -HTML_TAG(nobr) -HTML_TAG(noembed) -HTML_TAG(noframes) -HTML_TAG(nolayer) -HTML_TAG(noscript) -HTML_TAG(object) -HTML_TAG(ol) -HTML_TAG(optgroup) -HTML_TAG(option) -HTML_TAG(p) -HTML_TAG(param) -HTML_TAG(parsererror) -HTML_TAG(plaintext) -HTML_TAG(pre) -HTML_TAG(q) -HTML_TAG(s) -HTML_TAG(samp) -HTML_TAG(script) -HTML_TAG(select) -HTML_TAG(server) -HTML_TAG(small) -HTML_TAG(sound) -HTML_TAG(sourcetext) -HTML_TAG(spacer) -HTML_TAG(span) -HTML_TAG(strike) -HTML_TAG(strong) -HTML_TAG(style) -HTML_TAG(sub) -HTML_TAG(sup) -HTML_TAG(table) -HTML_TAG(tbody) -HTML_TAG(td) -HTML_TAG(textarea) -HTML_TAG(tfoot) -HTML_TAG(th) -HTML_TAG(thead) -HTML_TAG(title) -HTML_TAG(tr) -HTML_TAG(tt) -HTML_TAG(u) -HTML_TAG(ul) -HTML_TAG(var) -HTML_TAG(wbr) -HTML_TAG(xmp) diff --git a/parser/htmlparser/src/nsHTMLTags.cpp b/parser/htmlparser/src/nsHTMLTags.cpp index af3848d568d..dba7c101def 100644 --- a/parser/htmlparser/src/nsHTMLTags.cpp +++ b/parser/htmlparser/src/nsHTMLTags.cpp @@ -23,7 +23,7 @@ #include "nsHTMLTags.h" #include "nsString.h" -#include "nsAVLTree.h" +#include "nsStaticNameTable.h" // define an array of all HTML tags #define HTML_TAG(_tag) #_tag, @@ -32,55 +32,29 @@ static const char* kTagTable[] = { }; #undef HTML_TAG - -struct TagNode { - TagNode(void) - : mStr(), - mEnum(eHTMLTag_unknown) - {} - - TagNode(const nsCString& aString) : mStr(aString), mEnum(eHTMLTag_unknown) { - } - - nsCAutoString mStr; - nsHTMLTag mEnum; -}; - -class TagComparitor: public nsAVLNodeComparitor { -public: - virtual ~TagComparitor(void) {} - virtual PRInt32 operator()(void* anItem1,void* anItem2) { - TagNode* one = (TagNode*)anItem1; - TagNode* two = (TagNode*)anItem2; - return one->mStr.CompareWithConversion(two->mStr, PR_TRUE); - } -}; - - -static PRInt32 gTableRefCount; -static TagNode* gTagArray; -static nsAVLTree* gTagTree; -static TagComparitor* gComparitor; +static PRInt32 gTableRefCount; +static nsStaticCaseInsensitiveNameTable* gTagTable; void nsHTMLTags::AddRefTable(void) { if (0 == gTableRefCount++) { - if (! gTagArray) { - gTagArray= new TagNode[NS_HTML_TAG_MAX]; - gComparitor = new TagComparitor(); - if (gComparitor) { - gTagTree = new nsAVLTree(*gComparitor, nsnull); - } - if (gTagArray && gTagTree) { - PRInt32 index = -1; - while (++index < NS_HTML_TAG_MAX) { - gTagArray[index].mStr = kTagTable[index]; - gTagArray[index].mEnum = nsHTMLTag(index + 1); // 1 based - gTagTree->AddItem(&(gTagArray[index])); - } + NS_ASSERTION(!gTagTable, "pre existing array!"); + gTagTable = new nsStaticCaseInsensitiveNameTable(); + if (gTagTable) { +#ifdef DEBUG + { + // let's verify the table... + for (PRInt32 index = 0; index < NS_HTML_TAG_MAX; ++index) { + nsCAutoString temp1(kTagTable[index]); + nsCAutoString temp2(kTagTable[index]); + temp1.ToLowerCase(); + NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); } } +#endif + gTagTable->Init(kTagTable, NS_HTML_TAG_MAX); + } } } @@ -88,75 +62,85 @@ void nsHTMLTags::ReleaseTable(void) { if (0 == --gTableRefCount) { - if (gTagArray) { - delete [] gTagArray; - gTagArray = nsnull; - } - if (gTagTree) { - delete gTagTree; - gTagTree = nsnull; - } - if (gComparitor) { - delete gComparitor; - gComparitor = nsnull; + if (gTagTable) { + delete gTagTable; + gTagTable = nsnull; } } } - nsHTMLTag nsHTMLTags::LookupTag(const nsCString& aTag) { - NS_ASSERTION(gTagTree, "no lookup table, needs addref"); - if (gTagTree) { - TagNode node(aTag); - TagNode* found = (TagNode*)gTagTree->FindItem(&node); - if (found) { - NS_ASSERTION(found->mStr.EqualsWithConversion(aTag,IGNORE_CASE), "bad tree"); - return found->mEnum; - } - else { + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + nsHTMLTag tag = nsHTMLTag(gTagTable->Lookup(aTag)+1); + // hack: this can come out when rickg provides a way for the editor to ask // CanContain() questions without having to first fetch the parsers // internal enum values for a tag name. - if (aTag.Equals("__moz_text")) - return eHTMLTag_text; + + if (tag == eHTMLTag_unknown) { + if(aTag.Equals("__moz_text")) { + tag = eHTMLTag_text; + } + else { + tag = eHTMLTag_userdefined; + } } - } + return tag; + } return eHTMLTag_userdefined; } nsHTMLTag -nsHTMLTags::LookupTag(const nsString& aTag) { - nsCAutoString theTag; theTag.AssignWithConversion(aTag); - return LookupTag(theTag); +nsHTMLTags::LookupTag(const nsString& aTag) +{ + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + nsHTMLTag tag = nsHTMLTag(gTagTable->Lookup(aTag)+1); + + // hack: this can come out when rickg provides a way for the editor to ask + // CanContain() questions without having to first fetch the parsers + // internal enum values for a tag name. + + if (tag == eHTMLTag_unknown) { + nsCAutoString theTag; + theTag.AssignWithConversion(aTag); + if (theTag.Equals("__moz_text")) { + tag = eHTMLTag_text; + } + else { + tag = eHTMLTag_userdefined; + } + } + return tag; + } + return eHTMLTag_userdefined; } - - const nsCString& nsHTMLTags::GetStringValue(nsHTMLTag aTag) { - NS_ASSERTION(gTagArray, "no lookup table, needs addref"); - // Note: NS_HTML_TAG_MAX=113 - if ((eHTMLTag_unknown < aTag) && - (aTag <= NS_HTML_TAG_MAX) && gTagArray) { - return gTagArray[aTag - 1].mStr; - } - else { - static const nsCString* kNullStr=0; - if(!kNullStr) - kNullStr=new nsCString(""); - return *kNullStr; + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); + if (gTagTable) { + // table is zero based, but tags are one based + return gTagTable->GetStringValue(PRInt32(aTag)-1); + } else { + static nsCString kNullStr; + return kNullStr; } } -const char* nsHTMLTags::GetCStringValue(nsHTMLTag aTag) { - NS_ASSERTION(gTagArray, "no lookup table, needs addref"); +const char* +nsHTMLTags::GetCStringValue(nsHTMLTag aTag) { + NS_ASSERTION(gTagTable, "no lookup table, needs addref"); // Note: NS_HTML_TAG_MAX=113 if ((eHTMLTag_unknown < aTag) && - (aTag <= NS_HTML_TAG_MAX) && gTagArray) { - return gTagArray[aTag - 1].mStr.mStr; + (aTag <= NS_HTML_TAG_MAX)) { + return kTagTable[PRInt32(aTag)-1]; } else { static const char* kNullStr=""; @@ -203,4 +187,3 @@ public: }; //nsTestTagTable validateTagTable; #endif -