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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 case Set: | 74 case Set: |
75 case List: | 75 case List: |
76 case Hyphen: | 76 case Hyphen: |
77 case PseudoClass: | 77 case PseudoClass: |
78 case PseudoElement: | 78 case PseudoElement: |
79 case Contain: | 79 case Contain: |
80 case Begin: | 80 case Begin: |
81 case End: | 81 case End: |
82 // FIXME: PsuedoAny should base the specificity on the sub-selectors. | 82 // FIXME: PsuedoAny should base the specificity on the sub-selectors. |
83 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html | 83 // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html |
84 if (pseudoType() == PseudoNot) { | 84 if (pseudoType() == PseudoNot && selectorList()) |
85 ASSERT(selectorList()); | |
86 s += selectorList()->first()->specificityForOneSelector(); | 85 s += selectorList()->first()->specificityForOneSelector(); |
87 } else | 86 else |
88 s += 0x100; | 87 s += 0x100; |
89 case None: | 88 case None: |
90 break; | 89 break; |
91 } | 90 } |
92 return s; | 91 return s; |
93 } | 92 } |
94 | 93 |
95 unsigned CSSSelector::specificityForPage() const | 94 unsigned CSSSelector::specificityForPage() const |
96 { | 95 { |
97 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context | 96 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 serializeIdentifier(cs->value(), str); | 536 serializeIdentifier(cs->value(), str); |
538 } else if (cs->m_match == CSSSelector::Class) { | 537 } else if (cs->m_match == CSSSelector::Class) { |
539 str += "."; | 538 str += "."; |
540 serializeIdentifier(cs->value(), str); | 539 serializeIdentifier(cs->value(), str); |
541 } else if (cs->m_match == CSSSelector::PseudoClass || cs->m_match == CSS
Selector::PagePseudoClass) { | 540 } else if (cs->m_match == CSSSelector::PseudoClass || cs->m_match == CSS
Selector::PagePseudoClass) { |
542 str += ":"; | 541 str += ":"; |
543 str += cs->value(); | 542 str += cs->value(); |
544 | 543 |
545 switch (cs->pseudoType()) { | 544 switch (cs->pseudoType()) { |
546 case PseudoNot: | 545 case PseudoNot: |
547 ASSERT(cs->selectorList()); | 546 if (CSSSelectorList* selectorList = cs->selectorList()) |
548 str += cs->selectorList()->first()->selectorText(); | 547 str += selectorList->first()->selectorText(); |
549 str += ")"; | 548 str += ")"; |
550 break; | 549 break; |
551 case PseudoLang: | 550 case PseudoLang: |
552 case PseudoNthChild: | 551 case PseudoNthChild: |
553 case PseudoNthLastChild: | 552 case PseudoNthLastChild: |
554 case PseudoNthOfType: | 553 case PseudoNthOfType: |
555 case PseudoNthLastOfType: | 554 case PseudoNthLastOfType: |
556 str += cs->argument(); | 555 str += cs->argument(); |
557 str += ")"; | 556 str += ")"; |
558 break; | 557 break; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 return false; | 760 return false; |
762 return (count - m_b) % m_a == 0; | 761 return (count - m_b) % m_a == 0; |
763 } else { | 762 } else { |
764 if (count > m_b) | 763 if (count > m_b) |
765 return false; | 764 return false; |
766 return (m_b - count) % (-m_a) == 0; | 765 return (m_b - count) % (-m_a) == 0; |
767 } | 766 } |
768 } | 767 } |
769 | 768 |
770 } // namespace WebCore | 769 } // namespace WebCore |
OLD | NEW |