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

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

Issue 2349633002: Move PseudoId parsing out of CSSComputedStyleDeclaration constructor into CSSSelector (Closed)
Patch Set: Fix typo Created 4 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 | « third_party/WebKit/Source/core/css/CSSSelector.h ('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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return pseudoType; 461 return pseudoType;
462 462
463 if (name.startsWith("-webkit-")) 463 if (name.startsWith("-webkit-"))
464 return PseudoWebKitCustomElement; 464 return PseudoWebKitCustomElement;
465 if (name.startsWith("-internal-")) 465 if (name.startsWith("-internal-"))
466 return PseudoBlinkInternalElement; 466 return PseudoBlinkInternalElement;
467 467
468 return PseudoUnknown; 468 return PseudoUnknown;
469 } 469 }
470 470
471 PseudoId CSSSelector::parsePseudoId(const String& name)
472 {
473 unsigned nameWithoutColonsStart = name[0] == ':' ? (name[1] == ':' ? 2 : 1) : 0;
474 return pseudoId(parsePseudoType(
475 AtomicString(name.substring(nameWithoutColonsStart)), false));
476 }
477
471 void CSSSelector::updatePseudoType(const AtomicString& value, bool hasArguments) 478 void CSSSelector::updatePseudoType(const AtomicString& value, bool hasArguments)
472 { 479 {
473 ASSERT(m_match == PseudoClass || m_match == PseudoElement || m_match == Page PseudoClass); 480 ASSERT(m_match == PseudoClass || m_match == PseudoElement || m_match == Page PseudoClass);
474 481
475 setValue(value); 482 setValue(value);
476 setPseudoType(parsePseudoType(value, hasArguments)); 483 setPseudoType(parsePseudoType(value, hasArguments));
477 484
478 switch (m_pseudoType) { 485 switch (m_pseudoType) {
479 case PseudoAfter: 486 case PseudoAfter:
480 case PseudoBefore: 487 case PseudoBefore:
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 if (count < nthBValue()) 986 if (count < nthBValue())
980 return false; 987 return false;
981 return (count - nthBValue()) % nthAValue() == 0; 988 return (count - nthBValue()) % nthAValue() == 0;
982 } 989 }
983 if (count > nthBValue()) 990 if (count > nthBValue())
984 return false; 991 return false;
985 return (nthBValue() - count) % (-nthAValue()) == 0; 992 return (nthBValue() - count) % (-nthAValue()) == 0;
986 } 993 }
987 994
988 } // namespace blink 995 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698