1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23 #include "third_party/blink/renderer/core/events/mutation_event.h"
24
25 #include "third_party/blink/renderer/core/event_interface_names.h"
26
27 namespace blink {
28
MutationEvent()29 MutationEvent::MutationEvent() : attr_change_(0) {}
30
MutationEvent(const AtomicString & type,Bubbles bubbles,Cancelable cancelable,Node * related_node,const String & prev_value,const String & new_value,const String & attr_name,uint16_t attr_change)31 MutationEvent::MutationEvent(const AtomicString& type,
32 Bubbles bubbles,
33 Cancelable cancelable,
34 Node* related_node,
35 const String& prev_value,
36 const String& new_value,
37 const String& attr_name,
38 uint16_t attr_change)
39 : Event(type, bubbles, cancelable),
40 related_node_(related_node),
41 prev_value_(prev_value),
42 new_value_(new_value),
43 attr_name_(attr_name),
44 attr_change_(attr_change) {}
45
46 MutationEvent::~MutationEvent() = default;
47
initMutationEvent(const AtomicString & type,bool bubbles,bool cancelable,Node * related_node,const String & prev_value,const String & new_value,const String & attr_name,uint16_t attr_change)48 void MutationEvent::initMutationEvent(const AtomicString& type,
49 bool bubbles,
50 bool cancelable,
51 Node* related_node,
52 const String& prev_value,
53 const String& new_value,
54 const String& attr_name,
55 uint16_t attr_change) {
56 if (IsBeingDispatched())
57 return;
58
59 initEvent(type, bubbles, cancelable);
60
61 related_node_ = related_node;
62 prev_value_ = prev_value;
63 new_value_ = new_value;
64 attr_name_ = attr_name;
65 attr_change_ = attr_change;
66 }
67
InterfaceName() const68 const AtomicString& MutationEvent::InterfaceName() const {
69 return event_interface_names::kMutationEvent;
70 }
71
Trace(Visitor * visitor)72 void MutationEvent::Trace(Visitor* visitor) {
73 visitor->Trace(related_node_);
74 Event::Trace(visitor);
75 }
76
77 } // namespace blink
78