| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool childListValue = false; | 112 bool childListValue = false; |
| 113 if (optionsDictionary.get("childList", childListValue) && childListValue) | 113 if (optionsDictionary.get("childList", childListValue) && childListValue) |
| 114 options |= ChildList; | 114 options |= ChildList; |
| 115 | 115 |
| 116 bool subtreeValue = false; | 116 bool subtreeValue = false; |
| 117 if (optionsDictionary.get("subtree", subtreeValue) && subtreeValue) | 117 if (optionsDictionary.get("subtree", subtreeValue) && subtreeValue) |
| 118 options |= Subtree; | 118 options |= Subtree; |
| 119 | 119 |
| 120 if (!(options & Attributes)) { | 120 if (!(options & Attributes)) { |
| 121 if (options & AttributeOldValue) { | 121 if (options & AttributeOldValue) { |
| 122 exceptionState.throwDOMException(TypeError, "The options object may
only set 'attributeOldValue' to true when 'attributes' is true or not present.")
; | 122 exceptionState.throwTypeError("The options object may only set 'attr
ibuteOldValue' to true when 'attributes' is true or not present."); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 if (options & AttributeFilter) { | 125 if (options & AttributeFilter) { |
| 126 exceptionState.throwDOMException(TypeError, "The options object may
only set 'attributeFilter' when 'attributes' is true or not present."); | 126 exceptionState.throwTypeError("The options object may only set 'attr
ibuteFilter' when 'attributes' is true or not present."); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 if (!((options & CharacterData) || !(options & CharacterDataOldValue))) { | 130 if (!((options & CharacterData) || !(options & CharacterDataOldValue))) { |
| 131 exceptionState.throwDOMException(TypeError, "The options object may only
set 'characterDataOldValue' to true when 'characterData' is true or not present
."); | 131 exceptionState.throwTypeError("The options object may only set 'characte
rDataOldValue' to true when 'characterData' is true or not present."); |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (!(options & (Attributes | CharacterData | ChildList))) { | 135 if (!(options & (Attributes | CharacterData | ChildList))) { |
| 136 exceptionState.throwDOMException(TypeError, "The options object must set
at least one of 'attributes', 'characterData', or 'childList' to true."); | 136 exceptionState.throwTypeError("The options object must set at least one
of 'attributes', 'characterData', or 'childList' to true."); |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 | 139 |
| 140 node->registerMutationObserver(this, options, attributeFilter); | 140 node->registerMutationObserver(this, options, attributeFilter); |
| 141 } | 141 } |
| 142 | 142 |
| 143 Vector<RefPtr<MutationRecord> > MutationObserver::takeRecords() | 143 Vector<RefPtr<MutationRecord> > MutationObserver::takeRecords() |
| 144 { | 144 { |
| 145 Vector<RefPtr<MutationRecord> > records; | 145 Vector<RefPtr<MutationRecord> > records; |
| 146 records.swap(m_records); | 146 records.swap(m_records); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 std::sort(observers.begin(), observers.end(), ObserverLessThan()); | 268 std::sort(observers.begin(), observers.end(), ObserverLessThan()); |
| 269 for (size_t i = 0; i < observers.size(); ++i) { | 269 for (size_t i = 0; i < observers.size(); ++i) { |
| 270 if (observers[i]->canDeliver()) | 270 if (observers[i]->canDeliver()) |
| 271 observers[i]->deliver(); | 271 observers[i]->deliver(); |
| 272 else | 272 else |
| 273 suspendedMutationObservers().add(observers[i]); | 273 suspendedMutationObservers().add(observers[i]); |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace WebCore | 277 } // namespace WebCore |
| OLD | NEW |