2
* Copyright 2010 Google Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
// Copyright 2007 Google Inc. All Rights Reserved.
18
// Author: yian@google.com (Yi-an Huang)
20
// Identifier represents the value of a CSS identifier (e.g.,
21
// normal, repeat, small, inherit). If we recognize the ident,
22
// we store it as an enum. Otherwise, we store the text for the
23
// string value of the identifier.
25
// This code is based on CSS 2.1.
27
#ifndef WEBUTIL_CSS_IDENTIFIER_H__
28
#define WEBUTIL_CSS_IDENTIFIER_H__
30
#include "util/utf8/public/unicodetext.h"
38
// UNKNOWN identifiers. Reserved for internal use.
41
INHERIT, NONE, AUTO, NORMAL, VISIBLE, HIDDEN, ALWAYS, AVOID, MEDIUM,
42
REPEAT, COLLAPSE, LEFT, CENTER, RIGHT, TOP, BOTTOM, BOTH,
47
REPEAT_X, REPEAT_Y, NO_REPEAT,
51
DOTTED, DASHED, SOLID, DOUBLE, GROOVE, RIDGE, INSET, OUTSET,
55
OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE,
57
CROSSHAIR, DEFAULT, POINTER, MOVE, E_RESIZE, NE_RESIZE, NW_RESIZE,
58
N_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, W_RESIZE, TEXT, WAIT, HELP,
63
INLINE, BLOCK, LIST_ITEM, RUN_IN, INLINE_BLOCK, TABLE, INLINE_TABLE,
64
TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
65
TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL, TABLE_CAPTION,
69
SERIF, SANS_SERIF, CURSIVE, FANTASY, MONOSPACE,
71
XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE, SMALLER, LARGER,
77
BOLD, BOLDER, LIGHTER,
79
CAPTION, ICON, MENU, MESSAGE_BOX, SMALL_CAPTION, STATUS_BAR,
80
// list-style-position
83
DISC, CIRCLE, SQUARE, DECIMAL, DECIMAL_LEADING_ZERO, LOWER_ROMAN,
84
UPPER_ROMAN, LOWER_GREEK, LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN,
85
LOWER_ALPHA, UPPER_ALPHA,
89
STATIC, RELATIVE, ABSOLUTE,
93
UNDERLINE, OVERLINE, LINE_THROUGH, BLINK,
95
CAPITALIZE, UPPERCASE, LOWERCASE,
99
BASELINE, SUB, SUPER, TEXT_TOP, MIDDLE, TEXT_BOTTOM,
101
PRE, NOWRAP, PRE_WRAP, PRE_LINE,
102
// google specific. Internal use only.
103
// For property with context-dependent initial values. such as border-color
106
// color specified by <body text=color>
108
// color specified by <body link=color>
109
GOOG_BODY_LINK_COLOR,
110
// identifier reserved for font-size in <big> and <small>. IE has special
111
// semantics for them.
112
GOOG_BIG, GOOG_SMALL,
117
Identifier() : ident_(GOOG_UNKNOWN) { }
118
explicit Identifier(const UnicodeText& s);
119
explicit Identifier(Ident ident) : ident_(ident) { }
123
// ident() returns the ident enum -- OTHER if unrecognized.
124
Ident ident() const { return ident_; }
126
// ident_text() returns the identifier as a string.
127
UnicodeText ident_text() const {
131
return TextFromIdent(ident_);
134
// Static methods mapping between Ident and strings:
136
// Given the text of a CSS identifier, IdentFromText returns the
137
// corresponding enum. If no such identifier is found, IdentromText returns
139
static Ident IdentFromText(const UnicodeText& s);
140
// Given a Ident, returns its string representation. If u is OTHER, we
141
// return "OTHER", but this may not be what you want.
142
static UnicodeText TextFromIdent(Ident p);
146
UnicodeText other_; // valid if ident_ is OTHER.
151
#endif // WEBUTIL_CSS_IDENTIFIER_H__