Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (96063 => 96064)
--- trunk/Source/WebCore/CMakeLists.txt 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/CMakeLists.txt 2011-09-27 01:44:36 UTC (rev 96064)
@@ -163,6 +163,7 @@
dom/MessagePort.idl
dom/MouseEvent.idl
dom/MutationEvent.idl
+ dom/MutationRecord.idl
dom/NamedNodeMap.idl
dom/NodeFilter.idl
dom/Node.idl
@@ -547,6 +548,7 @@
dom/MouseEvent.cpp
dom/MouseRelatedEvent.cpp
dom/MutationEvent.cpp
+ dom/MutationRecord.cpp
dom/NamedNodeMap.cpp
dom/NameNodeList.cpp
dom/Node.cpp
Modified: trunk/Source/WebCore/ChangeLog (96063 => 96064)
--- trunk/Source/WebCore/ChangeLog 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/ChangeLog 2011-09-27 01:44:36 UTC (rev 96064)
@@ -1,3 +1,46 @@
+2011-09-26 Adam Klein <[email protected]>
+
+ [MutationObservers] implement MutationRecord
+ https://bugs.webkit.org/show_bug.cgi?id=68824
+
+ Reviewed by Darin Adler.
+
+ Implements MutationRecord as specified in the thread at
+ http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/1622.html,
+ including some minor naming changes from the original proposal.
+
+ This is a small part of the MutationObserver API, see
+ https://bugs.webkit.org/show_bug.cgi?id=68729 for the metabug covering
+ this feature.
+
+ No new tests as this isn't yet exposed to the platform.
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/MutationRecord.cpp: Added.
+ (WebCore::MutationRecord::createChildList):
+ (WebCore::MutationRecord::createAttributes):
+ (WebCore::MutationRecord::createCharacterData):
+ (WebCore::MutationRecord::MutationRecord):
+ (WebCore::MutationRecord::~MutationRecord):
+ * dom/MutationRecord.h: Added.
+ (WebCore::MutationRecord::target):
+ (WebCore::MutationRecord::addedNodes):
+ (WebCore::MutationRecord::removedNodes):
+ (WebCore::MutationRecord::previousSibling):
+ (WebCore::MutationRecord::nextSibling):
+ (WebCore::MutationRecord::attributeName):
+ (WebCore::MutationRecord::attributeNamespace):
+ (WebCore::MutationRecord::oldValue):
+ (WebCore::MutationRecord::setOldValue):
+ * dom/MutationRecord.idl: Added.
+
2011-09-26 Kentaro Hara <[email protected]>
Implement a CloseEvent constructor for V8
Modified: trunk/Source/WebCore/DerivedSources.cpp (96063 => 96064)
--- trunk/Source/WebCore/DerivedSources.cpp 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/DerivedSources.cpp 2011-09-27 01:44:36 UTC (rev 96064)
@@ -245,6 +245,7 @@
#include "JSMetadataCallback.cpp"
#include "JSMouseEvent.cpp"
#include "JSMutationEvent.cpp"
+#include "JSMutationRecord.cpp"
#include "JSNamedNodeMap.cpp"
#include "JSNavigator.cpp"
#include "JSNavigatorUserMediaError.cpp"
Modified: trunk/Source/WebCore/DerivedSources.make (96063 => 96064)
--- trunk/Source/WebCore/DerivedSources.make 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/DerivedSources.make 2011-09-27 01:44:36 UTC (rev 96064)
@@ -298,6 +298,7 @@
MetadataCallback \
MouseEvent \
MutationEvent \
+ MutationRecord \
NamedNodeMap \
Navigator \
NavigatorUserMediaError \
Modified: trunk/Source/WebCore/GNUmakefile.list.am (96063 => 96064)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-09-27 01:44:36 UTC (rev 96064)
@@ -376,6 +376,8 @@
DerivedSources/WebCore/JSMouseEvent.h \
DerivedSources/WebCore/JSMutationEvent.cpp \
DerivedSources/WebCore/JSMutationEvent.h \
+ DerivedSources/WebCore/JSMutationRecord.cpp \
+ DerivedSources/WebCore/JSMutationRecord.h \
DerivedSources/WebCore/JSNamedNodeMap.cpp \
DerivedSources/WebCore/JSNamedNodeMap.h \
DerivedSources/WebCore/JSNavigator.cpp \
@@ -1221,6 +1223,8 @@
Source/WebCore/dom/MouseRelatedEvent.h \
Source/WebCore/dom/MutationEvent.cpp \
Source/WebCore/dom/MutationEvent.h \
+ Source/WebCore/dom/MutationRecord.cpp \
+ Source/WebCore/dom/MutationRecord.h \
Source/WebCore/dom/NamedNodeMap.cpp \
Source/WebCore/dom/NamedNodeMap.h \
Source/WebCore/dom/NameNodeList.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (96063 => 96064)
--- trunk/Source/WebCore/WebCore.gypi 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/WebCore.gypi 2011-09-27 01:44:36 UTC (rev 96064)
@@ -1185,6 +1185,7 @@
'dom/MessagePort.idl',
'dom/MouseEvent.idl',
'dom/MutationEvent.idl',
+ 'dom/MutationRecord.idl',
'dom/NamedNodeMap.idl',
'dom/Node.idl',
'dom/NodeFilter.idl',
@@ -5199,6 +5200,8 @@
'dom/MouseRelatedEvent.cpp',
'dom/MutationEvent.cpp',
'dom/MutationEvent.h',
+ 'dom/MutationRecord.cpp',
+ 'dom/MutationRecord.h',
'dom/NameNodeList.cpp',
'dom/NameNodeList.h',
'dom/NamedNodeMap.cpp',
@@ -7465,6 +7468,8 @@
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSMouseEvent.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSMutationEvent.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSMutationEvent.h',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSMutationRecord.cpp',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSMutationRecord.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSNamedNodeMap.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSNamedNodeMap.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSNavigator.cpp',
Modified: trunk/Source/WebCore/WebCore.pro (96063 => 96064)
--- trunk/Source/WebCore/WebCore.pro 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/WebCore.pro 2011-09-27 01:44:36 UTC (rev 96064)
@@ -510,6 +510,7 @@
dom/MouseEvent.cpp \
dom/MouseRelatedEvent.cpp \
dom/MutationEvent.cpp \
+ dom/MutationRecord.cpp \
dom/NamedNodeMap.cpp \
dom/NameNodeList.cpp \
dom/Node.cpp \
@@ -1523,6 +1524,7 @@
dom/MouseEvent.h \
dom/MouseRelatedEvent.h \
dom/MutationEvent.h \
+ dom/MutationRecord.h \
dom/NamedNodeMap.h \
dom/NameNodeList.h \
dom/NodeFilterCondition.h \
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (96063 => 96064)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-09-27 01:44:36 UTC (rev 96064)
@@ -11654,6 +11654,62 @@
>
</File>
<File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSMutationRecord.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSMutationRecord.h"
+ >
+ </File>
+ <File
RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSNamedNodeMap.cpp"
>
<FileConfiguration
@@ -47054,6 +47110,62 @@
>
</File>
<File
+ RelativePath="..\dom\MutationRecord.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\dom\MutationRecord.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\NamedNodeMap.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (96063 => 96064)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-09-27 01:40:37 UTC (rev 96063)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-09-27 01:44:36 UTC (rev 96064)
@@ -5437,6 +5437,10 @@
C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; };
C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; };
C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
+ C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F08FB91430FE8F00685849 /* MutationRecord.cpp */; };
+ C6F08FBD1430FE8F00685849 /* MutationRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F08FBA1430FE8F00685849 /* MutationRecord.h */; };
+ C6F08FC91431000D00685849 /* JSMutationRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F08FC71431000D00685849 /* JSMutationRecord.cpp */; };
+ C6F08FCA1431000D00685849 /* JSMutationRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F08FC81431000D00685849 /* JSMutationRecord.h */; };
C6F41047130C6E8900393DE4 /* EntryBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F41046130C6E8900393DE4 /* EntryBase.cpp */; };
CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; };
@@ -12204,6 +12208,11 @@
C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; };
C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModifySelectionListLevel.h; sourceTree = "<group>"; };
C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModifySelectionListLevel.cpp; sourceTree = "<group>"; };
+ C6F08FB91430FE8F00685849 /* MutationRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutationRecord.cpp; sourceTree = "<group>"; };
+ C6F08FBA1430FE8F00685849 /* MutationRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutationRecord.h; sourceTree = "<group>"; };
+ C6F08FBB1430FE8F00685849 /* MutationRecord.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MutationRecord.idl; sourceTree = "<group>"; };
+ C6F08FC71431000D00685849 /* JSMutationRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMutationRecord.cpp; sourceTree = "<group>"; };
+ C6F08FC81431000D00685849 /* JSMutationRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMutationRecord.h; sourceTree = "<group>"; };
C6F41046130C6E8900393DE4 /* EntryBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EntryBase.cpp; path = fileapi/EntryBase.cpp; sourceTree = "<group>"; };
CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
@@ -17418,6 +17427,8 @@
49C9F48B13D57D320052600A /* JSMediaStreamTrack.h */,
49C9F48C13D57D320052600A /* JSMediaStreamTrackList.cpp */,
49C9F48D13D57D320052600A /* JSMediaStreamTrackList.h */,
+ C6F08FC71431000D00685849 /* JSMutationRecord.cpp */,
+ C6F08FC81431000D00685849 /* JSMutationRecord.h */,
BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */,
BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */,
14DC0D3509FED073007B0235 /* JSNode.cpp */,
@@ -20024,6 +20035,9 @@
85031B330A44EFC700F992E0 /* MutationEvent.cpp */,
85031B340A44EFC700F992E0 /* MutationEvent.h */,
93EEC1F309C2877700C515D1 /* MutationEvent.idl */,
+ C6F08FB91430FE8F00685849 /* MutationRecord.cpp */,
+ C6F08FBA1430FE8F00685849 /* MutationRecord.h */,
+ C6F08FBB1430FE8F00685849 /* MutationRecord.idl */,
BCF34A3611A231CD00C71804 /* NamedNodeMap.cpp */,
A81872180977D3C0005826D9 /* NamedNodeMap.h */,
85ACA9F90A9B631000671E90 /* NamedNodeMap.idl */,
@@ -22145,6 +22159,7 @@
898785B9122CA2A7003AABDA /* JSMetadataCallback.h in Headers */,
A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */,
+ C6F08FCA1431000D00685849 /* JSMutationRecord.h in Headers */,
BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */,
A9D247F80D757E3400FDF959 /* JSNavigator.h in Headers */,
B1E545E013462B0B0092A545 /* JSNavigatorUserMediaError.h in Headers */,
@@ -22517,6 +22532,7 @@
93309DFC099E64920056E581 /* MoveSelectionCommand.h in Headers */,
B1AD4E6313A12A0B00846B27 /* MutableTextTrack.h in Headers */,
85031B4A0A44EFC700F992E0 /* MutationEvent.h in Headers */,
+ C6F08FBD1430FE8F00685849 /* MutationRecord.h in Headers */,
A81872230977D3C0005826D9 /* NamedNodeMap.h in Headers */,
A818721E0977D3C0005826D9 /* NameNodeList.h in Headers */,
E10B9B6C0B747599003ED890 /* NativeXPathNSResolver.h in Headers */,
@@ -25167,6 +25183,7 @@
898785B8122CA2A7003AABDA /* JSMetadataCallback.cpp in Sources */,
A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
65DF31FB09D1CC60000BE325 /* JSMutationEvent.cpp in Sources */,
+ C6F08FC91431000D00685849 /* JSMutationRecord.cpp in Sources */,
BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */,
BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */,
A9D247F70D757E3400FDF959 /* JSNavigator.cpp in Sources */,
@@ -25566,6 +25583,7 @@
93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */,
B1AD4E6213A12A0B00846B27 /* MutableTextTrack.cpp in Sources */,
85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */,
+ C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */,
BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */,
A81872240977D3C0005826D9 /* NameNodeList.cpp in Sources */,
E10B9B6D0B747599003ED890 /* NativeXPathNSResolver.cpp in Sources */,
Added: trunk/Source/WebCore/dom/MutationRecord.cpp (0 => 96064)
--- trunk/Source/WebCore/dom/MutationRecord.cpp (rev 0)
+++ trunk/Source/WebCore/dom/MutationRecord.cpp 2011-09-27 01:44:36 UTC (rev 96064)
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MUTATION_OBSERVERS)
+
+#include "MutationRecord.h"
+
+#include "Node.h"
+#include "NodeList.h"
+#include <wtf/Assertions.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+namespace {
+
+class ChildListRecord : public MutationRecord {
+public:
+ ChildListRecord(PassRefPtr<Node> target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling)
+ : MutationRecord(target)
+ , m_addedNodes(added)
+ , m_removedNodes(removed)
+ , m_previousSibling(previousSibling)
+ , m_nextSibling(nextSibling)
+ {
+ }
+
+private:
+ virtual const AtomicString& type();
+ virtual NodeList* addedNodes() { return m_addedNodes.get(); }
+ virtual NodeList* removedNodes() { return m_removedNodes.get(); }
+ virtual Node* previousSibling() { return m_previousSibling.get(); }
+ virtual Node* nextSibling() { return m_nextSibling.get(); }
+
+ RefPtr<NodeList> m_addedNodes;
+ RefPtr<NodeList> m_removedNodes;
+ RefPtr<Node> m_previousSibling;
+ RefPtr<Node> m_nextSibling;
+};
+
+class AttributesRecord : public MutationRecord {
+public:
+ AttributesRecord(PassRefPtr<Node> target, const AtomicString& attributeName, const AtomicString& attributeNamespace)
+ : MutationRecord(target)
+ , m_attributeName(attributeName)
+ , m_attributeNamespace(attributeNamespace)
+ {
+ }
+
+private:
+ virtual const AtomicString& type();
+ virtual const AtomicString& attributeName() { return m_attributeName; }
+ virtual const AtomicString& attributeNamespace() { return m_attributeName; }
+ virtual String oldValue() { return m_oldValue; }
+ virtual void setOldValue(const String& value) { m_oldValue = value; }
+
+ AtomicString m_attributeName;
+ AtomicString m_attributeNamespace;
+ String m_oldValue;
+};
+
+class CharacterDataRecord : public MutationRecord {
+public:
+ CharacterDataRecord(PassRefPtr<Node> target)
+ : MutationRecord(target)
+ {
+ }
+
+private:
+ virtual const AtomicString& type();
+ virtual String oldValue() { return m_oldValue; }
+ virtual void setOldValue(const String& value) { m_oldValue = value; }
+
+ String m_oldValue;
+};
+
+const AtomicString& ChildListRecord::type()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, childList, ("childList"));
+ return childList;
+}
+
+const AtomicString& AttributesRecord::type()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, attributes, ("attributes"));
+ return attributes;
+}
+
+const AtomicString& CharacterDataRecord::type()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, characterData, ("characterData"));
+ return characterData;
+}
+
+} // namespace
+
+PassRefPtr<MutationRecord> MutationRecord::createChildList(PassRefPtr<Node> target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling)
+{
+ return adoptRef(static_cast<MutationRecord*>(new ChildListRecord(target, added, removed, previousSibling, nextSibling)));
+}
+
+PassRefPtr<MutationRecord> MutationRecord::createAttributes(PassRefPtr<Node> target, const AtomicString& attributeName, const AtomicString& attributeNamespace)
+{
+ return adoptRef(static_cast<MutationRecord*>(new AttributesRecord(target, attributeName, attributeNamespace)));
+}
+
+PassRefPtr<MutationRecord> MutationRecord::createCharacterData(PassRefPtr<Node> target)
+{
+ return adoptRef(static_cast<MutationRecord*>(new CharacterDataRecord(target)));
+}
+
+MutationRecord::MutationRecord(PassRefPtr<Node> target)
+ : m_target(target)
+{
+}
+
+MutationRecord::~MutationRecord()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MUTATION_OBSERVERS)
Added: trunk/Source/WebCore/dom/MutationRecord.h (0 => 96064)
--- trunk/Source/WebCore/dom/MutationRecord.h (rev 0)
+++ trunk/Source/WebCore/dom/MutationRecord.h 2011-09-27 01:44:36 UTC (rev 96064)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MutationRecord_h
+#define MutationRecord_h
+
+#if ENABLE(MUTATION_OBSERVERS)
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Node;
+class NodeList;
+
+class MutationRecord : public RefCounted<MutationRecord> {
+public:
+ static PassRefPtr<MutationRecord> createChildList(PassRefPtr<Node> target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling);
+ static PassRefPtr<MutationRecord> createAttributes(PassRefPtr<Node> target, const AtomicString& attributeName, const AtomicString& attributeNamespace);
+ static PassRefPtr<MutationRecord> createCharacterData(PassRefPtr<Node> target);
+
+ virtual ~MutationRecord();
+
+ virtual const AtomicString& type() = 0;
+ Node* target() { return m_target.get(); }
+
+ virtual NodeList* addedNodes() { return 0; }
+ virtual NodeList* removedNodes() { return 0; }
+ virtual Node* previousSibling() { return 0; }
+ virtual Node* nextSibling() { return 0; }
+
+ virtual const AtomicString& attributeName() { return nullAtom; }
+ virtual const AtomicString& attributeNamespace() { return nullAtom; }
+
+ virtual String oldValue() { return String(); }
+ virtual void setOldValue(const String&) { }
+
+protected:
+ explicit MutationRecord(PassRefPtr<Node> target);
+
+private:
+ RefPtr<Node> m_target;
+};
+
+
+} // namespace WebCore
+
+#endif // ENABLE(MUTATION_OBSERVERS)
+
+#endif // MutationRecord_h
Added: trunk/Source/WebCore/dom/MutationRecord.idl (0 => 96064)
--- trunk/Source/WebCore/dom/MutationRecord.idl (rev 0)
+++ trunk/Source/WebCore/dom/MutationRecord.idl 2011-09-27 01:44:36 UTC (rev 96064)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {
+ interface [
+ Conditional=MUTATION_OBSERVERS
+ ] MutationRecord {
+ readonly attribute DOMString type;
+ readonly attribute Node target;
+
+ readonly attribute NodeList addedNodes;
+ readonly attribute NodeList removedNodes;
+ readonly attribute Node previousSibling;
+ readonly attribute Node nextSibling;
+
+ readonly attribute DOMString attributeName;
+ readonly attribute DOMString attributeNamespace;
+
+ readonly attribute DOMString oldValue;
+ };
+}