| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/QualifiedName.h" | 37 #include "core/dom/QualifiedName.h" |
| 38 #include "core/dom/StaticNodeList.h" | 38 #include "core/dom/StaticNodeList.h" |
| 39 #include "wtf/StdLibExtras.h" | 39 #include "wtf/StdLibExtras.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class ChildListRecord : public MutationRecord { | 45 class ChildListRecord : public MutationRecord { |
| 46 public: | 46 public: |
| 47 ChildListRecord(PassRefPtr<Node> target, PassRefPtrWillBeRawPtr<NodeList> ad
ded, PassRefPtrWillBeRawPtr<NodeList> removed, PassRefPtr<Node> previousSibling,
PassRefPtr<Node> nextSibling) | 47 ChildListRecord(PassRefPtrWillBeRawPtr<Node> target, PassRefPtrWillBeRawPtr<
NodeList> added, PassRefPtrWillBeRawPtr<NodeList> removed, PassRefPtrWillBeRawPt
r<Node> previousSibling, PassRefPtrWillBeRawPtr<Node> nextSibling) |
| 48 : m_target(target) | 48 : m_target(target) |
| 49 , m_addedNodes(added) | 49 , m_addedNodes(added) |
| 50 , m_removedNodes(removed) | 50 , m_removedNodes(removed) |
| 51 , m_previousSibling(previousSibling) | 51 , m_previousSibling(previousSibling) |
| 52 , m_nextSibling(nextSibling) | 52 , m_nextSibling(nextSibling) |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void trace(Visitor* visitor) OVERRIDE | 56 virtual void trace(Visitor* visitor) OVERRIDE |
| 57 { | 57 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 RefPtrWillBeMember<Node> m_target; | 74 RefPtrWillBeMember<Node> m_target; |
| 75 RefPtrWillBeMember<NodeList> m_addedNodes; | 75 RefPtrWillBeMember<NodeList> m_addedNodes; |
| 76 RefPtrWillBeMember<NodeList> m_removedNodes; | 76 RefPtrWillBeMember<NodeList> m_removedNodes; |
| 77 RefPtrWillBeMember<Node> m_previousSibling; | 77 RefPtrWillBeMember<Node> m_previousSibling; |
| 78 RefPtrWillBeMember<Node> m_nextSibling; | 78 RefPtrWillBeMember<Node> m_nextSibling; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class RecordWithEmptyNodeLists : public MutationRecord { | 81 class RecordWithEmptyNodeLists : public MutationRecord { |
| 82 public: | 82 public: |
| 83 RecordWithEmptyNodeLists(PassRefPtr<Node> target, const String& oldValue) | 83 RecordWithEmptyNodeLists(PassRefPtrWillBeRawPtr<Node> target, const String&
oldValue) |
| 84 : m_target(target) | 84 : m_target(target) |
| 85 , m_oldValue(oldValue) | 85 , m_oldValue(oldValue) |
| 86 { | 86 { |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual void trace(Visitor* visitor) OVERRIDE | 89 virtual void trace(Visitor* visitor) OVERRIDE |
| 90 { | 90 { |
| 91 visitor->trace(m_target); | 91 visitor->trace(m_target); |
| 92 visitor->trace(m_addedNodes); | 92 visitor->trace(m_addedNodes); |
| 93 visitor->trace(m_removedNodes); | 93 visitor->trace(m_removedNodes); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 RefPtrWillBeMember<Node> m_target; | 110 RefPtrWillBeMember<Node> m_target; |
| 111 String m_oldValue; | 111 String m_oldValue; |
| 112 RefPtrWillBeMember<NodeList> m_addedNodes; | 112 RefPtrWillBeMember<NodeList> m_addedNodes; |
| 113 RefPtrWillBeMember<NodeList> m_removedNodes; | 113 RefPtrWillBeMember<NodeList> m_removedNodes; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 class AttributesRecord : public RecordWithEmptyNodeLists { | 116 class AttributesRecord : public RecordWithEmptyNodeLists { |
| 117 public: | 117 public: |
| 118 AttributesRecord(PassRefPtr<Node> target, const QualifiedName& name, const A
tomicString& oldValue) | 118 AttributesRecord(PassRefPtrWillBeRawPtr<Node> target, const QualifiedName& n
ame, const AtomicString& oldValue) |
| 119 : RecordWithEmptyNodeLists(target, oldValue) | 119 : RecordWithEmptyNodeLists(target, oldValue) |
| 120 , m_attributeName(name.localName()) | 120 , m_attributeName(name.localName()) |
| 121 , m_attributeNamespace(name.namespaceURI()) | 121 , m_attributeNamespace(name.namespaceURI()) |
| 122 { | 122 { |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 virtual const AtomicString& type() OVERRIDE; | 126 virtual const AtomicString& type() OVERRIDE; |
| 127 virtual const AtomicString& attributeName() OVERRIDE { return m_attributeNam
e; } | 127 virtual const AtomicString& attributeName() OVERRIDE { return m_attributeNam
e; } |
| 128 virtual const AtomicString& attributeNamespace() OVERRIDE { return m_attribu
teNamespace; } | 128 virtual const AtomicString& attributeNamespace() OVERRIDE { return m_attribu
teNamespace; } |
| 129 | 129 |
| 130 AtomicString m_attributeName; | 130 AtomicString m_attributeName; |
| 131 AtomicString m_attributeNamespace; | 131 AtomicString m_attributeNamespace; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class CharacterDataRecord : public RecordWithEmptyNodeLists { | 134 class CharacterDataRecord : public RecordWithEmptyNodeLists { |
| 135 public: | 135 public: |
| 136 CharacterDataRecord(PassRefPtr<Node> target, const String& oldValue) | 136 CharacterDataRecord(PassRefPtrWillBeRawPtr<Node> target, const String& oldVa
lue) |
| 137 : RecordWithEmptyNodeLists(target, oldValue) | 137 : RecordWithEmptyNodeLists(target, oldValue) |
| 138 { | 138 { |
| 139 } | 139 } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 virtual const AtomicString& type() OVERRIDE; | 142 virtual const AtomicString& type() OVERRIDE; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 class MutationRecordWithNullOldValue : public MutationRecord { | 145 class MutationRecordWithNullOldValue : public MutationRecord { |
| 146 public: | 146 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 const AtomicString& CharacterDataRecord::type() | 185 const AtomicString& CharacterDataRecord::type() |
| 186 { | 186 { |
| 187 DEFINE_STATIC_LOCAL(AtomicString, characterData, ("characterData", AtomicStr
ing::ConstructFromLiteral)); | 187 DEFINE_STATIC_LOCAL(AtomicString, characterData, ("characterData", AtomicStr
ing::ConstructFromLiteral)); |
| 188 return characterData; | 188 return characterData; |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace | 191 } // namespace |
| 192 | 192 |
| 193 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createChildList(PassRefPt
r<Node> target, PassRefPtrWillBeRawPtr<NodeList> added, PassRefPtrWillBeRawPtr<N
odeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling
) | 193 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createChildList(PassRefPt
rWillBeRawPtr<Node> target, PassRefPtrWillBeRawPtr<NodeList> added, PassRefPtrWi
llBeRawPtr<NodeList> removed, PassRefPtrWillBeRawPtr<Node> previousSibling, Pass
RefPtrWillBeRawPtr<Node> nextSibling) |
| 194 { | 194 { |
| 195 return adoptRefWillBeNoop(new ChildListRecord(target, added, removed, previo
usSibling, nextSibling)); | 195 return adoptRefWillBeNoop(new ChildListRecord(target, added, removed, previo
usSibling, nextSibling)); |
| 196 } | 196 } |
| 197 | 197 |
| 198 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createAttributes(PassRefP
tr<Node> target, const QualifiedName& name, const AtomicString& oldValue) | 198 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createAttributes(PassRefP
trWillBeRawPtr<Node> target, const QualifiedName& name, const AtomicString& oldV
alue) |
| 199 { | 199 { |
| 200 return adoptRefWillBeNoop(new AttributesRecord(target, name, oldValue)); | 200 return adoptRefWillBeNoop(new AttributesRecord(target, name, oldValue)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createCharacterData(PassR
efPtr<Node> target, const String& oldValue) | 203 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createCharacterData(PassR
efPtrWillBeRawPtr<Node> target, const String& oldValue) |
| 204 { | 204 { |
| 205 return adoptRefWillBeNoop(new CharacterDataRecord(target, oldValue)); | 205 return adoptRefWillBeNoop(new CharacterDataRecord(target, oldValue)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createWithNullOldValue(Pa
ssRefPtrWillBeRawPtr<MutationRecord> record) | 208 PassRefPtrWillBeRawPtr<MutationRecord> MutationRecord::createWithNullOldValue(Pa
ssRefPtrWillBeRawPtr<MutationRecord> record) |
| 209 { | 209 { |
| 210 return adoptRefWillBeNoop(new MutationRecordWithNullOldValue(record)); | 210 return adoptRefWillBeNoop(new MutationRecordWithNullOldValue(record)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 MutationRecord::~MutationRecord() | 213 MutationRecord::~MutationRecord() |
| 214 { | 214 { |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace WebCore | 217 } // namespace WebCore |
| OLD | NEW |