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

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

Issue 2825993002: Prevent integer overflows in ANPlusB handling (Closed)
Patch Set: Remove incorrect test - testing input as -1 for unsigned doesn't make sense Created 3 years, 7 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 | « no previous file | third_party/WebKit/Source/core/css/CSSSelector.cpp » ('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 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void Show(int indent) const; 277 void Show(int indent) const;
278 #endif 278 #endif
279 279
280 bool IsASCIILower(const AtomicString& value); 280 bool IsASCIILower(const AtomicString& value);
281 void SetValue(const AtomicString&, bool match_lower_case); 281 void SetValue(const AtomicString&, bool match_lower_case);
282 void SetAttribute(const QualifiedName&, AttributeMatchType); 282 void SetAttribute(const QualifiedName&, AttributeMatchType);
283 void SetArgument(const AtomicString&); 283 void SetArgument(const AtomicString&);
284 void SetSelectorList(std::unique_ptr<CSSSelectorList>); 284 void SetSelectorList(std::unique_ptr<CSSSelectorList>);
285 285
286 void SetNth(int a, int b); 286 void SetNth(int a, int b);
287 bool MatchNth(int count) const; 287 bool MatchNth(unsigned count) const;
288 288
289 bool IsAdjacentSelector() const { 289 bool IsAdjacentSelector() const {
290 return relation_ == kDirectAdjacent || relation_ == kIndirectAdjacent; 290 return relation_ == kDirectAdjacent || relation_ == kIndirectAdjacent;
291 } 291 }
292 bool IsShadowSelector() const { 292 bool IsShadowSelector() const {
293 return relation_ == kShadowPseudo || relation_ == kShadowDeep; 293 return relation_ == kShadowPseudo || relation_ == kShadowDeep;
294 } 294 }
295 bool IsAttributeSelector() const { 295 bool IsAttributeSelector() const {
296 return match_ >= kFirstAttributeSelectorMatch; 296 return match_ >= kFirstAttributeSelectorMatch;
297 } 297 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 // Hide. 372 // Hide.
373 CSSSelector& operator=(const CSSSelector&); 373 CSSSelector& operator=(const CSSSelector&);
374 374
375 struct RareData : public RefCounted<RareData> { 375 struct RareData : public RefCounted<RareData> {
376 static PassRefPtr<RareData> Create(const AtomicString& value) { 376 static PassRefPtr<RareData> Create(const AtomicString& value) {
377 return AdoptRef(new RareData(value)); 377 return AdoptRef(new RareData(value));
378 } 378 }
379 ~RareData(); 379 ~RareData();
380 380
381 bool MatchNth(int count); 381 bool MatchNth(unsigned count);
382 int NthAValue() const { return bits_.nth_.a_; } 382 int NthAValue() const { return bits_.nth_.a_; }
383 int NthBValue() const { return bits_.nth_.b_; } 383 int NthBValue() const { return bits_.nth_.b_; }
384 384
385 AtomicString matching_value_; 385 AtomicString matching_value_;
386 AtomicString serializing_value_; 386 AtomicString serializing_value_;
387 union { 387 union {
388 struct { 388 struct {
389 int a_; // Used for :nth-* 389 int a_; // Used for :nth-*
390 int b_; // Used for :nth-* 390 int b_; // Used for :nth-*
391 } nth_; 391 } nth_;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 537 }
538 538
539 inline bool CSSSelector::IsIdClassOrAttributeSelector() const { 539 inline bool CSSSelector::IsIdClassOrAttributeSelector() const {
540 return IsAttributeSelector() || Match() == CSSSelector::kId || 540 return IsAttributeSelector() || Match() == CSSSelector::kId ||
541 Match() == CSSSelector::kClass; 541 Match() == CSSSelector::kClass;
542 } 542 }
543 543
544 } // namespace blink 544 } // namespace blink
545 545
546 #endif // CSSSelector_h 546 #endif // CSSSelector_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSSelector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698