| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 sel1 = sel1->tagHistory(); | 623 sel1 = sel1->tagHistory(); |
| 624 sel2 = sel2->tagHistory(); | 624 sel2 = sel2->tagHistory(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 if (sel1 || sel2) | 627 if (sel1 || sel2) |
| 628 return false; | 628 return false; |
| 629 | 629 |
| 630 return true; | 630 return true; |
| 631 } | 631 } |
| 632 | 632 |
| 633 static void serializeIdentifierOrAny(const AtomicString& identifier, |
| 634 StringBuilder& builder) { |
| 635 if (identifier != starAtom) |
| 636 serializeIdentifier(identifier, builder); |
| 637 else |
| 638 builder.append(identifier); |
| 639 } |
| 640 |
| 641 static void serializeNamespacePrefixIfNeeded(const AtomicString& prefix, |
| 642 StringBuilder& builder) { |
| 643 if (prefix.isNull()) |
| 644 return; |
| 645 serializeIdentifierOrAny(prefix, builder); |
| 646 builder.append('|'); |
| 647 } |
| 648 |
| 633 String CSSSelector::selectorText(const String& rightSide) const { | 649 String CSSSelector::selectorText(const String& rightSide) const { |
| 634 StringBuilder str; | 650 StringBuilder str; |
| 635 | 651 |
| 636 if (m_match == Tag && !m_tagIsImplicit) { | 652 if (m_match == Tag && !m_tagIsImplicit) { |
| 637 if (tagQName().prefix().isNull()) { | 653 serializeNamespacePrefixIfNeeded(tagQName().prefix(), str); |
| 638 str.append(tagQName().localName()); | 654 serializeIdentifierOrAny(tagQName().localName(), str); |
| 639 } else { | |
| 640 str.append(tagQName().prefix().getString()); | |
| 641 str.append('|'); | |
| 642 str.append(tagQName().localName()); | |
| 643 } | |
| 644 } | 655 } |
| 645 | 656 |
| 646 const CSSSelector* cs = this; | 657 const CSSSelector* cs = this; |
| 647 while (true) { | 658 while (true) { |
| 648 if (cs->m_match == Id) { | 659 if (cs->m_match == Id) { |
| 649 str.append('#'); | 660 str.append('#'); |
| 650 serializeIdentifier(cs->serializingValue(), str); | 661 serializeIdentifier(cs->serializingValue(), str); |
| 651 } else if (cs->m_match == Class) { | 662 } else if (cs->m_match == Class) { |
| 652 str.append('.'); | 663 str.append('.'); |
| 653 serializeIdentifier(cs->serializingValue(), str); | 664 serializeIdentifier(cs->serializingValue(), str); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 case PseudoAny: | 703 case PseudoAny: |
| 693 break; | 704 break; |
| 694 default: | 705 default: |
| 695 break; | 706 break; |
| 696 } | 707 } |
| 697 } else if (cs->m_match == PseudoElement) { | 708 } else if (cs->m_match == PseudoElement) { |
| 698 str.append("::"); | 709 str.append("::"); |
| 699 str.append(cs->serializingValue()); | 710 str.append(cs->serializingValue()); |
| 700 } else if (cs->isAttributeSelector()) { | 711 } else if (cs->isAttributeSelector()) { |
| 701 str.append('['); | 712 str.append('['); |
| 702 const AtomicString& prefix = cs->attribute().prefix(); | 713 serializeNamespacePrefixIfNeeded(cs->attribute().prefix(), str); |
| 703 if (!prefix.isNull()) { | 714 serializeIdentifier(cs->attribute().localName(), str); |
| 704 str.append(prefix); | |
| 705 str.append('|'); | |
| 706 } | |
| 707 str.append(cs->attribute().localName()); | |
| 708 switch (cs->m_match) { | 715 switch (cs->m_match) { |
| 709 case AttributeExact: | 716 case AttributeExact: |
| 710 str.append('='); | 717 str.append('='); |
| 711 break; | 718 break; |
| 712 case AttributeSet: | 719 case AttributeSet: |
| 713 // set has no operator or value, just the attrName | 720 // set has no operator or value, just the attrName |
| 714 str.append(']'); | 721 str.append(']'); |
| 715 break; | 722 break; |
| 716 case AttributeList: | 723 case AttributeList: |
| 717 str.append("~="); | 724 str.append("~="); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 if (count < nthBValue()) | 1014 if (count < nthBValue()) |
| 1008 return false; | 1015 return false; |
| 1009 return (count - nthBValue()) % nthAValue() == 0; | 1016 return (count - nthBValue()) % nthAValue() == 0; |
| 1010 } | 1017 } |
| 1011 if (count > nthBValue()) | 1018 if (count > nthBValue()) |
| 1012 return false; | 1019 return false; |
| 1013 return (nthBValue() - count) % (-nthAValue()) == 0; | 1020 return (nthBValue() - count) % (-nthAValue()) == 0; |
| 1014 } | 1021 } |
| 1015 | 1022 |
| 1016 } // namespace blink | 1023 } // namespace blink |
| OLD | NEW |