| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ASSERT(!isActiveInsertionPoint(node.get())); | 42 ASSERT(!isActiveInsertionPoint(node.get())); |
| 43 size_t size = m_nodes.size(); | 43 size_t size = m_nodes.size(); |
| 44 m_indices.set(node.get(), size); | 44 m_indices.set(node.get(), size); |
| 45 m_nodes.append(node); | 45 m_nodes.append(node); |
| 46 } | 46 } |
| 47 | 47 |
| 48 size_t ContentDistribution::find(const Node* node) const | 48 size_t ContentDistribution::find(const Node* node) const |
| 49 { | 49 { |
| 50 HashMap<const Node*, size_t>::const_iterator it = m_indices.find(node); | 50 HashMap<const Node*, size_t>::const_iterator it = m_indices.find(node); |
| 51 if (it == m_indices.end()) | 51 if (it == m_indices.end()) |
| 52 return notFound; | 52 return kNotFound; |
| 53 | 53 |
| 54 return it.get()->value; | 54 return it.get()->value; |
| 55 } | 55 } |
| 56 | 56 |
| 57 Node* ContentDistribution::nextTo(const Node* node) const | 57 Node* ContentDistribution::nextTo(const Node* node) const |
| 58 { | 58 { |
| 59 size_t index = find(node); | 59 size_t index = find(node); |
| 60 if (index == notFound || index + 1 == size()) | 60 if (index == kNotFound || index + 1 == size()) |
| 61 return 0; | 61 return 0; |
| 62 return at(index + 1).get(); | 62 return at(index + 1).get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 Node* ContentDistribution::previousTo(const Node* node) const | 65 Node* ContentDistribution::previousTo(const Node* node) const |
| 66 { | 66 { |
| 67 size_t index = find(node); | 67 size_t index = find(node); |
| 68 if (index == notFound || !index) | 68 if (index == kNotFound || !index) |
| 69 return 0; | 69 return 0; |
| 70 return at(index - 1).get(); | 70 return at(index - 1).get(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace WebCore | 73 } // namespace WebCore |
| OLD | NEW |