| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 class NameToPseudoCompare { | 388 class NameToPseudoCompare { |
| 389 public: | 389 public: |
| 390 NameToPseudoCompare(const AtomicString& key) : key_(key) { | 390 NameToPseudoCompare(const AtomicString& key) : key_(key) { |
| 391 DCHECK(key_.Is8Bit()); | 391 DCHECK(key_.Is8Bit()); |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) { | 394 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) { |
| 395 DCHECK(entry.string); | 395 DCHECK(entry.string); |
| 396 const char* key = reinterpret_cast<const char*>(key_.Characters8()); | 396 const char* key = reinterpret_cast<const char*>(key_.Characters8()); |
| 397 // If strncmp returns 0, then either the keys are equal, or |m_key| sorts | 397 // If strncmp returns 0, then either the keys are equal, or |key_| sorts |
| 398 // before |entry|. | 398 // before |entry|. |
| 399 return strncmp(entry.string, key, key_.length()) < 0; | 399 return strncmp(entry.string, key, key_.length()) < 0; |
| 400 } | 400 } |
| 401 | 401 |
| 402 private: | 402 private: |
| 403 const AtomicString& key_; | 403 const AtomicString& key_; |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 static CSSSelector::PseudoType NameToPseudoType(const AtomicString& name, | 406 static CSSSelector::PseudoType NameToPseudoType(const AtomicString& name, |
| 407 bool has_arguments) { | 407 bool has_arguments) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 428 | 428 |
| 429 if (match->type == CSSSelector::kPseudoDefined && | 429 if (match->type == CSSSelector::kPseudoDefined && |
| 430 !RuntimeEnabledFeatures::customElementsV1Enabled()) | 430 !RuntimeEnabledFeatures::customElementsV1Enabled()) |
| 431 return CSSSelector::kPseudoUnknown; | 431 return CSSSelector::kPseudoUnknown; |
| 432 | 432 |
| 433 return static_cast<CSSSelector::PseudoType>(match->type); | 433 return static_cast<CSSSelector::PseudoType>(match->type); |
| 434 } | 434 } |
| 435 | 435 |
| 436 #ifndef NDEBUG | 436 #ifndef NDEBUG |
| 437 void CSSSelector::Show(int indent) const { | 437 void CSSSelector::Show(int indent) const { |
| 438 printf("%*sselectorText(): %s\n", indent, "", SelectorText().Ascii().Data()); | 438 printf("%*sSelectorText(): %s\n", indent, "", SelectorText().Ascii().Data()); |
| 439 printf("%*sm_match: %d\n", indent, "", match_); | 439 printf("%*smatch_: %d\n", indent, "", match_); |
| 440 if (match_ != kTag) | 440 if (match_ != kTag) |
| 441 printf("%*svalue(): %s\n", indent, "", Value().Ascii().Data()); | 441 printf("%*sValue(): %s\n", indent, "", Value().Ascii().Data()); |
| 442 printf("%*sgetPseudoType(): %d\n", indent, "", GetPseudoType()); | 442 printf("%*sGetPseudoType(): %d\n", indent, "", GetPseudoType()); |
| 443 if (match_ == kTag) | 443 if (match_ == kTag) |
| 444 printf("%*stagQName().localName: %s\n", indent, "", | 444 printf("%*sTagQName().LocalName(): %s\n", indent, "", |
| 445 TagQName().LocalName().Ascii().Data()); | 445 TagQName().LocalName().Ascii().Data()); |
| 446 printf("%*sisAttributeSelector(): %d\n", indent, "", IsAttributeSelector()); | 446 printf("%*sIsAttributeSelector(): %d\n", indent, "", IsAttributeSelector()); |
| 447 if (IsAttributeSelector()) | 447 if (IsAttributeSelector()) |
| 448 printf("%*sattribute(): %s\n", indent, "", | 448 printf("%*sAttribute(): %s\n", indent, "", |
| 449 Attribute().LocalName().Ascii().Data()); | 449 Attribute().LocalName().Ascii().Data()); |
| 450 printf("%*sargument(): %s\n", indent, "", Argument().Ascii().Data()); | 450 printf("%*sArgument(): %s\n", indent, "", Argument().Ascii().Data()); |
| 451 printf("%*sspecificity(): %u\n", indent, "", Specificity()); | 451 printf("%*sSpecificity(): %u\n", indent, "", Specificity()); |
| 452 if (TagHistory()) { | 452 if (TagHistory()) { |
| 453 printf("\n%*s--> (relation == %d)\n", indent, "", Relation()); | 453 printf("\n%*s--> (Relation() == %d)\n", indent, "", Relation()); |
| 454 TagHistory()->Show(indent + 2); | 454 TagHistory()->Show(indent + 2); |
| 455 } else { | 455 } else { |
| 456 printf("\n%*s--> (relation == %d)\n", indent, "", Relation()); | 456 printf("\n%*s--> (Relation() == %d)\n", indent, "", Relation()); |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 void CSSSelector::Show() const { | 460 void CSSSelector::Show() const { |
| 461 printf("\n******* CSSSelector::show(\"%s\") *******\n", | 461 printf("\n******* CSSSelector::Show(\"%s\") *******\n", |
| 462 SelectorText().Ascii().Data()); | 462 SelectorText().Ascii().Data()); |
| 463 Show(2); | 463 Show(2); |
| 464 printf("******* end *******\n"); | 464 printf("******* end *******\n"); |
| 465 } | 465 } |
| 466 #endif | 466 #endif |
| 467 | 467 |
| 468 CSSSelector::PseudoType CSSSelector::ParsePseudoType(const AtomicString& name, | 468 CSSSelector::PseudoType CSSSelector::ParsePseudoType(const AtomicString& name, |
| 469 bool has_arguments) { | 469 bool has_arguments) { |
| 470 PseudoType pseudo_type = NameToPseudoType(name, has_arguments); | 470 PseudoType pseudo_type = NameToPseudoType(name, has_arguments); |
| 471 if (pseudo_type != kPseudoUnknown) | 471 if (pseudo_type != kPseudoUnknown) |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 if (count < NthBValue()) | 1010 if (count < NthBValue()) |
| 1011 return false; | 1011 return false; |
| 1012 return (count - NthBValue()) % NthAValue() == 0; | 1012 return (count - NthBValue()) % NthAValue() == 0; |
| 1013 } | 1013 } |
| 1014 if (count > NthBValue()) | 1014 if (count > NthBValue()) |
| 1015 return false; | 1015 return false; |
| 1016 return (NthBValue() - count) % (-NthAValue()) == 0; | 1016 return (NthBValue() - count) % (-NthAValue()) == 0; |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 } // namespace blink | 1019 } // namespace blink |
| OLD | NEW |