WebKit Bugzilla
Attachment 359590 Details for
Bug 193111
: [Cocoa] Allow the page to add to the platform undo stack via UndoManager.addItem()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193111-20190118234324.patch (text/plain), 32.88 KB, created by
Wenson Hsieh
on 2019-01-18 23:43:24 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-18 23:43:24 PST
Size:
32.88 KB
patch
obsolete
>Subversion Revision: 240139 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 609aaafafc74b81a7a3f11fc2d67b25759e8e925..9e5378b840a88f76cf81654e76b81d229176ca14 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,67 @@ >+2019-01-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Add some bindings-related bookkeepping to UndoManager and UndoItem >+ https://bugs.webkit.org/show_bug.cgi?id=193111 >+ <rdar://problem/44807048> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch is work in progress towards supporting `UndoManager.addItem()`. Here, we add helper methods to >+ UndoItem and UndoManager which later patches will exercise, as well as introduce some custom bindings to >+ properly handle the case where UndoItems are given anonymous JavaScript functions (see below for more details). >+ >+ No new tests, because there is no script-observable change in behavior yet. When `addItems()` is hooked up, I >+ will write a test to verify that the undo and redo JavaScript functions survive garbage collection. >+ >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ >+ Auto-sort some WHLSL headers. >+ >+ * bindings/js/JSUndoItemCustom.cpp: >+ (WebCore::JSUndoItem::visitAdditionalChildren): >+ >+ Have each JSUndoItem visit its undo and redo callback functions to ensure that the JavaScript wrapper objects >+ for these functions are not garbage collected underneath the item. >+ >+ (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots): >+ >+ Consider the undo item wrapper reachable from opaque roots if it is associated with its UndoManager's Document. >+ This ensures that if script isn't holding on to a reference to the wrapper (for instance, by calling >+ `UndoManager.addItem(new UndoItem({ ... }))`), we still protect the corresponding JSUndoItem as long as the >+ UndoManager's Document is alive. In the case where the undo item is not associated with a document, either (1) >+ script is keeping a reference to it, in which case it will be trivially reachable, or (2) script won't be able >+ to observe the destruction of the wrapper anyways (e.g. calling `new UndoItem({ ... })` by itself). >+ >+ * dom/Document.cpp: >+ (WebCore::Document::prepareForDestruction): >+ >+ Invalidate all undo items when the document is about to go away. >+ >+ * page/UndoItem.cpp: Copied from Source/WebCore/page/UndoManager.cpp. >+ (WebCore::UndoItem::setUndoManager): >+ (WebCore::UndoItem::invalidate): >+ (WebCore::UndoItem::isValid const): >+ >+ Add a few helpers, to be used in a future patch. We consider an UndoItem valid if it has been added to an >+ UndoManager, and is thus associated with a document. >+ >+ (WebCore::UndoItem::document const): >+ * page/UndoItem.h: >+ * page/UndoItem.idl: >+ * page/UndoManager.cpp: >+ (WebCore::UndoManager::UndoManager): >+ (WebCore::UndoManager::addItem): >+ >+ Have an UndoManager keep its UndoItems alive. These UndoItems remain in this set until either the document will >+ be destroyed, or the corresponding undo action is no longer needed because the platform undo stack has changed >+ (this latter behavior is yet to be implemented). >+ >+ (WebCore::UndoManager::removeItem): >+ (WebCore::UndoManager::removeAllItems): >+ * page/UndoManager.h: >+ (WebCore::UndoManager::UndoManager): Deleted. >+ > 2019-01-17 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index b6124192ce94452f6d1fe4bbf309fcdac41b472a..245a55908dfe2e3055ac6adb7fd4bb0021624659 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -520,6 +520,7 @@ bindings/js/JSTextTrackListCustom.cpp > bindings/js/JSTrackCustom.cpp > bindings/js/JSTreeWalkerCustom.cpp > bindings/js/JSTypedOMCSSStyleValueCustom.cpp >+bindings/js/JSUndoItemCustom.cpp > bindings/js/JSVideoTrackCustom.cpp > bindings/js/JSVideoTrackListCustom.cpp > bindings/js/JSWebAnimationCustom.cpp >@@ -1530,6 +1531,7 @@ page/SocketProvider.cpp > page/SpatialNavigation.cpp > page/SuspendableTimer.cpp > page/TextIndicator.cpp >+page/UndoItem.cpp > page/UndoManager.cpp > page/UserContentProvider.cpp > page/UserContentController.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index c0c2973855bfa7ec7ffa71141277bec8cf5e61d7..3a1161a7951fc7e44ecec20feee2ce480dbdddbf 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -6430,17 +6430,16 @@ > 1C840B9A21EC400900D0500D /* WHLSLGatherEntryPointItems.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLGatherEntryPointItems.h; sourceTree = "<group>"; }; > 1C840B9B21EC400900D0500D /* WHLSLChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLChecker.cpp; sourceTree = "<group>"; }; > 1C904DF90BA9D2C80081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; }; >- 1CA0C2E421EED12A00A11860 /* WHLSLFunctionStageChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLFunctionStageChecker.cpp; sourceTree = "<group>"; }; >- 1CA0C2E521EED12A00A11860 /* WHLSLFunctionStageChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionStageChecker.h; sourceTree = "<group>"; }; >+ 1C9AE5CA21ED9DF50069D5F2 /* WHLSLHighZombieFinder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLHighZombieFinder.cpp; sourceTree = "<group>"; }; >+ 1C9AE5CB21ED9DF50069D5F2 /* WHLSLHighZombieFinder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLHighZombieFinder.h; sourceTree = "<group>"; }; > 1CA0C2DE21EEB5F400A11860 /* WHLSLRecursionChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLRecursionChecker.h; sourceTree = "<group>"; }; > 1CA0C2E021EEB5F500A11860 /* WHLSLRecursionChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLRecursionChecker.cpp; sourceTree = "<group>"; }; >+ 1CA0C2E421EED12A00A11860 /* WHLSLFunctionStageChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLFunctionStageChecker.cpp; sourceTree = "<group>"; }; >+ 1CA0C2E521EED12A00A11860 /* WHLSLFunctionStageChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionStageChecker.h; sourceTree = "<group>"; }; > 1CA0C2EA21EED6F500A11860 /* WHLSLLiteralTypeChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLiteralTypeChecker.h; sourceTree = "<group>"; }; > 1CA0C2EC21EED6F600A11860 /* WHLSLLiteralTypeChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLLiteralTypeChecker.cpp; sourceTree = "<group>"; }; >- 1C9AE5CA21ED9DF50069D5F2 /* WHLSLHighZombieFinder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLHighZombieFinder.cpp; sourceTree = "<group>"; }; >- 1C9AE5CB21ED9DF50069D5F2 /* WHLSLHighZombieFinder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLHighZombieFinder.h; sourceTree = "<group>"; }; > 1CA0C2F421EEDAD000A11860 /* WHLSLLoopChecker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLLoopChecker.cpp; sourceTree = "<group>"; }; > 1CA0C2F521EEDAD100A11860 /* WHLSLLoopChecker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLLoopChecker.h; sourceTree = "<group>"; }; >- 1CA0C2F621EEDAD200A11860 /* AST */ = {isa = PBXFileReference; lastKnownFileType = folder; path = AST; sourceTree = "<group>"; }; > 1CA19E030DC255950065A994 /* EventLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventLoopMac.mm; sourceTree = "<group>"; }; > 1CA19E150DC255CA0065A994 /* EventLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventLoop.h; sourceTree = "<group>"; }; > 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObject.h; sourceTree = "<group>"; }; >@@ -7090,8 +7089,6 @@ > 319BDE531E7A86C100BA296C /* JSRTCIceTransportState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRTCIceTransportState.h; sourceTree = "<group>"; }; > 319BDE531E7A86C100BA296D /* JSRTCPeerConnectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRTCPeerConnectionState.h; sourceTree = "<group>"; }; > 319FBD5D15D2F444009640A6 /* CachedImageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedImageClient.h; sourceTree = "<group>"; }; >- 31A088C41E737B2C003B6609 /* JSWebGPURenderingContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPURenderingContextCustom.cpp; sourceTree = "<group>"; }; >- 31A088C51E737B2C003B6609 /* JSWebGPURenderPassAttachmentDescriptorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPURenderPassAttachmentDescriptorCustom.cpp; sourceTree = "<group>"; }; > 31A0891B1E738D59003B6609 /* JSWebGPUBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPUBuffer.cpp; sourceTree = "<group>"; }; > 31A0891D1E738D59003B6609 /* JSWebGPUBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGPUBuffer.h; sourceTree = "<group>"; }; > 31A0891E1E738D59003B6609 /* JSWebGPUCommandBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPUCommandBuffer.cpp; sourceTree = "<group>"; }; >@@ -15123,6 +15120,8 @@ > F4D43D64218802E600ECECAC /* SerializedAttachmentData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SerializedAttachmentData.h; sourceTree = "<group>"; }; > F4D9817D2195FBF6008230FC /* ChangeListTypeCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChangeListTypeCommand.h; sourceTree = "<group>"; }; > F4D9817E2195FBF6008230FC /* ChangeListTypeCommand.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ChangeListTypeCommand.cpp; sourceTree = "<group>"; }; >+ F4E1965A21F2395000285078 /* JSUndoItemCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUndoItemCustom.cpp; sourceTree = "<group>"; }; >+ F4E1965F21F26E4E00285078 /* UndoItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UndoItem.cpp; sourceTree = "<group>"; }; > F4E57EDA213F3F5F004EA98E /* FontAttributeChanges.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontAttributeChanges.h; sourceTree = "<group>"; }; > F4E57EDF213F434A004EA98E /* WebCoreNSFontManagerExtras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCoreNSFontManagerExtras.h; sourceTree = "<group>"; }; > F4E57EE0213F434A004EA98E /* WebCoreNSFontManagerExtras.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSFontManagerExtras.mm; sourceTree = "<group>"; }; >@@ -17038,6 +17037,100 @@ > tabWidth = 8; > usesTabs = 0; > }; >+ 1CA0C2F621EEDAD200A11860 /* AST */ = { >+ isa = PBXGroup; >+ children = ( >+ 1C840B9021EC30F900D0500D /* WHLSLAddressSpace.h */, >+ C21BF72521CD89E200227979 /* WHLSLArrayReferenceType.h */, >+ C21BF70921CD89CA00227979 /* WHLSLArrayType.h */, >+ C21BF73021CD89ED00227979 /* WHLSLAssignmentExpression.h */, >+ C21BF70A21CD89CB00227979 /* WHLSLBaseFunctionAttribute.h */, >+ C21BF6FA21CD89BE00227979 /* WHLSLBaseSemantic.h */, >+ C21BF71E21CD89DC00227979 /* WHLSLBlock.h */, >+ C21BF6F621CD89B700227979 /* WHLSLBooleanLiteral.h */, >+ C21BF71A21CD89D800227979 /* WHLSLBreak.h */, >+ C2138A1321DDECD300F516BA /* WHLSLBuiltInSemantic.cpp */, >+ C21BF72221CD89DF00227979 /* WHLSLBuiltInSemantic.h */, >+ C21BF71621CD89D500227979 /* WHLSLCallExpression.h */, >+ C21BF70621CD89C700227979 /* WHLSLCommaExpression.h */, >+ C21BF73321CD89F000227979 /* WHLSLConstantExpression.h */, >+ C21BF6F521CD89B500227979 /* WHLSLContinue.h */, >+ C21BF70121CD89C400227979 /* WHLSLDereferenceExpression.h */, >+ C21BF71821CD89D700227979 /* WHLSLDotExpression.h */, >+ C21BF6FB21CD89BE00227979 /* WHLSLDoWhileLoop.h */, >+ C21BF72821CD89E500227979 /* WHLSLEffectfulExpressionStatement.h */, >+ 1C840B7D21EBE0B800D0500D /* WHLSLEntryPointType.h */, >+ C21BF72021CD89DD00227979 /* WHLSLEnumerationDefinition.h */, >+ C21BF72621CD89E300227979 /* WHLSLEnumerationMember.h */, >+ C21BF70221CD89C400227979 /* WHLSLEnumerationMemberLiteral.h */, >+ C21BF70C21CD89CC00227979 /* WHLSLExpression.h */, >+ C21BF70021CD89C200227979 /* WHLSLFallthrough.h */, >+ C21BF73521CD89F200227979 /* WHLSLFloatLiteral.h */, >+ 1CB69B3821DF03E1006E846A /* WHLSLFloatLiteralType.cpp */, >+ 1CB69B3421DED63A006E846A /* WHLSLFloatLiteralType.h */, >+ C21BF73421CD89F100227979 /* WHLSLForLoop.h */, >+ C21BF70521CD89C700227979 /* WHLSLFunctionAttribute.h */, >+ C21BF6FD21CD89C000227979 /* WHLSLFunctionDeclaration.h */, >+ C21BF6F421CD89B300227979 /* WHLSLFunctionDefinition.h */, >+ C21BF6FF21CD89C200227979 /* WHLSLIfStatement.h */, >+ C21BF6F721CD89B900227979 /* WHLSLIndexExpression.h */, >+ C20F4F6621DFF2360070C45A /* WHLSLIntegerLiteral.cpp */, >+ C21BF6F821CD89BB00227979 /* WHLSLIntegerLiteral.h */, >+ 1CB69B3921DF03F3006E846A /* WHLSLIntegerLiteralType.cpp */, >+ 1CB69B3521DED649006E846A /* WHLSLIntegerLiteralType.h */, >+ C21BF73221CD89EF00227979 /* WHLSLLogicalExpression.h */, >+ C21BF71521CD89D400227979 /* WHLSLLogicalNotExpression.h */, >+ C21BF72D21CD89E900227979 /* WHLSLMakeArrayReferenceExpression.h */, >+ C21BF72C21CD89E900227979 /* WHLSLMakePointerExpression.h */, >+ 1C33277121CF0BE1000DC9F2 /* WHLSLNamedType.h */, >+ C21BF72321CD89E100227979 /* WHLSLNativeFunctionDeclaration.h */, >+ C21BF72A21CD89E700227979 /* WHLSLNativeTypeDeclaration.h */, >+ C21BF72421CD89E100227979 /* WHLSLNode.h */, >+ C21BF70721CD89C800227979 /* WHLSLNullLiteral.h */, >+ 1CB69B3A21DF0403006E846A /* WHLSLNullLiteralType.cpp */, >+ 1CB69B3621DED657006E846A /* WHLSLNullLiteralType.h */, >+ C21BF72121CD89DE00227979 /* WHLSLNumThreadsFunctionAttribute.h */, >+ C21BF72F21CD89EC00227979 /* WHLSLPointerType.h */, >+ C21BF72E21CD89EA00227979 /* WHLSLPropertyAccessExpression.h */, >+ C21BF70B21CD89CC00227979 /* WHLSLQualifier.h */, >+ C21BF71B21CD89D900227979 /* WHLSLReadModifyWriteExpression.h */, >+ C21BF70D21CD89CD00227979 /* WHLSLReferenceType.h */, >+ 1CB69B3221DED40B006E846A /* WHLSLResolvableType.h */, >+ C2138A1521DDECE900F516BA /* WHLSLResourceSemantic.cpp */, >+ C21BF70821CD89C900227979 /* WHLSLResourceSemantic.h */, >+ C21BF70321CD89C500227979 /* WHLSLReturn.h */, >+ C21BF6F921CD89BD00227979 /* WHLSLSemantic.h */, >+ C2138A1621DDECFB00F516BA /* WHLSLSpecializationConstantSemantic.cpp */, >+ C21BF73621CD89F300227979 /* WHLSLSpecializationConstantSemantic.h */, >+ C2138A1721DDED0D00F516BA /* WHLSLStageInOutSemantic.cpp */, >+ C21BF70E21CD89CE00227979 /* WHLSLStageInOutSemantic.h */, >+ C21BF71221CD89D100227979 /* WHLSLStatement.h */, >+ C21BF72721CD89E400227979 /* WHLSLStructureDefinition.h */, >+ C21BF6FE21CD89C100227979 /* WHLSLStructureElement.h */, >+ C21BF71921CD89D700227979 /* WHLSLSwitchCase.h */, >+ C21BF73121CD89EE00227979 /* WHLSLSwitchStatement.h */, >+ C21BF71C21CD89DA00227979 /* WHLSLTernaryExpression.h */, >+ C21BF6F321CD89AD00227979 /* WHLSLTrap.h */, >+ C21BF71D21CD89DB00227979 /* WHLSLType.h */, >+ C288C72D21C991DA002DF5CA /* WHLSLTypeArgument.cpp */, >+ C21BF71121CD89D100227979 /* WHLSLTypeArgument.h */, >+ C21BF72921CD89E600227979 /* WHLSLTypeDefinition.h */, >+ C20F4F6421DFBE5C0070C45A /* WHLSLTypeReference.cpp */, >+ C21BF71F21CD89DC00227979 /* WHLSLTypeReference.h */, >+ 1C33277221CF0D2E000DC9F2 /* WHLSLUnnamedType.h */, >+ C20F4F6721DFF3A70070C45A /* WHLSLUnsignedIntegerLiteral.cpp */, >+ C21BF72B21CD89E800227979 /* WHLSLUnsignedIntegerLiteral.h */, >+ 1CB69B3B21DF041E006E846A /* WHLSLUnsignedIntegerLiteralType.cpp */, >+ 1CB69B3721DED66B006E846A /* WHLSLUnsignedIntegerLiteralType.h */, >+ C21BF6FC21CD89BF00227979 /* WHLSLValue.h */, >+ C21BF71021CD89D000227979 /* WHLSLVariableDeclaration.h */, >+ C21BF71421CD89D300227979 /* WHLSLVariableDeclarationsStatement.h */, >+ C21BF71321CD89D200227979 /* WHLSLVariableReference.h */, >+ C21BF70421CD89C600227979 /* WHLSLWhileLoop.h */, >+ ); >+ path = AST; >+ sourceTree = "<group>"; >+ }; > 1CDD44660BA9C80000F90147 /* Configurations */ = { > isa = PBXGroup; > children = ( >@@ -20313,6 +20406,7 @@ > 62C1217B11AB9E77003C462C /* SuspendableTimer.h */, > 2D4F96F11A1ECC240098BF88 /* TextIndicator.cpp */, > 2D4F96F21A1ECC240098BF88 /* TextIndicator.h */, >+ F4E1965F21F26E4E00285078 /* UndoItem.cpp */, > 2ECDBAD521D8906300F00ECD /* UndoItem.h */, > 2ECDBAD721D8906300F00ECD /* UndoItem.idl */, > 2ECDBACF21D8903400F00ECD /* UndoManager.cpp */, >@@ -20681,13 +20775,12 @@ > 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */, > 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */, > 4BAFD0E22192604D00C0AB64 /* JSTypedOMCSSStyleValueCustom.cpp */, >+ F4E1965A21F2395000285078 /* JSUndoItemCustom.cpp */, > BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */, > BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */, > 715DA5D3201BB902002EF2B0 /* JSWebAnimationCustom.cpp */, > D3F3D3591A69A3B00059FC2B /* JSWebGL2RenderingContextCustom.cpp */, > 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */, >- 31A088C41E737B2C003B6609 /* JSWebGPURenderingContextCustom.cpp */, >- 31A088C51E737B2C003B6609 /* JSWebGPURenderPassAttachmentDescriptorCustom.cpp */, > E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */, > 46F91BC91FCDD0FE001599C3 /* JSWorkerNavigatorCustom.cpp */, > 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */, >@@ -25515,100 +25608,6 @@ > path = WHLSL; > sourceTree = "<group>"; > }; >- 1CA0C2F621EEDAD200A11860 /* AST */ = { >- isa = PBXGroup; >- children = ( >- 1C840B9021EC30F900D0500D /* WHLSLAddressSpace.h */, >- C21BF72521CD89E200227979 /* WHLSLArrayReferenceType.h */, >- C21BF70921CD89CA00227979 /* WHLSLArrayType.h */, >- C21BF73021CD89ED00227979 /* WHLSLAssignmentExpression.h */, >- C21BF70A21CD89CB00227979 /* WHLSLBaseFunctionAttribute.h */, >- C21BF6FA21CD89BE00227979 /* WHLSLBaseSemantic.h */, >- C21BF71E21CD89DC00227979 /* WHLSLBlock.h */, >- C21BF6F621CD89B700227979 /* WHLSLBooleanLiteral.h */, >- C21BF71A21CD89D800227979 /* WHLSLBreak.h */, >- C2138A1321DDECD300F516BA /* WHLSLBuiltInSemantic.cpp */, >- C21BF72221CD89DF00227979 /* WHLSLBuiltInSemantic.h */, >- C21BF71621CD89D500227979 /* WHLSLCallExpression.h */, >- C21BF70621CD89C700227979 /* WHLSLCommaExpression.h */, >- C21BF73321CD89F000227979 /* WHLSLConstantExpression.h */, >- C21BF6F521CD89B500227979 /* WHLSLContinue.h */, >- C21BF70121CD89C400227979 /* WHLSLDereferenceExpression.h */, >- C21BF71821CD89D700227979 /* WHLSLDotExpression.h */, >- C21BF6FB21CD89BE00227979 /* WHLSLDoWhileLoop.h */, >- C21BF72821CD89E500227979 /* WHLSLEffectfulExpressionStatement.h */, >- 1C840B7D21EBE0B800D0500D /* WHLSLEntryPointType.h */, >- C21BF72021CD89DD00227979 /* WHLSLEnumerationDefinition.h */, >- C21BF72621CD89E300227979 /* WHLSLEnumerationMember.h */, >- C21BF70221CD89C400227979 /* WHLSLEnumerationMemberLiteral.h */, >- C21BF70C21CD89CC00227979 /* WHLSLExpression.h */, >- C21BF70021CD89C200227979 /* WHLSLFallthrough.h */, >- C21BF73521CD89F200227979 /* WHLSLFloatLiteral.h */, >- 1CB69B3821DF03E1006E846A /* WHLSLFloatLiteralType.cpp */, >- 1CB69B3421DED63A006E846A /* WHLSLFloatLiteralType.h */, >- C21BF73421CD89F100227979 /* WHLSLForLoop.h */, >- C21BF70521CD89C700227979 /* WHLSLFunctionAttribute.h */, >- C21BF6FD21CD89C000227979 /* WHLSLFunctionDeclaration.h */, >- C21BF6F421CD89B300227979 /* WHLSLFunctionDefinition.h */, >- C21BF6FF21CD89C200227979 /* WHLSLIfStatement.h */, >- C21BF6F721CD89B900227979 /* WHLSLIndexExpression.h */, >- C20F4F6621DFF2360070C45A /* WHLSLIntegerLiteral.cpp */, >- C21BF6F821CD89BB00227979 /* WHLSLIntegerLiteral.h */, >- 1CB69B3921DF03F3006E846A /* WHLSLIntegerLiteralType.cpp */, >- 1CB69B3521DED649006E846A /* WHLSLIntegerLiteralType.h */, >- C21BF73221CD89EF00227979 /* WHLSLLogicalExpression.h */, >- C21BF71521CD89D400227979 /* WHLSLLogicalNotExpression.h */, >- C21BF72D21CD89E900227979 /* WHLSLMakeArrayReferenceExpression.h */, >- C21BF72C21CD89E900227979 /* WHLSLMakePointerExpression.h */, >- 1C33277121CF0BE1000DC9F2 /* WHLSLNamedType.h */, >- C21BF72321CD89E100227979 /* WHLSLNativeFunctionDeclaration.h */, >- C21BF72A21CD89E700227979 /* WHLSLNativeTypeDeclaration.h */, >- C21BF72421CD89E100227979 /* WHLSLNode.h */, >- C21BF70721CD89C800227979 /* WHLSLNullLiteral.h */, >- 1CB69B3A21DF0403006E846A /* WHLSLNullLiteralType.cpp */, >- 1CB69B3621DED657006E846A /* WHLSLNullLiteralType.h */, >- C21BF72121CD89DE00227979 /* WHLSLNumThreadsFunctionAttribute.h */, >- C21BF72F21CD89EC00227979 /* WHLSLPointerType.h */, >- C21BF72E21CD89EA00227979 /* WHLSLPropertyAccessExpression.h */, >- C21BF70B21CD89CC00227979 /* WHLSLQualifier.h */, >- C21BF71B21CD89D900227979 /* WHLSLReadModifyWriteExpression.h */, >- C21BF70D21CD89CD00227979 /* WHLSLReferenceType.h */, >- 1CB69B3221DED40B006E846A /* WHLSLResolvableType.h */, >- C2138A1521DDECE900F516BA /* WHLSLResourceSemantic.cpp */, >- C21BF70821CD89C900227979 /* WHLSLResourceSemantic.h */, >- C21BF70321CD89C500227979 /* WHLSLReturn.h */, >- C21BF6F921CD89BD00227979 /* WHLSLSemantic.h */, >- C2138A1621DDECFB00F516BA /* WHLSLSpecializationConstantSemantic.cpp */, >- C21BF73621CD89F300227979 /* WHLSLSpecializationConstantSemantic.h */, >- C2138A1721DDED0D00F516BA /* WHLSLStageInOutSemantic.cpp */, >- C21BF70E21CD89CE00227979 /* WHLSLStageInOutSemantic.h */, >- C21BF71221CD89D100227979 /* WHLSLStatement.h */, >- C21BF72721CD89E400227979 /* WHLSLStructureDefinition.h */, >- C21BF6FE21CD89C100227979 /* WHLSLStructureElement.h */, >- C21BF71921CD89D700227979 /* WHLSLSwitchCase.h */, >- C21BF73121CD89EE00227979 /* WHLSLSwitchStatement.h */, >- C21BF71C21CD89DA00227979 /* WHLSLTernaryExpression.h */, >- C21BF6F321CD89AD00227979 /* WHLSLTrap.h */, >- C21BF71D21CD89DB00227979 /* WHLSLType.h */, >- C288C72D21C991DA002DF5CA /* WHLSLTypeArgument.cpp */, >- C21BF71121CD89D100227979 /* WHLSLTypeArgument.h */, >- C21BF72921CD89E600227979 /* WHLSLTypeDefinition.h */, >- C20F4F6421DFBE5C0070C45A /* WHLSLTypeReference.cpp */, >- C21BF71F21CD89DC00227979 /* WHLSLTypeReference.h */, >- 1C33277221CF0D2E000DC9F2 /* WHLSLUnnamedType.h */, >- C20F4F6721DFF3A70070C45A /* WHLSLUnsignedIntegerLiteral.cpp */, >- C21BF72B21CD89E800227979 /* WHLSLUnsignedIntegerLiteral.h */, >- 1CB69B3B21DF041E006E846A /* WHLSLUnsignedIntegerLiteralType.cpp */, >- 1CB69B3721DED66B006E846A /* WHLSLUnsignedIntegerLiteralType.h */, >- C21BF6FC21CD89BF00227979 /* WHLSLValue.h */, >- C21BF71021CD89D000227979 /* WHLSLVariableDeclaration.h */, >- C21BF71421CD89D300227979 /* WHLSLVariableDeclarationsStatement.h */, >- C21BF71321CD89D200227979 /* WHLSLVariableReference.h */, >- C21BF70421CD89C600227979 /* WHLSLWhileLoop.h */, >- ); >- path = AST; >- sourceTree = "<group>"; >- }; > C96F5EBF1B5872260091EA9D /* mediasession */ = { > isa = PBXGroup; > children = ( >diff --git a/Source/WebCore/bindings/js/JSUndoItemCustom.cpp b/Source/WebCore/bindings/js/JSUndoItemCustom.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..475db0a2248c4f18a5821d2520da968f29954c04 >--- /dev/null >+++ b/Source/WebCore/bindings/js/JSUndoItemCustom.cpp >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2019 Apple 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: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. 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. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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" >+#include "JSUndoItem.h" >+ >+namespace WebCore { >+ >+void JSUndoItem::visitAdditionalChildren(JSC::SlotVisitor& visitor) >+{ >+ wrapped().undoHandler().visitJSFunction(visitor); >+ wrapped().redoHandler().visitJSFunction(visitor); >+} >+ >+bool JSUndoItemOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) >+{ >+ auto* documentForUndoItem = jsCast<JSUndoItem*>(handle.slot()->asCell())->wrapped().document(); >+ if (!documentForUndoItem) >+ return false; >+ >+ if (!visitor.containsOpaqueRoot(documentForUndoItem)) >+ return false; >+ >+ if (UNLIKELY(reason)) >+ *reason = "Document is an opaque root."; >+ return true; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 67eb1a19aff791e62d645d693ad923779b121bdf..938019aca16597699ef5077ed4273d96243d9716 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -2501,6 +2501,8 @@ void Document::prepareForDestruction() > clearTouchEventHandlersAndListeners(); > #endif > >+ m_undoManager->removeAllItems(); >+ > #if HAVE(ACCESSIBILITY) > if (this != &topDocument()) { > // Let the ax cache know that this subframe goes out of scope. >diff --git a/Source/WebCore/page/UndoItem.cpp b/Source/WebCore/page/UndoItem.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..b91fc86c76602a9cd6c4ac4996c7fd0b972052ce >--- /dev/null >+++ b/Source/WebCore/page/UndoItem.cpp >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2019 Apple 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: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. 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. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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" >+#include "UndoItem.h" >+ >+#include "UndoManager.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(UndoItem); >+ >+void UndoItem::setUndoManager(UndoManager& undoManager) >+{ >+ ASSERT(!m_undoManager); >+ m_undoManager = makeWeakPtr(undoManager); >+} >+ >+void UndoItem::invalidate() >+{ >+ if (auto manager = std::exchange(m_undoManager, nullptr)) >+ manager->removeItem(*this); >+} >+ >+bool UndoItem::isValid() const >+{ >+ return !!m_undoManager; >+} >+ >+Document* UndoItem::document() const >+{ >+ return isValid() ? &m_undoManager->document() : nullptr; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/page/UndoItem.h b/Source/WebCore/page/UndoItem.h >index 019bb9afcffe1df70d331635061334713806aaf4..b3a15e71d40ac30ca76c5b1d04db4a2160301a34 100644 >--- a/Source/WebCore/page/UndoItem.h >+++ b/Source/WebCore/page/UndoItem.h >@@ -26,15 +26,18 @@ > #pragma once > > #include "VoidCallback.h" >-#include <wtf/Function.h> >-#include <wtf/IsoMallocInlines.h> >+#include <wtf/IsoMalloc.h> > #include <wtf/RefCounted.h> >+#include <wtf/WeakPtr.h> > #include <wtf/text/WTFString.h> > > namespace WebCore { > >+class Document; >+class UndoManager; >+ > class UndoItem : public RefCounted<UndoItem> { >- WTF_MAKE_ISO_ALLOCATED_INLINE(UndoItem); >+ WTF_MAKE_ISO_ALLOCATED(UndoItem); > public: > struct Init { > String label; >@@ -47,6 +50,13 @@ public: > return adoptRef(*new UndoItem(WTFMove(init))); > } > >+ bool isValid() const; >+ void invalidate(); >+ >+ Document* document() const; >+ >+ void setUndoManager(UndoManager&); >+ > const String& label() const { return m_label; } > VoidCallback& undoHandler() const { return m_undoHandler.get(); } > VoidCallback& redoHandler() const { return m_redoHandler.get(); } >@@ -62,6 +72,7 @@ private: > String m_label; > Ref<VoidCallback> m_undoHandler; > Ref<VoidCallback> m_redoHandler; >+ WeakPtr<UndoManager> m_undoManager; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/page/UndoItem.idl b/Source/WebCore/page/UndoItem.idl >index 09b97c8c150c107e0941418ec11770d86d4a91ca..190f9bbb52d0e5f81c65cd4e0e7d40683e808765 100644 >--- a/Source/WebCore/page/UndoItem.idl >+++ b/Source/WebCore/page/UndoItem.idl >@@ -34,6 +34,8 @@ > [ > EnabledAtRuntime=UndoManagerAPI, > ImplementationLacksVTable, >+ JSCustomMarkFunction, >+ CustomIsReachable, > Constructor(UndoItemInit initDict), > ] interface UndoItem { > readonly attribute DOMString label; >diff --git a/Source/WebCore/page/UndoManager.cpp b/Source/WebCore/page/UndoManager.cpp >index 221bf28cc969ea842307fab891e5a5c202a35305..1d45ba358be049eada151dab093f1db002355851 100644 >--- a/Source/WebCore/page/UndoManager.cpp >+++ b/Source/WebCore/page/UndoManager.cpp >@@ -33,10 +33,32 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(UndoManager); > >+UndoManager::UndoManager(Document& document) >+ : m_document(document) >+{ >+} >+ >+UndoManager::~UndoManager() = default; >+ > void UndoManager::addItem(Ref<UndoItem>&& item) > { >- UNUSED_PARAM(item); > UNUSED_PARAM(m_document); >+ >+ item->setUndoManager(*this); >+ m_items.add(WTFMove(item)); >+} >+ >+void UndoManager::removeItem(UndoItem& item) >+{ >+ if (auto foundItem = m_items.take(&item)) >+ foundItem->invalidate(); >+} >+ >+void UndoManager::removeAllItems() >+{ >+ auto items = std::exchange(m_items, { }); >+ for (auto& item : items) >+ item->invalidate(); > } > > } // namespace WebCore >diff --git a/Source/WebCore/page/UndoManager.h b/Source/WebCore/page/UndoManager.h >index 49604f09c5c8a501689bc5ce1e86d037f499bb54..78fa720dc731080064b70d8303a2fbbdb4d3c5dd 100644 >--- a/Source/WebCore/page/UndoManager.h >+++ b/Source/WebCore/page/UndoManager.h >@@ -28,13 +28,15 @@ > #include <wtf/IsoMalloc.h> > #include <wtf/Ref.h> > #include <wtf/RefCounted.h> >+#include <wtf/RefPtr.h> >+#include <wtf/WeakPtr.h> > > namespace WebCore { > > class Document; > class UndoItem; > >-class UndoManager : public RefCounted<UndoManager> { >+class UndoManager : public RefCounted<UndoManager>, public CanMakeWeakPtr<UndoManager> { > WTF_MAKE_ISO_ALLOCATED(UndoManager); > public: > static Ref<UndoManager> create(Document& document) >@@ -42,16 +44,18 @@ public: > return adoptRef(*new UndoManager(document)); > } > >+ ~UndoManager(); >+ >+ void removeItem(UndoItem&); >+ void removeAllItems(); > void addItem(Ref<UndoItem>&&); > Document& document() { return m_document; } > > private: >- UndoManager(Document& document) >- : m_document(document) >- { >- } >+ UndoManager(Document&); > > Document& m_document; >+ HashSet<RefPtr<UndoItem>> m_items; > }; > > } // namespace WebCore
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 193111
:
358427
|
359498
|
359590
|
359591
|
359592
|
359593
|
359594
|
359631
|
359632
|
359819
|
359832
|
359834