WebKit Bugzilla
Attachment 356133 Details for
Bug 192206
: Inform clients when editable image attachment backing data changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192206-20181129220342.patch (text/plain), 21.46 KB, created by
Tim Horton
on 2018-11-29 22:03:43 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-11-29 22:03:43 PST
Size:
21.46 KB
patch
obsolete
>Subversion Revision: 238722 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 45c5dda11f9abe7b2d68a70a30fad9b4d638f2c5..15eef3361b00093db6ac754afb69e19716bdd017 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2018-11-29 Tim Horton <timothy_horton@apple.com> >+ >+ Inform clients when editable image attachment backing data changes >+ https://bugs.webkit.org/show_bug.cgi?id=192206 >+ <rdar://problem/46350277> >+ >+ Reviewed by Wenson Hsieh. >+ >+ * UIProcess/API/Cocoa/APIAttachmentCocoa.mm: >+ (API::Attachment::invalidateGeneratedFileWrapper): >+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _didInvalidateDataForAttachment:]): >+ * UIProcess/API/Cocoa/WKWebViewInternal.h: >+ * UIProcess/Cocoa/PageClientImplCocoa.h: >+ * UIProcess/Cocoa/PageClientImplCocoa.mm: >+ (WebKit::PageClientImplCocoa::didInvalidateDataForAttachment): >+ * UIProcess/PageClient.h: >+ (WebKit::PageClient::didInvalidateDataForAttachment): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::didInvalidateDataForAttachment): >+ * UIProcess/WebPageProxy.h: >+ Plumb file-wrapper-invalidation through from APIAttachment to WKUIDelegate. >+ > 2018-11-29 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r238713. >diff --git a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >index 6255af0ae94e03e62cca660e50477e81cb569e4b..29ec69a16bbb73d48a75eef1f718c871b8f05640 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm >@@ -64,6 +64,7 @@ void Attachment::invalidateGeneratedFileWrapper() > { > ASSERT(m_fileWrapperGenerator); > m_fileWrapper = nil; >+ m_webPage->didInvalidateDataForAttachment(*this); > } > > WTF::String Attachment::mimeType() const >@@ -193,6 +194,7 @@ void Attachment::setFileWrapperGenerator(Function<RetainPtr<NSFileWrapper>(void) > { > m_fileWrapperGenerator = WTFMove(fileWrapperGenerator); > m_fileWrapper = nil; >+ m_webPage->didInvalidateDataForAttachment(*this); > } > > } // namespace API >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >index 81861bc47fda75e15ae8928cb3ac2a3222e2e016..997468cadadda4019ed26cc08bbe78644a418790 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h >@@ -116,6 +116,7 @@ struct UIEdgeInsets; > > - (void)_webView:(WKWebView *)webView didRemoveAttachment:(_WKAttachment *)attachment WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); > - (void)_webView:(WKWebView *)webView didInsertAttachment:(_WKAttachment *)attachment withSource:(NSString *)source WK_API_AVAILABLE(macosx(10.14), ios(12.0)); >+- (void)_webView:(WKWebView *)webView didInvalidateDataForAttachment:(_WKAttachment *)attachment WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > > - (void)_webView:(WKWebView *)webView didResignInputElementStrongPasswordAppearanceWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index d9fca4d03c2cfbe3a24b969fa122661aeaa70e43..881434206632ee57c7223f85e3a22d2c040c1c1b 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -1314,6 +1314,13 @@ - (void)_didRemoveAttachment:(API::Attachment&)attachment > [uiDelegate _webView:self didRemoveAttachment:wrapper(attachment)]; > } > >+- (void)_didInvalidateDataForAttachment:(API::Attachment&)attachment >+{ >+ id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)self.UIDelegate; >+ if ([uiDelegate respondsToSelector:@selector(_webView:didInvalidateDataForAttachment:)]) >+ [uiDelegate _webView:self didInvalidateDataForAttachment:wrapper(attachment)]; >+} >+ > #endif // ENABLE(ATTACHMENT_ELEMENT) > > #pragma mark iOS-specific methods >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >index 71e291f300801a563bc472989e9b80c5f243fe09..b065b3518f829cef353d781c1aa00a6994802d45 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >@@ -181,6 +181,7 @@ class URL; > #if ENABLE(ATTACHMENT_ELEMENT) > - (void)_didRemoveAttachment:(API::Attachment&)attachment; > - (void)_didInsertAttachment:(API::Attachment&)attachment withSource:(NSString *)source; >+- (void)_didInvalidateDataForAttachment:(API::Attachment&)attachment; > #endif > > - (void)_showSafeBrowsingWarning:(const WebKit::SafeBrowsingWarning&)warning completionHandler:(CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, WebCore::URL>&&)>&&)completionHandler; >diff --git a/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h b/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h >index 83948d800f61af508bfda40da757524ae04c01c4..7b4a2dac250c90aaa1cc289ab4c47a123fefc4b7 100644 >--- a/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h >+++ b/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h >@@ -46,6 +46,7 @@ public: > #if ENABLE(ATTACHMENT_ELEMENT) > void didInsertAttachment(API::Attachment&, const String& source) final; > void didRemoveAttachment(API::Attachment&) final; >+ void didInvalidateDataForAttachment(API::Attachment&) final; > NSFileWrapper *allocFileWrapperInstance() const final; > NSSet *serializableFileWrapperClasses() const final; > #endif >diff --git a/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm b/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm >index efe4e81bcc29811132a31210bbacdc8168404a4a..07f02c34f74598fb85b9bfcec7a55e3caa710519 100644 >--- a/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm >@@ -66,6 +66,15 @@ void PageClientImplCocoa::didRemoveAttachment(API::Attachment& attachment) > #endif > } > >+void PageClientImplCocoa::didInvalidateDataForAttachment(API::Attachment& attachment) >+{ >+#if WK_API_ENABLED >+ [m_webView _didInvalidateDataForAttachment:attachment]; >+#else >+ UNUSED_PARAM(attachment); >+#endif >+} >+ > NSFileWrapper *PageClientImplCocoa::allocFileWrapperInstance() const > { > #if WK_API_ENABLED >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index 7defa4029b550dd8fc9f566073cd3f322a360044..ee852b249977b8fd70702d887854127308f194e5 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -454,6 +454,7 @@ public: > #if ENABLE(ATTACHMENT_ELEMENT) > virtual void didInsertAttachment(API::Attachment&, const String& source) { } > virtual void didRemoveAttachment(API::Attachment&) { } >+ virtual void didInvalidateDataForAttachment(API::Attachment&) { } > #if PLATFORM(COCOA) > virtual NSFileWrapper *allocFileWrapperInstance() const { return nullptr; } > virtual NSSet *serializableFileWrapperClasses() const { return nullptr; } >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index c791eabb4def3580a69cb1d6b7bfda2192479781..5ffb2bff6e65a2bc000c0189baee0b3b18ce39f6 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -8115,6 +8115,11 @@ void WebPageProxy::serializedAttachmentDataForIdentifiers(const Vector<String>& > } > } > >+void WebPageProxy::didInvalidateDataForAttachment(API::Attachment& attachment) >+{ >+ pageClient().didInvalidateDataForAttachment(attachment); >+} >+ > WebPageProxy::ShouldUpdateAttachmentAttributes WebPageProxy::willUpdateAttachmentAttributes(const API::Attachment& attachment) > { > #if HAVE(PENCILKIT) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 0ae1fbba1d9a5cb58fa3926506726371f66c7804..b72b00602898c977aca5f7e26019b3a8123f4008 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1370,6 +1370,7 @@ public: > void updateAttachmentAttributes(const API::Attachment&, Function<void(CallbackBase::Error)>&&); > void serializedAttachmentDataForIdentifiers(const Vector<String>&, Vector<WebCore::SerializedAttachmentData>&); > void registerAttachmentIdentifier(const String&); >+ void didInvalidateDataForAttachment(API::Attachment&); > > enum class ShouldUpdateAttachmentAttributes : bool { No, Yes }; > ShouldUpdateAttachmentAttributes willUpdateAttachmentAttributes(const API::Attachment&); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2a468ac4c7b29a498614fd7942dc7b3a0ab7037d..73d6f2fd706b3a26714ccf2117d41497df84441b 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,25 @@ >+2018-11-29 Tim Horton <timothy_horton@apple.com> >+ >+ Inform clients when editable image attachment backing data changes >+ https://bugs.webkit.org/show_bug.cgi?id=192206 >+ <rdar://problem/46350277> >+ >+ Reviewed by Wenson Hsieh. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ (-[AttachmentUpdateObserver init]): >+ (-[AttachmentUpdateObserver dataInvalidated]): >+ (-[AttachmentUpdateObserver _webView:didInvalidateDataForAttachment:]): >+ (TestWebKitAPI::ObserveAttachmentUpdatesForScope::expectAttachmentInvalidation): >+ (webViewForTestingAttachments): >+ (TestWebKitAPI::forEachViewInHierarchy): >+ (TestWebKitAPI::findEditableImageCanvas): >+ (TestWebKitAPI::drawSquareInEditableImage): >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/ios/PencilKitTestSPI.h: Added. >+ Add a test ensuring that we get an invalidation callback when an editable image is changed. >+ > 2018-11-29 Fujii Hironori <Hironori.Fujii@sony.com> > > REGRESSION(r238445)[Buildbot] Unknown builder 'GTK Linux 32-bit Release' in scheduler 'trunk' >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 11d64781f2da258bb44931c3ae3577b179b82406..8e2a4e3ca0f6f1d3595830013db6e09d54533482 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -1368,6 +1368,7 @@ > 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewStablePresentationUpdateCallback.mm; sourceTree = "<group>"; }; > 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKThumbnailView.mm; path = WebKit/WKThumbnailView.mm; sourceTree = "<group>"; }; > 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLVideoElementWrapper.mm; sourceTree = "<group>"; }; >+ 2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PencilKitTestSPI.h; sourceTree = "<group>"; }; > 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; }; > 2D8104CB1BEC13E70020DA46 /* FindInPage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPage.mm; sourceTree = "<group>"; }; > 2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewEditingActions.mm; sourceTree = "<group>"; }; >@@ -2564,6 +2565,7 @@ > children = ( > F4D4F3B41E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm */, > 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */, >+ 2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */, > F4517B652054C49500C26721 /* TestWKWebViewController.h */, > F4517B662054C49500C26721 /* TestWKWebViewController.mm */, > F493247C1F44DF8D006F4336 /* UIKitSPI.h */, >@@ -3795,7 +3797,6 @@ > F45B63FE1F19D410009D38B9 /* ActionSheetTests.mm in Sources */, > 37E7DD641EA06FF2009B396D /* AdditionalReadAccessAllowedURLs.mm in Sources */, > 55A817FC218100E00004A39A /* AdditionalSupportedImageTypes.mm in Sources */, >- 637281A721AE1386009E0DE6 /* DownloadProgress.mm in Sources */, > 7A909A7D1D877480007E10F8 /* AffineTransform.cpp in Sources */, > A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */, > 2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */, >@@ -3881,6 +3882,7 @@ > 518EE51820A78CE200E024F3 /* DoubleDefersLoading.mm in Sources */, > 7CCE7F231A411AF600447C4C /* Download.mm in Sources */, > 7CCE7EEE1A411AE600447C4C /* DownloadDecideDestinationCrash.cpp in Sources */, >+ 637281A721AE1386009E0DE6 /* DownloadProgress.mm in Sources */, > F4D4F3B61E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm in Sources */, > F46128B7211C8ED500D9FADB /* DragAndDropSimulatorMac.mm in Sources */, > F46128D7211E489C00D9FADB /* DragAndDropTests.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index d48f43ef72121e2b597a87578039f778e947f570..048b9078c56d1db04396e3bc5054cd08883eec3a 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -26,6 +26,7 @@ > #import "config.h" > > #import "DragAndDropSimulator.h" >+#import "PencilKitTestSPI.h" > #import "PlatformUtilities.h" > #import "TestNavigationDelegate.h" > #import "TestWKWebView.h" >@@ -47,11 +48,13 @@ > @interface AttachmentUpdateObserver : NSObject <WKUIDelegatePrivate> > @property (nonatomic, readonly) NSArray *inserted; > @property (nonatomic, readonly) NSArray *removed; >+@property (nonatomic, readonly) NSArray *dataInvalidated; > @end > > @implementation AttachmentUpdateObserver { > RetainPtr<NSMutableArray<_WKAttachment *>> _inserted; > RetainPtr<NSMutableArray<_WKAttachment *>> _removed; >+ RetainPtr<NSMutableArray<_WKAttachment *>> _dataInvalidated; > RetainPtr<NSMutableDictionary<NSString *, NSString *>> _identifierToSourceMap; > } > >@@ -60,6 +63,7 @@ - (instancetype)init > if (self = [super init]) { > _inserted = adoptNS([[NSMutableArray alloc] init]); > _removed = adoptNS([[NSMutableArray alloc] init]); >+ _dataInvalidated = adoptNS([[NSMutableArray alloc] init]); > _identifierToSourceMap = adoptNS([[NSMutableDictionary alloc] init]); > } > return self; >@@ -75,6 +79,11 @@ - (NSArray<_WKAttachment *> *)removed > return _removed.get(); > } > >+- (NSArray<_WKAttachment *> *)dataInvalidated >+{ >+ return _dataInvalidated.get(); >+} >+ > - (NSString *)sourceForIdentifier:(NSString *)identifier > { > return [_identifierToSourceMap objectForKey:identifier]; >@@ -92,6 +101,11 @@ - (void)_webView:(WKWebView *)webView didRemoveAttachment:(_WKAttachment *)attac > [_removed addObject:attachment]; > } > >+- (void)_webView:(WKWebView *)webView didInvalidateDataForAttachment:(_WKAttachment *)attachment >+{ >+ [_dataInvalidated addObject:attachment]; >+} >+ > @end > > namespace TestWebKitAPI { >@@ -126,6 +140,14 @@ public: > EXPECT_TRUE(insertedAttachmentsMatch); > } > >+ void expectAttachmentInvalidation(NSArray<_WKAttachment *> *dataInvalidated) >+ { >+ BOOL invalidatedAttachmentsMatch = [[NSSet setWithArray:observer().dataInvalidated] isEqual:[NSSet setWithArray:dataInvalidated]]; >+ if (!invalidatedAttachmentsMatch) >+ NSLog(@"Expected attachments with invalidated data: %@ to match %@.", observer().dataInvalidated, dataInvalidated); >+ EXPECT_TRUE(invalidatedAttachmentsMatch); >+ } >+ > void expectSourceForIdentifier(NSString *expectedSource, NSString *identifier) > { > NSString *observedSource = [observer() sourceForIdentifier:identifier]; >@@ -153,6 +175,7 @@ static NSString *attachmentEditingTestMarkup = @"<meta name='viewport' content=' > static RetainPtr<TestWKWebView> webViewForTestingAttachments(CGSize webViewSize, WKWebViewConfiguration *configuration) > { > configuration._attachmentElementEnabled = YES; >+ configuration._editableImagesEnabled = YES; > WKPreferencesSetCustomPasteboardDataEnabled((__bridge WKPreferencesRef)[configuration preferences], YES); > > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, webViewSize.width, webViewSize.height) configuration:configuration]); >@@ -1778,6 +1801,76 @@ TEST(WKAttachmentTestsIOS, DragAttachmentInsertedAsData) > [dragAndDropSimulator endDataTransfer]; > } > >+#if HAVE(PENCILKIT) >+static BOOL forEachViewInHierarchy(UIView *view, void(^mapFunction)(UIView *subview, BOOL *stop)) >+{ >+ BOOL stop = NO; >+ mapFunction(view, &stop); >+ if (stop) >+ return YES; >+ >+ for (UIView *subview in view.subviews) { >+ stop = forEachViewInHierarchy(subview, mapFunction); >+ if (stop) >+ break; >+ } >+ return stop; >+} >+ >+static PKCanvasView *findEditableImageCanvas(WKWebView *webView) >+{ >+ Class pkCanvasViewClass = NSClassFromString(@"PKCanvasView"); >+ __block PKCanvasView *canvasView = nil; >+ forEachViewInHierarchy(webView.window, ^(UIView *subview, BOOL *stop) { >+ if (![subview isKindOfClass:pkCanvasViewClass]) >+ return; >+ >+ canvasView = (PKCanvasView *)subview; >+ *stop = YES; >+ }); >+ return canvasView; >+} >+ >+static void drawSquareInEditableImage(WKWebView *webView) >+{ >+ Class pkDrawingClass = NSClassFromString(@"PKDrawing"); >+ Class pkInkClass = NSClassFromString(@"PKInk"); >+ Class pkStrokeClass = NSClassFromString(@"PKStroke"); >+ >+ PKCanvasView *canvasView = findEditableImageCanvas(webView); >+ RetainPtr<PKDrawing> drawing = canvasView.drawing ?: adoptNS([[pkDrawingClass alloc] init]); >+ RetainPtr<CGPathRef> path = adoptCF(CGPathCreateWithRect(CGRectMake(0, 0, 50, 50), NULL)); >+ RetainPtr<PKInk> ink = [pkInkClass inkWithType:0 color:UIColor.greenColor weight:100.0]; >+ RetainPtr<PKStroke> stroke = adoptNS([[pkStrokeClass alloc] _initWithPath:path.get() ink:ink.get() inputScale:1]); >+ [drawing _addStroke:stroke.get()]; >+ >+ [canvasView setDrawing:drawing.get()]; >+} >+ >+TEST(WKAttachmentTestsIOS, EditableImageAttachmentDataInvalidation) >+{ >+ auto webView = webViewForTestingAttachments(); >+ >+ RetainPtr<_WKAttachment> attachment; >+ >+ { >+ ObserveAttachmentUpdatesForScope observer(webView.get()); >+ EXPECT_TRUE([webView _synchronouslyExecuteEditCommand:@"InsertEditableImage" argument:nil]); >+ EXPECT_EQ(observer.observer().inserted.count, 1LU); >+ attachment = observer.observer().inserted.firstObject; >+ } >+ >+ [webView waitForNextPresentationUpdate]; >+ >+ { >+ ObserveAttachmentUpdatesForScope observer(webView.get()); >+ drawSquareInEditableImage(webView.get()); >+ observer.expectAttachmentInvalidation(@[ attachment.get() ]); >+ } >+} >+ >+#endif // HAVE(PENCILKIT) >+ > #endif // PLATFORM(IOS_FAMILY) > > } // namespace TestWebKitAPI >diff --git a/Tools/TestWebKitAPI/ios/PencilKitTestSPI.h b/Tools/TestWebKitAPI/ios/PencilKitTestSPI.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b58369feeb4644f38a99b6f8d5a3051f73d39d7d >--- /dev/null >+++ b/Tools/TestWebKitAPI/ios/PencilKitTestSPI.h >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#pragma once >+ >+#import <wtf/Platform.h> >+ >+#if HAVE(PENCILKIT) >+ >+#if USE(APPLE_INTERNAL_SDK) >+ >+#import <PencilKit/PencilKit.h> >+ >+#import <PencilKit/PKDrawing_Private.h> >+#import <PencilKit/PKStroke_Private.h> >+ >+#else >+ >+typedef NSInteger PKInkType; >+ >+@interface PKInk : NSObject >++ (PKInk *)inkWithType:(PKInkType)type color:(UIColor *)color weight:(CGFloat)weight; >+@end >+ >+@interface PKStroke : NSObject >+- (id)_initWithPath:(CGPathRef)path ink:(PKInk *)ink inputScale:(CGFloat)inputScale; >+@end >+ >+@interface PKDrawing : NSObject >+- (PKStroke *)_addStroke:(PKStroke *)stroke; >+@property (nonatomic, readonly) NSArray<PKStroke *> *_allStrokes; >+@end >+ >+@interface PKCanvasView : UIView >+@property (nonatomic, copy) PKDrawing *drawing; >+@end >+ >+#endif // USE(APPLE_INTERNAL_SDK) >+ >+#endif // HAVE(PENCILKIT)
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 192206
:
356102
| 356133