Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // https://dom.spec.whatwg.org/#concept-domtokenlist-validation | 63 // https://dom.spec.whatwg.org/#concept-domtokenlist-validation |
| 64 bool DOMTokenList::ValidateTokenValue(const AtomicString&, | 64 bool DOMTokenList::ValidateTokenValue(const AtomicString&, |
| 65 ExceptionState& exception_state) const { | 65 ExceptionState& exception_state) const { |
| 66 exception_state.ThrowTypeError("DOMTokenList has no supported tokens."); | 66 exception_state.ThrowTypeError("DOMTokenList has no supported tokens."); |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool DOMTokenList::contains(const AtomicString& token, | 70 bool DOMTokenList::contains(const AtomicString& token) const { |
| 71 ExceptionState& exception_state) const { | 71 // https://dom.spec.whatwg.org/#dom-domtokenlist-contains |
|
kochi
2017/05/23 04:15:01
nit: comment above function? (see line 63 for exam
tkent
2017/05/23 05:19:38
Done.
| |
| 72 if (!ValidateToken(token, exception_state)) | |
| 73 return false; | |
| 74 return ContainsInternal(token); | 72 return ContainsInternal(token); |
| 75 } | 73 } |
| 76 | 74 |
| 77 void DOMTokenList::add(const AtomicString& token, | 75 void DOMTokenList::add(const AtomicString& token, |
| 78 ExceptionState& exception_state) { | 76 ExceptionState& exception_state) { |
| 79 Vector<String> tokens; | 77 Vector<String> tokens; |
| 80 tokens.push_back(token.GetString()); | 78 tokens.push_back(token.GetString()); |
| 81 add(tokens, exception_state); | 79 add(tokens, exception_state); |
| 82 } | 80 } |
| 83 | 81 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 return tokens_.Contains(token); | 272 return tokens_.Contains(token); |
| 275 } | 273 } |
| 276 | 274 |
| 277 const AtomicString DOMTokenList::item(unsigned index) const { | 275 const AtomicString DOMTokenList::item(unsigned index) const { |
| 278 if (index >= length()) | 276 if (index >= length()) |
| 279 return AtomicString(); | 277 return AtomicString(); |
| 280 return tokens_[index]; | 278 return tokens_[index]; |
| 281 } | 279 } |
| 282 | 280 |
| 283 } // namespace blink | 281 } // namespace blink |
| OLD | NEW |