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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 const NameToPseudoStruct* pseudoTypeMapEnd; | 396 const NameToPseudoStruct* pseudoTypeMapEnd; |
397 if (hasArguments) { | 397 if (hasArguments) { |
398 pseudoTypeMap = pseudoTypeWithArgumentsMap; | 398 pseudoTypeMap = pseudoTypeWithArgumentsMap; |
399 pseudoTypeMapEnd = pseudoTypeWithArgumentsMap + WTF_ARRAY_LENGTH(pseudoT
ypeWithArgumentsMap); | 399 pseudoTypeMapEnd = pseudoTypeWithArgumentsMap + WTF_ARRAY_LENGTH(pseudoT
ypeWithArgumentsMap); |
400 } else { | 400 } else { |
401 pseudoTypeMap = pseudoTypeWithoutArgumentsMap; | 401 pseudoTypeMap = pseudoTypeWithoutArgumentsMap; |
402 pseudoTypeMapEnd = pseudoTypeWithoutArgumentsMap + WTF_ARRAY_LENGTH(pseu
doTypeWithoutArgumentsMap); | 402 pseudoTypeMapEnd = pseudoTypeWithoutArgumentsMap + WTF_ARRAY_LENGTH(pseu
doTypeWithoutArgumentsMap); |
403 } | 403 } |
404 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown }; | 404 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown }; |
405 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType
MapEnd, dummyKey, NameToPseudoCompare(name)); | 405 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType
MapEnd, dummyKey, NameToPseudoCompare(name)); |
406 if (match == pseudoTypeMapEnd || match->string != name.string()) | 406 if (match == pseudoTypeMapEnd || match->string != name.getString()) |
407 return CSSSelector::PseudoUnknown; | 407 return CSSSelector::PseudoUnknown; |
408 | 408 |
409 return static_cast<CSSSelector::PseudoType>(match->type); | 409 return static_cast<CSSSelector::PseudoType>(match->type); |
410 } | 410 } |
411 | 411 |
412 #ifndef NDEBUG | 412 #ifndef NDEBUG |
413 void CSSSelector::show(int indent) const | 413 void CSSSelector::show(int indent) const |
414 { | 414 { |
415 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data())
; | 415 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data())
; |
416 printf("%*sm_match: %d\n", indent, "", m_match); | 416 printf("%*sm_match: %d\n", indent, "", m_match); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 588 } |
589 | 589 |
590 String CSSSelector::selectorText(const String& rightSide) const | 590 String CSSSelector::selectorText(const String& rightSide) const |
591 { | 591 { |
592 StringBuilder str; | 592 StringBuilder str; |
593 | 593 |
594 if (m_match == Tag && !m_tagIsImplicit) { | 594 if (m_match == Tag && !m_tagIsImplicit) { |
595 if (tagQName().prefix().isNull()) { | 595 if (tagQName().prefix().isNull()) { |
596 str.append(tagQName().localName()); | 596 str.append(tagQName().localName()); |
597 } else { | 597 } else { |
598 str.append(tagQName().prefix().string()); | 598 str.append(tagQName().prefix().getString()); |
599 str.append('|'); | 599 str.append('|'); |
600 str.append(tagQName().localName()); | 600 str.append(tagQName().localName()); |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 const CSSSelector* cs = this; | 604 const CSSSelector* cs = this; |
605 while (true) { | 605 while (true) { |
606 if (cs->m_match == Id) { | 606 if (cs->m_match == Id) { |
607 str.append('#'); | 607 str.append('#'); |
608 serializeIdentifier(cs->serializingValue(), str); | 608 serializeIdentifier(cs->serializingValue(), str); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 if (count < nthBValue()) | 914 if (count < nthBValue()) |
915 return false; | 915 return false; |
916 return (count - nthBValue()) % nthAValue() == 0; | 916 return (count - nthBValue()) % nthAValue() == 0; |
917 } | 917 } |
918 if (count > nthBValue()) | 918 if (count > nthBValue()) |
919 return false; | 919 return false; |
920 return (nthBValue() - count) % (-nthAValue()) == 0; | 920 return (nthBValue() - count) % (-nthAValue()) == 0; |
921 } | 921 } |
922 | 922 |
923 } // namespace blink | 923 } // namespace blink |
OLD | NEW |