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

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

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSParser-in.cpp ('k') | Source/core/css/CSSSelectorList.h » ('j') | 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 m_a = 0; 882 m_a = 0;
883 m_b = 0; 883 m_b = 0;
884 if (argument == "odd") { 884 if (argument == "odd") {
885 m_a = 2; 885 m_a = 2;
886 m_b = 1; 886 m_b = 1;
887 } else if (argument == "even") { 887 } else if (argument == "even") {
888 m_a = 2; 888 m_a = 2;
889 m_b = 0; 889 m_b = 0;
890 } else { 890 } else {
891 size_t n = argument.find('n'); 891 size_t n = argument.find('n');
892 if (n != notFound) { 892 if (n != kNotFound) {
893 if (argument[0] == '-') { 893 if (argument[0] == '-') {
894 if (n == 1) 894 if (n == 1)
895 m_a = -1; // -n == -1n 895 m_a = -1; // -n == -1n
896 else 896 else
897 m_a = argument.substring(0, n).toInt(); 897 m_a = argument.substring(0, n).toInt();
898 } else if (!n) 898 } else if (!n)
899 m_a = 1; // n == 1n 899 m_a = 1; // n == 1n
900 else 900 else
901 m_a = argument.substring(0, n).toInt(); 901 m_a = argument.substring(0, n).toInt();
902 902
903 size_t p = argument.find('+', n); 903 size_t p = argument.find('+', n);
904 if (p != notFound) 904 if (p != kNotFound)
905 m_b = argument.substring(p + 1, argument.length() - p - 1).toInt (); 905 m_b = argument.substring(p + 1, argument.length() - p - 1).toInt ();
906 else { 906 else {
907 p = argument.find('-', n); 907 p = argument.find('-', n);
908 if (p != notFound) 908 if (p != kNotFound)
909 m_b = -argument.substring(p + 1, argument.length() - p - 1). toInt(); 909 m_b = -argument.substring(p + 1, argument.length() - p - 1). toInt();
910 } 910 }
911 } else 911 } else
912 m_b = argument.toInt(); 912 m_b = argument.toInt();
913 } 913 }
914 return true; 914 return true;
915 } 915 }
916 916
917 // a helper function for checking nth-arguments 917 // a helper function for checking nth-arguments
918 bool CSSSelector::RareData::matchNth(int count) 918 bool CSSSelector::RareData::matchNth(int count)
919 { 919 {
920 if (!m_a) 920 if (!m_a)
921 return count == m_b; 921 return count == m_b;
922 else if (m_a > 0) { 922 else if (m_a > 0) {
923 if (count < m_b) 923 if (count < m_b)
924 return false; 924 return false;
925 return (count - m_b) % m_a == 0; 925 return (count - m_b) % m_a == 0;
926 } else { 926 } else {
927 if (count > m_b) 927 if (count > m_b)
928 return false; 928 return false;
929 return (m_b - count) % (-m_a) == 0; 929 return (m_b - count) % (-m_a) == 0;
930 } 930 }
931 } 931 }
932 932
933 } // namespace WebCore 933 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser-in.cpp ('k') | Source/core/css/CSSSelectorList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698