WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-68824-20110926143939.patch (text/plain), 28.44 KB, created by
Adam Klein
on 2011-09-26 14:39:40 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Adam Klein
Created:
2011-09-26 14:39:40 PDT
Size:
28.44 KB
patch
obsolete
>Subversion Revision: 95968 >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index e798380cb5d1a70d51aa48866d219e45d2a2360d..dcf6e41fe6c49efdbed56eb2337c4c695d1405f5 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -163,6 +163,7 @@ SET(WebCore_IDL_FILES > 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 @@ SET(WebCore_SOURCES > dom/MouseEvent.cpp > dom/MouseRelatedEvent.cpp > dom/MutationEvent.cpp >+ dom/MutationRecord.cpp > dom/NamedNodeMap.cpp > dom/NameNodeList.cpp > dom/Node.cpp >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f73eace3afc2ae8b513a3c8e0c98917998b555bd..f27e6a6bee5955ff4a1c4902bcd8894ff405cfe7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,49 @@ >+2011-09-26 Adam Klein <adamk@chromium.org> >+ >+ [MutationObservers] implement MutationRecord >+ https://bugs.webkit.org/show_bug.cgi?id=68824 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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::type): >+ (WebCore::MutationRecord::oldValue): >+ (WebCore::MutationRecord::setOldValue): >+ (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::typeFlag): >+ (WebCore::MutationRecord::extraData): >+ * dom/MutationRecord.idl: Added. >+ > 2011-09-23 Simon Fraser <simon.fraser@apple.com> > > Repaint tests don't work in WebKit2 >diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp >index 8a45986affebf524e14ad98b117df813b50d16bf..84f02947c920899ea164199564b4ff1aa2954f1a 100644 >--- a/Source/WebCore/DerivedSources.cpp >+++ b/Source/WebCore/DerivedSources.cpp >@@ -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" >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index df8091360d7067f73e4d02a194b77d7eaa9d5a4e..72f47e4fd12a83a06819b1baabf81f20dbe7311a 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -298,6 +298,7 @@ DOM_CLASSES = \ > MetadataCallback \ > MouseEvent \ > MutationEvent \ >+ MutationRecord \ > NamedNodeMap \ > Navigator \ > NavigatorUserMediaError \ >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index 410cacf50402bb32664a29722b46f2bf9b3bac1b..dd6698df10d545752256b3874a448d1ba3919d2d 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -376,6 +376,8 @@ webcore_built_sources += \ > 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 @@ webcore_sources += \ > 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 \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 76f4e65571240c06e3c442a9775649391836d446..e0c95bbaa46eb07217d65d3ef743dc87ce1756e7 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -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', >diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro >index 6028e96859da9c8ce342b0e49d4c0e90b15eff65..778bf8a2ff9cb55cf5296c71d29c801df9518bda 100644 >--- a/Source/WebCore/WebCore.pro >+++ b/Source/WebCore/WebCore.pro >@@ -510,6 +510,7 @@ SOURCES += \ > 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 @@ HEADERS += \ > dom/MouseEvent.h \ > dom/MouseRelatedEvent.h \ > dom/MutationEvent.h \ >+ dom/MutationRecord.h \ > dom/NamedNodeMap.h \ > dom/NameNodeList.h \ > dom/NodeFilterCondition.h \ >diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >index 581518b96d626188c555a370ee233fa3a535b78d..de4bd69831bf85b5beb195e303b39ab0e8e2f236 100755 >--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj >+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >@@ -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 >@@ -46998,6 +47054,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> >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 70044daac92d45bc7335da066565b9df56a1d0c4..6763191f1a903b8d18af3dae962776fcc0c05e7d 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -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 */, >diff --git a/Source/WebCore/dom/MutationRecord.cpp b/Source/WebCore/dom/MutationRecord.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..12cfdaacb6fba6663d9772a4130f80e8f4534ee3 >--- /dev/null >+++ b/Source/WebCore/dom/MutationRecord.cpp >@@ -0,0 +1,115 @@ >+/* >+ * 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 { >+ >+PassRefPtr<MutationRecord> MutationRecord::createChildList(PassRefPtr<Node> target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling) >+{ >+ OwnPtr<ChildListData> childListData = adoptPtr(new ChildListData); >+ childListData->addedNodes = added; >+ childListData->removedNodes = removed; >+ childListData->previousSibling = previousSibling; >+ childListData->nextSibling = nextSibling; >+ return adoptRef(new MutationRecord(ChildListFlag, target, childListData.release())); >+} >+ >+PassRefPtr<MutationRecord> MutationRecord::createAttributes(PassRefPtr<Node> target, const AtomicString& attributeName, const AtomicString& attributeNamespace) >+{ >+ OwnPtr<AttributesData> attrData = adoptPtr(new AttributesData); >+ attrData->localName = attributeName; >+ attrData->namespaceURI = attributeNamespace; >+ return adoptRef(new MutationRecord(AttributesFlag, target, attrData.release())); >+} >+ >+PassRefPtr<MutationRecord> MutationRecord::createCharacterData(PassRefPtr<Node> target) >+{ >+ return adoptRef(new MutationRecord(CharacterDataFlag, target, adoptPtr(new CharacterDataData))); >+} >+ >+const AtomicString& MutationRecord::type() >+{ >+ DEFINE_STATIC_LOCAL(AtomicString, childList, ("childList")); >+ DEFINE_STATIC_LOCAL(AtomicString, attributes, ("attributes")); >+ DEFINE_STATIC_LOCAL(AtomicString, characterData, ("characterData")); >+ >+ switch (m_typeFlag) { >+ case ChildListFlag: >+ return childList; >+ case AttributesFlag: >+ return attributes; >+ case CharacterDataFlag: >+ return characterData; >+ } >+ ASSERT_NOT_REACHED(); >+ return emptyAtom; >+} >+ >+const String& MutationRecord::oldValue() >+{ >+ if (m_typeFlag == AttributesFlag) >+ return extraData<AttributesData>()->oldValue; >+ if (m_typeFlag == CharacterDataFlag) >+ return extraData<CharacterDataData>()->oldValue; >+ return nullAtom; >+} >+ >+void MutationRecord::setOldValue(const String& val) >+{ >+ if (m_typeFlag == AttributesFlag) >+ extraData<AttributesData>()->oldValue = val; >+ else if (m_typeFlag == CharacterDataFlag) >+ extraData<CharacterDataData>()->oldValue = val; >+} >+ >+MutationRecord::MutationRecord(MutationTypeFlag typeFlag, PassRefPtr<Node> target, PassOwnPtr<ExtraData> extraData) >+ : m_typeFlag(typeFlag) >+ , m_target(target) >+ , m_extraData(extraData) >+{ >+} >+ >+MutationRecord::~MutationRecord() >+{ >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MUTATION_OBSERVERS) >diff --git a/Source/WebCore/dom/MutationRecord.h b/Source/WebCore/dom/MutationRecord.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f46e083defa506bf9536f3f1eeb1cc9a35a626d7 >--- /dev/null >+++ b/Source/WebCore/dom/MutationRecord.h >@@ -0,0 +1,136 @@ >+/* >+ * 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/OwnPtr.h> >+#include <wtf/PassOwnPtr.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(); >+ >+ const AtomicString& type(); >+ Node* target() { return m_target.get(); } >+ >+ NodeList* addedNodes() >+ { >+ return m_typeFlag == ChildListFlag ? extraData<ChildListData>()->addedNodes.get() : 0; >+ } >+ NodeList* removedNodes() >+ { >+ return m_typeFlag == ChildListFlag ? extraData<ChildListData>()->removedNodes.get() : 0; >+ } >+ Node* previousSibling() >+ { >+ return m_typeFlag == ChildListFlag ? extraData<ChildListData>()->previousSibling.get() : 0; >+ } >+ Node* nextSibling() >+ { >+ return m_typeFlag == ChildListFlag ? extraData<ChildListData>()->nextSibling.get() : 0; >+ } >+ >+ const AtomicString& attributeName() >+ { >+ return m_typeFlag == AttributesFlag ? extraData<AttributesData>()->localName : nullAtom; >+ } >+ const AtomicString& attributeNamespace() >+ { >+ return m_typeFlag == AttributesFlag ? extraData<AttributesData>()->namespaceURI : nullAtom; >+ } >+ >+ const String& oldValue(); >+ void setOldValue(const String&); >+ >+ enum MutationTypeFlag { >+ ChildListFlag = 1 << 0, >+ AttributesFlag = 1 << 1, >+ CharacterDataFlag = 1 << 2 >+ }; >+ MutationTypeFlag typeFlag() { return m_typeFlag; } >+ >+private: >+ class ExtraData { >+ public: >+ virtual ~ExtraData() { } >+ protected: >+ ExtraData() { } >+ }; >+ >+ struct ChildListData : public ExtraData { >+ RefPtr<NodeList> addedNodes; >+ RefPtr<NodeList> removedNodes; >+ RefPtr<Node> previousSibling; >+ RefPtr<Node> nextSibling; >+ }; >+ >+ struct AttributesData : public ExtraData { >+ AtomicString localName; >+ AtomicString namespaceURI; >+ String oldValue; >+ }; >+ >+ struct CharacterDataData : public ExtraData { >+ String oldValue; >+ }; >+ >+ MutationRecord(MutationTypeFlag, PassRefPtr<Node> target, PassOwnPtr<ExtraData>); >+ >+ template<class C> C* extraData() >+ { >+ return static_cast<C*>(m_extraData.get()); >+ } >+ >+ MutationTypeFlag m_typeFlag; >+ RefPtr<Node> m_target; >+ OwnPtr<ExtraData> m_extraData; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MUTATION_OBSERVERS) >+ >+#endif // MutationRecord_h >diff --git a/Source/WebCore/dom/MutationRecord.idl b/Source/WebCore/dom/MutationRecord.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..46e7a29bbb84526b4290d9046680038ce0cc5b29 >--- /dev/null >+++ b/Source/WebCore/dom/MutationRecord.idl >@@ -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; >+ }; >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 68824
:
108719
|
108724
|
108757
|
108759