Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: Source/core/css/CSSSelector.cpp

Issue 23597051: Use correct pseudo type for page selector specificity. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/printing/page-rule-specificity-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 unsigned CSSSelector::specificityForPage() const 120 unsigned CSSSelector::specificityForPage() const
121 { 121 {
122 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context 122 // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context
123 unsigned s = 0; 123 unsigned s = 0;
124 124
125 for (const CSSSelector* component = this; component; component = component-> tagHistory()) { 125 for (const CSSSelector* component = this; component; component = component-> tagHistory()) {
126 switch (component->m_match) { 126 switch (component->m_match) {
127 case Tag: 127 case Tag:
128 s += tagQName().localName() == starAtom ? 0 : 4; 128 s += tagQName().localName() == starAtom ? 0 : 4;
129 break; 129 break;
130 case PseudoClass: 130 case PagePseudoClass:
131 switch (component->pseudoType()) { 131 switch (component->pseudoType()) {
132 case PseudoFirstPage: 132 case PseudoFirstPage:
133 s += 2; 133 s += 2;
134 break; 134 break;
135 case PseudoLeftPage: 135 case PseudoLeftPage:
136 case PseudoRightPage: 136 case PseudoRightPage:
137 s += 1; 137 s += 1;
138 break; 138 break;
139 case PseudoNotParsed: 139 case PseudoNotParsed:
140 break; 140 break;
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 return false; 922 return false;
923 return (count - m_b) % m_a == 0; 923 return (count - m_b) % m_a == 0;
924 } else { 924 } else {
925 if (count > m_b) 925 if (count > m_b)
926 return false; 926 return false;
927 return (m_b - count) % (-m_a) == 0; 927 return (m_b - count) % (-m_a) == 0;
928 } 928 }
929 } 929 }
930 930
931 } // namespace WebCore 931 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/printing/page-rule-specificity-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698