| 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 | 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) | 8 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) |
| 9 * Copyright (C) 2010 Google Inc. All rights reserved. | 9 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 case AttributeBegin: | 127 case AttributeBegin: |
| 128 case AttributeEnd: | 128 case AttributeEnd: |
| 129 return 0x000100; | 129 return 0x000100; |
| 130 case Tag: | 130 case Tag: |
| 131 if (tagQName().localName() == starAtom) | 131 if (tagQName().localName() == starAtom) |
| 132 return 0; | 132 return 0; |
| 133 return 0x000001; | 133 return 0x000001; |
| 134 case Unknown: | 134 case Unknown: |
| 135 return 0; | 135 return 0; |
| 136 } | 136 } |
| 137 ASSERT_NOT_REACHED(); | 137 NOTREACHED(); |
| 138 return 0; | 138 return 0; |
| 139 } | 139 } |
| 140 | 140 |
| 141 unsigned CSSSelector::specificityForPage() const { | 141 unsigned CSSSelector::specificityForPage() const { |
| 142 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context | 142 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context |
| 143 unsigned s = 0; | 143 unsigned s = 0; |
| 144 | 144 |
| 145 for (const CSSSelector* component = this; component; | 145 for (const CSSSelector* component = this; component; |
| 146 component = component->tagHistory()) { | 146 component = component->tagHistory()) { |
| 147 switch (component->m_match) { | 147 switch (component->m_match) { |
| 148 case Tag: | 148 case Tag: |
| 149 s += tagQName().localName() == starAtom ? 0 : 4; | 149 s += tagQName().localName() == starAtom ? 0 : 4; |
| 150 break; | 150 break; |
| 151 case PagePseudoClass: | 151 case PagePseudoClass: |
| 152 switch (component->getPseudoType()) { | 152 switch (component->getPseudoType()) { |
| 153 case PseudoFirstPage: | 153 case PseudoFirstPage: |
| 154 s += 2; | 154 s += 2; |
| 155 break; | 155 break; |
| 156 case PseudoLeftPage: | 156 case PseudoLeftPage: |
| 157 case PseudoRightPage: | 157 case PseudoRightPage: |
| 158 s += 1; | 158 s += 1; |
| 159 break; | 159 break; |
| 160 default: | 160 default: |
| 161 ASSERT_NOT_REACHED(); | 161 NOTREACHED(); |
| 162 } | 162 } |
| 163 break; | 163 break; |
| 164 default: | 164 default: |
| 165 break; | 165 break; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 return s; | 168 return s; |
| 169 } | 169 } |
| 170 | 170 |
| 171 PseudoId CSSSelector::pseudoId(PseudoType type) { | 171 PseudoId CSSSelector::pseudoId(PseudoType type) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 case PseudoShadow: | 264 case PseudoShadow: |
| 265 case PseudoFullScreen: | 265 case PseudoFullScreen: |
| 266 case PseudoFullScreenAncestor: | 266 case PseudoFullScreenAncestor: |
| 267 case PseudoSpatialNavigationFocus: | 267 case PseudoSpatialNavigationFocus: |
| 268 case PseudoListBox: | 268 case PseudoListBox: |
| 269 case PseudoHostHasAppearance: | 269 case PseudoHostHasAppearance: |
| 270 case PseudoSlotted: | 270 case PseudoSlotted: |
| 271 return PseudoIdNone; | 271 return PseudoIdNone; |
| 272 } | 272 } |
| 273 | 273 |
| 274 ASSERT_NOT_REACHED(); | 274 NOTREACHED(); |
| 275 return PseudoIdNone; | 275 return PseudoIdNone; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Could be made smaller and faster by replacing pointer with an | 278 // Could be made smaller and faster by replacing pointer with an |
| 279 // offset into a string buffer and making the bit fields smaller but | 279 // offset into a string buffer and making the bit fields smaller but |
| 280 // that could not be maintained by hand. | 280 // that could not be maintained by hand. |
| 281 struct NameToPseudoStruct { | 281 struct NameToPseudoStruct { |
| 282 const char* string; | 282 const char* string; |
| 283 unsigned type : 8; | 283 unsigned type : 8; |
| 284 }; | 284 }; |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 if (count < nthBValue()) | 1004 if (count < nthBValue()) |
| 1005 return false; | 1005 return false; |
| 1006 return (count - nthBValue()) % nthAValue() == 0; | 1006 return (count - nthBValue()) % nthAValue() == 0; |
| 1007 } | 1007 } |
| 1008 if (count > nthBValue()) | 1008 if (count > nthBValue()) |
| 1009 return false; | 1009 return false; |
| 1010 return (nthBValue() - count) % (-nthAValue()) == 0; | 1010 return (nthBValue() - count) % (-nthAValue()) == 0; |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 } // namespace blink | 1013 } // namespace blink |
| OLD | NEW |