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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 m_data.m_rareData->m_bits.m_nth.m_a = a; | 874 m_data.m_rareData->m_bits.m_nth.m_a = a; |
875 m_data.m_rareData->m_bits.m_nth.m_b = b; | 875 m_data.m_rareData->m_bits.m_nth.m_b = b; |
876 } | 876 } |
877 | 877 |
878 bool CSSSelector::matchNth(int count) const | 878 bool CSSSelector::matchNth(int count) const |
879 { | 879 { |
880 ASSERT(m_hasRareData); | 880 ASSERT(m_hasRareData); |
881 return m_data.m_rareData->matchNth(count); | 881 return m_data.m_rareData->matchNth(count); |
882 } | 882 } |
883 | 883 |
| 884 bool CSSSelector::matchesPseudoElement() const |
| 885 { |
| 886 for (const CSSSelector* current = this; current; current = current->tagHisto
ry()) { |
| 887 if (current->match() == PseudoElement) |
| 888 return true; |
| 889 if (current->relation() != SubSelector) |
| 890 return false; |
| 891 } |
| 892 return false; |
| 893 } |
| 894 |
884 CSSSelector::RareData::RareData(const AtomicString& value) | 895 CSSSelector::RareData::RareData(const AtomicString& value) |
885 : m_matchingValue(value) | 896 : m_matchingValue(value) |
886 , m_serializingValue(value) | 897 , m_serializingValue(value) |
887 , m_bits() | 898 , m_bits() |
888 , m_attribute(anyQName()) | 899 , m_attribute(anyQName()) |
889 , m_argument(nullAtom) | 900 , m_argument(nullAtom) |
890 { | 901 { |
891 } | 902 } |
892 | 903 |
893 CSSSelector::RareData::~RareData() | 904 CSSSelector::RareData::~RareData() |
894 { | 905 { |
895 } | 906 } |
896 | 907 |
897 // a helper function for checking nth-arguments | 908 // a helper function for checking nth-arguments |
898 bool CSSSelector::RareData::matchNth(int count) | 909 bool CSSSelector::RareData::matchNth(int count) |
899 { | 910 { |
900 if (!nthAValue()) | 911 if (!nthAValue()) |
901 return count == nthBValue(); | 912 return count == nthBValue(); |
902 if (nthAValue() > 0) { | 913 if (nthAValue() > 0) { |
903 if (count < nthBValue()) | 914 if (count < nthBValue()) |
904 return false; | 915 return false; |
905 return (count - nthBValue()) % nthAValue() == 0; | 916 return (count - nthBValue()) % nthAValue() == 0; |
906 } | 917 } |
907 if (count > nthBValue()) | 918 if (count > nthBValue()) |
908 return false; | 919 return false; |
909 return (nthBValue() - count) % (-nthAValue()) == 0; | 920 return (nthBValue() - count) % (-nthAValue()) == 0; |
910 } | 921 } |
911 | 922 |
912 } // namespace blink | 923 } // namespace blink |
OLD | NEW |