| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * 1999 Waldo Bastian (bastian@kde.org) | 3 * 1999 Waldo Bastian (bastian@kde.org) |
| 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) | 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) |
| 5 * 2001-2003 Dirk Mueller (mueller@kde.org) | 5 * 2001-2003 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) | 7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 PseudoId CSSSelector::pseudoId(PseudoType type) | 62 PseudoId CSSSelector::pseudoId(PseudoType type) |
| 63 { | 63 { |
| 64 switch (type) { | 64 switch (type) { |
| 65 case PseudoUnknown: | 65 case PseudoUnknown: |
| 66 case PseudoHover: | 66 case PseudoHover: |
| 67 case PseudoFocus: | 67 case PseudoFocus: |
| 68 case PseudoActive: | 68 case PseudoActive: |
| 69 case PseudoLang: | 69 case PseudoLang: |
| 70 case PseudoUserAgentCustomElement: | 70 case PseudoUserAgentCustomElement: |
| 71 case PseudoUnresolved: | |
| 72 case PseudoHost: | 71 case PseudoHost: |
| 73 return NOPSEUDO; | 72 return NOPSEUDO; |
| 74 case PseudoNotParsed: | 73 case PseudoNotParsed: |
| 75 ASSERT_NOT_REACHED(); | 74 ASSERT_NOT_REACHED(); |
| 76 return NOPSEUDO; | 75 return NOPSEUDO; |
| 77 } | 76 } |
| 78 | 77 |
| 79 ASSERT_NOT_REACHED(); | 78 ASSERT_NOT_REACHED(); |
| 80 return NOPSEUDO; | 79 return NOPSEUDO; |
| 81 } | 80 } |
| 82 | 81 |
| 83 // Could be made smaller and faster by replacing pointer with an | 82 // Could be made smaller and faster by replacing pointer with an |
| 84 // offset into a string buffer and making the bit fields smaller but | 83 // offset into a string buffer and making the bit fields smaller but |
| 85 // that could not be maintained by hand. | 84 // that could not be maintained by hand. |
| 86 struct NameToPseudoStruct { | 85 struct NameToPseudoStruct { |
| 87 const char* string; | 86 const char* string; |
| 88 unsigned type:8; | 87 unsigned type:8; |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 // This table should be kept sorted. | 90 // This table should be kept sorted. |
| 92 const static NameToPseudoStruct pseudoTypeMap[] = { | 91 const static NameToPseudoStruct pseudoTypeMap[] = { |
| 93 {"active", CSSSelector::PseudoActive}, | 92 {"active", CSSSelector::PseudoActive}, |
| 94 {"focus", CSSSelector::PseudoFocus}, | 93 {"focus", CSSSelector::PseudoFocus}, |
| 95 {"host", CSSSelector::PseudoHost}, | 94 {"host", CSSSelector::PseudoHost}, |
| 96 {"host(", CSSSelector::PseudoHost}, | 95 {"host(", CSSSelector::PseudoHost}, |
| 97 {"hover", CSSSelector::PseudoHover}, | 96 {"hover", CSSSelector::PseudoHover}, |
| 98 {"lang(", CSSSelector::PseudoLang}, | 97 {"lang(", CSSSelector::PseudoLang}, |
| 99 {"unresolved", CSSSelector::PseudoUnresolved}, | |
| 100 }; | 98 }; |
| 101 | 99 |
| 102 class NameToPseudoCompare { | 100 class NameToPseudoCompare { |
| 103 public: | 101 public: |
| 104 NameToPseudoCompare(const AtomicString& key) : m_key(key) { ASSERT(m_key.is8
Bit()); } | 102 NameToPseudoCompare(const AtomicString& key) : m_key(key) { ASSERT(m_key.is8
Bit()); } |
| 105 | 103 |
| 106 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) | 104 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) |
| 107 { | 105 { |
| 108 ASSERT(entry.string); | 106 ASSERT(entry.string); |
| 109 const char* key = reinterpret_cast<const char*>(m_key.characters8()); | 107 const char* key = reinterpret_cast<const char*>(m_key.characters8()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 case PseudoUserAgentCustomElement: | 171 case PseudoUserAgentCustomElement: |
| 174 element = true; | 172 element = true; |
| 175 break; | 173 break; |
| 176 case PseudoUnknown: | 174 case PseudoUnknown: |
| 177 case PseudoHover: | 175 case PseudoHover: |
| 178 case PseudoFocus: | 176 case PseudoFocus: |
| 179 case PseudoActive: | 177 case PseudoActive: |
| 180 case PseudoLang: | 178 case PseudoLang: |
| 181 case PseudoNotParsed: | 179 case PseudoNotParsed: |
| 182 case PseudoHost: | 180 case PseudoHost: |
| 183 case PseudoUnresolved: | |
| 184 break; | 181 break; |
| 185 } | 182 } |
| 186 | 183 |
| 187 if (m_match == PseudoClass && element) { | 184 if (m_match == PseudoClass && element) { |
| 188 if (!compat) | 185 if (!compat) |
| 189 m_pseudoType = PseudoUnknown; | 186 m_pseudoType = PseudoUnknown; |
| 190 else | 187 else |
| 191 m_match = PseudoElement; | 188 m_match = PseudoElement; |
| 192 } else if (m_match == PseudoElement && !element) | 189 } else if (m_match == PseudoElement && !element) |
| 193 m_pseudoType = PseudoUnknown; | 190 m_pseudoType = PseudoUnknown; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 , m_attribute(anyName) | 348 , m_attribute(anyName) |
| 352 , m_argument(nullAtom) | 349 , m_argument(nullAtom) |
| 353 { | 350 { |
| 354 } | 351 } |
| 355 | 352 |
| 356 CSSSelector::RareData::~RareData() | 353 CSSSelector::RareData::~RareData() |
| 357 { | 354 { |
| 358 } | 355 } |
| 359 | 356 |
| 360 } // namespace blink | 357 } // namespace blink |
| OLD | NEW |