~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/css_parser/src/webutil/css/identifier.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * Copyright 2010 Google Inc.
3
 
 *
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
7
 
 *
8
 
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
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.
15
 
 */
16
 
 
17
 
// Copyright 2007 Google Inc. All Rights Reserved.
18
 
// Author: yian@google.com (Yi-an Huang)
19
 
//
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.
24
 
//
25
 
// This code is based on CSS 2.1.
26
 
 
27
 
#ifndef WEBUTIL_CSS_IDENTIFIER_H__
28
 
#define WEBUTIL_CSS_IDENTIFIER_H__
29
 
 
30
 
#include "util/utf8/public/unicodetext.h"
31
 
 
32
 
namespace Css {
33
 
 
34
 
class Identifier {
35
 
 public:
36
 
  enum Ident {
37
 
    // local add
38
 
    // UNKNOWN identifiers. Reserved for internal use.
39
 
    GOOG_UNKNOWN,
40
 
    // common values
41
 
    INHERIT, NONE, AUTO, NORMAL, VISIBLE, HIDDEN, ALWAYS, AVOID, MEDIUM,
42
 
    REPEAT, COLLAPSE, LEFT, CENTER, RIGHT, TOP, BOTTOM, BOTH,
43
 
    SCROLL, FIXED,
44
 
    // background-color
45
 
    TRANSPARENT,
46
 
    // background-repeat
47
 
    REPEAT_X, REPEAT_Y, NO_REPEAT,
48
 
    // border-collapse
49
 
    SEPARATE,
50
 
    // border-style
51
 
    DOTTED, DASHED, SOLID, DOUBLE, GROOVE, RIDGE, INSET, OUTSET,
52
 
    // border-width
53
 
    THIN, THICK,
54
 
    // content
55
 
    OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE,
56
 
    // cursor
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,
59
 
    PROGRESS,
60
 
    // direction,
61
 
    LTR, RTL,
62
 
    // display
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,
66
 
    // empty-cells
67
 
    SHOW, HIDE,
68
 
    // font-family
69
 
    SERIF, SANS_SERIF, CURSIVE, FANTASY, MONOSPACE,
70
 
    // font-size
71
 
    XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE, SMALLER, LARGER,
72
 
    // font-style
73
 
    ITALIC, OBLIQUE,
74
 
    // font-variant
75
 
    SMALL_CAPS,
76
 
    // font-weight
77
 
    BOLD, BOLDER, LIGHTER,
78
 
    // font
79
 
    CAPTION, ICON, MENU, MESSAGE_BOX, SMALL_CAPTION, STATUS_BAR,
80
 
    // list-style-position
81
 
    INSIDE, OUTSIDE,
82
 
    // list-style-type
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,
86
 
    // outline-color
87
 
    INVERT,
88
 
    // position
89
 
    STATIC, RELATIVE, ABSOLUTE,
90
 
    // text-align
91
 
    JUSTIFY,
92
 
    // text-decoration
93
 
    UNDERLINE, OVERLINE, LINE_THROUGH, BLINK,
94
 
    // text-transform
95
 
    CAPITALIZE, UPPERCASE, LOWERCASE,
96
 
    // unicode-bidi
97
 
    EMBED, BIDI_OVERRIDE,
98
 
    // vertical-align
99
 
    BASELINE, SUB, SUPER, TEXT_TOP, MIDDLE, TEXT_BOTTOM,
100
 
    // white-space
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
104
 
    // and text-align.
105
 
    GOOG_INITIAL,
106
 
    // color specified by <body text=color>
107
 
    GOOG_BODY_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,
113
 
    OTHER
114
 
  };
115
 
 
116
 
  // Constructor.
117
 
  Identifier() : ident_(GOOG_UNKNOWN) { }
118
 
  explicit Identifier(const UnicodeText& s);
119
 
  explicit Identifier(Ident ident) : ident_(ident) { }
120
 
 
121
 
  // Accessors.
122
 
  //
123
 
  // ident() returns the ident enum -- OTHER if unrecognized.
124
 
  Ident ident() const { return ident_; }
125
 
 
126
 
  // ident_text() returns the identifier as a string.
127
 
  UnicodeText ident_text() const {
128
 
    if (ident_ == OTHER)
129
 
      return other_;
130
 
    else
131
 
      return TextFromIdent(ident_);
132
 
  }
133
 
 
134
 
  // Static methods mapping between Ident and strings:
135
 
  //
136
 
  // Given the text of a CSS identifier, IdentFromText returns the
137
 
  // corresponding enum.  If no such identifier is found, IdentromText returns
138
 
  // OTHER.
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);
143
 
 
144
 
 private:
145
 
  Ident ident_;
146
 
  UnicodeText other_;  // valid if ident_ is OTHER.
147
 
};
148
 
 
149
 
}  // namespace
150
 
 
151
 
#endif  // WEBUTIL_CSS_IDENTIFIER_H__