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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 case PseudoPastCue: | 251 case PseudoPastCue: |
252 case PseudoUnresolved: | 252 case PseudoUnresolved: |
253 case PseudoContent: | 253 case PseudoContent: |
254 case PseudoHost: | 254 case PseudoHost: |
255 case PseudoHostContext: | 255 case PseudoHostContext: |
256 case PseudoShadow: | 256 case PseudoShadow: |
257 case PseudoFullScreen: | 257 case PseudoFullScreen: |
258 case PseudoFullScreenDocument: | 258 case PseudoFullScreenDocument: |
259 case PseudoFullScreenAncestor: | 259 case PseudoFullScreenAncestor: |
260 case PseudoSpatialNavigationFocus: | 260 case PseudoSpatialNavigationFocus: |
| 261 case PseudoListBox: |
261 return NOPSEUDO; | 262 return NOPSEUDO; |
262 case PseudoNotParsed: | 263 case PseudoNotParsed: |
263 ASSERT_NOT_REACHED(); | 264 ASSERT_NOT_REACHED(); |
264 return NOPSEUDO; | 265 return NOPSEUDO; |
265 } | 266 } |
266 | 267 |
267 ASSERT_NOT_REACHED(); | 268 ASSERT_NOT_REACHED(); |
268 return NOPSEUDO; | 269 return NOPSEUDO; |
269 } | 270 } |
270 | 271 |
271 // Could be made smaller and faster by replacing pointer with an | 272 // Could be made smaller and faster by replacing pointer with an |
272 // offset into a string buffer and making the bit fields smaller but | 273 // offset into a string buffer and making the bit fields smaller but |
273 // that could not be maintained by hand. | 274 // that could not be maintained by hand. |
274 struct NameToPseudoStruct { | 275 struct NameToPseudoStruct { |
275 const char* string; | 276 const char* string; |
276 unsigned type:8; | 277 unsigned type:8; |
277 }; | 278 }; |
278 | 279 |
279 // This table should be kept sorted. | 280 // This table should be kept sorted. |
280 const static NameToPseudoStruct pseudoTypeMap[] = { | 281 const static NameToPseudoStruct pseudoTypeMap[] = { |
| 282 {"-internal-list-box", CSSSelector::PseudoListBox}, |
281 {"-internal-spatial-navigation-focus", CSSSelector::PseudoSpatialNavigationFocus
}, | 283 {"-internal-spatial-navigation-focus", CSSSelector::PseudoSpatialNavigationFocus
}, |
282 {"-webkit-any(", CSSSelector::PseudoAny}, | 284 {"-webkit-any(", CSSSelector::PseudoAny}, |
283 {"-webkit-any-link", CSSSelector::PseudoAnyLink}, | 285 {"-webkit-any-link", CSSSelector::PseudoAnyLink}, |
284 {"-webkit-autofill", CSSSelector::PseudoAutofill}, | 286 {"-webkit-autofill", CSSSelector::PseudoAutofill}, |
285 {"-webkit-drag", CSSSelector::PseudoDrag}, | 287 {"-webkit-drag", CSSSelector::PseudoDrag}, |
286 {"-webkit-full-page-media", CSSSelector::PseudoFullPageMedia}, | 288 {"-webkit-full-page-media", CSSSelector::PseudoFullPageMedia}, |
287 {"-webkit-full-screen", CSSSelector::PseudoFullScreen}, | 289 {"-webkit-full-screen", CSSSelector::PseudoFullScreen}, |
288 {"-webkit-full-screen-ancestor", CSSSelector::PseudoFullScreenAncestor}, | 290 {"-webkit-full-screen-ancestor", CSSSelector::PseudoFullScreenAncestor}, |
289 {"-webkit-full-screen-document", CSSSelector::PseudoFullScreenDocument}, | 291 {"-webkit-full-screen-document", CSSSelector::PseudoFullScreenDocument}, |
290 {"-webkit-resizer", CSSSelector::PseudoResizer}, | 292 {"-webkit-resizer", CSSSelector::PseudoResizer}, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 static CSSSelector::PseudoType nameToPseudoType(const AtomicString& name) | 381 static CSSSelector::PseudoType nameToPseudoType(const AtomicString& name) |
380 { | 382 { |
381 if (name.isNull() || !name.is8Bit()) | 383 if (name.isNull() || !name.is8Bit()) |
382 return CSSSelector::PseudoUnknown; | 384 return CSSSelector::PseudoUnknown; |
383 | 385 |
384 const NameToPseudoStruct* pseudoTypeMapEnd = pseudoTypeMap + WTF_ARRAY_LENGT
H(pseudoTypeMap); | 386 const NameToPseudoStruct* pseudoTypeMapEnd = pseudoTypeMap + WTF_ARRAY_LENGT
H(pseudoTypeMap); |
385 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown }; | 387 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown }; |
386 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType
MapEnd, dummyKey, NameToPseudoCompare(name)); | 388 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType
MapEnd, dummyKey, NameToPseudoCompare(name)); |
387 if (match == pseudoTypeMapEnd || match->string != name.string()) | 389 if (match == pseudoTypeMapEnd || match->string != name.string()) |
388 return CSSSelector::PseudoUnknown; | 390 return CSSSelector::PseudoUnknown; |
389 | |
390 return static_cast<CSSSelector::PseudoType>(match->type); | 391 return static_cast<CSSSelector::PseudoType>(match->type); |
391 } | 392 } |
392 | 393 |
393 #ifndef NDEBUG | 394 #ifndef NDEBUG |
394 void CSSSelector::show(int indent) const | 395 void CSSSelector::show(int indent) const |
395 { | 396 { |
396 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data())
; | 397 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data())
; |
397 printf("%*sm_match: %d\n", indent, "", m_match); | 398 printf("%*sm_match: %d\n", indent, "", m_match); |
398 printf("%*sisCustomPseudoElement(): %d\n", indent, "", isCustomPseudoElement
()); | 399 printf("%*sisCustomPseudoElement(): %d\n", indent, "", isCustomPseudoElement
()); |
399 if (m_match != Tag) | 400 if (m_match != Tag) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 case PseudoFullScreenDocument: | 526 case PseudoFullScreenDocument: |
526 case PseudoFullScreenAncestor: | 527 case PseudoFullScreenAncestor: |
527 case PseudoInRange: | 528 case PseudoInRange: |
528 case PseudoOutOfRange: | 529 case PseudoOutOfRange: |
529 case PseudoFutureCue: | 530 case PseudoFutureCue: |
530 case PseudoPastCue: | 531 case PseudoPastCue: |
531 case PseudoHost: | 532 case PseudoHost: |
532 case PseudoHostContext: | 533 case PseudoHostContext: |
533 case PseudoUnresolved: | 534 case PseudoUnresolved: |
534 case PseudoSpatialNavigationFocus: | 535 case PseudoSpatialNavigationFocus: |
| 536 case PseudoListBox: |
535 break; | 537 break; |
536 case PseudoFirstPage: | 538 case PseudoFirstPage: |
537 case PseudoLeftPage: | 539 case PseudoLeftPage: |
538 case PseudoRightPage: | 540 case PseudoRightPage: |
539 isPagePseudoClass = true; | 541 isPagePseudoClass = true; |
540 break; | 542 break; |
541 } | 543 } |
542 | 544 |
543 bool matchPagePseudoClass = (m_match == PagePseudoClass); | 545 bool matchPagePseudoClass = (m_match == PagePseudoClass); |
544 if (matchPagePseudoClass != isPagePseudoClass) | 546 if (matchPagePseudoClass != isPagePseudoClass) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 case CSSSelector::PseudoNthLastOfType: | 779 case CSSSelector::PseudoNthLastOfType: |
778 case CSSSelector::PseudoFirstChild: | 780 case CSSSelector::PseudoFirstChild: |
779 case CSSSelector::PseudoLastChild: | 781 case CSSSelector::PseudoLastChild: |
780 case CSSSelector::PseudoFirstOfType: | 782 case CSSSelector::PseudoFirstOfType: |
781 case CSSSelector::PseudoLastOfType: | 783 case CSSSelector::PseudoLastOfType: |
782 case CSSSelector::PseudoOnlyOfType: | 784 case CSSSelector::PseudoOnlyOfType: |
783 case CSSSelector::PseudoHost: | 785 case CSSSelector::PseudoHost: |
784 case CSSSelector::PseudoHostContext: | 786 case CSSSelector::PseudoHostContext: |
785 case CSSSelector::PseudoNot: | 787 case CSSSelector::PseudoNot: |
786 case CSSSelector::PseudoSpatialNavigationFocus: | 788 case CSSSelector::PseudoSpatialNavigationFocus: |
| 789 case CSSSelector::PseudoListBox: |
787 return true; | 790 return true; |
788 default: | 791 default: |
789 return false; | 792 return false; |
790 } | 793 } |
791 } | 794 } |
792 | 795 |
793 bool CSSSelector::isCompound() const | 796 bool CSSSelector::isCompound() const |
794 { | 797 { |
795 if (!validateSubSelector(this)) | 798 if (!validateSubSelector(this)) |
796 return false; | 799 return false; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 if (count < nthBValue()) | 898 if (count < nthBValue()) |
896 return false; | 899 return false; |
897 return (count - nthBValue()) % nthAValue() == 0; | 900 return (count - nthBValue()) % nthAValue() == 0; |
898 } | 901 } |
899 if (count > nthBValue()) | 902 if (count > nthBValue()) |
900 return false; | 903 return false; |
901 return (nthBValue() - count) % (-nthAValue()) == 0; | 904 return (nthBValue() - count) % (-nthAValue()) == 0; |
902 } | 905 } |
903 | 906 |
904 } // namespace blink | 907 } // namespace blink |
OLD | NEW |