| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 { | 57 { |
| 58 visitor->trace(m_target); | 58 visitor->trace(m_target); |
| 59 visitor->trace(m_addedNodes); | 59 visitor->trace(m_addedNodes); |
| 60 visitor->trace(m_removedNodes); | 60 visitor->trace(m_removedNodes); |
| 61 visitor->trace(m_previousSibling); | 61 visitor->trace(m_previousSibling); |
| 62 visitor->trace(m_nextSibling); | 62 visitor->trace(m_nextSibling); |
| 63 MutationRecord::trace(visitor); | 63 MutationRecord::trace(visitor); |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 virtual const AtomicString& type() override; | 67 const AtomicString& type() override; |
| 68 virtual Node* target() override { return m_target.get(); } | 68 Node* target() override { return m_target.get(); } |
| 69 virtual StaticNodeList* addedNodes() override { return m_addedNodes.get(); } | 69 StaticNodeList* addedNodes() override { return m_addedNodes.get(); } |
| 70 virtual StaticNodeList* removedNodes() override { return m_removedNodes.get(
); } | 70 StaticNodeList* removedNodes() override { return m_removedNodes.get(); } |
| 71 virtual Node* previousSibling() override { return m_previousSibling.get(); } | 71 Node* previousSibling() override { return m_previousSibling.get(); } |
| 72 virtual Node* nextSibling() override { return m_nextSibling.get(); } | 72 Node* nextSibling() override { return m_nextSibling.get(); } |
| 73 | 73 |
| 74 RefPtrWillBeMember<Node> m_target; | 74 RefPtrWillBeMember<Node> m_target; |
| 75 RefPtrWillBeMember<StaticNodeList> m_addedNodes; | 75 RefPtrWillBeMember<StaticNodeList> m_addedNodes; |
| 76 RefPtrWillBeMember<StaticNodeList> m_removedNodes; | 76 RefPtrWillBeMember<StaticNodeList> 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(PassRefPtrWillBeRawPtr<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 DEFINE_INLINE_VIRTUAL_TRACE() | 89 DEFINE_INLINE_VIRTUAL_TRACE() |
| 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); |
| 94 MutationRecord::trace(visitor); | 94 MutationRecord::trace(visitor); |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 virtual Node* target() override { return m_target.get(); } | 98 Node* target() override { return m_target.get(); } |
| 99 virtual String oldValue() override { return m_oldValue; } | 99 String oldValue() override { return m_oldValue; } |
| 100 virtual StaticNodeList* addedNodes() override { return lazilyInitializeEmpty
NodeList(m_addedNodes); } | 100 StaticNodeList* addedNodes() override { return lazilyInitializeEmptyNodeList
(m_addedNodes); } |
| 101 virtual StaticNodeList* removedNodes() override { return lazilyInitializeEmp
tyNodeList(m_removedNodes); } | 101 StaticNodeList* removedNodes() override { return lazilyInitializeEmptyNodeLi
st(m_removedNodes); } |
| 102 | 102 |
| 103 static StaticNodeList* lazilyInitializeEmptyNodeList(RefPtrWillBeMember<Stat
icNodeList>& nodeList) | 103 static StaticNodeList* lazilyInitializeEmptyNodeList(RefPtrWillBeMember<Stat
icNodeList>& nodeList) |
| 104 { | 104 { |
| 105 if (!nodeList) | 105 if (!nodeList) |
| 106 nodeList = StaticNodeList::createEmpty(); | 106 nodeList = StaticNodeList::createEmpty(); |
| 107 return nodeList.get(); | 107 return nodeList.get(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 RefPtrWillBeMember<Node> m_target; | 110 RefPtrWillBeMember<Node> m_target; |
| 111 String m_oldValue; | 111 String m_oldValue; |
| 112 RefPtrWillBeMember<StaticNodeList> m_addedNodes; | 112 RefPtrWillBeMember<StaticNodeList> m_addedNodes; |
| 113 RefPtrWillBeMember<StaticNodeList> m_removedNodes; | 113 RefPtrWillBeMember<StaticNodeList> m_removedNodes; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 class AttributesRecord : public RecordWithEmptyNodeLists { | 116 class AttributesRecord : public RecordWithEmptyNodeLists { |
| 117 public: | 117 public: |
| 118 AttributesRecord(PassRefPtrWillBeRawPtr<Node> target, const QualifiedName& n
ame, const AtomicString& 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 const AtomicString& type() override; |
| 127 virtual const AtomicString& attributeName() override { return m_attributeNam
e; } | 127 const AtomicString& attributeName() override { return m_attributeName; } |
| 128 virtual const AtomicString& attributeNamespace() override { return m_attribu
teNamespace; } | 128 const AtomicString& attributeNamespace() override { return m_attributeNamesp
ace; } |
| 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(PassRefPtrWillBeRawPtr<Node> target, const String& oldVa
lue) | 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 const AtomicString& type() override; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 class MutationRecordWithNullOldValue : public MutationRecord { | 145 class MutationRecordWithNullOldValue : public MutationRecord { |
| 146 public: | 146 public: |
| 147 MutationRecordWithNullOldValue(PassRefPtrWillBeRawPtr<MutationRecord> record
) | 147 MutationRecordWithNullOldValue(PassRefPtrWillBeRawPtr<MutationRecord> record
) |
| 148 : m_record(record) | 148 : m_record(record) |
| 149 { | 149 { |
| 150 } | 150 } |
| 151 | 151 |
| 152 DEFINE_INLINE_VIRTUAL_TRACE() | 152 DEFINE_INLINE_VIRTUAL_TRACE() |
| 153 { | 153 { |
| 154 visitor->trace(m_record); | 154 visitor->trace(m_record); |
| 155 MutationRecord::trace(visitor); | 155 MutationRecord::trace(visitor); |
| 156 } | 156 } |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 virtual const AtomicString& type() override { return m_record->type(); } | 159 const AtomicString& type() override { return m_record->type(); } |
| 160 virtual Node* target() override { return m_record->target(); } | 160 Node* target() override { return m_record->target(); } |
| 161 virtual StaticNodeList* addedNodes() override { return m_record->addedNodes(
); } | 161 StaticNodeList* addedNodes() override { return m_record->addedNodes(); } |
| 162 virtual StaticNodeList* removedNodes() override { return m_record->removedNo
des(); } | 162 StaticNodeList* removedNodes() override { return m_record->removedNodes(); } |
| 163 virtual Node* previousSibling() override { return m_record->previousSibling(
); } | 163 Node* previousSibling() override { return m_record->previousSibling(); } |
| 164 virtual Node* nextSibling() override { return m_record->nextSibling(); } | 164 Node* nextSibling() override { return m_record->nextSibling(); } |
| 165 virtual const AtomicString& attributeName() override { return m_record->attr
ibuteName(); } | 165 const AtomicString& attributeName() override { return m_record->attributeNam
e(); } |
| 166 virtual const AtomicString& attributeNamespace() override { return m_record-
>attributeNamespace(); } | 166 const AtomicString& attributeNamespace() override { return m_record->attribu
teNamespace(); } |
| 167 | 167 |
| 168 virtual String oldValue() override { return String(); } | 168 String oldValue() override { return String(); } |
| 169 | 169 |
| 170 RefPtrWillBeMember<MutationRecord> m_record; | 170 RefPtrWillBeMember<MutationRecord> m_record; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 const AtomicString& ChildListRecord::type() | 173 const AtomicString& ChildListRecord::type() |
| 174 { | 174 { |
| 175 DEFINE_STATIC_LOCAL(AtomicString, childList, ("childList", AtomicString::Con
structFromLiteral)); | 175 DEFINE_STATIC_LOCAL(AtomicString, childList, ("childList", AtomicString::Con
structFromLiteral)); |
| 176 return childList; | 176 return childList; |
| 177 } | 177 } |
| 178 | 178 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 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 blink | 217 } // namespace blink |
| OLD | NEW |