| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } else { | 76 } else { |
| 77 accumulator = new ChildListMutationAccumulator( | 77 accumulator = new ChildListMutationAccumulator( |
| 78 &target, | 78 &target, |
| 79 MutationObserverInterestGroup::createForChildListMutation(target)); | 79 MutationObserverInterestGroup::createForChildListMutation(target)); |
| 80 result.storedValue->value = accumulator; | 80 result.storedValue->value = accumulator; |
| 81 } | 81 } |
| 82 return accumulator; | 82 return accumulator; |
| 83 } | 83 } |
| 84 | 84 |
| 85 inline bool ChildListMutationAccumulator::isAddedNodeInOrder(Node* child) { | 85 inline bool ChildListMutationAccumulator::isAddedNodeInOrder(Node* child) { |
| 86 return isEmpty() || (m_lastAdded == child->previousSibling() && | 86 return isEmpty() || |
| 87 m_nextSibling == child->nextSibling()); | 87 (m_lastAdded == child->previousSibling() && |
| 88 m_nextSibling == child->nextSibling()); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void ChildListMutationAccumulator::childAdded(Node* child) { | 91 void ChildListMutationAccumulator::childAdded(Node* child) { |
| 91 DCHECK(hasObservers()); | 92 DCHECK(hasObservers()); |
| 92 | 93 |
| 93 if (!isAddedNodeInOrder(child)) | 94 if (!isAddedNodeInOrder(child)) |
| 94 enqueueMutationRecord(); | 95 enqueueMutationRecord(); |
| 95 | 96 |
| 96 if (isEmpty()) { | 97 if (isEmpty()) { |
| 97 m_previousSibling = child->previousSibling(); | 98 m_previousSibling = child->previousSibling(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 visitor->trace(m_target); | 154 visitor->trace(m_target); |
| 154 visitor->trace(m_removedNodes); | 155 visitor->trace(m_removedNodes); |
| 155 visitor->trace(m_addedNodes); | 156 visitor->trace(m_addedNodes); |
| 156 visitor->trace(m_previousSibling); | 157 visitor->trace(m_previousSibling); |
| 157 visitor->trace(m_nextSibling); | 158 visitor->trace(m_nextSibling); |
| 158 visitor->trace(m_lastAdded); | 159 visitor->trace(m_lastAdded); |
| 159 visitor->trace(m_observers); | 160 visitor->trace(m_observers); |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |