| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) | 2 * Copyright (C) 2007 David Smith (catfish.man@gmail.com) |
| 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 unsigned start = 0; | 57 unsigned start = 0; |
| 58 while (true) { | 58 while (true) { |
| 59 while (start < length && isHTMLSpace<CharacterType>(characters[start])) | 59 while (start < length && isHTMLSpace<CharacterType>(characters[start])) |
| 60 ++start; | 60 ++start; |
| 61 if (start >= length) | 61 if (start >= length) |
| 62 break; | 62 break; |
| 63 unsigned end = start + 1; | 63 unsigned end = start + 1; |
| 64 while (end < length && isNotHTMLSpace<CharacterType>(characters[end])) | 64 while (end < length && isNotHTMLSpace<CharacterType>(characters[end])) |
| 65 ++end; | 65 ++end; |
| 66 | 66 |
| 67 m_vector.append(AtomicString(characters + start, end - start)); | 67 m_vector.push_back(AtomicString(characters + start, end - start)); |
| 68 | 68 |
| 69 start = end + 1; | 69 start = end + 1; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SpaceSplitString::Data::createVector(const String& string) { | 73 void SpaceSplitString::Data::createVector(const String& string) { |
| 74 unsigned length = string.length(); | 74 unsigned length = string.length(); |
| 75 | 75 |
| 76 if (string.is8Bit()) { | 76 if (string.is8Bit()) { |
| 77 createVector(string.characters8(), length); | 77 createVector(string.characters8(), length); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 } | 96 } |
| 97 if (j == thisSize) | 97 if (j == thisSize) |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SpaceSplitString::Data::add(const AtomicString& string) { | 103 void SpaceSplitString::Data::add(const AtomicString& string) { |
| 104 DCHECK(hasOneRef()); | 104 DCHECK(hasOneRef()); |
| 105 DCHECK(!contains(string)); | 105 DCHECK(!contains(string)); |
| 106 m_vector.append(string); | 106 m_vector.push_back(string); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void SpaceSplitString::Data::remove(unsigned index) { | 109 void SpaceSplitString::Data::remove(unsigned index) { |
| 110 DCHECK(hasOneRef()); | 110 DCHECK(hasOneRef()); |
| 111 m_vector.remove(index); | 111 m_vector.remove(index); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SpaceSplitString::add(const AtomicString& string) { | 114 void SpaceSplitString::add(const AtomicString& string) { |
| 115 // FIXME: add() does not allow duplicates but createVector() does. | 115 // FIXME: add() does not allow duplicates but createVector() does. |
| 116 if (contains(string)) | 116 if (contains(string)) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 createVector(string); | 185 createVector(string); |
| 186 } | 186 } |
| 187 | 187 |
| 188 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) | 188 SpaceSplitString::Data::Data(const SpaceSplitString::Data& other) |
| 189 : RefCounted<Data>(), m_vector(other.m_vector) { | 189 : RefCounted<Data>(), m_vector(other.m_vector) { |
| 190 // Note that we don't copy m_keyString to indicate to the destructor that | 190 // Note that we don't copy m_keyString to indicate to the destructor that |
| 191 // there's nothing to be removed from the sharedDataMap(). | 191 // there's nothing to be removed from the sharedDataMap(). |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace blink | 194 } // namespace blink |
| OLD | NEW |