OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 ChildListMutationAccumulator::~ChildListMutationAccumulator() | 58 ChildListMutationAccumulator::~ChildListMutationAccumulator() |
59 { | 59 { |
60 if (!isEmpty()) | 60 if (!isEmpty()) |
61 enqueueMutationRecord(); | 61 enqueueMutationRecord(); |
62 accumulatorMap().remove(m_target.get()); | 62 accumulatorMap().remove(m_target.get()); |
63 } | 63 } |
64 | 64 |
65 PassRefPtr<ChildListMutationAccumulator> ChildListMutationAccumulator::getOrCrea
te(Node* target) | 65 PassRefPtr<ChildListMutationAccumulator> ChildListMutationAccumulator::getOrCrea
te(Node& target) |
66 { | 66 { |
67 AccumulatorMap::AddResult result = accumulatorMap().add(target, 0); | 67 AccumulatorMap::AddResult result = accumulatorMap().add(&target, 0); |
68 RefPtr<ChildListMutationAccumulator> accumulator; | 68 RefPtr<ChildListMutationAccumulator> accumulator; |
69 if (!result.isNewEntry) | 69 if (!result.isNewEntry) |
70 accumulator = result.iterator->value; | 70 accumulator = result.iterator->value; |
71 else { | 71 else { |
72 accumulator = adoptRef(new ChildListMutationAccumulator(target, Mutation
ObserverInterestGroup::createForChildListMutation(target))); | 72 accumulator = adoptRef(new ChildListMutationAccumulator(PassRefPtr<Node>
(target), MutationObserverInterestGroup::createForChildListMutation(target))); |
73 result.iterator->value = accumulator.get(); | 73 result.iterator->value = accumulator.get(); |
74 } | 74 } |
75 return accumulator.release(); | 75 return accumulator.release(); |
76 } | 76 } |
77 | 77 |
78 inline bool ChildListMutationAccumulator::isAddedNodeInOrder(Node* child) | 78 inline bool ChildListMutationAccumulator::isAddedNodeInOrder(Node* child) |
79 { | 79 { |
80 return isEmpty() || (m_lastAdded == child->previousSibling() && m_nextSiblin
g == child->nextSibling()); | 80 return isEmpty() || (m_lastAdded == child->previousSibling() && m_nextSiblin
g == child->nextSibling()); |
81 } | 81 } |
82 | 82 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (result) { | 142 if (result) { |
143 ASSERT(!m_previousSibling); | 143 ASSERT(!m_previousSibling); |
144 ASSERT(!m_nextSibling); | 144 ASSERT(!m_nextSibling); |
145 ASSERT(!m_lastAdded); | 145 ASSERT(!m_lastAdded); |
146 } | 146 } |
147 #endif | 147 #endif |
148 return result; | 148 return result; |
149 } | 149 } |
150 | 150 |
151 } // namespace WebCore | 151 } // namespace WebCore |
OLD | NEW |