Chromium Code Reviews

Side by Side Diff: Source/core/dom/MutationObserver.cpp

Issue 534133002: [WIP] bindings: Introduce PropertyBag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...)
78 void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionState& exceptionState) 78 void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionState& exceptionState)
79 { 79 {
80 if (!node) { 80 if (!node) {
81 exceptionState.throwDOMException(NotFoundError, "The provided node was n ull."); 81 exceptionState.throwDOMException(NotFoundError, "The provided node was n ull.");
82 return; 82 return;
83 } 83 }
84 84
85 MutationObserverOptions options = 0; 85 MutationObserverOptions options = 0;
86 86
87 bool attributeOldValue = false; 87 bool attributeOldValue = false;
88 bool attributeOldValuePresent = DictionaryHelper::get(optionsDictionary, "at tributeOldValue", attributeOldValue); 88 bool attributeOldValuePresent = optionsDictionary.get("attributeOldValue", a ttributeOldValue);
89 if (attributeOldValue) 89 if (attributeOldValue)
90 options |= AttributeOldValue; 90 options |= AttributeOldValue;
91 91
92 HashSet<AtomicString> attributeFilter; 92 HashSet<AtomicString> attributeFilter;
93 bool attributeFilterPresent = DictionaryHelper::get(optionsDictionary, "attr ibuteFilter", attributeFilter); 93 bool attributeFilterPresent = optionsDictionary.get("attributeFilter", attri buteFilter);
94 if (attributeFilterPresent) 94 if (attributeFilterPresent)
95 options |= AttributeFilter; 95 options |= AttributeFilter;
96 96
97 bool attributes = false; 97 bool attributes = false;
98 bool attributesPresent = DictionaryHelper::get(optionsDictionary, "attribute s", attributes); 98 bool attributesPresent = optionsDictionary.get("attributes", attributes);
99 if (attributes || (!attributesPresent && (attributeOldValuePresent || attrib uteFilterPresent))) 99 if (attributes || (!attributesPresent && (attributeOldValuePresent || attrib uteFilterPresent)))
100 options |= Attributes; 100 options |= Attributes;
101 101
102 bool characterDataOldValue = false; 102 bool characterDataOldValue = false;
103 bool characterDataOldValuePresent = DictionaryHelper::get(optionsDictionary, "characterDataOldValue", characterDataOldValue); 103 bool characterDataOldValuePresent = optionsDictionary.get("characterDataOldV alue", characterDataOldValue);
104 if (characterDataOldValue) 104 if (characterDataOldValue)
105 options |= CharacterDataOldValue; 105 options |= CharacterDataOldValue;
106 106
107 bool characterData = false; 107 bool characterData = false;
108 bool characterDataPresent = DictionaryHelper::get(optionsDictionary, "charac terData", characterData); 108 bool characterDataPresent = optionsDictionary.get("characterData", character Data);
109 if (characterData || (!characterDataPresent && characterDataOldValuePresent) ) 109 if (characterData || (!characterDataPresent && characterDataOldValuePresent) )
110 options |= CharacterData; 110 options |= CharacterData;
111 111
112 bool childListValue = false; 112 bool childListValue = false;
113 if (DictionaryHelper::get(optionsDictionary, "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 (DictionaryHelper::get(optionsDictionary, "subtree", subtreeValue) && sub treeValue) 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.throwTypeError("The options object may only set 'attr ibuteOldValue' 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.throwTypeError("The options object may only set 'attr ibuteFilter' 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;
(...skipping 147 matching lines...)
275 275
276 void MutationObserver::trace(Visitor* visitor) 276 void MutationObserver::trace(Visitor* visitor)
277 { 277 {
278 #if ENABLE(OILPAN) 278 #if ENABLE(OILPAN)
279 visitor->trace(m_records); 279 visitor->trace(m_records);
280 visitor->trace(m_registrations); 280 visitor->trace(m_registrations);
281 #endif 281 #endif
282 } 282 }
283 283
284 } // namespace blink 284 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine