From fa018045f0c8cb3cd2b0e1bdd3a2d9dfbbeb5f84 Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Sun, 18 Jul 1999 00:32:32 +0000 Subject: [PATCH] switch to preprocessor for code generation git-svn-id: svn://10.0.0.236/trunk@39956 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/html/style/src/nsCSSKeywordList.h | 265 +++ .../content/html/style/src/nsCSSKeywords.h | 36 +- .../content/html/style/src/nsCSSPropList.h | 191 ++ mozilla/content/html/style/src/nsCSSProps.h | 54 +- .../content/shared/public/nsCSSKeywordList.h | 265 +++ mozilla/content/shared/public/nsCSSKeywords.h | 36 +- mozilla/content/shared/public/nsCSSPropList.h | 191 ++ mozilla/content/shared/public/nsCSSProps.h | 54 +- mozilla/content/shared/src/nsCSSKeywords.cpp | 1058 ++--------- mozilla/content/shared/src/nsCSSProps.cpp | 1651 ++++++++++------- mozilla/layout/html/style/src/MANIFEST | 4 +- mozilla/layout/html/style/src/Makefile.in | 5 +- mozilla/layout/html/style/src/makefile.win | 6 +- .../layout/html/style/src/nsCSSKeywordList.h | 265 +++ .../layout/html/style/src/nsCSSKeywords.cpp | 1058 ++--------- mozilla/layout/html/style/src/nsCSSKeywords.h | 36 +- mozilla/layout/html/style/src/nsCSSPropList.h | 191 ++ mozilla/layout/html/style/src/nsCSSProps.cpp | 1651 ++++++++++------- mozilla/layout/html/style/src/nsCSSProps.h | 54 +- mozilla/layout/style/nsCSSKeywordList.h | 265 +++ mozilla/layout/style/nsCSSKeywords.cpp | 1058 ++--------- mozilla/layout/style/nsCSSKeywords.h | 36 +- mozilla/layout/style/nsCSSPropList.h | 191 ++ mozilla/layout/style/nsCSSProps.cpp | 1651 ++++++++++------- mozilla/layout/style/nsCSSProps.h | 54 +- 25 files changed, 5421 insertions(+), 4905 deletions(-) create mode 100644 mozilla/content/html/style/src/nsCSSKeywordList.h create mode 100644 mozilla/content/html/style/src/nsCSSPropList.h create mode 100644 mozilla/content/shared/public/nsCSSKeywordList.h create mode 100644 mozilla/content/shared/public/nsCSSPropList.h create mode 100644 mozilla/layout/html/style/src/nsCSSKeywordList.h create mode 100644 mozilla/layout/html/style/src/nsCSSPropList.h create mode 100644 mozilla/layout/style/nsCSSKeywordList.h create mode 100644 mozilla/layout/style/nsCSSPropList.h diff --git a/mozilla/content/html/style/src/nsCSSKeywordList.h b/mozilla/content/html/style/src/nsCSSKeywordList.h new file mode 100644 index 00000000000..117d0b78c51 --- /dev/null +++ b/mozilla/content/html/style/src/nsCSSKeywordList.h @@ -0,0 +1,265 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS keywords + See nsCSSKeywords.h for access to the enum values for keywords + + It is designed to be used as inline input to nsCSSKeywords.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_KEY which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in keywords are automagically converted into hyphens + + ******/ + + +CSS_KEY(_moz_bg_inset) +CSS_KEY(_moz_bg_outset) +CSS_KEY(_moz_pre_wrap) +CSS_KEY(_moz_center) +CSS_KEY(_moz_right) +CSS_KEY(above) +CSS_KEY(absolute) +CSS_KEY(activate_next) +CSS_KEY(all) +CSS_KEY(always) +CSS_KEY(any) +CSS_KEY(armenian) +CSS_KEY(auto) +CSS_KEY(avoid) +CSS_KEY(baseline) +CSS_KEY(behind) +CSS_KEY(below) +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(capitalize) +CSS_KEY(caption) +CSS_KEY(center) +CSS_KEY(center_left) +CSS_KEY(center_right) +CSS_KEY(ch) +CSS_KEY(circle) +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(continuous) +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(digits) +CSS_KEY(disabled) +CSS_KEY(disc) +CSS_KEY(dotted) +CSS_KEY(double) +CSS_KEY(e_resize) +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(fixed) +CSS_KEY(georgian) +CSS_KEY(grad) +CSS_KEY(groove) +CSS_KEY(hebrew) +CSS_KEY(help) +CSS_KEY(hidden) +CSS_KEY(hide) +CSS_KEY(high) +CSS_KEY(higher) +CSS_KEY(hiragana) +CSS_KEY(hiragana_iroha) +CSS_KEY(horizontal) +CSS_KEY(hz) +CSS_KEY(icon) +CSS_KEY(in) +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(justify) +CSS_KEY(katakana) +CSS_KEY(katakana_iroha) +CSS_KEY(khz) +CSS_KEY(landscape) +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) +CSS_KEY(line_through) +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(margin_box) +CSS_KEY(marker) +CSS_KEY(medium) +CSS_KEY(menu) +CSS_KEY(message_box) +CSS_KEY(middle) +CSS_KEY(mix) +CSS_KEY(mm) +CSS_KEY(move) +CSS_KEY(ms) +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(outset) +CSS_KEY(outside) +CSS_KEY(overline) +CSS_KEY(padding_box) +CSS_KEY(paragraph) +CSS_KEY(pc) +CSS_KEY(pointer) +CSS_KEY(portrait) +CSS_KEY(pre) +CSS_KEY(pt) +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(se_resize) +CSS_KEY(select) +CSS_KEY(select_next) +CSS_KEY(semi_condensed) +CSS_KEY(semi_expanded) +CSS_KEY(separate) +CSS_KEY(show) +CSS_KEY(silent) +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(square) +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(text) +CSS_KEY(text_bottom) +CSS_KEY(text_top) +CSS_KEY(thick) +CSS_KEY(thin) +CSS_KEY(toggle) +CSS_KEY(top) +CSS_KEY(transparent) +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(vertical) +CSS_KEY(visible) +CSS_KEY(w_resize) +CSS_KEY(wait) +CSS_KEY(wider) +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) diff --git a/mozilla/content/html/style/src/nsCSSKeywords.h b/mozilla/content/html/style/src/nsCSSKeywords.h index 1db3cbe5ee3..f254c0ca372 100644 --- a/mozilla/content/html/style/src/nsCSSKeywords.h +++ b/mozilla/content/html/style/src/nsCSSKeywords.h @@ -19,22 +19,36 @@ #define nsCSSKeywords_h___ #include "nslayout.h" -#include "nsCSSKeywordIDs.h" + +struct nsStr; +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: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsHTMLTagIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a keyword string, return the enum value + static nsCSSKeyword LookupKeyword(const nsStr& aKeyword); - // A table whose index is the tag id (from LookupName) - static const NameTableEntry kNameTable[]; + // Given a keyword enum, get the string value + static const nsCString& GetStringValue(nsCSSKeyword aKeyword); }; #endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/content/html/style/src/nsCSSPropList.h b/mozilla/content/html/style/src/nsCSSPropList.h new file mode 100644 index 00000000000..86661b29c00 --- /dev/null +++ b/mozilla/content/html/style/src/nsCSSPropList.h @@ -0,0 +1,191 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS properties + See nsCSSProps.h for access to the enum values for properties + + It is designed to be used as inline input to nsCSSProps.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_PROP which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in properties are automagically converted into hyphens + + 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 + ******/ + + +CSS_PROP(_moz_border_radius, VISUAL) +CSS_PROP(azimuth, AURAL) +CSS_PROP(auto_select, CONTENT) +CSS_PROP(auto_tab, CONTENT) +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(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(modify_content, FRAMECHANGE) +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(selection_style, CONTENT) +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_input, FRAMECHANGE) // XXX ??? +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) + diff --git a/mozilla/content/html/style/src/nsCSSProps.h b/mozilla/content/html/style/src/nsCSSProps.h index 92f3de0b8e8..d30dae464c9 100644 --- a/mozilla/content/html/style/src/nsCSSProps.h +++ b/mozilla/content/html/style/src/nsCSSProps.h @@ -19,33 +19,48 @@ #define nsCSSProps_h___ #include "nslayout.h" -#include "nsCSSPropIDs.h" + +struct nsStr; +class nsCString; + +/* + Declare the enum list using the magic of preprocessing + enum values are "eCSSProperty_foo" (where foo is the property) + + To change the list of properties, see nsCSSPropList.h + + */ +#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +enum nsCSSProperty { + eCSSProperty_UNKNOWN = -1, +#include "nsCSSPropList.h" + eCSSProperty_COUNT +}; +#undef CSS_PROP + class NS_LAYOUT nsCSSProps { public: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsCSSPropIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - - // Given a CSS Property ID and an Property Value Index - // Return back a const char* representation of the - // value. Return back nsnull if no value is found - static const char* LookupProperty(PRInt32 aProp, PRInt32 aIndex); + // Given a property string, return the enum value + static nsCSSProperty LookupProperty(const nsStr& aProperty); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a property enum, get the string value + static const nsCString& GetStringValue(nsCSSProperty aProperty); - // A table whose index is the tag id (from nsCSSPropIDs) - static const NameTableEntry kNameTable[]; + // Given a CSS Property and a Property Enum Value + // Return back a const nsString& representation of the + // value. Return back nullstr if no value is found + static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const PRInt32 kHintTable[]; // Keyword/Enum value tables static const PRInt32 kAzimuthKTable[]; + static const PRInt32 kAutoSelectKTable[]; + static const PRInt32 kAutoTabKTable[]; static const PRInt32 kBackgroundAttachmentKTable[]; static const PRInt32 kBackgroundColorKTable[]; static const PRInt32 kBackgroundRepeatKTable[]; @@ -53,6 +68,7 @@ public: static const PRInt32 kBorderColorKTable[]; static const PRInt32 kBorderStyleKTable[]; static const PRInt32 kBorderWidthKTable[]; + static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; static const PRInt32 kClearKTable[]; static const PRInt32 kContentKTable[]; @@ -62,14 +78,17 @@ public: static const PRInt32 kElevationKTable[]; static const PRInt32 kEmptyCellsKTable[]; static const PRInt32 kFloatKTable[]; + static const PRInt32 kFloatEdgeKTable[]; static const PRInt32 kFontKTable[]; static const PRInt32 kFontSizeKTable[]; static const PRInt32 kFontStretchKTable[]; static const PRInt32 kFontStyleKTable[]; static const PRInt32 kFontVariantKTable[]; static const PRInt32 kFontWeightKTable[]; + static const PRInt32 kKeyEquivalentKTable[]; static const PRInt32 kListStylePositionKTable[]; static const PRInt32 kListStyleKTable[]; + static const PRInt32 kModifyContentKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; static const PRInt32 kPageBreakKTable[]; @@ -79,6 +98,8 @@ public: static const PRInt32 kPitchKTable[]; static const PRInt32 kPlayDuringKTable[]; static const PRInt32 kPositionKTable[]; + static const PRInt32 kResizerKTable[]; + static const PRInt32 kSelectionStyleKTable[]; static const PRInt32 kSpeakKTable[]; static const PRInt32 kSpeakHeaderKTable[]; static const PRInt32 kSpeakNumeralKTable[]; @@ -89,6 +110,7 @@ public: static const PRInt32 kTextDecorationKTable[]; static const PRInt32 kTextTransformKTable[]; static const PRInt32 kUnicodeBidiKTable[]; + static const PRInt32 kUserInputKTable[]; static const PRInt32 kVerticalAlignKTable[]; static const PRInt32 kVisibilityKTable[]; static const PRInt32 kVolumeKTable[]; diff --git a/mozilla/content/shared/public/nsCSSKeywordList.h b/mozilla/content/shared/public/nsCSSKeywordList.h new file mode 100644 index 00000000000..117d0b78c51 --- /dev/null +++ b/mozilla/content/shared/public/nsCSSKeywordList.h @@ -0,0 +1,265 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS keywords + See nsCSSKeywords.h for access to the enum values for keywords + + It is designed to be used as inline input to nsCSSKeywords.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_KEY which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in keywords are automagically converted into hyphens + + ******/ + + +CSS_KEY(_moz_bg_inset) +CSS_KEY(_moz_bg_outset) +CSS_KEY(_moz_pre_wrap) +CSS_KEY(_moz_center) +CSS_KEY(_moz_right) +CSS_KEY(above) +CSS_KEY(absolute) +CSS_KEY(activate_next) +CSS_KEY(all) +CSS_KEY(always) +CSS_KEY(any) +CSS_KEY(armenian) +CSS_KEY(auto) +CSS_KEY(avoid) +CSS_KEY(baseline) +CSS_KEY(behind) +CSS_KEY(below) +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(capitalize) +CSS_KEY(caption) +CSS_KEY(center) +CSS_KEY(center_left) +CSS_KEY(center_right) +CSS_KEY(ch) +CSS_KEY(circle) +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(continuous) +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(digits) +CSS_KEY(disabled) +CSS_KEY(disc) +CSS_KEY(dotted) +CSS_KEY(double) +CSS_KEY(e_resize) +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(fixed) +CSS_KEY(georgian) +CSS_KEY(grad) +CSS_KEY(groove) +CSS_KEY(hebrew) +CSS_KEY(help) +CSS_KEY(hidden) +CSS_KEY(hide) +CSS_KEY(high) +CSS_KEY(higher) +CSS_KEY(hiragana) +CSS_KEY(hiragana_iroha) +CSS_KEY(horizontal) +CSS_KEY(hz) +CSS_KEY(icon) +CSS_KEY(in) +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(justify) +CSS_KEY(katakana) +CSS_KEY(katakana_iroha) +CSS_KEY(khz) +CSS_KEY(landscape) +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) +CSS_KEY(line_through) +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(margin_box) +CSS_KEY(marker) +CSS_KEY(medium) +CSS_KEY(menu) +CSS_KEY(message_box) +CSS_KEY(middle) +CSS_KEY(mix) +CSS_KEY(mm) +CSS_KEY(move) +CSS_KEY(ms) +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(outset) +CSS_KEY(outside) +CSS_KEY(overline) +CSS_KEY(padding_box) +CSS_KEY(paragraph) +CSS_KEY(pc) +CSS_KEY(pointer) +CSS_KEY(portrait) +CSS_KEY(pre) +CSS_KEY(pt) +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(se_resize) +CSS_KEY(select) +CSS_KEY(select_next) +CSS_KEY(semi_condensed) +CSS_KEY(semi_expanded) +CSS_KEY(separate) +CSS_KEY(show) +CSS_KEY(silent) +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(square) +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(text) +CSS_KEY(text_bottom) +CSS_KEY(text_top) +CSS_KEY(thick) +CSS_KEY(thin) +CSS_KEY(toggle) +CSS_KEY(top) +CSS_KEY(transparent) +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(vertical) +CSS_KEY(visible) +CSS_KEY(w_resize) +CSS_KEY(wait) +CSS_KEY(wider) +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) diff --git a/mozilla/content/shared/public/nsCSSKeywords.h b/mozilla/content/shared/public/nsCSSKeywords.h index 1db3cbe5ee3..f254c0ca372 100644 --- a/mozilla/content/shared/public/nsCSSKeywords.h +++ b/mozilla/content/shared/public/nsCSSKeywords.h @@ -19,22 +19,36 @@ #define nsCSSKeywords_h___ #include "nslayout.h" -#include "nsCSSKeywordIDs.h" + +struct nsStr; +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: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsHTMLTagIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a keyword string, return the enum value + static nsCSSKeyword LookupKeyword(const nsStr& aKeyword); - // A table whose index is the tag id (from LookupName) - static const NameTableEntry kNameTable[]; + // Given a keyword enum, get the string value + static const nsCString& GetStringValue(nsCSSKeyword aKeyword); }; #endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/content/shared/public/nsCSSPropList.h b/mozilla/content/shared/public/nsCSSPropList.h new file mode 100644 index 00000000000..86661b29c00 --- /dev/null +++ b/mozilla/content/shared/public/nsCSSPropList.h @@ -0,0 +1,191 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS properties + See nsCSSProps.h for access to the enum values for properties + + It is designed to be used as inline input to nsCSSProps.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_PROP which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in properties are automagically converted into hyphens + + 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 + ******/ + + +CSS_PROP(_moz_border_radius, VISUAL) +CSS_PROP(azimuth, AURAL) +CSS_PROP(auto_select, CONTENT) +CSS_PROP(auto_tab, CONTENT) +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(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(modify_content, FRAMECHANGE) +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(selection_style, CONTENT) +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_input, FRAMECHANGE) // XXX ??? +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) + diff --git a/mozilla/content/shared/public/nsCSSProps.h b/mozilla/content/shared/public/nsCSSProps.h index 92f3de0b8e8..d30dae464c9 100644 --- a/mozilla/content/shared/public/nsCSSProps.h +++ b/mozilla/content/shared/public/nsCSSProps.h @@ -19,33 +19,48 @@ #define nsCSSProps_h___ #include "nslayout.h" -#include "nsCSSPropIDs.h" + +struct nsStr; +class nsCString; + +/* + Declare the enum list using the magic of preprocessing + enum values are "eCSSProperty_foo" (where foo is the property) + + To change the list of properties, see nsCSSPropList.h + + */ +#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +enum nsCSSProperty { + eCSSProperty_UNKNOWN = -1, +#include "nsCSSPropList.h" + eCSSProperty_COUNT +}; +#undef CSS_PROP + class NS_LAYOUT nsCSSProps { public: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsCSSPropIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - - // Given a CSS Property ID and an Property Value Index - // Return back a const char* representation of the - // value. Return back nsnull if no value is found - static const char* LookupProperty(PRInt32 aProp, PRInt32 aIndex); + // Given a property string, return the enum value + static nsCSSProperty LookupProperty(const nsStr& aProperty); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a property enum, get the string value + static const nsCString& GetStringValue(nsCSSProperty aProperty); - // A table whose index is the tag id (from nsCSSPropIDs) - static const NameTableEntry kNameTable[]; + // Given a CSS Property and a Property Enum Value + // Return back a const nsString& representation of the + // value. Return back nullstr if no value is found + static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const PRInt32 kHintTable[]; // Keyword/Enum value tables static const PRInt32 kAzimuthKTable[]; + static const PRInt32 kAutoSelectKTable[]; + static const PRInt32 kAutoTabKTable[]; static const PRInt32 kBackgroundAttachmentKTable[]; static const PRInt32 kBackgroundColorKTable[]; static const PRInt32 kBackgroundRepeatKTable[]; @@ -53,6 +68,7 @@ public: static const PRInt32 kBorderColorKTable[]; static const PRInt32 kBorderStyleKTable[]; static const PRInt32 kBorderWidthKTable[]; + static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; static const PRInt32 kClearKTable[]; static const PRInt32 kContentKTable[]; @@ -62,14 +78,17 @@ public: static const PRInt32 kElevationKTable[]; static const PRInt32 kEmptyCellsKTable[]; static const PRInt32 kFloatKTable[]; + static const PRInt32 kFloatEdgeKTable[]; static const PRInt32 kFontKTable[]; static const PRInt32 kFontSizeKTable[]; static const PRInt32 kFontStretchKTable[]; static const PRInt32 kFontStyleKTable[]; static const PRInt32 kFontVariantKTable[]; static const PRInt32 kFontWeightKTable[]; + static const PRInt32 kKeyEquivalentKTable[]; static const PRInt32 kListStylePositionKTable[]; static const PRInt32 kListStyleKTable[]; + static const PRInt32 kModifyContentKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; static const PRInt32 kPageBreakKTable[]; @@ -79,6 +98,8 @@ public: static const PRInt32 kPitchKTable[]; static const PRInt32 kPlayDuringKTable[]; static const PRInt32 kPositionKTable[]; + static const PRInt32 kResizerKTable[]; + static const PRInt32 kSelectionStyleKTable[]; static const PRInt32 kSpeakKTable[]; static const PRInt32 kSpeakHeaderKTable[]; static const PRInt32 kSpeakNumeralKTable[]; @@ -89,6 +110,7 @@ public: static const PRInt32 kTextDecorationKTable[]; static const PRInt32 kTextTransformKTable[]; static const PRInt32 kUnicodeBidiKTable[]; + static const PRInt32 kUserInputKTable[]; static const PRInt32 kVerticalAlignKTable[]; static const PRInt32 kVisibilityKTable[]; static const PRInt32 kVolumeKTable[]; diff --git a/mozilla/content/shared/src/nsCSSKeywords.cpp b/mozilla/content/shared/src/nsCSSKeywords.cpp index f896cda51e9..4d934f8d225 100644 --- a/mozilla/content/shared/src/nsCSSKeywords.cpp +++ b/mozilla/content/shared/src/nsCSSKeywords.cpp @@ -1,934 +1,140 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSKeywords.h" -#define TOTAL_KEYWORDS 208 -#define MIN_WORD_LENGTH 1 -#define MAX_WORD_LENGTH 20 -#define MIN_HASH_VALUE 27 -#define MAX_HASH_VALUE 1665 -/* maximum key range = 1639, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSKeywords::LookupName(const char* str) + +#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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static KeywordNode* gKeywordArray; +static nsAVLTree* gKeywordTree; +static KeywordComparitor* gComparitor; + +void +nsCSSKeywords::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 217, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 211, 243, 50, - 211, 226, 194, 85, 108, 123, 138, 168, 168, 139, - 36, 30, 233, 99, 156, 13, 193, 206, 155, 182, - 10, 239, 79, 1666, 1666, 1666, 1666, 1666 - }; - static unsigned char lengthtable[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0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{""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"s", 147}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ms", 111}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"in", 72}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"ex", 50}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"px", 135}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"cross", 36}, - {"hz", 70}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"icon", 71}, - {""}, {""}, {""}, {""}, {""}, - {"mix", 108}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"cm", 29}, - {""}, {""}, {""}, {""}, - {"pc", 130}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"continuous", 34}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"mm", 109}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"khz", 83}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"disc", 44}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"thin", 184}, - {""}, {""}, {""}, {""}, {""}, - {"em", 48}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"show", 154}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"high", 66}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"solid", 163}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"none", 118}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"low", 95}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"once", 124}, - {""}, - {"digits", 43}, - {""}, {""}, {""}, {""}, - {"slow", 156}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"scroll", 149}, - {""}, {""}, {""}, {""}, - {"inset", 76}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"deg", 42}, - {""}, - {"x-low", 202}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"pt", 134}, - {""}, {""}, {""}, {""}, {""}, - {"soft", 162}, - {""}, {""}, {""}, - {"noshade", 120}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"crosshair", 37}, - {""}, - {"thick", 183}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"x-soft", 205}, - {""}, - {"block", 16}, - {""}, {""}, {""}, {""}, {""}, - {"right", 142}, - {""}, {""}, {""}, - {"auto", 9}, - {""}, - {"ltr", 102}, - {""}, {""}, {""}, - {"x-high", 199}, - {""}, {""}, {""}, {""}, {""}, - {"both", 19}, - {""}, - {"rtl", 145}, - {""}, {""}, {""}, - {"top", 185}, - {"run-in", 146}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"georgian", 59}, - {""}, - {"compact", 32}, - {"normal", 119}, - {"small", 158}, - {""}, - {"crop", 35}, - {""}, - {"sub", 168}, - {""}, {""}, - {"slower", 157}, - {""}, {""}, - {"message-box", 106}, - {""}, - {"static", 166}, - {""}, - {"-moz-center", 3}, - {""}, {""}, {""}, - {"x-small", 204}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hidden", 64}, - {""}, {""}, {""}, - {"avoid", 10}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"higher", 67}, - {"blink", 15}, - {""}, {""}, {""}, - {"code", 30}, - {""}, {""}, {""}, {""}, {""}, - {"inside", 77}, - {""}, {""}, {""}, {""}, {""}, - {"groove", 61}, - {"caption", 22}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"lower", 96}, - {""}, - {"fixed", 58}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"x-slow", 203}, - {""}, - {"move", 110}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"rad", 136}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"italic", 79}, - {""}, {""}, - {"always", 7}, - {"xx-small", 207}, - {"ridge", 141}, - {""}, - {"fast", 56}, - {"condensed", 33}, - {""}, - {"pointer", 131}, - {""}, {""}, {""}, - {"visible", 194}, - {"inherit", 73}, - {"menu", 105}, - {""}, - {"text", 180}, - {""}, {""}, {""}, - {"center", 23}, - {""}, - {"semi-condensed", 151}, - {""}, {""}, {""}, {""}, - {"loud", 94}, - {""}, {""}, - {"rightwards", 144}, - {"outset", 126}, - {""}, {""}, - {"circle", 26}, - {""}, - {"super", 169}, - {""}, {""}, {""}, {""}, - {"pre", 133}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"large", 85}, - {""}, - {"x-loud", 201}, - {"below", 13}, - {""}, {""}, {""}, {""}, - {"no-close-quote", 115}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bold", 17}, - {""}, {""}, - {"above", 5}, - {""}, {""}, - {"lighter", 91}, - {""}, {""}, - {"nowrap", 121}, - {""}, - {"grad", 60}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"outside", 127}, - {""}, {""}, {""}, - {"open-quote", 125}, - {""}, {""}, {""}, {""}, - {"sw-resize", 170}, - {""}, {""}, - {"hide", 65}, - {""}, - {"lower-roman", 100}, - {""}, {""}, - {"wider", 197}, - {"lowercase", 101}, - {""}, - {"wait", 196}, - {""}, - {"inline", 74}, - {"-moz-right", 4}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"nw-resize", 122}, - {""}, - {"smaller", 161}, - {"close-quote", 28}, - {"silent", 155}, - {""}, - {"x-large", 200}, - {""}, {""}, {""}, {""}, - {"faster", 57}, - {""}, {""}, - {"invert", 78}, - {""}, {""}, - {"armenian", 8}, - {""}, {""}, - {"larger", 86}, - {"se-resize", 150}, - {""}, {""}, {""}, - {"bottom", 20}, - {""}, {""}, {""}, {""}, - {"level", 90}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ne-resize", 114}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bolder", 18}, - {"dashed", 38}, - {"help", 63}, - {""}, {""}, {""}, {""}, {""}, - {"left", 87}, - {""}, {""}, {""}, - {"small-caps", 159}, - {"medium", 104}, - {""}, {""}, {""}, - {"square", 165}, - {""}, {""}, - {"justify", 80}, - {""}, - {"marker", 103}, - {""}, - {"list-item", 93}, - {""}, - {"decimal", 39}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"oblique", 123}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"xx-large", 206}, - {""}, {""}, - {"x-fast", 198}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"status-bar", 167}, - {"center-left", 24}, - {""}, {""}, {""}, {""}, - {"small-caption", 160}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table", 171}, - {""}, - {"right-side", 143}, - {""}, - {"embed", 49}, - {""}, {""}, {""}, {""}, - {"dotted", 45}, - {""}, {""}, {""}, {""}, {""}, - {"narrower", 113}, - {"repeat-x", 139}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-latin", 99}, - {""}, {""}, {""}, - {"no-repeat", 117}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-condensed", 52}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hebrew", 62}, - {""}, {""}, {""}, {""}, {""}, - {"collapse", 31}, - {""}, {""}, - {"cjk-ideographic", 27}, - {""}, {""}, {""}, {""}, {""}, - {"underline", 189}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"behind", 12}, - {""}, - {"line-through", 92}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"middle", 107}, - {""}, - {"landscape", 84}, - {"-moz-bg-outset", 1}, - {"table-column", 174}, - {""}, - {"double", 46}, - {""}, - {"overline", 128}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-greek", 98}, - {""}, {""}, {""}, {""}, - {"absolute", 6}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"capitalize", 21}, - {"no-open-quote", 116}, - {"transparent", 186}, - {""}, {""}, - {"upper-roman", 192}, - {""}, {""}, - {"s-resize", 148}, - {"uppercase", 193}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"text-bottom", 181}, - {""}, - {"default", 41}, - {"far-right", 55}, - {""}, - {"lower-alpha", 97}, - {""}, - {"center-right", 25}, - {""}, - {"portrait", 132}, - {"n-resize", 112}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"leftwards", 89}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"ultra-condensed", 187}, - {"repeat", 138}, - {""}, {""}, {""}, {""}, {""}, - {"hiragana", 68}, - {"left-side", 88}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-expanded", 53}, - {""}, {""}, {""}, {""}, - {"table-row", 178}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"spell-out", 164}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hiragana-iroha", 69}, - {"baseline", 11}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"text-top", 182}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"decimal-leading-zero", 40}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"paragraph", 129}, - {""}, {""}, {""}, - {"expanded", 51}, - {"table-caption", 172}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"inline-table", 75}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"relative", 137}, - {""}, {""}, {""}, {""}, - {"table-column-group", 175}, - {""}, {""}, {""}, {""}, - {"separate", 153}, - {""}, {""}, - {"-moz-bg-inset", 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"w-resize", 195}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-latin", 191}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"-moz-pre-wrap", 2}, - {""}, {""}, {""}, {""}, - {"ultra-expanded", 188}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"far-left", 54}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bidi-override", 14}, - {""}, - {"e-resize", 47}, - {""}, - {"semi-expanded", 152}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"katakana", 81}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"table-cell", 173}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"katakana-iroha", 82}, - {""}, {""}, {""}, {""}, {""}, - {"table-row-group", 179}, - {""}, {""}, - {"table-footer-group", 176}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-alpha", 190}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"repeat-y", 140}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table-header-group", 177} - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - hval += asso_values[MYLOWER(str[3])]; - case 3: - hval += asso_values[MYLOWER(str[2])]; - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSKeywords::NameTableEntry nsCSSKeywords::kNameTable[] = { - { "-moz-bg-inset", 0 }, - { "-moz-bg-outset", 1 }, - { "-moz-pre-wrap", 2 }, - { "-moz-center", 3 }, - { "-moz-right", 4 }, - { "above", 5 }, - { "absolute", 6 }, - { "always", 7 }, - { "armenian", 8 }, - { "auto", 9 }, - { "avoid", 10 }, - { "baseline", 11 }, - { "behind", 12 }, - { "below", 13 }, - { "bidi-override", 14 }, - { "blink", 15 }, - { "block", 16 }, - { "bold", 17 }, - { "bolder", 18 }, - { "both", 19 }, - { "bottom", 20 }, - { "capitalize", 21 }, - { "caption", 22 }, - { "center", 23 }, - { "center-left", 24 }, - { "center-right", 25 }, - { "circle", 26 }, - { "cjk-ideographic", 27 }, - { "close-quote", 28 }, - { "cm", 29 }, - { "code", 30 }, - { "collapse", 31 }, - { "compact", 32 }, - { "condensed", 33 }, - { "continuous", 34 }, - { "crop", 35 }, - { "cross", 36 }, - { "crosshair", 37 }, - { "dashed", 38 }, - { "decimal", 39 }, - { "decimal-leading-zero", 40 }, - { "default", 41 }, - { "deg", 42 }, - { "digits", 43 }, - { "disc", 44 }, - { "dotted", 45 }, - { "double", 46 }, - { "e-resize", 47 }, - { "em", 48 }, - { "embed", 49 }, - { "ex", 50 }, - { "expanded", 51 }, - { "extra-condensed", 52 }, - { "extra-expanded", 53 }, - { "far-left", 54 }, - { "far-right", 55 }, - { "fast", 56 }, - { "faster", 57 }, - { "fixed", 58 }, - { "georgian", 59 }, - { "grad", 60 }, - { "groove", 61 }, - { "hebrew", 62 }, - { "help", 63 }, - { "hidden", 64 }, - { "hide", 65 }, - { "high", 66 }, - { "higher", 67 }, - { "hiragana", 68 }, - { "hiragana-iroha", 69 }, - { "hz", 70 }, - { "icon", 71 }, - { "in", 72 }, - { "inherit", 73 }, - { "inline", 74 }, - { "inline-table", 75 }, - { "inset", 76 }, - { "inside", 77 }, - { "invert", 78 }, - { "italic", 79 }, - { "justify", 80 }, - { "katakana", 81 }, - { "katakana-iroha", 82 }, - { "khz", 83 }, - { "landscape", 84 }, - { "large", 85 }, - { "larger", 86 }, - { "left", 87 }, - { "left-side", 88 }, - { "leftwards", 89 }, - { "level", 90 }, - { "lighter", 91 }, - { "line-through", 92 }, - { "list-item", 93 }, - { "loud", 94 }, - { "low", 95 }, - { "lower", 96 }, - { "lower-alpha", 97 }, - { "lower-greek", 98 }, - { "lower-latin", 99 }, - { "lower-roman", 100 }, - { "lowercase", 101 }, - { "ltr", 102 }, - { "marker", 103 }, - { "medium", 104 }, - { "menu", 105 }, - { "message-box", 106 }, - { "middle", 107 }, - { "mix", 108 }, - { "mm", 109 }, - { "move", 110 }, - { "ms", 111 }, - { "n-resize", 112 }, - { "narrower", 113 }, - { "ne-resize", 114 }, - { "no-close-quote", 115 }, - { "no-open-quote", 116 }, - { "no-repeat", 117 }, - { "none", 118 }, - { "normal", 119 }, - { "noshade", 120 }, - { "nowrap", 121 }, - { "nw-resize", 122 }, - { "oblique", 123 }, - { "once", 124 }, - { "open-quote", 125 }, - { "outset", 126 }, - { "outside", 127 }, - { "overline", 128 }, - { "paragraph", 129 }, - { "pc", 130 }, - { "pointer", 131 }, - { "portrait", 132 }, - { "pre", 133 }, - { "pt", 134 }, - { "px", 135 }, - { "rad", 136 }, - { "relative", 137 }, - { "repeat", 138 }, - { "repeat-x", 139 }, - { "repeat-y", 140 }, - { "ridge", 141 }, - { "right", 142 }, - { "right-side", 143 }, - { "rightwards", 144 }, - { "rtl", 145 }, - { "run-in", 146 }, - { "s", 147 }, - { "s-resize", 148 }, - { "scroll", 149 }, - { "se-resize", 150 }, - { "semi-condensed", 151 }, - { "semi-expanded", 152 }, - { "separate", 153 }, - { "show", 154 }, - { "silent", 155 }, - { "slow", 156 }, - { "slower", 157 }, - { "small", 158 }, - { "small-caps", 159 }, - { "small-caption", 160 }, - { "smaller", 161 }, - { "soft", 162 }, - { "solid", 163 }, - { "spell-out", 164 }, - { "square", 165 }, - { "static", 166 }, - { "status-bar", 167 }, - { "sub", 168 }, - { "super", 169 }, - { "sw-resize", 170 }, - { "table", 171 }, - { "table-caption", 172 }, - { "table-cell", 173 }, - { "table-column", 174 }, - { "table-column-group", 175 }, - { "table-footer-group", 176 }, - { "table-header-group", 177 }, - { "table-row", 178 }, - { "table-row-group", 179 }, - { "text", 180 }, - { "text-bottom", 181 }, - { "text-top", 182 }, - { "thick", 183 }, - { "thin", 184 }, - { "top", 185 }, - { "transparent", 186 }, - { "ultra-condensed", 187 }, - { "ultra-expanded", 188 }, - { "underline", 189 }, - { "upper-alpha", 190 }, - { "upper-latin", 191 }, - { "upper-roman", 192 }, - { "uppercase", 193 }, - { "visible", 194 }, - { "w-resize", 195 }, - { "wait", 196 }, - { "wider", 197 }, - { "x-fast", 198 }, - { "x-high", 199 }, - { "x-large", 200 }, - { "x-loud", 201 }, - { "x-low", 202 }, - { "x-slow", 203 }, - { "x-small", 204 }, - { "x-soft", 205 }, - { "xx-large", 206 }, - { "xx-small", 207 }, -}; +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; + } + } +} + + +nsCSSKeyword +nsCSSKeywords::LookupKeyword(const nsStr& 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; +} + + +const nsCString& +nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) +{ + nsString* value = nsnull; + + NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); + if ((eCSSKeyword_UNKNOWN < aKeyword) && + (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { + return gKeywordArray[aKeyword].mStr; + } + else { + static const nsCString kNullStr; + return kNullStr; + } +} + diff --git a/mozilla/content/shared/src/nsCSSProps.cpp b/mozilla/content/shared/src/nsCSSProps.cpp index 8d9f87576dc..c7285f9f811 100644 --- a/mozilla/content/shared/src/nsCSSProps.cpp +++ b/mozilla/content/shared/src/nsCSSProps.cpp @@ -1,680 +1,989 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSProps.h" -#define TOTAL_KEYWORDS 143 -#define MIN_WORD_LENGTH 3 -#define MAX_WORD_LENGTH 21 -#define MIN_HASH_VALUE 260 -#define MAX_HASH_VALUE 1186 -/* maximum key range = 927, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSProps::LookupName(const char* str) + +#include "nsCSSProps.h" +#include "nsCSSKeywords.h" +#include "nsStyleConsts.h" + +#include "nsString.h" +#include "nsAVLTree.h" + + +// define an array of all CSS properties +#define CSS_PROP(_prop, _hint) #_prop, +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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static PropertyNode* gPropertyArray; +static nsAVLTree* gPropertyTree; +static PropertyComparitor* gComparitor; + +void +nsCSSProps::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 115, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 84, 184, 76, - 120, 248, 1, 192, 45, 108, 1187, 52, 98, 78, - 46, 127, 221, 59, 85, 219, 204, 211, 54, 111, - 216, 201, 122, 1187, 1187, 1187, 1187, 1187, - }; - static unsigned char lengthtable[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - }; - static struct StaticNameTable wordlist[] = - { - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"margin", 73}, - {"",}, {"",}, {"",}, - {"clear", 37}, - {"",}, {"",}, {"",}, {"",}, - {"width", 140}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"filter", 55}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"color", 43}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"float", 56}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - - {"font", 57}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch", 103}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marks", 79}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"clip", 38}, - {"",}, {"",}, - {"right", 112}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-family", 58}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"content", 44}, - {"",}, - {"azimuth", 1}, - {"cursor", 50}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"bottom", 35}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"orphans", 85}, - {"",}, - {"clip-left", 40}, - {"border", 11}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak", 116}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"overflow", 90}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-after", 101}, - {"",}, {"",}, - {"display", 52}, - {"margin-left", 75}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"max-width", 81}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-stretch", 61}, - {"",}, {"",}, {"",}, - {"cue", 47}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"padding", 91}, - {"",}, - {"min-width", 83}, - {"",}, - {"left", 66}, - {"top", 132}, - {"position", 107}, - {"page", 96}, - {"pause", 100}, - {"",}, {"",}, {"",}, - {"font-weight", 64}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"line-height", 68}, - {"",}, {"",}, {"",}, {"",}, - {"size", 113}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"visibility", 135}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"border-width", 32}, - {"margin-bottom", 74}, - {"",}, {"",}, - {"size-width", 115}, - {"direction", 51}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"cue-after", 48}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline", 86}, - {"",}, {"",}, {"",}, - {"margin-top", 77}, - {"vertical-align", 134}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-bottom", 39}, - {"",}, {"",}, - {"border-color", 17}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"widows", 139}, - {"",}, - {"clip-right", 41}, - {"",}, - {"background-filter", 5}, - {"",}, {"",}, {"",}, - {"border-left-width", 21}, - {"",}, - {"quotes-open", 110}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"volume", 137}, - {"",}, {"",}, {"",}, - {"font-variant", 63}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background", 2}, - {"size-height", 114}, - {"",}, {"",}, - {"padding-top", 95}, - {"",}, - {"text-align", 123}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"height", 65}, - {"z-index", 142}, - {"border-left", 18}, - {"",}, - {"border-left-color", 19}, - {"",}, - {"margin-right", 76}, - {"quotes", 108}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"unicode-bidi", 133}, - {"",}, {"",}, {"",}, - {"outline-color", 87}, - {"",}, - {"font-size", 59}, - {"play-during", 105}, - {"padding-right", 94}, - {"",}, {"",}, {"",}, - {"elevation", 53}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-color", 4}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right-width", 25}, - {"",}, {"",}, - {"white-space", 138}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"opacity", 84}, - {"outline-width", 89}, - {"padding-bottom", 92}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-bottom-width", 15}, - {"border-top-width", 31}, - {"",}, {"",}, {"",}, {"",}, - {"border-top-color", 29}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch-range", 104}, - {"border-right-color", 23}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"voice-family", 136}, - {"",}, {"",}, {"",}, - {"border-bottom", 12}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-style", 62}, - {"",}, {"",}, - {"font-size-adjust", 60}, - {"",}, - {"border-bottom-color", 13}, - {"",}, {"",}, - {"-moz-border-radius", 0}, - {"",}, - {"max-height", 80}, - {"",}, {"",}, - {"border-collapse", 16}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-top", 42}, - {"speech-rate", 120}, - {"",}, - {"border-top", 28}, - {"background-y-position", 10}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marker-offset", 78}, - {"min-height", 82}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-x-position", 9}, - {"",}, {"",}, - {"background-position", 7}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline-style", 88}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"stress", 121}, - {"",}, {"",}, - {"background-repeat", 8}, - {"",}, - {"counter-increment", 45}, - {"background-attachment", 3}, - {"border-left-style", 20}, - {"play-during-flags", 106}, - {"",}, - {"text-shadow", 126}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style", 69}, - {"",}, - {"padding-left", 93}, - {"richness", 111}, - {"",}, - {"border-y-spacing", 34}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-indent", 125}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right", 22}, - {"",}, {"",}, - {"border-x-spacing", 33}, - {"",}, {"",}, - {"table-layout", 122}, - {"",}, {"",}, - {"caption-side", 36}, - {"",}, - {"list-style-position", 71}, - {"text-decoration", 124}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"empty-cells", 54}, - {"cue-before", 49}, - {"",}, - {"page-break-after", 97}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-spacing", 26}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-image", 6}, - {"word-spacing", 141}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"border-right-style", 24}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-transform", 131}, - {"",}, - {"speak-numeral", 118}, - {"",}, {"",}, - {"letter-spacing", 67}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-color", 127}, - {"",}, - {"border-bottom-style", 14}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"speak-header", 117}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"list-style-image", 70}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"counter-reset", 46}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak-punctuation", 119}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"quotes-close", 109}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-top-style", 30}, - {"text-shadow-y", 130}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style-type", 72}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-x", 129}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-radius", 128}, - {"",}, {"",}, - {"page-break-inside", 99}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"border-style", 27}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-before", 102}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"page-break-before", 98}, - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - case 3: - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSProps::NameTableEntry nsCSSProps::kNameTable[] = { - { "-moz-border-radius", 0 }, - { "azimuth", 1 }, - { "background", 2 }, - { "background-attachment", 3 }, - { "background-color", 4 }, - { "background-filter", 5 }, - { "background-image", 6 }, - { "background-position", 7 }, - { "background-repeat", 8 }, - { "background-x-position", 9 }, - { "background-y-position", 10 }, - { "border", 11 }, - { "border-bottom", 12 }, - { "border-bottom-color", 13 }, - { "border-bottom-style", 14 }, - { "border-bottom-width", 15 }, - { "border-collapse", 16 }, - { "border-color", 17 }, - { "border-left", 18 }, - { "border-left-color", 19 }, - { "border-left-style", 20 }, - { "border-left-width", 21 }, - { "border-right", 22 }, - { "border-right-color", 23 }, - { "border-right-style", 24 }, - { "border-right-width", 25 }, - { "border-spacing", 26 }, - { "border-style", 27 }, - { "border-top", 28 }, - { "border-top-color", 29 }, - { "border-top-style", 30 }, - { "border-top-width", 31 }, - { "border-width", 32 }, - { "border-x-spacing", 33 }, - { "border-y-spacing", 34 }, - { "bottom", 35 }, - { "caption-side", 36 }, - { "clear", 37 }, - { "clip", 38 }, - { "clip-bottom", 39 }, - { "clip-left", 40 }, - { "clip-right", 41 }, - { "clip-top", 42 }, - { "color", 43 }, - { "content", 44 }, - { "counter-increment", 45 }, - { "counter-reset", 46 }, - { "cue", 47 }, - { "cue-after", 48 }, - { "cue-before", 49 }, - { "cursor", 50 }, - { "direction", 51 }, - { "display", 52 }, - { "elevation", 53 }, - { "empty-cells", 54 }, - { "filter", 55 }, - { "float", 56 }, - { "font", 57 }, - { "font-family", 58 }, - { "font-size", 59 }, - { "font-size-adjust", 60 }, - { "font-stretch", 61 }, - { "font-style", 62 }, - { "font-variant", 63 }, - { "font-weight", 64 }, - { "height", 65 }, - { "left", 66 }, - { "letter-spacing", 67 }, - { "line-height", 68 }, - { "list-style", 69 }, - { "list-style-image", 70 }, - { "list-style-position", 71 }, - { "list-style-type", 72 }, - { "margin", 73 }, - { "margin-bottom", 74 }, - { "margin-left", 75 }, - { "margin-right", 76 }, - { "margin-top", 77 }, - { "marker-offset", 78 }, - { "marks", 79 }, - { "max-height", 80 }, - { "max-width", 81 }, - { "min-height", 82 }, - { "min-width", 83 }, - { "opacity", 84 }, - { "orphans", 85 }, - { "outline", 86 }, - { "outline-color", 87 }, - { "outline-style", 88 }, - { "outline-width", 89 }, - { "overflow", 90 }, - { "padding", 91 }, - { "padding-bottom", 92 }, - { "padding-left", 93 }, - { "padding-right", 94 }, - { "padding-top", 95 }, - { "page", 96 }, - { "page-break-after", 97 }, - { "page-break-before", 98 }, - { "page-break-inside", 99 }, - { "pause", 100 }, - { "pause-after", 101 }, - { "pause-before", 102 }, - { "pitch", 103 }, - { "pitch-range", 104 }, - { "play-during", 105 }, - { "play-during-flags", 106 }, - { "position", 107 }, - { "quotes", 108 }, - { "quotes-close", 109 }, - { "quotes-open", 110 }, - { "richness", 111 }, - { "right", 112 }, - { "size", 113 }, - { "size-height", 114 }, - { "size-width", 115 }, - { "speak", 116 }, - { "speak-header", 117 }, - { "speak-numeral", 118 }, - { "speak-punctuation", 119 }, - { "speech-rate", 120 }, - { "stress", 121 }, - { "table-layout", 122 }, - { "text-align", 123 }, - { "text-decoration", 124 }, - { "text-indent", 125 }, - { "text-shadow", 126 }, - { "text-shadow-color", 127 }, - { "text-shadow-radius", 128 }, - { "text-shadow-x", 129 }, - { "text-shadow-y", 130 }, - { "text-transform", 131 }, - { "top", 132 }, - { "unicode-bidi", 133 }, - { "vertical-align", 134 }, - { "visibility", 135 }, - { "voice-family", 136 }, - { "volume", 137 }, - { "white-space", 138 }, - { "widows", 139 }, - { "width", 140 }, - { "word-spacing", 141 }, - { "z-index", 142 }, +void +nsCSSProps::ReleaseTable(void) +{ + if (0 == --gTableRefCount) { + if (gPropertyArray) { + delete [] gPropertyArray; + gPropertyArray = nsnull; + } + if (gPropertyTree) { + delete gPropertyTree; + gPropertyTree = nsnull; + } + if (gComparitor) { + delete gComparitor; + gComparitor = nsnull; + } + } +} + + +nsCSSProperty +nsCSSProps::LookupProperty(const nsStr& 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; + } + } + 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 { + static const nsCString kNullStr; + return kNullStr; + } +} + + + +// Keyword id tables for variant/enum parsing +const PRInt32 nsCSSProps::kAutoSelectKTable[] = { + eCSSKeyword_select, NS_STYLE_AUTO_SELECT_SELECT, + -1,-1 }; + +const PRInt32 nsCSSProps::kAutoTabKTable[] = { + eCSSKeyword_activate_next, NS_STYLE_AUTO_TAB_ACTIVATE_NEXT, + eCSSKeyword_select_next, NS_STYLE_AUTO_TAB_SELECT_NEXT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kAzimuthKTable[] = { + eCSSKeyword_left_side, NS_STYLE_AZIMUTH_LEFT_SIDE, + eCSSKeyword_far_left, NS_STYLE_AZIMUTH_FAR_LEFT, + eCSSKeyword_left, NS_STYLE_AZIMUTH_LEFT, + eCSSKeyword_center_left, NS_STYLE_AZIMUTH_CENTER_LEFT, + eCSSKeyword_center, NS_STYLE_AZIMUTH_CENTER, + eCSSKeyword_center_right, NS_STYLE_AZIMUTH_CENTER_RIGHT, + eCSSKeyword_right, NS_STYLE_AZIMUTH_RIGHT, + eCSSKeyword_far_right, NS_STYLE_AZIMUTH_FAR_RIGHT, + eCSSKeyword_right_side, NS_STYLE_AZIMUTH_RIGHT_SIDE, + eCSSKeyword_behind, NS_STYLE_AZIMUTH_BEHIND, + eCSSKeyword_leftwards, NS_STYLE_AZIMUTH_LEFTWARDS, + eCSSKeyword_rightwards, NS_STYLE_AZIMUTH_RIGHTWARDS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = { + eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, + eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundRepeatKTable[] = { + eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_OFF, + eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_XY, + eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_X, + eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_Y, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderCollapseKTable[] = { + eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE, + eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderStyleKTable[] = { + eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN, + eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED, + eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED, + eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID, + eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE, + eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE, + eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE, + eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET, + eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET, + eCSSKeyword__moz_bg_inset, NS_STYLE_BORDER_STYLE_BG_INSET, + eCSSKeyword__moz_bg_outset, NS_STYLE_BORDER_STYLE_BG_OUTSET, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderWidthKTable[] = { + eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN, + eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM, + eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBoxSizingKTable[] = { + eCSSKeyword_content_box, NS_STYLE_BOX_SIZING_CONTENT, + eCSSKeyword_border_box, NS_STYLE_BOX_SIZING_BORDER, + eCSSKeyword_padding_box, NS_STYLE_BOX_SIZING_PADDING, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCaptionSideKTable[] = { + eCSSKeyword_top, NS_SIDE_TOP, + eCSSKeyword_right, NS_SIDE_RIGHT, + eCSSKeyword_bottom, NS_SIDE_BOTTOM, + eCSSKeyword_left, NS_SIDE_LEFT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kClearKTable[] = { + eCSSKeyword_left, NS_STYLE_CLEAR_LEFT, + eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT, + eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kContentKTable[] = { + eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, + eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, + eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, + eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCursorKTable[] = { + eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR, + eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT, + eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER, + eCSSKeyword_move, NS_STYLE_CURSOR_MOVE, + eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE, + eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE, + eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE, + eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE, + eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE, + eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE, + eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE, + eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE, + eCSSKeyword_text, NS_STYLE_CURSOR_TEXT, + eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT, + eCSSKeyword_help, NS_STYLE_CURSOR_HELP, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDirectionKTable[] = { + eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR, + eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDisplayKTable[] = { + eCSSKeyword_inline, NS_STYLE_DISPLAY_INLINE, + eCSSKeyword_block, NS_STYLE_DISPLAY_BLOCK, + eCSSKeyword_inline_block, NS_STYLE_DISPLAY_INLINE_BLOCK, + eCSSKeyword_list_item, NS_STYLE_DISPLAY_LIST_ITEM, + eCSSKeyword_run_in, NS_STYLE_DISPLAY_RUN_IN, + eCSSKeyword_compact, NS_STYLE_DISPLAY_COMPACT, + eCSSKeyword_marker, NS_STYLE_DISPLAY_MARKER, + eCSSKeyword_table, NS_STYLE_DISPLAY_TABLE, + eCSSKeyword_inline_table, NS_STYLE_DISPLAY_INLINE_TABLE, + eCSSKeyword_table_row_group, NS_STYLE_DISPLAY_TABLE_ROW_GROUP, + eCSSKeyword_table_header_group, NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, + eCSSKeyword_table_footer_group, NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, + eCSSKeyword_table_row, NS_STYLE_DISPLAY_TABLE_ROW, + eCSSKeyword_table_column_group, NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, + eCSSKeyword_table_column, NS_STYLE_DISPLAY_TABLE_COLUMN, + eCSSKeyword_table_cell, NS_STYLE_DISPLAY_TABLE_CELL, + eCSSKeyword_table_caption, NS_STYLE_DISPLAY_TABLE_CAPTION, + -1,-1 +}; + +const PRInt32 nsCSSProps::kElevationKTable[] = { + eCSSKeyword_below, NS_STYLE_ELEVATION_BELOW, + eCSSKeyword_level, NS_STYLE_ELEVATION_LEVEL, + eCSSKeyword_above, NS_STYLE_ELEVATION_ABOVE, + eCSSKeyword_higher, NS_STYLE_ELEVATION_HIGHER, + eCSSKeyword_lower, NS_STYLE_ELEVATION_LOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kEmptyCellsKTable[] = { + eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW, + eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatKTable[] = { + eCSSKeyword_left, NS_STYLE_FLOAT_LEFT, + eCSSKeyword_right, NS_STYLE_FLOAT_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatEdgeKTable[] = { + eCSSKeyword_content_box, NS_STYLE_FLOAT_EDGE_CONTENT, + eCSSKeyword_border_box, NS_STYLE_FLOAT_EDGE_BORDER, + eCSSKeyword_padding_box, NS_STYLE_FLOAT_EDGE_PADDING, + eCSSKeyword_margin_box, NS_STYLE_FLOAT_EDGE_MARGIN, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontKTable[] = { + eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, + eCSSKeyword_icon, NS_STYLE_FONT_ICON, + eCSSKeyword_menu, NS_STYLE_FONT_MENU, + eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX, + eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION, + eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontSizeKTable[] = { + eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL, + eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL, + eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL, + eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM, + eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE, + eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE, + eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE, + eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER, + eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStretchKTable[] = { + eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER, + eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER, + eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED, + eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED, + eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED, + eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED, + eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED, + eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED, + eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED, + eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStyleKTable[] = { + eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC, + eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontVariantKTable[] = { + eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontWeightKTable[] = { + eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD, + eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER, + eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kKeyEquivalentKTable[] = { + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStylePositionKTable[] = { + eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE, + eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStyleKTable[] = { + eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, + eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, + eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, + eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, + eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, + eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, + eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, + eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, + eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, + eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, + eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, + eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, + eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, + eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, + eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, + eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, + eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, + eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, + eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, + eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, + -1,-1 +}; + +const PRInt32 nsCSSProps::kModifyContentKTable[] = { + eCSSKeyword_read_only, NS_STYLE_MODIFY_CONTENT_READ_ONLY, + eCSSKeyword_read_write, NS_STYLE_MODIFY_CONTENT_READ_WRITE, + eCSSKeyword_write_only, NS_STYLE_MODIFY_CONTENT_WRITE_ONLY, + eCSSKeyword_toggle, NS_STYLE_MODIFY_CONTENT_TOGGLE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOutlineColorKTable[] = { + eCSSKeyword_invert, NS_STYLE_COLOR_INVERT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOverflowKTable[] = { + eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, + eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakKTable[] = { + eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT, + eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakInsideKTable[] = { + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageMarksKTable[] = { + eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP, + eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageSizeKTable[] = { + eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE, + eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPitchKTable[] = { + eCSSKeyword_x_low, NS_STYLE_PITCH_X_LOW, + eCSSKeyword_low, NS_STYLE_PITCH_LOW, + eCSSKeyword_medium, NS_STYLE_PITCH_MEDIUM, + eCSSKeyword_high, NS_STYLE_PITCH_HIGH, + eCSSKeyword_x_high, NS_STYLE_PITCH_X_HIGH, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPlayDuringKTable[] = { + eCSSKeyword_mix, NS_STYLE_PLAY_DURING_MIX, + eCSSKeyword_repeat, NS_STYLE_PLAY_DURING_REPEAT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPositionKTable[] = { + eCSSKeyword_static, NS_STYLE_POSITION_NORMAL, + eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE, + eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE, + eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kResizerKTable[] = { + eCSSKeyword_both, NS_STYLE_RESIZER_BOTH, + eCSSKeyword_horizontal, NS_STYLE_RESIZER_HORIZONTAL, + eCSSKeyword_vertical, NS_STYLE_RESIZER_VERTICAL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSelectionStyleKTable[] = { + eCSSKeyword_any, NS_STYLE_SELECTION_STYLE_ANY, + eCSSKeyword_line, NS_STYLE_SELECTION_STYLE_LINE, + eCSSKeyword_all, NS_STYLE_SELECTION_STYLE_ALL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakKTable[] = { + eCSSKeyword_spell_out, NS_STYLE_SPEAK_SPELL_OUT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakHeaderKTable[] = { + eCSSKeyword_once, NS_STYLE_SPEAK_HEADER_ONCE, + eCSSKeyword_always, NS_STYLE_SPEAK_HEADER_ALWAYS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakNumeralKTable[] = { + eCSSKeyword_digits, NS_STYLE_SPEAK_NUMERAL_DIGITS, + eCSSKeyword_continuous, NS_STYLE_SPEAK_NUMERAL_CONTINUOUS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakPunctuationKTable[] = { + eCSSKeyword_code, NS_STYLE_SPEAK_PUNCTUATION_CODE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeechRateKTable[] = { + eCSSKeyword_x_slow, NS_STYLE_SPEECH_RATE_X_SLOW, + eCSSKeyword_slow, NS_STYLE_SPEECH_RATE_SLOW, + eCSSKeyword_medium, NS_STYLE_SPEECH_RATE_MEDIUM, + eCSSKeyword_fast, NS_STYLE_SPEECH_RATE_FAST, + eCSSKeyword_x_fast, NS_STYLE_SPEECH_RATE_X_FAST, + eCSSKeyword_faster, NS_STYLE_SPEECH_RATE_FASTER, + eCSSKeyword_slower, NS_STYLE_SPEECH_RATE_SLOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTableLayoutKTable[] = { + eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextAlignKTable[] = { + eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT, + eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT, + eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER, + eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, + eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER, + eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextDecorationKTable[] = { + eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE, + eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE, + eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, + eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextTransformKTable[] = { + eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, + eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, + eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = { + eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED, + eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUserInputKTable[] = { + eCSSKeyword_enabled, NS_STYLE_USER_INPUT_ENABLED, + eCSSKeyword_disabled, NS_STYLE_USER_INPUT_DISABLED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVerticalAlignKTable[] = { + eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE, + eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB, + eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER, + eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP, + eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP, + eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE, + eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM, + eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVisibilityKTable[] = { + eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN, + eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVolumeKTable[] = { + eCSSKeyword_silent, NS_STYLE_VOLUME_SILENT, + eCSSKeyword_x_soft, NS_STYLE_VOLUME_X_SOFT, + eCSSKeyword_soft, NS_STYLE_VOLUME_SOFT, + eCSSKeyword_medium, NS_STYLE_VOLUME_MEDIUM, + eCSSKeyword_loud, NS_STYLE_VOLUME_LOUD, + eCSSKeyword_x_loud, NS_STYLE_VOLUME_X_LOUD, + -1,-1 +}; + +const PRInt32 nsCSSProps::kWhitespaceKTable[] = { + eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE, + eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP, + eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, + -1,-1 +}; + +static const nsCString& +SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) +{ + PRInt32 i = 1; + for (;;) { + if (aTable[i] < 0) { + break; + } + if (aValue == aTable[i]) { + return nsCSSKeywords::GetStringValue(nsCSSKeyword(aTable[i-1])); + } + i += 2; + } + static const nsCString kNullStr; + return kNullStr; +} + + + +const nsCString& +nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) +{ +static const PRInt32 kBackgroundXPositionKTable[] = { + eCSSKeyword_left, 0, + eCSSKeyword_center, 50, + eCSSKeyword_right, 100, + -1,-1 +}; + +static const PRInt32 kBackgroundYPositionKTable[] = { + eCSSKeyword_top, 0, + eCSSKeyword_center, 50, + eCSSKeyword_bottom, 100, + -1,-1 +}; + + switch (aProp) { + + case eCSSProperty_auto_select: + return SearchKeywordTable(aValue, kAutoSelectKTable); + + case eCSSProperty_auto_tab: + return SearchKeywordTable(aValue, kAutoTabKTable); + + case eCSSProperty_azimuth: + return SearchKeywordTable(aValue, kAzimuthKTable); + + case eCSSProperty_background: + break; + + case eCSSProperty_background_attachment: + return SearchKeywordTable(aValue, kBackgroundAttachmentKTable); + + case eCSSProperty_background_color: + return SearchKeywordTable(aValue, kBackgroundColorKTable); + + case eCSSProperty_background_image: + break; + + case eCSSProperty_background_position: + break; + + case eCSSProperty_background_repeat: + return SearchKeywordTable(aValue, kBackgroundRepeatKTable); + + case eCSSProperty_background_x_position: + return SearchKeywordTable(aValue, kBackgroundXPositionKTable); + + case eCSSProperty_background_y_position: + return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + + case eCSSProperty_border: + break; + + case eCSSProperty_border_collapse: + return SearchKeywordTable(aValue, kBorderCollapseKTable); + + case eCSSProperty_box_sizing: + return SearchKeywordTable(aValue, kBoxSizingKTable); + + case eCSSProperty_border_color: + case eCSSProperty_border_spacing: + case eCSSProperty_border_style: + case eCSSProperty_border_bottom: + case eCSSProperty_border_left: + case eCSSProperty_border_right: + case eCSSProperty_border_top: + break; + + case eCSSProperty_border_bottom_color: + case eCSSProperty_border_left_color: + case eCSSProperty_border_right_color: + case eCSSProperty_border_top_color: + return SearchKeywordTable(aValue, kBorderColorKTable); + + case eCSSProperty_border_bottom_style: + case eCSSProperty_border_left_style: + case eCSSProperty_border_right_style: + case eCSSProperty_border_top_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_border_bottom_width: + case eCSSProperty_border_left_width: + case eCSSProperty_border_right_width: + case eCSSProperty_border_top_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_border_width: + case eCSSProperty_border_x_spacing: + case eCSSProperty_border_y_spacing: + case eCSSProperty_bottom: + break; + + case eCSSProperty_caption_side: + return SearchKeywordTable(aValue, kCaptionSideKTable); + + case eCSSProperty_clear: + return SearchKeywordTable(aValue, kClearKTable); + + case eCSSProperty_clip: + case eCSSProperty_clip_bottom: + case eCSSProperty_clip_left: + case eCSSProperty_clip_right: + case eCSSProperty_clip_top: + case eCSSProperty_color: + break; + + case eCSSProperty_content: + return SearchKeywordTable(aValue, kContentKTable); + + case eCSSProperty_counter_increment: + case eCSSProperty_counter_reset: + case eCSSProperty_cue: + case eCSSProperty_cue_after: + case eCSSProperty_cue_before: + break; + + case eCSSProperty_cursor: + return SearchKeywordTable(aValue, kCursorKTable); + + case eCSSProperty_direction: + return SearchKeywordTable(aValue, kDirectionKTable); + + case eCSSProperty_display: + return SearchKeywordTable(aValue, kDisplayKTable); + + case eCSSProperty_elevation: + return SearchKeywordTable(aValue, kElevationKTable); + + case eCSSProperty_empty_cells: + return SearchKeywordTable(aValue, kEmptyCellsKTable); + + case eCSSProperty_float: + return SearchKeywordTable(aValue, kFloatKTable); + + case eCSSProperty_float_edge: + return SearchKeywordTable(aValue, kFloatEdgeKTable); + + case eCSSProperty_font: + break; + + case eCSSProperty_font_family: + return SearchKeywordTable(aValue, kFontKTable); + + case eCSSProperty_font_size: + return SearchKeywordTable(aValue, kFontSizeKTable); + + case eCSSProperty_font_size_adjust: + break; + + case eCSSProperty_font_stretch: + return SearchKeywordTable(aValue, kFontStretchKTable); + + case eCSSProperty_font_style: + return SearchKeywordTable(aValue, kFontStyleKTable); + + case eCSSProperty_font_variant: + return SearchKeywordTable(aValue, kFontVariantKTable); + + case eCSSProperty_font_weight: + return SearchKeywordTable(aValue, kFontWeightKTable); + + case eCSSProperty_height: + break; + + case eCSSProperty_key_equivalent: + return SearchKeywordTable(aValue, kKeyEquivalentKTable); + + case eCSSProperty_left: + case eCSSProperty_letter_spacing: + case eCSSProperty_line_height: + case eCSSProperty_list_style: + case eCSSProperty_list_style_image: + break; + + case eCSSProperty_list_style_position: + return SearchKeywordTable(aValue, kListStylePositionKTable); + + case eCSSProperty_list_style_type: + return SearchKeywordTable(aValue, kListStyleKTable); + + case eCSSProperty_margin: + case eCSSProperty_margin_bottom: + case eCSSProperty_margin_left: + case eCSSProperty_margin_right: + case eCSSProperty_margin_top: + case eCSSProperty_marker_offset: + break; + + case eCSSProperty_marks: + return SearchKeywordTable(aValue, kPageMarksKTable); + + case eCSSProperty_max_height: + case eCSSProperty_max_width: + case eCSSProperty_min_height: + case eCSSProperty_min_width: + break; + + case eCSSProperty_modify_content: + return SearchKeywordTable(aValue, kModifyContentKTable); + + case eCSSProperty_opacity: + case eCSSProperty_orphans: + case eCSSProperty_outline: + break; + + case eCSSProperty_outline_color: + return SearchKeywordTable(aValue, kOutlineColorKTable); + + case eCSSProperty_outline_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_outline_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_overflow: + return SearchKeywordTable(aValue, kOverflowKTable); + + case eCSSProperty_padding: + case eCSSProperty_padding_bottom: + case eCSSProperty_padding_left: + case eCSSProperty_padding_right: + case eCSSProperty_padding_top: + case eCSSProperty_page: + break; + + case eCSSProperty_page_break_before: + case eCSSProperty_page_break_after: + return SearchKeywordTable(aValue, kPageBreakKTable); + + case eCSSProperty_page_break_inside: + return SearchKeywordTable(aValue, kPageBreakInsideKTable); + + case eCSSProperty_pause: + case eCSSProperty_pause_after: + case eCSSProperty_pause_before: + break; + + case eCSSProperty_pitch: + return SearchKeywordTable(aValue, kPitchKTable); + + case eCSSProperty_pitch_range: + case eCSSProperty_play_during: + break; + + case eCSSProperty_play_during_flags: + return SearchKeywordTable(aValue, kPlayDuringKTable); + + case eCSSProperty_position: + return SearchKeywordTable(aValue, kPositionKTable); + + case eCSSProperty_quotes: + case eCSSProperty_quotes_close: + case eCSSProperty_quotes_open: + break; + + case eCSSProperty_resizer: + return SearchKeywordTable(aValue, kResizerKTable); + + case eCSSProperty_richness: + case eCSSProperty_right: + break; + + case eCSSProperty_selection_style: + return SearchKeywordTable(aValue, kSelectionStyleKTable); + + case eCSSProperty_size: + break; + + case eCSSProperty_size_height: + case eCSSProperty_size_width: + return SearchKeywordTable(aValue, kPageSizeKTable); + + case eCSSProperty_speak: + return SearchKeywordTable(aValue, kSpeakKTable); + + case eCSSProperty_speak_header: + return SearchKeywordTable(aValue, kSpeakHeaderKTable); + + case eCSSProperty_speak_numeral: + return SearchKeywordTable(aValue, kSpeakNumeralKTable); + + case eCSSProperty_speak_punctuation: + return SearchKeywordTable(aValue, kSpeakPunctuationKTable); + + case eCSSProperty_speech_rate: + return SearchKeywordTable(aValue, kSpeechRateKTable); + + case eCSSProperty_stress: + break; + + case eCSSProperty_table_layout: + return SearchKeywordTable(aValue, kTableLayoutKTable); + + case eCSSProperty_text_align: + return SearchKeywordTable(aValue, kTextAlignKTable); + + case eCSSProperty_text_decoration: + return SearchKeywordTable(aValue, kTextDecorationKTable); + + case eCSSProperty_text_indent: + case eCSSProperty_text_shadow: + case eCSSProperty_text_shadow_color: + case eCSSProperty_text_shadow_radius: + case eCSSProperty_text_shadow_x: + case eCSSProperty_text_shadow_y: + break; + + case eCSSProperty_text_transform: + return SearchKeywordTable(aValue, kTextTransformKTable); + + case eCSSProperty_top: + break; + + case eCSSProperty_unicode_bidi: + return SearchKeywordTable(aValue, kUnicodeBidiKTable); + + case eCSSProperty_user_input: + return SearchKeywordTable(aValue, kUserInputKTable); + + case eCSSProperty_vertical_align: + return SearchKeywordTable(aValue, kVerticalAlignKTable); + + case eCSSProperty_visibility: + return SearchKeywordTable(aValue, kVisibilityKTable); + + case eCSSProperty_voice_family: + break; + + case eCSSProperty_volume: + return SearchKeywordTable(aValue, kVolumeKTable); + + case eCSSProperty_white_space: + return SearchKeywordTable(aValue, kWhitespaceKTable); + + case eCSSProperty_widows: + case eCSSProperty_width: + case eCSSProperty_word_spacing: + case eCSSProperty_z_index: + break; + +// no default case, let the compiler help find missing values + case eCSSProperty_UNKNOWN: + case eCSSProperty_COUNT: + NS_ERROR("invalid property"); + break; + } + static const nsCString kNullStr; + return kNullStr; +} + + +// define array of all CSS property hints +#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { +#include "nsCSSPropList.h" +}; +#undef CSS_PROP + diff --git a/mozilla/layout/html/style/src/MANIFEST b/mozilla/layout/html/style/src/MANIFEST index 6debdb2ad4b..55595c720c1 100644 --- a/mozilla/layout/html/style/src/MANIFEST +++ b/mozilla/layout/html/style/src/MANIFEST @@ -1,6 +1,8 @@ nsDOMCSSDeclaration.h +nsCSSKeywords.h +nsCSSKeywordList.h nsCSSProps.h -nsCSSPropIDs.h +nsCSSPropList.h nsCSSValue.h nsICSSRule.h nsICSSGroupRule.h diff --git a/mozilla/layout/html/style/src/Makefile.in b/mozilla/layout/html/style/src/Makefile.in index ba9ca9dddec..08d5253c222 100644 --- a/mozilla/layout/html/style/src/Makefile.in +++ b/mozilla/layout/html/style/src/Makefile.in @@ -37,7 +37,6 @@ CPPSRCS = \ nsCSSLoader.cpp \ nsCSSParser.cpp \ nsCSSProps.cpp \ - nsCSSProps2.cpp \ nsCSSRendering.cpp \ nsCSSScanner.cpp \ nsCSSRule.cpp \ @@ -55,8 +54,10 @@ CPPSRCS = \ EXPORTS = \ nsDOMCSSDeclaration.h \ + nsCSSKeywords.h \ + nsCSSKeywordList.h \ nsCSSProps.h \ - nsCSSPropIDs.h \ + nsCSSPropList.h \ nsCSSValue.h \ nsICSSRule.h \ nsICSSGroupRule.h \ diff --git a/mozilla/layout/html/style/src/makefile.win b/mozilla/layout/html/style/src/makefile.win index 30d3ac73acb..a5849b77b40 100644 --- a/mozilla/layout/html/style/src/makefile.win +++ b/mozilla/layout/html/style/src/makefile.win @@ -24,8 +24,10 @@ REQUIRES=xpcom raptor dom js DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN EXPORTS = \ + nsCSSKeywords.h \ + nsCSSKeywordList.h \ nsCSSProps.h \ - nsCSSPropIDs.h \ + nsCSSPropList.h \ nsCSSValue.h \ nsICSSRule.h \ nsICSSGroupRule.h \ @@ -49,7 +51,6 @@ CPPSRCS= \ nsCSSLoader.cpp \ nsCSSParser.cpp \ nsCSSProps.cpp \ - nsCSSProps2.cpp \ nsCSSRendering.cpp \ nsCSSScanner.cpp \ nsCSSRule.cpp \ @@ -73,7 +74,6 @@ CPP_OBJS = \ .\$(OBJDIR)\nsCSSLoader.obj \ .\$(OBJDIR)\nsCSSParser.obj \ .\$(OBJDIR)\nsCSSProps.obj \ - .\$(OBJDIR)\nsCSSProps2.obj \ .\$(OBJDIR)\nsCSSRendering.obj \ .\$(OBJDIR)\nsCSSScanner.obj \ .\$(OBJDIR)\nsCSSRule.obj \ diff --git a/mozilla/layout/html/style/src/nsCSSKeywordList.h b/mozilla/layout/html/style/src/nsCSSKeywordList.h new file mode 100644 index 00000000000..117d0b78c51 --- /dev/null +++ b/mozilla/layout/html/style/src/nsCSSKeywordList.h @@ -0,0 +1,265 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS keywords + See nsCSSKeywords.h for access to the enum values for keywords + + It is designed to be used as inline input to nsCSSKeywords.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_KEY which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in keywords are automagically converted into hyphens + + ******/ + + +CSS_KEY(_moz_bg_inset) +CSS_KEY(_moz_bg_outset) +CSS_KEY(_moz_pre_wrap) +CSS_KEY(_moz_center) +CSS_KEY(_moz_right) +CSS_KEY(above) +CSS_KEY(absolute) +CSS_KEY(activate_next) +CSS_KEY(all) +CSS_KEY(always) +CSS_KEY(any) +CSS_KEY(armenian) +CSS_KEY(auto) +CSS_KEY(avoid) +CSS_KEY(baseline) +CSS_KEY(behind) +CSS_KEY(below) +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(capitalize) +CSS_KEY(caption) +CSS_KEY(center) +CSS_KEY(center_left) +CSS_KEY(center_right) +CSS_KEY(ch) +CSS_KEY(circle) +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(continuous) +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(digits) +CSS_KEY(disabled) +CSS_KEY(disc) +CSS_KEY(dotted) +CSS_KEY(double) +CSS_KEY(e_resize) +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(fixed) +CSS_KEY(georgian) +CSS_KEY(grad) +CSS_KEY(groove) +CSS_KEY(hebrew) +CSS_KEY(help) +CSS_KEY(hidden) +CSS_KEY(hide) +CSS_KEY(high) +CSS_KEY(higher) +CSS_KEY(hiragana) +CSS_KEY(hiragana_iroha) +CSS_KEY(horizontal) +CSS_KEY(hz) +CSS_KEY(icon) +CSS_KEY(in) +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(justify) +CSS_KEY(katakana) +CSS_KEY(katakana_iroha) +CSS_KEY(khz) +CSS_KEY(landscape) +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) +CSS_KEY(line_through) +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(margin_box) +CSS_KEY(marker) +CSS_KEY(medium) +CSS_KEY(menu) +CSS_KEY(message_box) +CSS_KEY(middle) +CSS_KEY(mix) +CSS_KEY(mm) +CSS_KEY(move) +CSS_KEY(ms) +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(outset) +CSS_KEY(outside) +CSS_KEY(overline) +CSS_KEY(padding_box) +CSS_KEY(paragraph) +CSS_KEY(pc) +CSS_KEY(pointer) +CSS_KEY(portrait) +CSS_KEY(pre) +CSS_KEY(pt) +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(se_resize) +CSS_KEY(select) +CSS_KEY(select_next) +CSS_KEY(semi_condensed) +CSS_KEY(semi_expanded) +CSS_KEY(separate) +CSS_KEY(show) +CSS_KEY(silent) +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(square) +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(text) +CSS_KEY(text_bottom) +CSS_KEY(text_top) +CSS_KEY(thick) +CSS_KEY(thin) +CSS_KEY(toggle) +CSS_KEY(top) +CSS_KEY(transparent) +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(vertical) +CSS_KEY(visible) +CSS_KEY(w_resize) +CSS_KEY(wait) +CSS_KEY(wider) +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) diff --git a/mozilla/layout/html/style/src/nsCSSKeywords.cpp b/mozilla/layout/html/style/src/nsCSSKeywords.cpp index f896cda51e9..4d934f8d225 100644 --- a/mozilla/layout/html/style/src/nsCSSKeywords.cpp +++ b/mozilla/layout/html/style/src/nsCSSKeywords.cpp @@ -1,934 +1,140 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSKeywords.h" -#define TOTAL_KEYWORDS 208 -#define MIN_WORD_LENGTH 1 -#define MAX_WORD_LENGTH 20 -#define MIN_HASH_VALUE 27 -#define MAX_HASH_VALUE 1665 -/* maximum key range = 1639, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSKeywords::LookupName(const char* str) + +#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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static KeywordNode* gKeywordArray; +static nsAVLTree* gKeywordTree; +static KeywordComparitor* gComparitor; + +void +nsCSSKeywords::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 217, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 211, 243, 50, - 211, 226, 194, 85, 108, 123, 138, 168, 168, 139, - 36, 30, 233, 99, 156, 13, 193, 206, 155, 182, - 10, 239, 79, 1666, 1666, 1666, 1666, 1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, 0, 0, 0, 0, 0, 18 - }; - static struct StaticNameTable wordlist[] = - { - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"s", 147}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ms", 111}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"in", 72}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"ex", 50}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"px", 135}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"cross", 36}, - {"hz", 70}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"icon", 71}, - {""}, {""}, {""}, {""}, {""}, - {"mix", 108}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"cm", 29}, - {""}, {""}, {""}, {""}, - {"pc", 130}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"continuous", 34}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"mm", 109}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"khz", 83}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"disc", 44}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"thin", 184}, - {""}, {""}, {""}, {""}, {""}, - {"em", 48}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"show", 154}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"high", 66}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"solid", 163}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"none", 118}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"low", 95}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"once", 124}, - {""}, - {"digits", 43}, - {""}, {""}, {""}, {""}, - {"slow", 156}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"scroll", 149}, - {""}, {""}, {""}, {""}, - {"inset", 76}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"deg", 42}, - {""}, - {"x-low", 202}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"pt", 134}, - {""}, {""}, {""}, {""}, {""}, - {"soft", 162}, - {""}, {""}, {""}, - {"noshade", 120}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"crosshair", 37}, - {""}, - {"thick", 183}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"x-soft", 205}, - {""}, - {"block", 16}, - {""}, {""}, {""}, {""}, {""}, - {"right", 142}, - {""}, {""}, {""}, - {"auto", 9}, - {""}, - {"ltr", 102}, - {""}, {""}, {""}, - {"x-high", 199}, - {""}, {""}, {""}, {""}, {""}, - {"both", 19}, - {""}, - {"rtl", 145}, - {""}, {""}, {""}, - {"top", 185}, - {"run-in", 146}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"georgian", 59}, - {""}, - {"compact", 32}, - {"normal", 119}, - {"small", 158}, - {""}, - {"crop", 35}, - {""}, - {"sub", 168}, - {""}, {""}, - {"slower", 157}, - {""}, {""}, - {"message-box", 106}, - {""}, - {"static", 166}, - {""}, - {"-moz-center", 3}, - {""}, {""}, {""}, - {"x-small", 204}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hidden", 64}, - {""}, {""}, {""}, - {"avoid", 10}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"higher", 67}, - {"blink", 15}, - {""}, {""}, {""}, - {"code", 30}, - {""}, {""}, {""}, {""}, {""}, - {"inside", 77}, - {""}, {""}, {""}, {""}, {""}, - {"groove", 61}, - {"caption", 22}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"lower", 96}, - {""}, - {"fixed", 58}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"x-slow", 203}, - {""}, - {"move", 110}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"rad", 136}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"italic", 79}, - {""}, {""}, - {"always", 7}, - {"xx-small", 207}, - {"ridge", 141}, - {""}, - {"fast", 56}, - {"condensed", 33}, - {""}, - {"pointer", 131}, - {""}, {""}, {""}, - {"visible", 194}, - {"inherit", 73}, - {"menu", 105}, - {""}, - {"text", 180}, - {""}, {""}, {""}, - {"center", 23}, - {""}, - {"semi-condensed", 151}, - {""}, {""}, {""}, {""}, - {"loud", 94}, - {""}, {""}, - {"rightwards", 144}, - {"outset", 126}, - {""}, {""}, - {"circle", 26}, - {""}, - {"super", 169}, - {""}, {""}, {""}, {""}, - {"pre", 133}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"large", 85}, - {""}, - {"x-loud", 201}, - {"below", 13}, - {""}, {""}, {""}, {""}, - {"no-close-quote", 115}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bold", 17}, - {""}, {""}, - {"above", 5}, - {""}, {""}, - {"lighter", 91}, - {""}, {""}, - {"nowrap", 121}, - {""}, - {"grad", 60}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"outside", 127}, - {""}, {""}, {""}, - {"open-quote", 125}, - {""}, {""}, {""}, {""}, - {"sw-resize", 170}, - {""}, {""}, - {"hide", 65}, - {""}, - {"lower-roman", 100}, - {""}, {""}, - {"wider", 197}, - {"lowercase", 101}, - {""}, - {"wait", 196}, - {""}, - {"inline", 74}, - {"-moz-right", 4}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"nw-resize", 122}, - {""}, - {"smaller", 161}, - {"close-quote", 28}, - {"silent", 155}, - {""}, - {"x-large", 200}, - {""}, {""}, {""}, {""}, - {"faster", 57}, - {""}, {""}, - {"invert", 78}, - {""}, {""}, - {"armenian", 8}, - {""}, {""}, - {"larger", 86}, - {"se-resize", 150}, - {""}, {""}, {""}, - {"bottom", 20}, - {""}, {""}, {""}, {""}, - {"level", 90}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ne-resize", 114}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bolder", 18}, - {"dashed", 38}, - {"help", 63}, - {""}, {""}, {""}, {""}, {""}, - {"left", 87}, - {""}, {""}, {""}, - {"small-caps", 159}, - {"medium", 104}, - {""}, {""}, {""}, - {"square", 165}, - {""}, {""}, - {"justify", 80}, - {""}, - {"marker", 103}, - {""}, - {"list-item", 93}, - {""}, - {"decimal", 39}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"oblique", 123}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"xx-large", 206}, - {""}, {""}, - {"x-fast", 198}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"status-bar", 167}, - {"center-left", 24}, - {""}, {""}, {""}, {""}, - {"small-caption", 160}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table", 171}, - {""}, - {"right-side", 143}, - {""}, - {"embed", 49}, - {""}, {""}, {""}, {""}, - {"dotted", 45}, - {""}, {""}, {""}, {""}, {""}, - {"narrower", 113}, - {"repeat-x", 139}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-latin", 99}, - {""}, {""}, {""}, - {"no-repeat", 117}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-condensed", 52}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hebrew", 62}, - {""}, {""}, {""}, {""}, {""}, - {"collapse", 31}, - {""}, {""}, - {"cjk-ideographic", 27}, - {""}, {""}, {""}, {""}, {""}, - {"underline", 189}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"behind", 12}, - {""}, - {"line-through", 92}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"middle", 107}, - {""}, - {"landscape", 84}, - {"-moz-bg-outset", 1}, - {"table-column", 174}, - {""}, - {"double", 46}, - {""}, - {"overline", 128}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-greek", 98}, - {""}, {""}, {""}, {""}, - {"absolute", 6}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"capitalize", 21}, - {"no-open-quote", 116}, - {"transparent", 186}, - {""}, {""}, - {"upper-roman", 192}, - {""}, {""}, - {"s-resize", 148}, - {"uppercase", 193}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"text-bottom", 181}, - {""}, - {"default", 41}, - {"far-right", 55}, - {""}, - {"lower-alpha", 97}, - {""}, - {"center-right", 25}, - {""}, - {"portrait", 132}, - {"n-resize", 112}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"leftwards", 89}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"ultra-condensed", 187}, - {"repeat", 138}, - {""}, {""}, {""}, {""}, {""}, - {"hiragana", 68}, - {"left-side", 88}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-expanded", 53}, - {""}, {""}, {""}, {""}, - {"table-row", 178}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"spell-out", 164}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hiragana-iroha", 69}, - {"baseline", 11}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"text-top", 182}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"decimal-leading-zero", 40}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"paragraph", 129}, - {""}, {""}, {""}, - {"expanded", 51}, - {"table-caption", 172}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"inline-table", 75}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"relative", 137}, - {""}, {""}, {""}, {""}, - {"table-column-group", 175}, - {""}, {""}, {""}, {""}, - {"separate", 153}, - {""}, {""}, - {"-moz-bg-inset", 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"w-resize", 195}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-latin", 191}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"-moz-pre-wrap", 2}, - {""}, {""}, {""}, {""}, - {"ultra-expanded", 188}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"far-left", 54}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bidi-override", 14}, - {""}, - {"e-resize", 47}, - {""}, - {"semi-expanded", 152}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"katakana", 81}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"table-cell", 173}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"katakana-iroha", 82}, - {""}, {""}, {""}, {""}, {""}, - {"table-row-group", 179}, - {""}, {""}, - {"table-footer-group", 176}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-alpha", 190}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"repeat-y", 140}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table-header-group", 177} - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - hval += asso_values[MYLOWER(str[3])]; - case 3: - hval += asso_values[MYLOWER(str[2])]; - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSKeywords::NameTableEntry nsCSSKeywords::kNameTable[] = { - { "-moz-bg-inset", 0 }, - { "-moz-bg-outset", 1 }, - { "-moz-pre-wrap", 2 }, - { "-moz-center", 3 }, - { "-moz-right", 4 }, - { "above", 5 }, - { "absolute", 6 }, - { "always", 7 }, - { "armenian", 8 }, - { "auto", 9 }, - { "avoid", 10 }, - { "baseline", 11 }, - { "behind", 12 }, - { "below", 13 }, - { "bidi-override", 14 }, - { "blink", 15 }, - { "block", 16 }, - { "bold", 17 }, - { "bolder", 18 }, - { "both", 19 }, - { "bottom", 20 }, - { "capitalize", 21 }, - { "caption", 22 }, - { "center", 23 }, - { "center-left", 24 }, - { "center-right", 25 }, - { "circle", 26 }, - { "cjk-ideographic", 27 }, - { "close-quote", 28 }, - { "cm", 29 }, - { "code", 30 }, - { "collapse", 31 }, - { "compact", 32 }, - { "condensed", 33 }, - { "continuous", 34 }, - { "crop", 35 }, - { "cross", 36 }, - { "crosshair", 37 }, - { "dashed", 38 }, - { "decimal", 39 }, - { "decimal-leading-zero", 40 }, - { "default", 41 }, - { "deg", 42 }, - { "digits", 43 }, - { "disc", 44 }, - { "dotted", 45 }, - { "double", 46 }, - { "e-resize", 47 }, - { "em", 48 }, - { "embed", 49 }, - { "ex", 50 }, - { "expanded", 51 }, - { "extra-condensed", 52 }, - { "extra-expanded", 53 }, - { "far-left", 54 }, - { "far-right", 55 }, - { "fast", 56 }, - { "faster", 57 }, - { "fixed", 58 }, - { "georgian", 59 }, - { "grad", 60 }, - { "groove", 61 }, - { "hebrew", 62 }, - { "help", 63 }, - { "hidden", 64 }, - { "hide", 65 }, - { "high", 66 }, - { "higher", 67 }, - { "hiragana", 68 }, - { "hiragana-iroha", 69 }, - { "hz", 70 }, - { "icon", 71 }, - { "in", 72 }, - { "inherit", 73 }, - { "inline", 74 }, - { "inline-table", 75 }, - { "inset", 76 }, - { "inside", 77 }, - { "invert", 78 }, - { "italic", 79 }, - { "justify", 80 }, - { "katakana", 81 }, - { "katakana-iroha", 82 }, - { "khz", 83 }, - { "landscape", 84 }, - { "large", 85 }, - { "larger", 86 }, - { "left", 87 }, - { "left-side", 88 }, - { "leftwards", 89 }, - { "level", 90 }, - { "lighter", 91 }, - { "line-through", 92 }, - { "list-item", 93 }, - { "loud", 94 }, - { "low", 95 }, - { "lower", 96 }, - { "lower-alpha", 97 }, - { "lower-greek", 98 }, - { "lower-latin", 99 }, - { "lower-roman", 100 }, - { "lowercase", 101 }, - { "ltr", 102 }, - { "marker", 103 }, - { "medium", 104 }, - { "menu", 105 }, - { "message-box", 106 }, - { "middle", 107 }, - { "mix", 108 }, - { "mm", 109 }, - { "move", 110 }, - { "ms", 111 }, - { "n-resize", 112 }, - { "narrower", 113 }, - { "ne-resize", 114 }, - { "no-close-quote", 115 }, - { "no-open-quote", 116 }, - { "no-repeat", 117 }, - { "none", 118 }, - { "normal", 119 }, - { "noshade", 120 }, - { "nowrap", 121 }, - { "nw-resize", 122 }, - { "oblique", 123 }, - { "once", 124 }, - { "open-quote", 125 }, - { "outset", 126 }, - { "outside", 127 }, - { "overline", 128 }, - { "paragraph", 129 }, - { "pc", 130 }, - { "pointer", 131 }, - { "portrait", 132 }, - { "pre", 133 }, - { "pt", 134 }, - { "px", 135 }, - { "rad", 136 }, - { "relative", 137 }, - { "repeat", 138 }, - { "repeat-x", 139 }, - { "repeat-y", 140 }, - { "ridge", 141 }, - { "right", 142 }, - { "right-side", 143 }, - { "rightwards", 144 }, - { "rtl", 145 }, - { "run-in", 146 }, - { "s", 147 }, - { "s-resize", 148 }, - { "scroll", 149 }, - { "se-resize", 150 }, - { "semi-condensed", 151 }, - { "semi-expanded", 152 }, - { "separate", 153 }, - { "show", 154 }, - { "silent", 155 }, - { "slow", 156 }, - { "slower", 157 }, - { "small", 158 }, - { "small-caps", 159 }, - { "small-caption", 160 }, - { "smaller", 161 }, - { "soft", 162 }, - { "solid", 163 }, - { "spell-out", 164 }, - { "square", 165 }, - { "static", 166 }, - { "status-bar", 167 }, - { "sub", 168 }, - { "super", 169 }, - { "sw-resize", 170 }, - { "table", 171 }, - { "table-caption", 172 }, - { "table-cell", 173 }, - { "table-column", 174 }, - { "table-column-group", 175 }, - { "table-footer-group", 176 }, - { "table-header-group", 177 }, - { "table-row", 178 }, - { "table-row-group", 179 }, - { "text", 180 }, - { "text-bottom", 181 }, - { "text-top", 182 }, - { "thick", 183 }, - { "thin", 184 }, - { "top", 185 }, - { "transparent", 186 }, - { "ultra-condensed", 187 }, - { "ultra-expanded", 188 }, - { "underline", 189 }, - { "upper-alpha", 190 }, - { "upper-latin", 191 }, - { "upper-roman", 192 }, - { "uppercase", 193 }, - { "visible", 194 }, - { "w-resize", 195 }, - { "wait", 196 }, - { "wider", 197 }, - { "x-fast", 198 }, - { "x-high", 199 }, - { "x-large", 200 }, - { "x-loud", 201 }, - { "x-low", 202 }, - { "x-slow", 203 }, - { "x-small", 204 }, - { "x-soft", 205 }, - { "xx-large", 206 }, - { "xx-small", 207 }, -}; +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; + } + } +} + + +nsCSSKeyword +nsCSSKeywords::LookupKeyword(const nsStr& 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; +} + + +const nsCString& +nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) +{ + nsString* value = nsnull; + + NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); + if ((eCSSKeyword_UNKNOWN < aKeyword) && + (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { + return gKeywordArray[aKeyword].mStr; + } + else { + static const nsCString kNullStr; + return kNullStr; + } +} + diff --git a/mozilla/layout/html/style/src/nsCSSKeywords.h b/mozilla/layout/html/style/src/nsCSSKeywords.h index 1db3cbe5ee3..f254c0ca372 100644 --- a/mozilla/layout/html/style/src/nsCSSKeywords.h +++ b/mozilla/layout/html/style/src/nsCSSKeywords.h @@ -19,22 +19,36 @@ #define nsCSSKeywords_h___ #include "nslayout.h" -#include "nsCSSKeywordIDs.h" + +struct nsStr; +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: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsHTMLTagIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a keyword string, return the enum value + static nsCSSKeyword LookupKeyword(const nsStr& aKeyword); - // A table whose index is the tag id (from LookupName) - static const NameTableEntry kNameTable[]; + // Given a keyword enum, get the string value + static const nsCString& GetStringValue(nsCSSKeyword aKeyword); }; #endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/layout/html/style/src/nsCSSPropList.h b/mozilla/layout/html/style/src/nsCSSPropList.h new file mode 100644 index 00000000000..86661b29c00 --- /dev/null +++ b/mozilla/layout/html/style/src/nsCSSPropList.h @@ -0,0 +1,191 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS properties + See nsCSSProps.h for access to the enum values for properties + + It is designed to be used as inline input to nsCSSProps.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_PROP which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in properties are automagically converted into hyphens + + 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 + ******/ + + +CSS_PROP(_moz_border_radius, VISUAL) +CSS_PROP(azimuth, AURAL) +CSS_PROP(auto_select, CONTENT) +CSS_PROP(auto_tab, CONTENT) +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(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(modify_content, FRAMECHANGE) +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(selection_style, CONTENT) +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_input, FRAMECHANGE) // XXX ??? +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) + diff --git a/mozilla/layout/html/style/src/nsCSSProps.cpp b/mozilla/layout/html/style/src/nsCSSProps.cpp index 8d9f87576dc..c7285f9f811 100644 --- a/mozilla/layout/html/style/src/nsCSSProps.cpp +++ b/mozilla/layout/html/style/src/nsCSSProps.cpp @@ -1,680 +1,989 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSProps.h" -#define TOTAL_KEYWORDS 143 -#define MIN_WORD_LENGTH 3 -#define MAX_WORD_LENGTH 21 -#define MIN_HASH_VALUE 260 -#define MAX_HASH_VALUE 1186 -/* maximum key range = 927, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSProps::LookupName(const char* str) + +#include "nsCSSProps.h" +#include "nsCSSKeywords.h" +#include "nsStyleConsts.h" + +#include "nsString.h" +#include "nsAVLTree.h" + + +// define an array of all CSS properties +#define CSS_PROP(_prop, _hint) #_prop, +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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static PropertyNode* gPropertyArray; +static nsAVLTree* gPropertyTree; +static PropertyComparitor* gComparitor; + +void +nsCSSProps::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 115, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 84, 184, 76, - 120, 248, 1, 192, 45, 108, 1187, 52, 98, 78, - 46, 127, 221, 59, 85, 219, 204, 211, 54, 111, - 216, 201, 122, 1187, 1187, 1187, 1187, 1187, - }; - static unsigned char lengthtable[] = - { - 0, 0, 0,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0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, - 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 16, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, - 0, 18, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - }; - static struct StaticNameTable wordlist[] = - { - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"margin", 73}, - {"",}, {"",}, {"",}, - {"clear", 37}, - {"",}, {"",}, {"",}, {"",}, - {"width", 140}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"filter", 55}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"color", 43}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"float", 56}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - - {"font", 57}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch", 103}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marks", 79}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"clip", 38}, - {"",}, {"",}, - {"right", 112}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-family", 58}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"content", 44}, - {"",}, - {"azimuth", 1}, - {"cursor", 50}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"bottom", 35}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"orphans", 85}, - {"",}, - {"clip-left", 40}, - {"border", 11}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak", 116}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"overflow", 90}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-after", 101}, - {"",}, {"",}, - {"display", 52}, - {"margin-left", 75}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"max-width", 81}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-stretch", 61}, - {"",}, {"",}, {"",}, - {"cue", 47}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"padding", 91}, - {"",}, - {"min-width", 83}, - {"",}, - {"left", 66}, - {"top", 132}, - {"position", 107}, - {"page", 96}, - {"pause", 100}, - {"",}, {"",}, {"",}, - {"font-weight", 64}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"line-height", 68}, - {"",}, {"",}, {"",}, {"",}, - {"size", 113}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"visibility", 135}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"border-width", 32}, - {"margin-bottom", 74}, - {"",}, {"",}, - {"size-width", 115}, - {"direction", 51}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"cue-after", 48}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline", 86}, - {"",}, {"",}, {"",}, - {"margin-top", 77}, - {"vertical-align", 134}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-bottom", 39}, - {"",}, {"",}, - {"border-color", 17}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"widows", 139}, - {"",}, - {"clip-right", 41}, - {"",}, - {"background-filter", 5}, - {"",}, {"",}, {"",}, - {"border-left-width", 21}, - {"",}, - {"quotes-open", 110}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"volume", 137}, - {"",}, {"",}, {"",}, - {"font-variant", 63}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background", 2}, - {"size-height", 114}, - {"",}, {"",}, - {"padding-top", 95}, - {"",}, - {"text-align", 123}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"height", 65}, - {"z-index", 142}, - {"border-left", 18}, - {"",}, - {"border-left-color", 19}, - {"",}, - {"margin-right", 76}, - {"quotes", 108}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"unicode-bidi", 133}, - {"",}, {"",}, {"",}, - {"outline-color", 87}, - {"",}, - {"font-size", 59}, - {"play-during", 105}, - {"padding-right", 94}, - {"",}, {"",}, {"",}, - {"elevation", 53}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-color", 4}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right-width", 25}, - {"",}, {"",}, - {"white-space", 138}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"opacity", 84}, - {"outline-width", 89}, - {"padding-bottom", 92}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-bottom-width", 15}, - {"border-top-width", 31}, - {"",}, {"",}, {"",}, {"",}, - {"border-top-color", 29}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch-range", 104}, - {"border-right-color", 23}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"voice-family", 136}, - {"",}, {"",}, {"",}, - {"border-bottom", 12}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-style", 62}, - {"",}, {"",}, - {"font-size-adjust", 60}, - {"",}, - {"border-bottom-color", 13}, - {"",}, {"",}, - {"-moz-border-radius", 0}, - {"",}, - {"max-height", 80}, - {"",}, {"",}, - {"border-collapse", 16}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-top", 42}, - {"speech-rate", 120}, - {"",}, - {"border-top", 28}, - {"background-y-position", 10}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marker-offset", 78}, - {"min-height", 82}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-x-position", 9}, - {"",}, {"",}, - {"background-position", 7}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline-style", 88}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"stress", 121}, - {"",}, {"",}, - {"background-repeat", 8}, - {"",}, - {"counter-increment", 45}, - {"background-attachment", 3}, - {"border-left-style", 20}, - {"play-during-flags", 106}, - {"",}, - {"text-shadow", 126}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style", 69}, - {"",}, - {"padding-left", 93}, - {"richness", 111}, - {"",}, - {"border-y-spacing", 34}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-indent", 125}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right", 22}, - {"",}, {"",}, - {"border-x-spacing", 33}, - {"",}, {"",}, - {"table-layout", 122}, - {"",}, {"",}, - {"caption-side", 36}, - {"",}, - {"list-style-position", 71}, - {"text-decoration", 124}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"empty-cells", 54}, - {"cue-before", 49}, - {"",}, - {"page-break-after", 97}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-spacing", 26}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-image", 6}, - {"word-spacing", 141}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"border-right-style", 24}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-transform", 131}, - {"",}, - {"speak-numeral", 118}, - {"",}, {"",}, - {"letter-spacing", 67}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-color", 127}, - {"",}, - {"border-bottom-style", 14}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"speak-header", 117}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"list-style-image", 70}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"counter-reset", 46}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak-punctuation", 119}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"quotes-close", 109}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-top-style", 30}, - {"text-shadow-y", 130}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style-type", 72}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-x", 129}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-radius", 128}, - {"",}, {"",}, - {"page-break-inside", 99}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"border-style", 27}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-before", 102}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"page-break-before", 98}, - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - case 3: - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSProps::NameTableEntry nsCSSProps::kNameTable[] = { - { "-moz-border-radius", 0 }, - { "azimuth", 1 }, - { "background", 2 }, - { "background-attachment", 3 }, - { "background-color", 4 }, - { "background-filter", 5 }, - { "background-image", 6 }, - { "background-position", 7 }, - { "background-repeat", 8 }, - { "background-x-position", 9 }, - { "background-y-position", 10 }, - { "border", 11 }, - { "border-bottom", 12 }, - { "border-bottom-color", 13 }, - { "border-bottom-style", 14 }, - { "border-bottom-width", 15 }, - { "border-collapse", 16 }, - { "border-color", 17 }, - { "border-left", 18 }, - { "border-left-color", 19 }, - { "border-left-style", 20 }, - { "border-left-width", 21 }, - { "border-right", 22 }, - { "border-right-color", 23 }, - { "border-right-style", 24 }, - { "border-right-width", 25 }, - { "border-spacing", 26 }, - { "border-style", 27 }, - { "border-top", 28 }, - { "border-top-color", 29 }, - { "border-top-style", 30 }, - { "border-top-width", 31 }, - { "border-width", 32 }, - { "border-x-spacing", 33 }, - { "border-y-spacing", 34 }, - { "bottom", 35 }, - { "caption-side", 36 }, - { "clear", 37 }, - { "clip", 38 }, - { "clip-bottom", 39 }, - { "clip-left", 40 }, - { "clip-right", 41 }, - { "clip-top", 42 }, - { "color", 43 }, - { "content", 44 }, - { "counter-increment", 45 }, - { "counter-reset", 46 }, - { "cue", 47 }, - { "cue-after", 48 }, - { "cue-before", 49 }, - { "cursor", 50 }, - { "direction", 51 }, - { "display", 52 }, - { "elevation", 53 }, - { "empty-cells", 54 }, - { "filter", 55 }, - { "float", 56 }, - { "font", 57 }, - { "font-family", 58 }, - { "font-size", 59 }, - { "font-size-adjust", 60 }, - { "font-stretch", 61 }, - { "font-style", 62 }, - { "font-variant", 63 }, - { "font-weight", 64 }, - { "height", 65 }, - { "left", 66 }, - { "letter-spacing", 67 }, - { "line-height", 68 }, - { "list-style", 69 }, - { "list-style-image", 70 }, - { "list-style-position", 71 }, - { "list-style-type", 72 }, - { "margin", 73 }, - { "margin-bottom", 74 }, - { "margin-left", 75 }, - { "margin-right", 76 }, - { "margin-top", 77 }, - { "marker-offset", 78 }, - { "marks", 79 }, - { "max-height", 80 }, - { "max-width", 81 }, - { "min-height", 82 }, - { "min-width", 83 }, - { "opacity", 84 }, - { "orphans", 85 }, - { "outline", 86 }, - { "outline-color", 87 }, - { "outline-style", 88 }, - { "outline-width", 89 }, - { "overflow", 90 }, - { "padding", 91 }, - { "padding-bottom", 92 }, - { "padding-left", 93 }, - { "padding-right", 94 }, - { "padding-top", 95 }, - { "page", 96 }, - { "page-break-after", 97 }, - { "page-break-before", 98 }, - { "page-break-inside", 99 }, - { "pause", 100 }, - { "pause-after", 101 }, - { "pause-before", 102 }, - { "pitch", 103 }, - { "pitch-range", 104 }, - { "play-during", 105 }, - { "play-during-flags", 106 }, - { "position", 107 }, - { "quotes", 108 }, - { "quotes-close", 109 }, - { "quotes-open", 110 }, - { "richness", 111 }, - { "right", 112 }, - { "size", 113 }, - { "size-height", 114 }, - { "size-width", 115 }, - { "speak", 116 }, - { "speak-header", 117 }, - { "speak-numeral", 118 }, - { "speak-punctuation", 119 }, - { "speech-rate", 120 }, - { "stress", 121 }, - { "table-layout", 122 }, - { "text-align", 123 }, - { "text-decoration", 124 }, - { "text-indent", 125 }, - { "text-shadow", 126 }, - { "text-shadow-color", 127 }, - { "text-shadow-radius", 128 }, - { "text-shadow-x", 129 }, - { "text-shadow-y", 130 }, - { "text-transform", 131 }, - { "top", 132 }, - { "unicode-bidi", 133 }, - { "vertical-align", 134 }, - { "visibility", 135 }, - { "voice-family", 136 }, - { "volume", 137 }, - { "white-space", 138 }, - { "widows", 139 }, - { "width", 140 }, - { "word-spacing", 141 }, - { "z-index", 142 }, +void +nsCSSProps::ReleaseTable(void) +{ + if (0 == --gTableRefCount) { + if (gPropertyArray) { + delete [] gPropertyArray; + gPropertyArray = nsnull; + } + if (gPropertyTree) { + delete gPropertyTree; + gPropertyTree = nsnull; + } + if (gComparitor) { + delete gComparitor; + gComparitor = nsnull; + } + } +} + + +nsCSSProperty +nsCSSProps::LookupProperty(const nsStr& 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; + } + } + 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 { + static const nsCString kNullStr; + return kNullStr; + } +} + + + +// Keyword id tables for variant/enum parsing +const PRInt32 nsCSSProps::kAutoSelectKTable[] = { + eCSSKeyword_select, NS_STYLE_AUTO_SELECT_SELECT, + -1,-1 }; + +const PRInt32 nsCSSProps::kAutoTabKTable[] = { + eCSSKeyword_activate_next, NS_STYLE_AUTO_TAB_ACTIVATE_NEXT, + eCSSKeyword_select_next, NS_STYLE_AUTO_TAB_SELECT_NEXT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kAzimuthKTable[] = { + eCSSKeyword_left_side, NS_STYLE_AZIMUTH_LEFT_SIDE, + eCSSKeyword_far_left, NS_STYLE_AZIMUTH_FAR_LEFT, + eCSSKeyword_left, NS_STYLE_AZIMUTH_LEFT, + eCSSKeyword_center_left, NS_STYLE_AZIMUTH_CENTER_LEFT, + eCSSKeyword_center, NS_STYLE_AZIMUTH_CENTER, + eCSSKeyword_center_right, NS_STYLE_AZIMUTH_CENTER_RIGHT, + eCSSKeyword_right, NS_STYLE_AZIMUTH_RIGHT, + eCSSKeyword_far_right, NS_STYLE_AZIMUTH_FAR_RIGHT, + eCSSKeyword_right_side, NS_STYLE_AZIMUTH_RIGHT_SIDE, + eCSSKeyword_behind, NS_STYLE_AZIMUTH_BEHIND, + eCSSKeyword_leftwards, NS_STYLE_AZIMUTH_LEFTWARDS, + eCSSKeyword_rightwards, NS_STYLE_AZIMUTH_RIGHTWARDS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = { + eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, + eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundRepeatKTable[] = { + eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_OFF, + eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_XY, + eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_X, + eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_Y, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderCollapseKTable[] = { + eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE, + eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderStyleKTable[] = { + eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN, + eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED, + eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED, + eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID, + eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE, + eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE, + eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE, + eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET, + eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET, + eCSSKeyword__moz_bg_inset, NS_STYLE_BORDER_STYLE_BG_INSET, + eCSSKeyword__moz_bg_outset, NS_STYLE_BORDER_STYLE_BG_OUTSET, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderWidthKTable[] = { + eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN, + eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM, + eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBoxSizingKTable[] = { + eCSSKeyword_content_box, NS_STYLE_BOX_SIZING_CONTENT, + eCSSKeyword_border_box, NS_STYLE_BOX_SIZING_BORDER, + eCSSKeyword_padding_box, NS_STYLE_BOX_SIZING_PADDING, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCaptionSideKTable[] = { + eCSSKeyword_top, NS_SIDE_TOP, + eCSSKeyword_right, NS_SIDE_RIGHT, + eCSSKeyword_bottom, NS_SIDE_BOTTOM, + eCSSKeyword_left, NS_SIDE_LEFT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kClearKTable[] = { + eCSSKeyword_left, NS_STYLE_CLEAR_LEFT, + eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT, + eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kContentKTable[] = { + eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, + eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, + eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, + eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCursorKTable[] = { + eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR, + eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT, + eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER, + eCSSKeyword_move, NS_STYLE_CURSOR_MOVE, + eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE, + eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE, + eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE, + eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE, + eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE, + eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE, + eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE, + eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE, + eCSSKeyword_text, NS_STYLE_CURSOR_TEXT, + eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT, + eCSSKeyword_help, NS_STYLE_CURSOR_HELP, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDirectionKTable[] = { + eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR, + eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDisplayKTable[] = { + eCSSKeyword_inline, NS_STYLE_DISPLAY_INLINE, + eCSSKeyword_block, NS_STYLE_DISPLAY_BLOCK, + eCSSKeyword_inline_block, NS_STYLE_DISPLAY_INLINE_BLOCK, + eCSSKeyword_list_item, NS_STYLE_DISPLAY_LIST_ITEM, + eCSSKeyword_run_in, NS_STYLE_DISPLAY_RUN_IN, + eCSSKeyword_compact, NS_STYLE_DISPLAY_COMPACT, + eCSSKeyword_marker, NS_STYLE_DISPLAY_MARKER, + eCSSKeyword_table, NS_STYLE_DISPLAY_TABLE, + eCSSKeyword_inline_table, NS_STYLE_DISPLAY_INLINE_TABLE, + eCSSKeyword_table_row_group, NS_STYLE_DISPLAY_TABLE_ROW_GROUP, + eCSSKeyword_table_header_group, NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, + eCSSKeyword_table_footer_group, NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, + eCSSKeyword_table_row, NS_STYLE_DISPLAY_TABLE_ROW, + eCSSKeyword_table_column_group, NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, + eCSSKeyword_table_column, NS_STYLE_DISPLAY_TABLE_COLUMN, + eCSSKeyword_table_cell, NS_STYLE_DISPLAY_TABLE_CELL, + eCSSKeyword_table_caption, NS_STYLE_DISPLAY_TABLE_CAPTION, + -1,-1 +}; + +const PRInt32 nsCSSProps::kElevationKTable[] = { + eCSSKeyword_below, NS_STYLE_ELEVATION_BELOW, + eCSSKeyword_level, NS_STYLE_ELEVATION_LEVEL, + eCSSKeyword_above, NS_STYLE_ELEVATION_ABOVE, + eCSSKeyword_higher, NS_STYLE_ELEVATION_HIGHER, + eCSSKeyword_lower, NS_STYLE_ELEVATION_LOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kEmptyCellsKTable[] = { + eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW, + eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatKTable[] = { + eCSSKeyword_left, NS_STYLE_FLOAT_LEFT, + eCSSKeyword_right, NS_STYLE_FLOAT_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatEdgeKTable[] = { + eCSSKeyword_content_box, NS_STYLE_FLOAT_EDGE_CONTENT, + eCSSKeyword_border_box, NS_STYLE_FLOAT_EDGE_BORDER, + eCSSKeyword_padding_box, NS_STYLE_FLOAT_EDGE_PADDING, + eCSSKeyword_margin_box, NS_STYLE_FLOAT_EDGE_MARGIN, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontKTable[] = { + eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, + eCSSKeyword_icon, NS_STYLE_FONT_ICON, + eCSSKeyword_menu, NS_STYLE_FONT_MENU, + eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX, + eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION, + eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontSizeKTable[] = { + eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL, + eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL, + eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL, + eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM, + eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE, + eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE, + eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE, + eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER, + eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStretchKTable[] = { + eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER, + eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER, + eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED, + eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED, + eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED, + eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED, + eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED, + eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED, + eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED, + eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStyleKTable[] = { + eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC, + eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontVariantKTable[] = { + eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontWeightKTable[] = { + eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD, + eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER, + eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kKeyEquivalentKTable[] = { + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStylePositionKTable[] = { + eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE, + eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStyleKTable[] = { + eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, + eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, + eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, + eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, + eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, + eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, + eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, + eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, + eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, + eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, + eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, + eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, + eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, + eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, + eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, + eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, + eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, + eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, + eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, + eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, + -1,-1 +}; + +const PRInt32 nsCSSProps::kModifyContentKTable[] = { + eCSSKeyword_read_only, NS_STYLE_MODIFY_CONTENT_READ_ONLY, + eCSSKeyword_read_write, NS_STYLE_MODIFY_CONTENT_READ_WRITE, + eCSSKeyword_write_only, NS_STYLE_MODIFY_CONTENT_WRITE_ONLY, + eCSSKeyword_toggle, NS_STYLE_MODIFY_CONTENT_TOGGLE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOutlineColorKTable[] = { + eCSSKeyword_invert, NS_STYLE_COLOR_INVERT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOverflowKTable[] = { + eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, + eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakKTable[] = { + eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT, + eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakInsideKTable[] = { + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageMarksKTable[] = { + eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP, + eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageSizeKTable[] = { + eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE, + eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPitchKTable[] = { + eCSSKeyword_x_low, NS_STYLE_PITCH_X_LOW, + eCSSKeyword_low, NS_STYLE_PITCH_LOW, + eCSSKeyword_medium, NS_STYLE_PITCH_MEDIUM, + eCSSKeyword_high, NS_STYLE_PITCH_HIGH, + eCSSKeyword_x_high, NS_STYLE_PITCH_X_HIGH, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPlayDuringKTable[] = { + eCSSKeyword_mix, NS_STYLE_PLAY_DURING_MIX, + eCSSKeyword_repeat, NS_STYLE_PLAY_DURING_REPEAT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPositionKTable[] = { + eCSSKeyword_static, NS_STYLE_POSITION_NORMAL, + eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE, + eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE, + eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kResizerKTable[] = { + eCSSKeyword_both, NS_STYLE_RESIZER_BOTH, + eCSSKeyword_horizontal, NS_STYLE_RESIZER_HORIZONTAL, + eCSSKeyword_vertical, NS_STYLE_RESIZER_VERTICAL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSelectionStyleKTable[] = { + eCSSKeyword_any, NS_STYLE_SELECTION_STYLE_ANY, + eCSSKeyword_line, NS_STYLE_SELECTION_STYLE_LINE, + eCSSKeyword_all, NS_STYLE_SELECTION_STYLE_ALL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakKTable[] = { + eCSSKeyword_spell_out, NS_STYLE_SPEAK_SPELL_OUT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakHeaderKTable[] = { + eCSSKeyword_once, NS_STYLE_SPEAK_HEADER_ONCE, + eCSSKeyword_always, NS_STYLE_SPEAK_HEADER_ALWAYS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakNumeralKTable[] = { + eCSSKeyword_digits, NS_STYLE_SPEAK_NUMERAL_DIGITS, + eCSSKeyword_continuous, NS_STYLE_SPEAK_NUMERAL_CONTINUOUS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakPunctuationKTable[] = { + eCSSKeyword_code, NS_STYLE_SPEAK_PUNCTUATION_CODE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeechRateKTable[] = { + eCSSKeyword_x_slow, NS_STYLE_SPEECH_RATE_X_SLOW, + eCSSKeyword_slow, NS_STYLE_SPEECH_RATE_SLOW, + eCSSKeyword_medium, NS_STYLE_SPEECH_RATE_MEDIUM, + eCSSKeyword_fast, NS_STYLE_SPEECH_RATE_FAST, + eCSSKeyword_x_fast, NS_STYLE_SPEECH_RATE_X_FAST, + eCSSKeyword_faster, NS_STYLE_SPEECH_RATE_FASTER, + eCSSKeyword_slower, NS_STYLE_SPEECH_RATE_SLOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTableLayoutKTable[] = { + eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextAlignKTable[] = { + eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT, + eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT, + eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER, + eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, + eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER, + eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextDecorationKTable[] = { + eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE, + eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE, + eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, + eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextTransformKTable[] = { + eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, + eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, + eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = { + eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED, + eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUserInputKTable[] = { + eCSSKeyword_enabled, NS_STYLE_USER_INPUT_ENABLED, + eCSSKeyword_disabled, NS_STYLE_USER_INPUT_DISABLED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVerticalAlignKTable[] = { + eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE, + eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB, + eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER, + eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP, + eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP, + eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE, + eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM, + eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVisibilityKTable[] = { + eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN, + eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVolumeKTable[] = { + eCSSKeyword_silent, NS_STYLE_VOLUME_SILENT, + eCSSKeyword_x_soft, NS_STYLE_VOLUME_X_SOFT, + eCSSKeyword_soft, NS_STYLE_VOLUME_SOFT, + eCSSKeyword_medium, NS_STYLE_VOLUME_MEDIUM, + eCSSKeyword_loud, NS_STYLE_VOLUME_LOUD, + eCSSKeyword_x_loud, NS_STYLE_VOLUME_X_LOUD, + -1,-1 +}; + +const PRInt32 nsCSSProps::kWhitespaceKTable[] = { + eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE, + eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP, + eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, + -1,-1 +}; + +static const nsCString& +SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) +{ + PRInt32 i = 1; + for (;;) { + if (aTable[i] < 0) { + break; + } + if (aValue == aTable[i]) { + return nsCSSKeywords::GetStringValue(nsCSSKeyword(aTable[i-1])); + } + i += 2; + } + static const nsCString kNullStr; + return kNullStr; +} + + + +const nsCString& +nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) +{ +static const PRInt32 kBackgroundXPositionKTable[] = { + eCSSKeyword_left, 0, + eCSSKeyword_center, 50, + eCSSKeyword_right, 100, + -1,-1 +}; + +static const PRInt32 kBackgroundYPositionKTable[] = { + eCSSKeyword_top, 0, + eCSSKeyword_center, 50, + eCSSKeyword_bottom, 100, + -1,-1 +}; + + switch (aProp) { + + case eCSSProperty_auto_select: + return SearchKeywordTable(aValue, kAutoSelectKTable); + + case eCSSProperty_auto_tab: + return SearchKeywordTable(aValue, kAutoTabKTable); + + case eCSSProperty_azimuth: + return SearchKeywordTable(aValue, kAzimuthKTable); + + case eCSSProperty_background: + break; + + case eCSSProperty_background_attachment: + return SearchKeywordTable(aValue, kBackgroundAttachmentKTable); + + case eCSSProperty_background_color: + return SearchKeywordTable(aValue, kBackgroundColorKTable); + + case eCSSProperty_background_image: + break; + + case eCSSProperty_background_position: + break; + + case eCSSProperty_background_repeat: + return SearchKeywordTable(aValue, kBackgroundRepeatKTable); + + case eCSSProperty_background_x_position: + return SearchKeywordTable(aValue, kBackgroundXPositionKTable); + + case eCSSProperty_background_y_position: + return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + + case eCSSProperty_border: + break; + + case eCSSProperty_border_collapse: + return SearchKeywordTable(aValue, kBorderCollapseKTable); + + case eCSSProperty_box_sizing: + return SearchKeywordTable(aValue, kBoxSizingKTable); + + case eCSSProperty_border_color: + case eCSSProperty_border_spacing: + case eCSSProperty_border_style: + case eCSSProperty_border_bottom: + case eCSSProperty_border_left: + case eCSSProperty_border_right: + case eCSSProperty_border_top: + break; + + case eCSSProperty_border_bottom_color: + case eCSSProperty_border_left_color: + case eCSSProperty_border_right_color: + case eCSSProperty_border_top_color: + return SearchKeywordTable(aValue, kBorderColorKTable); + + case eCSSProperty_border_bottom_style: + case eCSSProperty_border_left_style: + case eCSSProperty_border_right_style: + case eCSSProperty_border_top_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_border_bottom_width: + case eCSSProperty_border_left_width: + case eCSSProperty_border_right_width: + case eCSSProperty_border_top_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_border_width: + case eCSSProperty_border_x_spacing: + case eCSSProperty_border_y_spacing: + case eCSSProperty_bottom: + break; + + case eCSSProperty_caption_side: + return SearchKeywordTable(aValue, kCaptionSideKTable); + + case eCSSProperty_clear: + return SearchKeywordTable(aValue, kClearKTable); + + case eCSSProperty_clip: + case eCSSProperty_clip_bottom: + case eCSSProperty_clip_left: + case eCSSProperty_clip_right: + case eCSSProperty_clip_top: + case eCSSProperty_color: + break; + + case eCSSProperty_content: + return SearchKeywordTable(aValue, kContentKTable); + + case eCSSProperty_counter_increment: + case eCSSProperty_counter_reset: + case eCSSProperty_cue: + case eCSSProperty_cue_after: + case eCSSProperty_cue_before: + break; + + case eCSSProperty_cursor: + return SearchKeywordTable(aValue, kCursorKTable); + + case eCSSProperty_direction: + return SearchKeywordTable(aValue, kDirectionKTable); + + case eCSSProperty_display: + return SearchKeywordTable(aValue, kDisplayKTable); + + case eCSSProperty_elevation: + return SearchKeywordTable(aValue, kElevationKTable); + + case eCSSProperty_empty_cells: + return SearchKeywordTable(aValue, kEmptyCellsKTable); + + case eCSSProperty_float: + return SearchKeywordTable(aValue, kFloatKTable); + + case eCSSProperty_float_edge: + return SearchKeywordTable(aValue, kFloatEdgeKTable); + + case eCSSProperty_font: + break; + + case eCSSProperty_font_family: + return SearchKeywordTable(aValue, kFontKTable); + + case eCSSProperty_font_size: + return SearchKeywordTable(aValue, kFontSizeKTable); + + case eCSSProperty_font_size_adjust: + break; + + case eCSSProperty_font_stretch: + return SearchKeywordTable(aValue, kFontStretchKTable); + + case eCSSProperty_font_style: + return SearchKeywordTable(aValue, kFontStyleKTable); + + case eCSSProperty_font_variant: + return SearchKeywordTable(aValue, kFontVariantKTable); + + case eCSSProperty_font_weight: + return SearchKeywordTable(aValue, kFontWeightKTable); + + case eCSSProperty_height: + break; + + case eCSSProperty_key_equivalent: + return SearchKeywordTable(aValue, kKeyEquivalentKTable); + + case eCSSProperty_left: + case eCSSProperty_letter_spacing: + case eCSSProperty_line_height: + case eCSSProperty_list_style: + case eCSSProperty_list_style_image: + break; + + case eCSSProperty_list_style_position: + return SearchKeywordTable(aValue, kListStylePositionKTable); + + case eCSSProperty_list_style_type: + return SearchKeywordTable(aValue, kListStyleKTable); + + case eCSSProperty_margin: + case eCSSProperty_margin_bottom: + case eCSSProperty_margin_left: + case eCSSProperty_margin_right: + case eCSSProperty_margin_top: + case eCSSProperty_marker_offset: + break; + + case eCSSProperty_marks: + return SearchKeywordTable(aValue, kPageMarksKTable); + + case eCSSProperty_max_height: + case eCSSProperty_max_width: + case eCSSProperty_min_height: + case eCSSProperty_min_width: + break; + + case eCSSProperty_modify_content: + return SearchKeywordTable(aValue, kModifyContentKTable); + + case eCSSProperty_opacity: + case eCSSProperty_orphans: + case eCSSProperty_outline: + break; + + case eCSSProperty_outline_color: + return SearchKeywordTable(aValue, kOutlineColorKTable); + + case eCSSProperty_outline_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_outline_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_overflow: + return SearchKeywordTable(aValue, kOverflowKTable); + + case eCSSProperty_padding: + case eCSSProperty_padding_bottom: + case eCSSProperty_padding_left: + case eCSSProperty_padding_right: + case eCSSProperty_padding_top: + case eCSSProperty_page: + break; + + case eCSSProperty_page_break_before: + case eCSSProperty_page_break_after: + return SearchKeywordTable(aValue, kPageBreakKTable); + + case eCSSProperty_page_break_inside: + return SearchKeywordTable(aValue, kPageBreakInsideKTable); + + case eCSSProperty_pause: + case eCSSProperty_pause_after: + case eCSSProperty_pause_before: + break; + + case eCSSProperty_pitch: + return SearchKeywordTable(aValue, kPitchKTable); + + case eCSSProperty_pitch_range: + case eCSSProperty_play_during: + break; + + case eCSSProperty_play_during_flags: + return SearchKeywordTable(aValue, kPlayDuringKTable); + + case eCSSProperty_position: + return SearchKeywordTable(aValue, kPositionKTable); + + case eCSSProperty_quotes: + case eCSSProperty_quotes_close: + case eCSSProperty_quotes_open: + break; + + case eCSSProperty_resizer: + return SearchKeywordTable(aValue, kResizerKTable); + + case eCSSProperty_richness: + case eCSSProperty_right: + break; + + case eCSSProperty_selection_style: + return SearchKeywordTable(aValue, kSelectionStyleKTable); + + case eCSSProperty_size: + break; + + case eCSSProperty_size_height: + case eCSSProperty_size_width: + return SearchKeywordTable(aValue, kPageSizeKTable); + + case eCSSProperty_speak: + return SearchKeywordTable(aValue, kSpeakKTable); + + case eCSSProperty_speak_header: + return SearchKeywordTable(aValue, kSpeakHeaderKTable); + + case eCSSProperty_speak_numeral: + return SearchKeywordTable(aValue, kSpeakNumeralKTable); + + case eCSSProperty_speak_punctuation: + return SearchKeywordTable(aValue, kSpeakPunctuationKTable); + + case eCSSProperty_speech_rate: + return SearchKeywordTable(aValue, kSpeechRateKTable); + + case eCSSProperty_stress: + break; + + case eCSSProperty_table_layout: + return SearchKeywordTable(aValue, kTableLayoutKTable); + + case eCSSProperty_text_align: + return SearchKeywordTable(aValue, kTextAlignKTable); + + case eCSSProperty_text_decoration: + return SearchKeywordTable(aValue, kTextDecorationKTable); + + case eCSSProperty_text_indent: + case eCSSProperty_text_shadow: + case eCSSProperty_text_shadow_color: + case eCSSProperty_text_shadow_radius: + case eCSSProperty_text_shadow_x: + case eCSSProperty_text_shadow_y: + break; + + case eCSSProperty_text_transform: + return SearchKeywordTable(aValue, kTextTransformKTable); + + case eCSSProperty_top: + break; + + case eCSSProperty_unicode_bidi: + return SearchKeywordTable(aValue, kUnicodeBidiKTable); + + case eCSSProperty_user_input: + return SearchKeywordTable(aValue, kUserInputKTable); + + case eCSSProperty_vertical_align: + return SearchKeywordTable(aValue, kVerticalAlignKTable); + + case eCSSProperty_visibility: + return SearchKeywordTable(aValue, kVisibilityKTable); + + case eCSSProperty_voice_family: + break; + + case eCSSProperty_volume: + return SearchKeywordTable(aValue, kVolumeKTable); + + case eCSSProperty_white_space: + return SearchKeywordTable(aValue, kWhitespaceKTable); + + case eCSSProperty_widows: + case eCSSProperty_width: + case eCSSProperty_word_spacing: + case eCSSProperty_z_index: + break; + +// no default case, let the compiler help find missing values + case eCSSProperty_UNKNOWN: + case eCSSProperty_COUNT: + NS_ERROR("invalid property"); + break; + } + static const nsCString kNullStr; + return kNullStr; +} + + +// define array of all CSS property hints +#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { +#include "nsCSSPropList.h" +}; +#undef CSS_PROP + diff --git a/mozilla/layout/html/style/src/nsCSSProps.h b/mozilla/layout/html/style/src/nsCSSProps.h index 92f3de0b8e8..d30dae464c9 100644 --- a/mozilla/layout/html/style/src/nsCSSProps.h +++ b/mozilla/layout/html/style/src/nsCSSProps.h @@ -19,33 +19,48 @@ #define nsCSSProps_h___ #include "nslayout.h" -#include "nsCSSPropIDs.h" + +struct nsStr; +class nsCString; + +/* + Declare the enum list using the magic of preprocessing + enum values are "eCSSProperty_foo" (where foo is the property) + + To change the list of properties, see nsCSSPropList.h + + */ +#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +enum nsCSSProperty { + eCSSProperty_UNKNOWN = -1, +#include "nsCSSPropList.h" + eCSSProperty_COUNT +}; +#undef CSS_PROP + class NS_LAYOUT nsCSSProps { public: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsCSSPropIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - - // Given a CSS Property ID and an Property Value Index - // Return back a const char* representation of the - // value. Return back nsnull if no value is found - static const char* LookupProperty(PRInt32 aProp, PRInt32 aIndex); + // Given a property string, return the enum value + static nsCSSProperty LookupProperty(const nsStr& aProperty); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a property enum, get the string value + static const nsCString& GetStringValue(nsCSSProperty aProperty); - // A table whose index is the tag id (from nsCSSPropIDs) - static const NameTableEntry kNameTable[]; + // Given a CSS Property and a Property Enum Value + // Return back a const nsString& representation of the + // value. Return back nullstr if no value is found + static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const PRInt32 kHintTable[]; // Keyword/Enum value tables static const PRInt32 kAzimuthKTable[]; + static const PRInt32 kAutoSelectKTable[]; + static const PRInt32 kAutoTabKTable[]; static const PRInt32 kBackgroundAttachmentKTable[]; static const PRInt32 kBackgroundColorKTable[]; static const PRInt32 kBackgroundRepeatKTable[]; @@ -53,6 +68,7 @@ public: static const PRInt32 kBorderColorKTable[]; static const PRInt32 kBorderStyleKTable[]; static const PRInt32 kBorderWidthKTable[]; + static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; static const PRInt32 kClearKTable[]; static const PRInt32 kContentKTable[]; @@ -62,14 +78,17 @@ public: static const PRInt32 kElevationKTable[]; static const PRInt32 kEmptyCellsKTable[]; static const PRInt32 kFloatKTable[]; + static const PRInt32 kFloatEdgeKTable[]; static const PRInt32 kFontKTable[]; static const PRInt32 kFontSizeKTable[]; static const PRInt32 kFontStretchKTable[]; static const PRInt32 kFontStyleKTable[]; static const PRInt32 kFontVariantKTable[]; static const PRInt32 kFontWeightKTable[]; + static const PRInt32 kKeyEquivalentKTable[]; static const PRInt32 kListStylePositionKTable[]; static const PRInt32 kListStyleKTable[]; + static const PRInt32 kModifyContentKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; static const PRInt32 kPageBreakKTable[]; @@ -79,6 +98,8 @@ public: static const PRInt32 kPitchKTable[]; static const PRInt32 kPlayDuringKTable[]; static const PRInt32 kPositionKTable[]; + static const PRInt32 kResizerKTable[]; + static const PRInt32 kSelectionStyleKTable[]; static const PRInt32 kSpeakKTable[]; static const PRInt32 kSpeakHeaderKTable[]; static const PRInt32 kSpeakNumeralKTable[]; @@ -89,6 +110,7 @@ public: static const PRInt32 kTextDecorationKTable[]; static const PRInt32 kTextTransformKTable[]; static const PRInt32 kUnicodeBidiKTable[]; + static const PRInt32 kUserInputKTable[]; static const PRInt32 kVerticalAlignKTable[]; static const PRInt32 kVisibilityKTable[]; static const PRInt32 kVolumeKTable[]; diff --git a/mozilla/layout/style/nsCSSKeywordList.h b/mozilla/layout/style/nsCSSKeywordList.h new file mode 100644 index 00000000000..117d0b78c51 --- /dev/null +++ b/mozilla/layout/style/nsCSSKeywordList.h @@ -0,0 +1,265 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS keywords + See nsCSSKeywords.h for access to the enum values for keywords + + It is designed to be used as inline input to nsCSSKeywords.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_KEY which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in keywords are automagically converted into hyphens + + ******/ + + +CSS_KEY(_moz_bg_inset) +CSS_KEY(_moz_bg_outset) +CSS_KEY(_moz_pre_wrap) +CSS_KEY(_moz_center) +CSS_KEY(_moz_right) +CSS_KEY(above) +CSS_KEY(absolute) +CSS_KEY(activate_next) +CSS_KEY(all) +CSS_KEY(always) +CSS_KEY(any) +CSS_KEY(armenian) +CSS_KEY(auto) +CSS_KEY(avoid) +CSS_KEY(baseline) +CSS_KEY(behind) +CSS_KEY(below) +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(capitalize) +CSS_KEY(caption) +CSS_KEY(center) +CSS_KEY(center_left) +CSS_KEY(center_right) +CSS_KEY(ch) +CSS_KEY(circle) +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(continuous) +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(digits) +CSS_KEY(disabled) +CSS_KEY(disc) +CSS_KEY(dotted) +CSS_KEY(double) +CSS_KEY(e_resize) +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(fixed) +CSS_KEY(georgian) +CSS_KEY(grad) +CSS_KEY(groove) +CSS_KEY(hebrew) +CSS_KEY(help) +CSS_KEY(hidden) +CSS_KEY(hide) +CSS_KEY(high) +CSS_KEY(higher) +CSS_KEY(hiragana) +CSS_KEY(hiragana_iroha) +CSS_KEY(horizontal) +CSS_KEY(hz) +CSS_KEY(icon) +CSS_KEY(in) +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(justify) +CSS_KEY(katakana) +CSS_KEY(katakana_iroha) +CSS_KEY(khz) +CSS_KEY(landscape) +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) +CSS_KEY(line_through) +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(margin_box) +CSS_KEY(marker) +CSS_KEY(medium) +CSS_KEY(menu) +CSS_KEY(message_box) +CSS_KEY(middle) +CSS_KEY(mix) +CSS_KEY(mm) +CSS_KEY(move) +CSS_KEY(ms) +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(outset) +CSS_KEY(outside) +CSS_KEY(overline) +CSS_KEY(padding_box) +CSS_KEY(paragraph) +CSS_KEY(pc) +CSS_KEY(pointer) +CSS_KEY(portrait) +CSS_KEY(pre) +CSS_KEY(pt) +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(se_resize) +CSS_KEY(select) +CSS_KEY(select_next) +CSS_KEY(semi_condensed) +CSS_KEY(semi_expanded) +CSS_KEY(separate) +CSS_KEY(show) +CSS_KEY(silent) +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(square) +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(text) +CSS_KEY(text_bottom) +CSS_KEY(text_top) +CSS_KEY(thick) +CSS_KEY(thin) +CSS_KEY(toggle) +CSS_KEY(top) +CSS_KEY(transparent) +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(vertical) +CSS_KEY(visible) +CSS_KEY(w_resize) +CSS_KEY(wait) +CSS_KEY(wider) +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) diff --git a/mozilla/layout/style/nsCSSKeywords.cpp b/mozilla/layout/style/nsCSSKeywords.cpp index f896cda51e9..4d934f8d225 100644 --- a/mozilla/layout/style/nsCSSKeywords.cpp +++ b/mozilla/layout/style/nsCSSKeywords.cpp @@ -1,934 +1,140 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSKeywords.h" -#define TOTAL_KEYWORDS 208 -#define MIN_WORD_LENGTH 1 -#define MAX_WORD_LENGTH 20 -#define MIN_HASH_VALUE 27 -#define MAX_HASH_VALUE 1665 -/* maximum key range = 1639, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSKeywords::LookupName(const char* str) + +#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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static KeywordNode* gKeywordArray; +static nsAVLTree* gKeywordTree; +static KeywordComparitor* gComparitor; + +void +nsCSSKeywords::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 217, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, 1666, - 1666, 1666, 1666, 1666, 1666, 1666, 1666, 211, 243, 50, - 211, 226, 194, 85, 108, 123, 138, 168, 168, 139, - 36, 30, 233, 99, 156, 13, 193, 206, 155, 182, - 10, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18 - }; - static struct StaticNameTable wordlist[] = - { - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"s", 147}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ms", 111}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"in", 72}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"ex", 50}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"px", 135}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"cross", 36}, - {"hz", 70}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"icon", 71}, - {""}, {""}, {""}, {""}, {""}, - {"mix", 108}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"cm", 29}, - {""}, {""}, {""}, {""}, - {"pc", 130}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"continuous", 34}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"mm", 109}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"khz", 83}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"disc", 44}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"thin", 184}, - {""}, {""}, {""}, {""}, {""}, - {"em", 48}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"show", 154}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"high", 66}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"solid", 163}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"none", 118}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"low", 95}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"once", 124}, - {""}, - {"digits", 43}, - {""}, {""}, {""}, {""}, - {"slow", 156}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"scroll", 149}, - {""}, {""}, {""}, {""}, - {"inset", 76}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"deg", 42}, - {""}, - {"x-low", 202}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"pt", 134}, - {""}, {""}, {""}, {""}, {""}, - {"soft", 162}, - {""}, {""}, {""}, - {"noshade", 120}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"crosshair", 37}, - {""}, - {"thick", 183}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"x-soft", 205}, - {""}, - {"block", 16}, - {""}, {""}, {""}, {""}, {""}, - {"right", 142}, - {""}, {""}, {""}, - {"auto", 9}, - {""}, - {"ltr", 102}, - {""}, {""}, {""}, - {"x-high", 199}, - {""}, {""}, {""}, {""}, {""}, - {"both", 19}, - {""}, - {"rtl", 145}, - {""}, {""}, {""}, - {"top", 185}, - {"run-in", 146}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"georgian", 59}, - {""}, - {"compact", 32}, - {"normal", 119}, - {"small", 158}, - {""}, - {"crop", 35}, - {""}, - {"sub", 168}, - {""}, {""}, - {"slower", 157}, - {""}, {""}, - {"message-box", 106}, - {""}, - {"static", 166}, - {""}, - {"-moz-center", 3}, - {""}, {""}, {""}, - {"x-small", 204}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hidden", 64}, - {""}, {""}, {""}, - {"avoid", 10}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"higher", 67}, - {"blink", 15}, - {""}, {""}, {""}, - {"code", 30}, - {""}, {""}, {""}, {""}, {""}, - {"inside", 77}, - {""}, {""}, {""}, {""}, {""}, - {"groove", 61}, - {"caption", 22}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"lower", 96}, - {""}, - {"fixed", 58}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"x-slow", 203}, - {""}, - {"move", 110}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"rad", 136}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"italic", 79}, - {""}, {""}, - {"always", 7}, - {"xx-small", 207}, - {"ridge", 141}, - {""}, - {"fast", 56}, - {"condensed", 33}, - {""}, - {"pointer", 131}, - {""}, {""}, {""}, - {"visible", 194}, - {"inherit", 73}, - {"menu", 105}, - {""}, - {"text", 180}, - {""}, {""}, {""}, - {"center", 23}, - {""}, - {"semi-condensed", 151}, - {""}, {""}, {""}, {""}, - {"loud", 94}, - {""}, {""}, - {"rightwards", 144}, - {"outset", 126}, - {""}, {""}, - {"circle", 26}, - {""}, - {"super", 169}, - {""}, {""}, {""}, {""}, - {"pre", 133}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"large", 85}, - {""}, - {"x-loud", 201}, - {"below", 13}, - {""}, {""}, {""}, {""}, - {"no-close-quote", 115}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bold", 17}, - {""}, {""}, - {"above", 5}, - {""}, {""}, - {"lighter", 91}, - {""}, {""}, - {"nowrap", 121}, - {""}, - {"grad", 60}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"outside", 127}, - {""}, {""}, {""}, - {"open-quote", 125}, - {""}, {""}, {""}, {""}, - {"sw-resize", 170}, - {""}, {""}, - {"hide", 65}, - {""}, - {"lower-roman", 100}, - {""}, {""}, - {"wider", 197}, - {"lowercase", 101}, - {""}, - {"wait", 196}, - {""}, - {"inline", 74}, - {"-moz-right", 4}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"nw-resize", 122}, - {""}, - {"smaller", 161}, - {"close-quote", 28}, - {"silent", 155}, - {""}, - {"x-large", 200}, - {""}, {""}, {""}, {""}, - {"faster", 57}, - {""}, {""}, - {"invert", 78}, - {""}, {""}, - {"armenian", 8}, - {""}, {""}, - {"larger", 86}, - {"se-resize", 150}, - {""}, {""}, {""}, - {"bottom", 20}, - {""}, {""}, {""}, {""}, - {"level", 90}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"ne-resize", 114}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bolder", 18}, - {"dashed", 38}, - {"help", 63}, - {""}, {""}, {""}, {""}, {""}, - {"left", 87}, - {""}, {""}, {""}, - {"small-caps", 159}, - {"medium", 104}, - {""}, {""}, {""}, - {"square", 165}, - {""}, {""}, - {"justify", 80}, - {""}, - {"marker", 103}, - {""}, - {"list-item", 93}, - {""}, - {"decimal", 39}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"oblique", 123}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"xx-large", 206}, - {""}, {""}, - {"x-fast", 198}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"status-bar", 167}, - {"center-left", 24}, - {""}, {""}, {""}, {""}, - {"small-caption", 160}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table", 171}, - {""}, - {"right-side", 143}, - {""}, - {"embed", 49}, - {""}, {""}, {""}, {""}, - {"dotted", 45}, - {""}, {""}, {""}, {""}, {""}, - {"narrower", 113}, - {"repeat-x", 139}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-latin", 99}, - {""}, {""}, {""}, - {"no-repeat", 117}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-condensed", 52}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hebrew", 62}, - {""}, {""}, {""}, {""}, {""}, - {"collapse", 31}, - {""}, {""}, - {"cjk-ideographic", 27}, - {""}, {""}, {""}, {""}, {""}, - {"underline", 189}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"behind", 12}, - {""}, - {"line-through", 92}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"middle", 107}, - {""}, - {"landscape", 84}, - {"-moz-bg-outset", 1}, - {"table-column", 174}, - {""}, - {"double", 46}, - {""}, - {"overline", 128}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"lower-greek", 98}, - {""}, {""}, {""}, {""}, - {"absolute", 6}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"capitalize", 21}, - {"no-open-quote", 116}, - {"transparent", 186}, - {""}, {""}, - {"upper-roman", 192}, - {""}, {""}, - {"s-resize", 148}, - {"uppercase", 193}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"text-bottom", 181}, - {""}, - {"default", 41}, - {"far-right", 55}, - {""}, - {"lower-alpha", 97}, - {""}, - {"center-right", 25}, - {""}, - {"portrait", 132}, - {"n-resize", 112}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"leftwards", 89}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"ultra-condensed", 187}, - {"repeat", 138}, - {""}, {""}, {""}, {""}, {""}, - {"hiragana", 68}, - {"left-side", 88}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"extra-expanded", 53}, - {""}, {""}, {""}, {""}, - {"table-row", 178}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"spell-out", 164}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"hiragana-iroha", 69}, - {"baseline", 11}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, - {"text-top", 182}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"decimal-leading-zero", 40}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"paragraph", 129}, - {""}, {""}, {""}, - {"expanded", 51}, - {"table-caption", 172}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"inline-table", 75}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"relative", 137}, - {""}, {""}, {""}, {""}, - {"table-column-group", 175}, - {""}, {""}, {""}, {""}, - {"separate", 153}, - {""}, {""}, - {"-moz-bg-inset", 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"w-resize", 195}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-latin", 191}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"-moz-pre-wrap", 2}, - {""}, {""}, {""}, {""}, - {"ultra-expanded", 188}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"far-left", 54}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"bidi-override", 14}, - {""}, - {"e-resize", 47}, - {""}, - {"semi-expanded", 152}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"katakana", 81}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"table-cell", 173}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"katakana-iroha", 82}, - {""}, {""}, {""}, {""}, {""}, - {"table-row-group", 179}, - {""}, {""}, - {"table-footer-group", 176}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"upper-alpha", 190}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"repeat-y", 140}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"table-header-group", 177} - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - hval += asso_values[MYLOWER(str[3])]; - case 3: - hval += asso_values[MYLOWER(str[2])]; - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSKeywords::NameTableEntry nsCSSKeywords::kNameTable[] = { - { "-moz-bg-inset", 0 }, - { "-moz-bg-outset", 1 }, - { "-moz-pre-wrap", 2 }, - { "-moz-center", 3 }, - { "-moz-right", 4 }, - { "above", 5 }, - { "absolute", 6 }, - { "always", 7 }, - { "armenian", 8 }, - { "auto", 9 }, - { "avoid", 10 }, - { "baseline", 11 }, - { "behind", 12 }, - { "below", 13 }, - { "bidi-override", 14 }, - { "blink", 15 }, - { "block", 16 }, - { "bold", 17 }, - { "bolder", 18 }, - { "both", 19 }, - { "bottom", 20 }, - { "capitalize", 21 }, - { "caption", 22 }, - { "center", 23 }, - { "center-left", 24 }, - { "center-right", 25 }, - { "circle", 26 }, - { "cjk-ideographic", 27 }, - { "close-quote", 28 }, - { "cm", 29 }, - { "code", 30 }, - { "collapse", 31 }, - { "compact", 32 }, - { "condensed", 33 }, - { "continuous", 34 }, - { "crop", 35 }, - { "cross", 36 }, - { "crosshair", 37 }, - { "dashed", 38 }, - { "decimal", 39 }, - { "decimal-leading-zero", 40 }, - { "default", 41 }, - { "deg", 42 }, - { "digits", 43 }, - { "disc", 44 }, - { "dotted", 45 }, - { "double", 46 }, - { "e-resize", 47 }, - { "em", 48 }, - { "embed", 49 }, - { "ex", 50 }, - { "expanded", 51 }, - { "extra-condensed", 52 }, - { "extra-expanded", 53 }, - { "far-left", 54 }, - { "far-right", 55 }, - { "fast", 56 }, - { "faster", 57 }, - { "fixed", 58 }, - { "georgian", 59 }, - { "grad", 60 }, - { "groove", 61 }, - { "hebrew", 62 }, - { "help", 63 }, - { "hidden", 64 }, - { "hide", 65 }, - { "high", 66 }, - { "higher", 67 }, - { "hiragana", 68 }, - { "hiragana-iroha", 69 }, - { "hz", 70 }, - { "icon", 71 }, - { "in", 72 }, - { "inherit", 73 }, - { "inline", 74 }, - { "inline-table", 75 }, - { "inset", 76 }, - { "inside", 77 }, - { "invert", 78 }, - { "italic", 79 }, - { "justify", 80 }, - { "katakana", 81 }, - { "katakana-iroha", 82 }, - { "khz", 83 }, - { "landscape", 84 }, - { "large", 85 }, - { "larger", 86 }, - { "left", 87 }, - { "left-side", 88 }, - { "leftwards", 89 }, - { "level", 90 }, - { "lighter", 91 }, - { "line-through", 92 }, - { "list-item", 93 }, - { "loud", 94 }, - { "low", 95 }, - { "lower", 96 }, - { "lower-alpha", 97 }, - { "lower-greek", 98 }, - { "lower-latin", 99 }, - { "lower-roman", 100 }, - { "lowercase", 101 }, - { "ltr", 102 }, - { "marker", 103 }, - { "medium", 104 }, - { "menu", 105 }, - { "message-box", 106 }, - { "middle", 107 }, - { "mix", 108 }, - { "mm", 109 }, - { "move", 110 }, - { "ms", 111 }, - { "n-resize", 112 }, - { "narrower", 113 }, - { "ne-resize", 114 }, - { "no-close-quote", 115 }, - { "no-open-quote", 116 }, - { "no-repeat", 117 }, - { "none", 118 }, - { "normal", 119 }, - { "noshade", 120 }, - { "nowrap", 121 }, - { "nw-resize", 122 }, - { "oblique", 123 }, - { "once", 124 }, - { "open-quote", 125 }, - { "outset", 126 }, - { "outside", 127 }, - { "overline", 128 }, - { "paragraph", 129 }, - { "pc", 130 }, - { "pointer", 131 }, - { "portrait", 132 }, - { "pre", 133 }, - { "pt", 134 }, - { "px", 135 }, - { "rad", 136 }, - { "relative", 137 }, - { "repeat", 138 }, - { "repeat-x", 139 }, - { "repeat-y", 140 }, - { "ridge", 141 }, - { "right", 142 }, - { "right-side", 143 }, - { "rightwards", 144 }, - { "rtl", 145 }, - { "run-in", 146 }, - { "s", 147 }, - { "s-resize", 148 }, - { "scroll", 149 }, - { "se-resize", 150 }, - { "semi-condensed", 151 }, - { "semi-expanded", 152 }, - { "separate", 153 }, - { "show", 154 }, - { "silent", 155 }, - { "slow", 156 }, - { "slower", 157 }, - { "small", 158 }, - { "small-caps", 159 }, - { "small-caption", 160 }, - { "smaller", 161 }, - { "soft", 162 }, - { "solid", 163 }, - { "spell-out", 164 }, - { "square", 165 }, - { "static", 166 }, - { "status-bar", 167 }, - { "sub", 168 }, - { "super", 169 }, - { "sw-resize", 170 }, - { "table", 171 }, - { "table-caption", 172 }, - { "table-cell", 173 }, - { "table-column", 174 }, - { "table-column-group", 175 }, - { "table-footer-group", 176 }, - { "table-header-group", 177 }, - { "table-row", 178 }, - { "table-row-group", 179 }, - { "text", 180 }, - { "text-bottom", 181 }, - { "text-top", 182 }, - { "thick", 183 }, - { "thin", 184 }, - { "top", 185 }, - { "transparent", 186 }, - { "ultra-condensed", 187 }, - { "ultra-expanded", 188 }, - { "underline", 189 }, - { "upper-alpha", 190 }, - { "upper-latin", 191 }, - { "upper-roman", 192 }, - { "uppercase", 193 }, - { "visible", 194 }, - { "w-resize", 195 }, - { "wait", 196 }, - { "wider", 197 }, - { "x-fast", 198 }, - { "x-high", 199 }, - { "x-large", 200 }, - { "x-loud", 201 }, - { "x-low", 202 }, - { "x-slow", 203 }, - { "x-small", 204 }, - { "x-soft", 205 }, - { "xx-large", 206 }, - { "xx-small", 207 }, -}; +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; + } + } +} + + +nsCSSKeyword +nsCSSKeywords::LookupKeyword(const nsStr& 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; +} + + +const nsCString& +nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) +{ + nsString* value = nsnull; + + NS_ASSERTION(gKeywordArray, "no lookup table, needs addref"); + if ((eCSSKeyword_UNKNOWN < aKeyword) && + (aKeyword < eCSSKeyword_COUNT) && gKeywordArray) { + return gKeywordArray[aKeyword].mStr; + } + else { + static const nsCString kNullStr; + return kNullStr; + } +} + diff --git a/mozilla/layout/style/nsCSSKeywords.h b/mozilla/layout/style/nsCSSKeywords.h index 1db3cbe5ee3..f254c0ca372 100644 --- a/mozilla/layout/style/nsCSSKeywords.h +++ b/mozilla/layout/style/nsCSSKeywords.h @@ -19,22 +19,36 @@ #define nsCSSKeywords_h___ #include "nslayout.h" -#include "nsCSSKeywordIDs.h" + +struct nsStr; +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: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsHTMLTagIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a keyword string, return the enum value + static nsCSSKeyword LookupKeyword(const nsStr& aKeyword); - // A table whose index is the tag id (from LookupName) - static const NameTableEntry kNameTable[]; + // Given a keyword enum, get the string value + static const nsCString& GetStringValue(nsCSSKeyword aKeyword); }; #endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/layout/style/nsCSSPropList.h b/mozilla/layout/style/nsCSSPropList.h new file mode 100644 index 00000000000..86661b29c00 --- /dev/null +++ b/mozilla/layout/style/nsCSSPropList.h @@ -0,0 +1,191 @@ +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/****** + + This file contains the list of all parsed CSS properties + See nsCSSProps.h for access to the enum values for properties + + It is designed to be used as inline input to nsCSSProps.cpp *only* + through the magic of C preprocessing. + + All entires must be enclosed in the macro CSS_PROP which will have cruel + and unusual things done to it + + It is recommended (but not strictly necessary) to keep all entries + in alphabetical order + + Underbars in properties are automagically converted into hyphens + + 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 + ******/ + + +CSS_PROP(_moz_border_radius, VISUAL) +CSS_PROP(azimuth, AURAL) +CSS_PROP(auto_select, CONTENT) +CSS_PROP(auto_tab, CONTENT) +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(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(modify_content, FRAMECHANGE) +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(selection_style, CONTENT) +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_input, FRAMECHANGE) // XXX ??? +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) + diff --git a/mozilla/layout/style/nsCSSProps.cpp b/mozilla/layout/style/nsCSSProps.cpp index 8d9f87576dc..c7285f9f811 100644 --- a/mozilla/layout/style/nsCSSProps.cpp +++ b/mozilla/layout/style/nsCSSProps.cpp @@ -1,680 +1,989 @@ - -/* -** This is a generated file, do not edit it. This file is created by -** genhash.pl -*/ - -#include "plstr.h" -#include "nsCSSProps.h" -#define TOTAL_KEYWORDS 143 -#define MIN_WORD_LENGTH 3 -#define MAX_WORD_LENGTH 21 -#define MIN_HASH_VALUE 260 -#define MAX_HASH_VALUE 1186 -/* maximum key range = 927, duplicates = 0 */ - - -struct StaticNameTable { - char* tag; - PRInt32 id; -}; - -static const unsigned char kLowerLookup[256] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, - 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, - 64, - 97,98,99,100,101,102,103,104,105,106,107,108,109, - 110,111,112,113,114,115,116,117,118,119,120,121,122, - - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, - 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, - - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 -}; - -#define MYLOWER(x) kLowerLookup[((x) & 0x7f)] - -/** - * Map a name to an ID or -1 +/* -*- 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.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. */ -PRInt32 nsCSSProps::LookupName(const char* str) + +#include "nsCSSProps.h" +#include "nsCSSKeywords.h" +#include "nsStyleConsts.h" + +#include "nsString.h" +#include "nsAVLTree.h" + + +// define an array of all CSS properties +#define CSS_PROP(_prop, _hint) #_prop, +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.Compare(two->mStr, PR_TRUE); + } +}; + + +static PRInt32 gTableRefCount; +static PropertyNode* gPropertyArray; +static nsAVLTree* gPropertyTree; +static PropertyComparitor* gComparitor; + +void +nsCSSProps::AddRefTable(void) { - static unsigned short asso_values[] = - { - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 115, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, - 1187, 1187, 1187, 1187, 1187, 1187, 1187, 84, 184, 76, - 120, 248, 1, 192, 45, 108, 1187, 52, 98, 78, - 46, 127, 221, 59, 85, 219, 204, 211, 54, 111, - 216, 201, 122, 1187, 1187, 1187, 1187, 1187, - }; - static unsigned char lengthtable[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, - 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 16, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, - 0, 18, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - }; - static struct StaticNameTable wordlist[] = - { - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"margin", 73}, - {"",}, {"",}, {"",}, - {"clear", 37}, - {"",}, {"",}, {"",}, {"",}, - {"width", 140}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"filter", 55}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"color", 43}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"float", 56}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - - {"font", 57}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch", 103}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marks", 79}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"clip", 38}, - {"",}, {"",}, - {"right", 112}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-family", 58}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"content", 44}, - {"",}, - {"azimuth", 1}, - {"cursor", 50}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"bottom", 35}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"orphans", 85}, - {"",}, - {"clip-left", 40}, - {"border", 11}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak", 116}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"overflow", 90}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-after", 101}, - {"",}, {"",}, - {"display", 52}, - {"margin-left", 75}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"max-width", 81}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-stretch", 61}, - {"",}, {"",}, {"",}, - {"cue", 47}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"padding", 91}, - {"",}, - {"min-width", 83}, - {"",}, - {"left", 66}, - {"top", 132}, - {"position", 107}, - {"page", 96}, - {"pause", 100}, - {"",}, {"",}, {"",}, - {"font-weight", 64}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, - {"line-height", 68}, - {"",}, {"",}, {"",}, {"",}, - {"size", 113}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"visibility", 135}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"border-width", 32}, - {"margin-bottom", 74}, - {"",}, {"",}, - {"size-width", 115}, - {"direction", 51}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"cue-after", 48}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline", 86}, - {"",}, {"",}, {"",}, - {"margin-top", 77}, - {"vertical-align", 134}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-bottom", 39}, - {"",}, {"",}, - {"border-color", 17}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"widows", 139}, - {"",}, - {"clip-right", 41}, - {"",}, - {"background-filter", 5}, - {"",}, {"",}, {"",}, - {"border-left-width", 21}, - {"",}, - {"quotes-open", 110}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"volume", 137}, - {"",}, {"",}, {"",}, - {"font-variant", 63}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background", 2}, - {"size-height", 114}, - {"",}, {"",}, - {"padding-top", 95}, - {"",}, - {"text-align", 123}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"height", 65}, - {"z-index", 142}, - {"border-left", 18}, - {"",}, - {"border-left-color", 19}, - {"",}, - {"margin-right", 76}, - {"quotes", 108}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"unicode-bidi", 133}, - {"",}, {"",}, {"",}, - {"outline-color", 87}, - {"",}, - {"font-size", 59}, - {"play-during", 105}, - {"padding-right", 94}, - {"",}, {"",}, {"",}, - {"elevation", 53}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-color", 4}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right-width", 25}, - {"",}, {"",}, - {"white-space", 138}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"opacity", 84}, - {"outline-width", 89}, - {"padding-bottom", 92}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-bottom-width", 15}, - {"border-top-width", 31}, - {"",}, {"",}, {"",}, {"",}, - {"border-top-color", 29}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pitch-range", 104}, - {"border-right-color", 23}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"voice-family", 136}, - {"",}, {"",}, {"",}, - {"border-bottom", 12}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"font-style", 62}, - {"",}, {"",}, - {"font-size-adjust", 60}, - {"",}, - {"border-bottom-color", 13}, - {"",}, {"",}, - {"-moz-border-radius", 0}, - {"",}, - {"max-height", 80}, - {"",}, {"",}, - {"border-collapse", 16}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"clip-top", 42}, - {"speech-rate", 120}, - {"",}, - {"border-top", 28}, - {"background-y-position", 10}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"marker-offset", 78}, - {"min-height", 82}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-x-position", 9}, - {"",}, {"",}, - {"background-position", 7}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"outline-style", 88}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"stress", 121}, - {"",}, {"",}, - {"background-repeat", 8}, - {"",}, - {"counter-increment", 45}, - {"background-attachment", 3}, - {"border-left-style", 20}, - {"play-during-flags", 106}, - {"",}, - {"text-shadow", 126}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style", 69}, - {"",}, - {"padding-left", 93}, - {"richness", 111}, - {"",}, - {"border-y-spacing", 34}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-indent", 125}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-right", 22}, - {"",}, {"",}, - {"border-x-spacing", 33}, - {"",}, {"",}, - {"table-layout", 122}, - {"",}, {"",}, - {"caption-side", 36}, - {"",}, - {"list-style-position", 71}, - {"text-decoration", 124}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"empty-cells", 54}, - {"cue-before", 49}, - {"",}, - {"page-break-after", 97}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-spacing", 26}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"background-image", 6}, - {"word-spacing", 141}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, - {"border-right-style", 24}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-transform", 131}, - {"",}, - {"speak-numeral", 118}, - {"",}, {"",}, - {"letter-spacing", 67}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-color", 127}, - {"",}, - {"border-bottom-style", 14}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, - {"speak-header", 117}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"list-style-image", 70}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"counter-reset", 46}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"speak-punctuation", 119}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"quotes-close", 109}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"border-top-style", 30}, - {"text-shadow-y", 130}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"list-style-type", 72}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-x", 129}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"text-shadow-radius", 128}, - {"",}, {"",}, - {"page-break-inside", 99}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, - {"border-style", 27}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"pause-before", 102}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"page-break-before", 98}, - }; - - if (str != NULL) { - int len = PL_strlen(str); - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int hval = len; - - switch (hval) - { - default: - case 12: - hval += asso_values[MYLOWER(str[11])]; - case 11: - case 10: - case 9: - case 8: - hval += asso_values[MYLOWER(str[7])]; - case 7: - case 6: - hval += asso_values[MYLOWER(str[5])]; - case 5: - case 4: - case 3: - case 2: - hval += asso_values[MYLOWER(str[1])]; - case 1: - hval += asso_values[MYLOWER(str[0])]; - break; - } - hval += asso_values[MYLOWER(str[len - 1])]; - if (hval <= MAX_HASH_VALUE && hval >= MIN_HASH_VALUE) { - if (len == lengthtable[hval]) { - register const char *tag = wordlist[hval].tag; - - /* - ** While not at the end of the string, if they ever differ - ** they are not equal. We know "tag" is already lower case. - */ - while ((*tag != '\0')&&(*str != '\0')) { - if (*tag != (char) MYLOWER(*str)) { - return -1; - } - tag++; - str++; - } - - /* - ** One of the strings has ended, if they are both ended, then they - ** are equal, otherwise not. - */ - if ((*tag == '\0')&&(*str == '\0')) { - return wordlist[hval].id; - } + 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])); } } } } - return -1; } -const nsCSSProps::NameTableEntry nsCSSProps::kNameTable[] = { - { "-moz-border-radius", 0 }, - { "azimuth", 1 }, - { "background", 2 }, - { "background-attachment", 3 }, - { "background-color", 4 }, - { "background-filter", 5 }, - { "background-image", 6 }, - { "background-position", 7 }, - { "background-repeat", 8 }, - { "background-x-position", 9 }, - { "background-y-position", 10 }, - { "border", 11 }, - { "border-bottom", 12 }, - { "border-bottom-color", 13 }, - { "border-bottom-style", 14 }, - { "border-bottom-width", 15 }, - { "border-collapse", 16 }, - { "border-color", 17 }, - { "border-left", 18 }, - { "border-left-color", 19 }, - { "border-left-style", 20 }, - { "border-left-width", 21 }, - { "border-right", 22 }, - { "border-right-color", 23 }, - { "border-right-style", 24 }, - { "border-right-width", 25 }, - { "border-spacing", 26 }, - { "border-style", 27 }, - { "border-top", 28 }, - { "border-top-color", 29 }, - { "border-top-style", 30 }, - { "border-top-width", 31 }, - { "border-width", 32 }, - { "border-x-spacing", 33 }, - { "border-y-spacing", 34 }, - { "bottom", 35 }, - { "caption-side", 36 }, - { "clear", 37 }, - { "clip", 38 }, - { "clip-bottom", 39 }, - { "clip-left", 40 }, - { "clip-right", 41 }, - { "clip-top", 42 }, - { "color", 43 }, - { "content", 44 }, - { "counter-increment", 45 }, - { "counter-reset", 46 }, - { "cue", 47 }, - { "cue-after", 48 }, - { "cue-before", 49 }, - { "cursor", 50 }, - { "direction", 51 }, - { "display", 52 }, - { "elevation", 53 }, - { "empty-cells", 54 }, - { "filter", 55 }, - { "float", 56 }, - { "font", 57 }, - { "font-family", 58 }, - { "font-size", 59 }, - { "font-size-adjust", 60 }, - { "font-stretch", 61 }, - { "font-style", 62 }, - { "font-variant", 63 }, - { "font-weight", 64 }, - { "height", 65 }, - { "left", 66 }, - { "letter-spacing", 67 }, - { "line-height", 68 }, - { "list-style", 69 }, - { "list-style-image", 70 }, - { "list-style-position", 71 }, - { "list-style-type", 72 }, - { "margin", 73 }, - { "margin-bottom", 74 }, - { "margin-left", 75 }, - { "margin-right", 76 }, - { "margin-top", 77 }, - { "marker-offset", 78 }, - { "marks", 79 }, - { "max-height", 80 }, - { "max-width", 81 }, - { "min-height", 82 }, - { "min-width", 83 }, - { "opacity", 84 }, - { "orphans", 85 }, - { "outline", 86 }, - { "outline-color", 87 }, - { "outline-style", 88 }, - { "outline-width", 89 }, - { "overflow", 90 }, - { "padding", 91 }, - { "padding-bottom", 92 }, - { "padding-left", 93 }, - { "padding-right", 94 }, - { "padding-top", 95 }, - { "page", 96 }, - { "page-break-after", 97 }, - { "page-break-before", 98 }, - { "page-break-inside", 99 }, - { "pause", 100 }, - { "pause-after", 101 }, - { "pause-before", 102 }, - { "pitch", 103 }, - { "pitch-range", 104 }, - { "play-during", 105 }, - { "play-during-flags", 106 }, - { "position", 107 }, - { "quotes", 108 }, - { "quotes-close", 109 }, - { "quotes-open", 110 }, - { "richness", 111 }, - { "right", 112 }, - { "size", 113 }, - { "size-height", 114 }, - { "size-width", 115 }, - { "speak", 116 }, - { "speak-header", 117 }, - { "speak-numeral", 118 }, - { "speak-punctuation", 119 }, - { "speech-rate", 120 }, - { "stress", 121 }, - { "table-layout", 122 }, - { "text-align", 123 }, - { "text-decoration", 124 }, - { "text-indent", 125 }, - { "text-shadow", 126 }, - { "text-shadow-color", 127 }, - { "text-shadow-radius", 128 }, - { "text-shadow-x", 129 }, - { "text-shadow-y", 130 }, - { "text-transform", 131 }, - { "top", 132 }, - { "unicode-bidi", 133 }, - { "vertical-align", 134 }, - { "visibility", 135 }, - { "voice-family", 136 }, - { "volume", 137 }, - { "white-space", 138 }, - { "widows", 139 }, - { "width", 140 }, - { "word-spacing", 141 }, - { "z-index", 142 }, +void +nsCSSProps::ReleaseTable(void) +{ + if (0 == --gTableRefCount) { + if (gPropertyArray) { + delete [] gPropertyArray; + gPropertyArray = nsnull; + } + if (gPropertyTree) { + delete gPropertyTree; + gPropertyTree = nsnull; + } + if (gComparitor) { + delete gComparitor; + gComparitor = nsnull; + } + } +} + + +nsCSSProperty +nsCSSProps::LookupProperty(const nsStr& 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; + } + } + 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 { + static const nsCString kNullStr; + return kNullStr; + } +} + + + +// Keyword id tables for variant/enum parsing +const PRInt32 nsCSSProps::kAutoSelectKTable[] = { + eCSSKeyword_select, NS_STYLE_AUTO_SELECT_SELECT, + -1,-1 }; + +const PRInt32 nsCSSProps::kAutoTabKTable[] = { + eCSSKeyword_activate_next, NS_STYLE_AUTO_TAB_ACTIVATE_NEXT, + eCSSKeyword_select_next, NS_STYLE_AUTO_TAB_SELECT_NEXT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kAzimuthKTable[] = { + eCSSKeyword_left_side, NS_STYLE_AZIMUTH_LEFT_SIDE, + eCSSKeyword_far_left, NS_STYLE_AZIMUTH_FAR_LEFT, + eCSSKeyword_left, NS_STYLE_AZIMUTH_LEFT, + eCSSKeyword_center_left, NS_STYLE_AZIMUTH_CENTER_LEFT, + eCSSKeyword_center, NS_STYLE_AZIMUTH_CENTER, + eCSSKeyword_center_right, NS_STYLE_AZIMUTH_CENTER_RIGHT, + eCSSKeyword_right, NS_STYLE_AZIMUTH_RIGHT, + eCSSKeyword_far_right, NS_STYLE_AZIMUTH_FAR_RIGHT, + eCSSKeyword_right_side, NS_STYLE_AZIMUTH_RIGHT_SIDE, + eCSSKeyword_behind, NS_STYLE_AZIMUTH_BEHIND, + eCSSKeyword_leftwards, NS_STYLE_AZIMUTH_LEFTWARDS, + eCSSKeyword_rightwards, NS_STYLE_AZIMUTH_RIGHTWARDS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = { + eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, + eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBackgroundRepeatKTable[] = { + eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_OFF, + eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_XY, + eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_X, + eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_Y, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderCollapseKTable[] = { + eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE, + eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderColorKTable[] = { + eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderStyleKTable[] = { + eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN, + eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED, + eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED, + eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID, + eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE, + eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE, + eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE, + eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET, + eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET, + eCSSKeyword__moz_bg_inset, NS_STYLE_BORDER_STYLE_BG_INSET, + eCSSKeyword__moz_bg_outset, NS_STYLE_BORDER_STYLE_BG_OUTSET, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBorderWidthKTable[] = { + eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN, + eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM, + eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kBoxSizingKTable[] = { + eCSSKeyword_content_box, NS_STYLE_BOX_SIZING_CONTENT, + eCSSKeyword_border_box, NS_STYLE_BOX_SIZING_BORDER, + eCSSKeyword_padding_box, NS_STYLE_BOX_SIZING_PADDING, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCaptionSideKTable[] = { + eCSSKeyword_top, NS_SIDE_TOP, + eCSSKeyword_right, NS_SIDE_RIGHT, + eCSSKeyword_bottom, NS_SIDE_BOTTOM, + eCSSKeyword_left, NS_SIDE_LEFT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kClearKTable[] = { + eCSSKeyword_left, NS_STYLE_CLEAR_LEFT, + eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT, + eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kContentKTable[] = { + eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, + eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, + eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, + eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kCursorKTable[] = { + eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR, + eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT, + eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER, + eCSSKeyword_move, NS_STYLE_CURSOR_MOVE, + eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE, + eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE, + eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE, + eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE, + eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE, + eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE, + eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE, + eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE, + eCSSKeyword_text, NS_STYLE_CURSOR_TEXT, + eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT, + eCSSKeyword_help, NS_STYLE_CURSOR_HELP, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDirectionKTable[] = { + eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR, + eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kDisplayKTable[] = { + eCSSKeyword_inline, NS_STYLE_DISPLAY_INLINE, + eCSSKeyword_block, NS_STYLE_DISPLAY_BLOCK, + eCSSKeyword_inline_block, NS_STYLE_DISPLAY_INLINE_BLOCK, + eCSSKeyword_list_item, NS_STYLE_DISPLAY_LIST_ITEM, + eCSSKeyword_run_in, NS_STYLE_DISPLAY_RUN_IN, + eCSSKeyword_compact, NS_STYLE_DISPLAY_COMPACT, + eCSSKeyword_marker, NS_STYLE_DISPLAY_MARKER, + eCSSKeyword_table, NS_STYLE_DISPLAY_TABLE, + eCSSKeyword_inline_table, NS_STYLE_DISPLAY_INLINE_TABLE, + eCSSKeyword_table_row_group, NS_STYLE_DISPLAY_TABLE_ROW_GROUP, + eCSSKeyword_table_header_group, NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, + eCSSKeyword_table_footer_group, NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, + eCSSKeyword_table_row, NS_STYLE_DISPLAY_TABLE_ROW, + eCSSKeyword_table_column_group, NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, + eCSSKeyword_table_column, NS_STYLE_DISPLAY_TABLE_COLUMN, + eCSSKeyword_table_cell, NS_STYLE_DISPLAY_TABLE_CELL, + eCSSKeyword_table_caption, NS_STYLE_DISPLAY_TABLE_CAPTION, + -1,-1 +}; + +const PRInt32 nsCSSProps::kElevationKTable[] = { + eCSSKeyword_below, NS_STYLE_ELEVATION_BELOW, + eCSSKeyword_level, NS_STYLE_ELEVATION_LEVEL, + eCSSKeyword_above, NS_STYLE_ELEVATION_ABOVE, + eCSSKeyword_higher, NS_STYLE_ELEVATION_HIGHER, + eCSSKeyword_lower, NS_STYLE_ELEVATION_LOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kEmptyCellsKTable[] = { + eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW, + eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatKTable[] = { + eCSSKeyword_left, NS_STYLE_FLOAT_LEFT, + eCSSKeyword_right, NS_STYLE_FLOAT_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFloatEdgeKTable[] = { + eCSSKeyword_content_box, NS_STYLE_FLOAT_EDGE_CONTENT, + eCSSKeyword_border_box, NS_STYLE_FLOAT_EDGE_BORDER, + eCSSKeyword_padding_box, NS_STYLE_FLOAT_EDGE_PADDING, + eCSSKeyword_margin_box, NS_STYLE_FLOAT_EDGE_MARGIN, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontKTable[] = { + eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, + eCSSKeyword_icon, NS_STYLE_FONT_ICON, + eCSSKeyword_menu, NS_STYLE_FONT_MENU, + eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX, + eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION, + eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontSizeKTable[] = { + eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL, + eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL, + eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL, + eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM, + eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE, + eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE, + eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE, + eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER, + eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStretchKTable[] = { + eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER, + eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER, + eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED, + eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED, + eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED, + eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED, + eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED, + eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED, + eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED, + eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontStyleKTable[] = { + eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC, + eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontVariantKTable[] = { + eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kFontWeightKTable[] = { + eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD, + eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER, + eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kKeyEquivalentKTable[] = { + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStylePositionKTable[] = { + eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE, + eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kListStyleKTable[] = { + eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, + eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, + eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, + eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, + eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, + eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, + eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, + eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, + eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, + eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, + eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, + eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, + eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, + eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, + eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, + eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, + eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, + eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, + eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, + eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, + -1,-1 +}; + +const PRInt32 nsCSSProps::kModifyContentKTable[] = { + eCSSKeyword_read_only, NS_STYLE_MODIFY_CONTENT_READ_ONLY, + eCSSKeyword_read_write, NS_STYLE_MODIFY_CONTENT_READ_WRITE, + eCSSKeyword_write_only, NS_STYLE_MODIFY_CONTENT_WRITE_ONLY, + eCSSKeyword_toggle, NS_STYLE_MODIFY_CONTENT_TOGGLE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOutlineColorKTable[] = { + eCSSKeyword_invert, NS_STYLE_COLOR_INVERT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kOverflowKTable[] = { + eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, + eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakKTable[] = { + eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT, + eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageBreakInsideKTable[] = { + eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageMarksKTable[] = { + eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP, + eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPageSizeKTable[] = { + eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE, + eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPitchKTable[] = { + eCSSKeyword_x_low, NS_STYLE_PITCH_X_LOW, + eCSSKeyword_low, NS_STYLE_PITCH_LOW, + eCSSKeyword_medium, NS_STYLE_PITCH_MEDIUM, + eCSSKeyword_high, NS_STYLE_PITCH_HIGH, + eCSSKeyword_x_high, NS_STYLE_PITCH_X_HIGH, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPlayDuringKTable[] = { + eCSSKeyword_mix, NS_STYLE_PLAY_DURING_MIX, + eCSSKeyword_repeat, NS_STYLE_PLAY_DURING_REPEAT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kPositionKTable[] = { + eCSSKeyword_static, NS_STYLE_POSITION_NORMAL, + eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE, + eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE, + eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kResizerKTable[] = { + eCSSKeyword_both, NS_STYLE_RESIZER_BOTH, + eCSSKeyword_horizontal, NS_STYLE_RESIZER_HORIZONTAL, + eCSSKeyword_vertical, NS_STYLE_RESIZER_VERTICAL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSelectionStyleKTable[] = { + eCSSKeyword_any, NS_STYLE_SELECTION_STYLE_ANY, + eCSSKeyword_line, NS_STYLE_SELECTION_STYLE_LINE, + eCSSKeyword_all, NS_STYLE_SELECTION_STYLE_ALL, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakKTable[] = { + eCSSKeyword_spell_out, NS_STYLE_SPEAK_SPELL_OUT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakHeaderKTable[] = { + eCSSKeyword_once, NS_STYLE_SPEAK_HEADER_ONCE, + eCSSKeyword_always, NS_STYLE_SPEAK_HEADER_ALWAYS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakNumeralKTable[] = { + eCSSKeyword_digits, NS_STYLE_SPEAK_NUMERAL_DIGITS, + eCSSKeyword_continuous, NS_STYLE_SPEAK_NUMERAL_CONTINUOUS, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeakPunctuationKTable[] = { + eCSSKeyword_code, NS_STYLE_SPEAK_PUNCTUATION_CODE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kSpeechRateKTable[] = { + eCSSKeyword_x_slow, NS_STYLE_SPEECH_RATE_X_SLOW, + eCSSKeyword_slow, NS_STYLE_SPEECH_RATE_SLOW, + eCSSKeyword_medium, NS_STYLE_SPEECH_RATE_MEDIUM, + eCSSKeyword_fast, NS_STYLE_SPEECH_RATE_FAST, + eCSSKeyword_x_fast, NS_STYLE_SPEECH_RATE_X_FAST, + eCSSKeyword_faster, NS_STYLE_SPEECH_RATE_FASTER, + eCSSKeyword_slower, NS_STYLE_SPEECH_RATE_SLOWER, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTableLayoutKTable[] = { + eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextAlignKTable[] = { + eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT, + eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT, + eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER, + eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, + eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER, + eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextDecorationKTable[] = { + eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE, + eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE, + eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, + eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK, + -1,-1 +}; + +const PRInt32 nsCSSProps::kTextTransformKTable[] = { + eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, + eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, + eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = { + eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED, + eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kUserInputKTable[] = { + eCSSKeyword_enabled, NS_STYLE_USER_INPUT_ENABLED, + eCSSKeyword_disabled, NS_STYLE_USER_INPUT_DISABLED, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVerticalAlignKTable[] = { + eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE, + eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB, + eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER, + eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP, + eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP, + eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE, + eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM, + eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVisibilityKTable[] = { + eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE, + eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN, + eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE, + -1,-1 +}; + +const PRInt32 nsCSSProps::kVolumeKTable[] = { + eCSSKeyword_silent, NS_STYLE_VOLUME_SILENT, + eCSSKeyword_x_soft, NS_STYLE_VOLUME_X_SOFT, + eCSSKeyword_soft, NS_STYLE_VOLUME_SOFT, + eCSSKeyword_medium, NS_STYLE_VOLUME_MEDIUM, + eCSSKeyword_loud, NS_STYLE_VOLUME_LOUD, + eCSSKeyword_x_loud, NS_STYLE_VOLUME_X_LOUD, + -1,-1 +}; + +const PRInt32 nsCSSProps::kWhitespaceKTable[] = { + eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE, + eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP, + eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, + -1,-1 +}; + +static const nsCString& +SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) +{ + PRInt32 i = 1; + for (;;) { + if (aTable[i] < 0) { + break; + } + if (aValue == aTable[i]) { + return nsCSSKeywords::GetStringValue(nsCSSKeyword(aTable[i-1])); + } + i += 2; + } + static const nsCString kNullStr; + return kNullStr; +} + + + +const nsCString& +nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) +{ +static const PRInt32 kBackgroundXPositionKTable[] = { + eCSSKeyword_left, 0, + eCSSKeyword_center, 50, + eCSSKeyword_right, 100, + -1,-1 +}; + +static const PRInt32 kBackgroundYPositionKTable[] = { + eCSSKeyword_top, 0, + eCSSKeyword_center, 50, + eCSSKeyword_bottom, 100, + -1,-1 +}; + + switch (aProp) { + + case eCSSProperty_auto_select: + return SearchKeywordTable(aValue, kAutoSelectKTable); + + case eCSSProperty_auto_tab: + return SearchKeywordTable(aValue, kAutoTabKTable); + + case eCSSProperty_azimuth: + return SearchKeywordTable(aValue, kAzimuthKTable); + + case eCSSProperty_background: + break; + + case eCSSProperty_background_attachment: + return SearchKeywordTable(aValue, kBackgroundAttachmentKTable); + + case eCSSProperty_background_color: + return SearchKeywordTable(aValue, kBackgroundColorKTable); + + case eCSSProperty_background_image: + break; + + case eCSSProperty_background_position: + break; + + case eCSSProperty_background_repeat: + return SearchKeywordTable(aValue, kBackgroundRepeatKTable); + + case eCSSProperty_background_x_position: + return SearchKeywordTable(aValue, kBackgroundXPositionKTable); + + case eCSSProperty_background_y_position: + return SearchKeywordTable(aValue, kBackgroundYPositionKTable); + + case eCSSProperty_border: + break; + + case eCSSProperty_border_collapse: + return SearchKeywordTable(aValue, kBorderCollapseKTable); + + case eCSSProperty_box_sizing: + return SearchKeywordTable(aValue, kBoxSizingKTable); + + case eCSSProperty_border_color: + case eCSSProperty_border_spacing: + case eCSSProperty_border_style: + case eCSSProperty_border_bottom: + case eCSSProperty_border_left: + case eCSSProperty_border_right: + case eCSSProperty_border_top: + break; + + case eCSSProperty_border_bottom_color: + case eCSSProperty_border_left_color: + case eCSSProperty_border_right_color: + case eCSSProperty_border_top_color: + return SearchKeywordTable(aValue, kBorderColorKTable); + + case eCSSProperty_border_bottom_style: + case eCSSProperty_border_left_style: + case eCSSProperty_border_right_style: + case eCSSProperty_border_top_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_border_bottom_width: + case eCSSProperty_border_left_width: + case eCSSProperty_border_right_width: + case eCSSProperty_border_top_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_border_width: + case eCSSProperty_border_x_spacing: + case eCSSProperty_border_y_spacing: + case eCSSProperty_bottom: + break; + + case eCSSProperty_caption_side: + return SearchKeywordTable(aValue, kCaptionSideKTable); + + case eCSSProperty_clear: + return SearchKeywordTable(aValue, kClearKTable); + + case eCSSProperty_clip: + case eCSSProperty_clip_bottom: + case eCSSProperty_clip_left: + case eCSSProperty_clip_right: + case eCSSProperty_clip_top: + case eCSSProperty_color: + break; + + case eCSSProperty_content: + return SearchKeywordTable(aValue, kContentKTable); + + case eCSSProperty_counter_increment: + case eCSSProperty_counter_reset: + case eCSSProperty_cue: + case eCSSProperty_cue_after: + case eCSSProperty_cue_before: + break; + + case eCSSProperty_cursor: + return SearchKeywordTable(aValue, kCursorKTable); + + case eCSSProperty_direction: + return SearchKeywordTable(aValue, kDirectionKTable); + + case eCSSProperty_display: + return SearchKeywordTable(aValue, kDisplayKTable); + + case eCSSProperty_elevation: + return SearchKeywordTable(aValue, kElevationKTable); + + case eCSSProperty_empty_cells: + return SearchKeywordTable(aValue, kEmptyCellsKTable); + + case eCSSProperty_float: + return SearchKeywordTable(aValue, kFloatKTable); + + case eCSSProperty_float_edge: + return SearchKeywordTable(aValue, kFloatEdgeKTable); + + case eCSSProperty_font: + break; + + case eCSSProperty_font_family: + return SearchKeywordTable(aValue, kFontKTable); + + case eCSSProperty_font_size: + return SearchKeywordTable(aValue, kFontSizeKTable); + + case eCSSProperty_font_size_adjust: + break; + + case eCSSProperty_font_stretch: + return SearchKeywordTable(aValue, kFontStretchKTable); + + case eCSSProperty_font_style: + return SearchKeywordTable(aValue, kFontStyleKTable); + + case eCSSProperty_font_variant: + return SearchKeywordTable(aValue, kFontVariantKTable); + + case eCSSProperty_font_weight: + return SearchKeywordTable(aValue, kFontWeightKTable); + + case eCSSProperty_height: + break; + + case eCSSProperty_key_equivalent: + return SearchKeywordTable(aValue, kKeyEquivalentKTable); + + case eCSSProperty_left: + case eCSSProperty_letter_spacing: + case eCSSProperty_line_height: + case eCSSProperty_list_style: + case eCSSProperty_list_style_image: + break; + + case eCSSProperty_list_style_position: + return SearchKeywordTable(aValue, kListStylePositionKTable); + + case eCSSProperty_list_style_type: + return SearchKeywordTable(aValue, kListStyleKTable); + + case eCSSProperty_margin: + case eCSSProperty_margin_bottom: + case eCSSProperty_margin_left: + case eCSSProperty_margin_right: + case eCSSProperty_margin_top: + case eCSSProperty_marker_offset: + break; + + case eCSSProperty_marks: + return SearchKeywordTable(aValue, kPageMarksKTable); + + case eCSSProperty_max_height: + case eCSSProperty_max_width: + case eCSSProperty_min_height: + case eCSSProperty_min_width: + break; + + case eCSSProperty_modify_content: + return SearchKeywordTable(aValue, kModifyContentKTable); + + case eCSSProperty_opacity: + case eCSSProperty_orphans: + case eCSSProperty_outline: + break; + + case eCSSProperty_outline_color: + return SearchKeywordTable(aValue, kOutlineColorKTable); + + case eCSSProperty_outline_style: + return SearchKeywordTable(aValue, kBorderStyleKTable); + + case eCSSProperty_outline_width: + return SearchKeywordTable(aValue, kBorderWidthKTable); + + case eCSSProperty_overflow: + return SearchKeywordTable(aValue, kOverflowKTable); + + case eCSSProperty_padding: + case eCSSProperty_padding_bottom: + case eCSSProperty_padding_left: + case eCSSProperty_padding_right: + case eCSSProperty_padding_top: + case eCSSProperty_page: + break; + + case eCSSProperty_page_break_before: + case eCSSProperty_page_break_after: + return SearchKeywordTable(aValue, kPageBreakKTable); + + case eCSSProperty_page_break_inside: + return SearchKeywordTable(aValue, kPageBreakInsideKTable); + + case eCSSProperty_pause: + case eCSSProperty_pause_after: + case eCSSProperty_pause_before: + break; + + case eCSSProperty_pitch: + return SearchKeywordTable(aValue, kPitchKTable); + + case eCSSProperty_pitch_range: + case eCSSProperty_play_during: + break; + + case eCSSProperty_play_during_flags: + return SearchKeywordTable(aValue, kPlayDuringKTable); + + case eCSSProperty_position: + return SearchKeywordTable(aValue, kPositionKTable); + + case eCSSProperty_quotes: + case eCSSProperty_quotes_close: + case eCSSProperty_quotes_open: + break; + + case eCSSProperty_resizer: + return SearchKeywordTable(aValue, kResizerKTable); + + case eCSSProperty_richness: + case eCSSProperty_right: + break; + + case eCSSProperty_selection_style: + return SearchKeywordTable(aValue, kSelectionStyleKTable); + + case eCSSProperty_size: + break; + + case eCSSProperty_size_height: + case eCSSProperty_size_width: + return SearchKeywordTable(aValue, kPageSizeKTable); + + case eCSSProperty_speak: + return SearchKeywordTable(aValue, kSpeakKTable); + + case eCSSProperty_speak_header: + return SearchKeywordTable(aValue, kSpeakHeaderKTable); + + case eCSSProperty_speak_numeral: + return SearchKeywordTable(aValue, kSpeakNumeralKTable); + + case eCSSProperty_speak_punctuation: + return SearchKeywordTable(aValue, kSpeakPunctuationKTable); + + case eCSSProperty_speech_rate: + return SearchKeywordTable(aValue, kSpeechRateKTable); + + case eCSSProperty_stress: + break; + + case eCSSProperty_table_layout: + return SearchKeywordTable(aValue, kTableLayoutKTable); + + case eCSSProperty_text_align: + return SearchKeywordTable(aValue, kTextAlignKTable); + + case eCSSProperty_text_decoration: + return SearchKeywordTable(aValue, kTextDecorationKTable); + + case eCSSProperty_text_indent: + case eCSSProperty_text_shadow: + case eCSSProperty_text_shadow_color: + case eCSSProperty_text_shadow_radius: + case eCSSProperty_text_shadow_x: + case eCSSProperty_text_shadow_y: + break; + + case eCSSProperty_text_transform: + return SearchKeywordTable(aValue, kTextTransformKTable); + + case eCSSProperty_top: + break; + + case eCSSProperty_unicode_bidi: + return SearchKeywordTable(aValue, kUnicodeBidiKTable); + + case eCSSProperty_user_input: + return SearchKeywordTable(aValue, kUserInputKTable); + + case eCSSProperty_vertical_align: + return SearchKeywordTable(aValue, kVerticalAlignKTable); + + case eCSSProperty_visibility: + return SearchKeywordTable(aValue, kVisibilityKTable); + + case eCSSProperty_voice_family: + break; + + case eCSSProperty_volume: + return SearchKeywordTable(aValue, kVolumeKTable); + + case eCSSProperty_white_space: + return SearchKeywordTable(aValue, kWhitespaceKTable); + + case eCSSProperty_widows: + case eCSSProperty_width: + case eCSSProperty_word_spacing: + case eCSSProperty_z_index: + break; + +// no default case, let the compiler help find missing values + case eCSSProperty_UNKNOWN: + case eCSSProperty_COUNT: + NS_ERROR("invalid property"); + break; + } + static const nsCString kNullStr; + return kNullStr; +} + + +// define array of all CSS property hints +#define CSS_PROP(_prop, _hint) NS_STYLE_HINT_##_hint, +const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { +#include "nsCSSPropList.h" +}; +#undef CSS_PROP + diff --git a/mozilla/layout/style/nsCSSProps.h b/mozilla/layout/style/nsCSSProps.h index 92f3de0b8e8..d30dae464c9 100644 --- a/mozilla/layout/style/nsCSSProps.h +++ b/mozilla/layout/style/nsCSSProps.h @@ -19,33 +19,48 @@ #define nsCSSProps_h___ #include "nslayout.h" -#include "nsCSSPropIDs.h" + +struct nsStr; +class nsCString; + +/* + Declare the enum list using the magic of preprocessing + enum values are "eCSSProperty_foo" (where foo is the property) + + To change the list of properties, see nsCSSPropList.h + + */ +#define CSS_PROP(_prop, _hint) eCSSProperty_##_prop, +enum nsCSSProperty { + eCSSProperty_UNKNOWN = -1, +#include "nsCSSPropList.h" + eCSSProperty_COUNT +}; +#undef CSS_PROP + class NS_LAYOUT nsCSSProps { public: - // Given a null terminated string of 7 bit characters, return the - // tag id (see nsCSSPropIDs.h) for the tag or -1 if the tag is not - // known. The lookup function uses a perfect hash. - static PRInt32 LookupName(const char* str); + static void AddRefTable(void); + static void ReleaseTable(void); - - // Given a CSS Property ID and an Property Value Index - // Return back a const char* representation of the - // value. Return back nsnull if no value is found - static const char* LookupProperty(PRInt32 aProp, PRInt32 aIndex); + // Given a property string, return the enum value + static nsCSSProperty LookupProperty(const nsStr& aProperty); - struct NameTableEntry { - const char* name; - PRInt32 id; - }; + // Given a property enum, get the string value + static const nsCString& GetStringValue(nsCSSProperty aProperty); - // A table whose index is the tag id (from nsCSSPropIDs) - static const NameTableEntry kNameTable[]; + // Given a CSS Property and a Property Enum Value + // Return back a const nsString& representation of the + // value. Return back nullstr if no value is found + static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); static const PRInt32 kHintTable[]; // Keyword/Enum value tables static const PRInt32 kAzimuthKTable[]; + static const PRInt32 kAutoSelectKTable[]; + static const PRInt32 kAutoTabKTable[]; static const PRInt32 kBackgroundAttachmentKTable[]; static const PRInt32 kBackgroundColorKTable[]; static const PRInt32 kBackgroundRepeatKTable[]; @@ -53,6 +68,7 @@ public: static const PRInt32 kBorderColorKTable[]; static const PRInt32 kBorderStyleKTable[]; static const PRInt32 kBorderWidthKTable[]; + static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; static const PRInt32 kClearKTable[]; static const PRInt32 kContentKTable[]; @@ -62,14 +78,17 @@ public: static const PRInt32 kElevationKTable[]; static const PRInt32 kEmptyCellsKTable[]; static const PRInt32 kFloatKTable[]; + static const PRInt32 kFloatEdgeKTable[]; static const PRInt32 kFontKTable[]; static const PRInt32 kFontSizeKTable[]; static const PRInt32 kFontStretchKTable[]; static const PRInt32 kFontStyleKTable[]; static const PRInt32 kFontVariantKTable[]; static const PRInt32 kFontWeightKTable[]; + static const PRInt32 kKeyEquivalentKTable[]; static const PRInt32 kListStylePositionKTable[]; static const PRInt32 kListStyleKTable[]; + static const PRInt32 kModifyContentKTable[]; static const PRInt32 kOutlineColorKTable[]; static const PRInt32 kOverflowKTable[]; static const PRInt32 kPageBreakKTable[]; @@ -79,6 +98,8 @@ public: static const PRInt32 kPitchKTable[]; static const PRInt32 kPlayDuringKTable[]; static const PRInt32 kPositionKTable[]; + static const PRInt32 kResizerKTable[]; + static const PRInt32 kSelectionStyleKTable[]; static const PRInt32 kSpeakKTable[]; static const PRInt32 kSpeakHeaderKTable[]; static const PRInt32 kSpeakNumeralKTable[]; @@ -89,6 +110,7 @@ public: static const PRInt32 kTextDecorationKTable[]; static const PRInt32 kTextTransformKTable[]; static const PRInt32 kUnicodeBidiKTable[]; + static const PRInt32 kUserInputKTable[]; static const PRInt32 kVerticalAlignKTable[]; static const PRInt32 kVisibilityKTable[]; static const PRInt32 kVolumeKTable[];