Diff
Modified: trunk/Source/WebCore/ChangeLog (201055 => 201056)
--- trunk/Source/WebCore/ChangeLog 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/ChangeLog 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1,3 +1,18 @@
+2016-05-17 Beth Dakin <[email protected]>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ Define handleAcceptedCandidateWithSoftSpaces on EditorClient so that it can
+ be invoked on any EditorClient.
+ * loader/EmptyClients.h:
+ * page/EditorClient.h:
+ (WebCore::EditorClient::handleAcceptedCandidateWithSoftSpaces):
+
2016-05-17 Chris Dumez <[email protected]>
Unreviewed debug build fix after r201052.
Modified: trunk/Source/WebCore/loader/EmptyClients.h (201055 => 201056)
--- trunk/Source/WebCore/loader/EmptyClients.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -468,6 +468,7 @@
void didWriteSelectionToPasteboard() override { }
void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer>>&) override { }
void requestCandidatesForSelection(const VisibleSelection&) override { }
+ void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) override { }
void registerUndoStep(PassRefPtr<UndoStep>) override;
void registerRedoStep(PassRefPtr<UndoStep>) override;
Modified: trunk/Source/WebCore/page/EditorClient.h (201055 => 201056)
--- trunk/Source/WebCore/page/EditorClient.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/page/EditorClient.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -100,6 +100,7 @@
virtual void didWriteSelectionToPasteboard() = 0;
virtual void getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData) = 0;
virtual void requestCandidatesForSelection(const VisibleSelection&) { }
+ virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { }
// Notify an input method that a composition was voluntarily discarded by WebCore, so that it could clean up too.
// This function is not called when a composition is closed per a request from an input method.
Modified: trunk/Source/WebKit/mac/ChangeLog (201055 => 201056)
--- trunk/Source/WebKit/mac/ChangeLog 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1,3 +1,28 @@
+2016-05-17 Beth Dakin <[email protected]>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ This patch re-names handleAcceptedCandidate to
+ handleAcceptedCandidateWithSoftSpaces. The function now takes a
+ WebCore::TextCheckingResult instead of an NSTextCheckingResult and it can be
+ called from outside of WebEditorClient.
+
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::handleRequestedCandidates):
+ (WebEditorClient::handleAcceptedCandidateWithSoftSpaces):
+ (textCheckingResultFromNSTextCheckingResult): Deleted.
+ (WebEditorClient::handleAcceptedCandidate): Deleted.
+
+ Move showCandidates to WebViewPrivate so that it can be overridden by a test.
+ * WebView/WebViewInternal.h:
+ * WebView/WebViewPrivate.h:
+
2016-05-17 Dean Jackson <[email protected]>
Remove ES6_GENERATORS flag
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (201055 => 201056)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -172,7 +172,7 @@
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
void requestCandidatesForSelection(const WebCore::VisibleSelection&) override;
void handleRequestedCandidates(NSInteger, NSArray<NSTextCheckingResult *> *);
- void handleAcceptedCandidate(NSTextCheckingResult *);
+ void handleAcceptedCandidateWithSoftSpaces(WebCore::TextCheckingResult) override;
#endif
void registerUndoOrRedoStep(PassRefPtr<WebCore::UndoStep>, bool isRedo);
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (201055 => 201056)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1197,45 +1197,12 @@
if (!quads.isEmpty())
rectForSelectionCandidates = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
- auto weakEditor = m_weakPtrFactory.createWeakPtr();
- [m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:[weakEditor](NSTextCheckingResult *acceptedCandidate) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (!weakEditor)
- return;
- weakEditor->handleAcceptedCandidate(acceptedCandidate);
- });
- }];
+ [m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:nil];
}
-static WebCore::TextCheckingResult textCheckingResultFromNSTextCheckingResult(NSTextCheckingResult *nsResult)
+void WebEditorClient::handleAcceptedCandidateWithSoftSpaces(TextCheckingResult acceptedCandidate)
{
- WebCore::TextCheckingResult result;
-
- switch ([nsResult resultType]) {
- case NSTextCheckingTypeSpelling:
- result.type = WebCore::TextCheckingTypeSpelling;
- break;
- case NSTextCheckingTypeReplacement:
- result.type = WebCore::TextCheckingTypeReplacement;
- break;
- case NSTextCheckingTypeCorrection:
- result.type = WebCore::TextCheckingTypeCorrection;
- break;
- default:
- result.type = WebCore::TextCheckingTypeNone;
- }
-
- NSRange resultRange = [nsResult range];
- result.location = resultRange.location;
- result.length = resultRange.length;
- result.replacement = [nsResult replacementString];
-
- return result;
-}
-
-void WebEditorClient::handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate)
-{
Frame* frame = core([m_webView _selectedOrMainFrame]);
if (!frame)
return;
@@ -1246,16 +1213,16 @@
NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView];
if ([view isKindOfClass:[WebHTMLView class]]) {
- NSRange range = [acceptedCandidate range];
- if (acceptedCandidate.replacementString && [acceptedCandidate.replacementString length] > 0) {
- NSRange replacedRange = NSMakeRange(range.location, [acceptedCandidate.replacementString length]);
+ unsigned replacementLength = acceptedCandidate.replacement.length();
+ if (replacementLength > 0) {
+ NSRange replacedRange = NSMakeRange(acceptedCandidate.location, replacementLength);
NSRange softSpaceRange = NSMakeRange(NSMaxRange(replacedRange) - 1, 1);
- if ([acceptedCandidate.replacementString hasSuffix:@" "])
+ if (acceptedCandidate.replacement.endsWith(" "))
[(WebHTMLView *)view _setSoftSpaceRange:softSpaceRange];
}
}
- frame->editor().handleAcceptedCandidate(textCheckingResultFromNSTextCheckingResult(acceptedCandidate));
+ frame->editor().handleAcceptedCandidate(acceptedCandidate);
}
#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (201055 => 201056)
--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -297,7 +297,6 @@
@interface WebView (WebUpdateWebViewAdditions)
- (void)updateWebViewAdditions;
-- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock;
- (BOOL)shouldRequestCandidates;
- (void)webViewAdditionsWillDestroyView;
@end
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (201055 => 201056)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1067,6 +1067,10 @@
- (NSCachedURLResponse *)webView:(WebView *)sender resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
@end
+@interface WebView (WebShowCandidates)
+- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock;
+@end
+
#ifdef __cplusplus
extern "C" {
#endif
Modified: trunk/Source/WebKit2/ChangeLog (201055 => 201056)
--- trunk/Source/WebKit2/ChangeLog 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1,3 +1,17 @@
+2016-05-17 Beth Dakin <[email protected]>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ This patch makes handleAcceptedCandidate a public member of WebViewImpl
+ instead of a private member.
+ * UIProcess/Cocoa/WebViewImpl.h:
+ (WebKit::WebViewImpl::createWeakPtr):
+
2016-05-17 Dean Jackson <[email protected]>
Remove ES6_GENERATORS flag
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (201055 => 201056)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h 2016-05-17 23:24:19 UTC (rev 201056)
@@ -478,9 +478,12 @@
bool windowIsFrontWindowUnderMouse(NSEvent *);
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
+#if USE(APPLE_INTERNAL_SDK)
#import <WebKitAdditions/WebViewImplAdditions.h>
#endif
+#endif
private:
WeakPtr<WebViewImpl> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
@@ -514,7 +517,6 @@
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
void handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates);
- void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
#endif
NSView <WebViewImplDelegate> *m_view;
Modified: trunk/Tools/ChangeLog (201055 => 201056)
--- trunk/Tools/ChangeLog 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Tools/ChangeLog 2016-05-17 23:24:19 UTC (rev 201056)
@@ -1,3 +1,20 @@
+2016-05-17 Beth Dakin <[email protected]>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html: Added.
+ * TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm: Added.
+ (-[DoNotLeakWebView dealloc]):
+ (-[DoNotLeakWebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):
+ (-[DoNotLeakFrameLoadDelegate webView:didFinishLoadForFrame:]):
+ (TestWebKitAPI::TEST):
+
2016-05-17 Keith Miller <[email protected]>
Add test262 harness support code
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201055 => 201056)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-05-17 23:24:19 UTC (rev 201056)
@@ -299,6 +299,8 @@
936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */; };
93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; };
93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
+ 93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */; };
+ 93CFA8691CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */; };
93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */; };
93F1DB3414DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB3314DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp */; };
93F1DB5714DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB5614DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp */; };
@@ -422,6 +424,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ 93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */,
@@ -743,6 +746,8 @@
93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutForImages.cpp; sourceTree = "<group>"; };
93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp; sourceTree = "<group>"; };
93AF4ECF1506F123007FD57E /* lots-of-images.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-images.html"; sourceTree = "<group>"; };
+ 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "autofocused-text-input.html"; sourceTree = "<group>"; };
+ 93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewWithEditableAreaLeak.mm; sourceTree = "<group>"; };
93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "all-content-in-one-iframe.html"; sourceTree = "<group>"; };
93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutMilestonesWithAllContentInFrame.cpp; sourceTree = "<group>"; };
93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoControlsManager.mm; sourceTree = "<group>"; };
@@ -1156,6 +1161,7 @@
51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
+ 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */,
936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */,
936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */,
93625D261CD973AF006DC1F1 /* large-video-without-audio.html */,
@@ -1517,6 +1523,7 @@
939BFE3918E5548900883275 /* StringTruncator.mm */,
37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */,
E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */,
+ 93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */,
51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */,
C2EB2DD116CAC7AC009B52EE /* WebViewDidCreateJavaScriptContext.mm */,
51B454EB1B4E236B0085EAA6 /* WebViewCloseInsideDidFinishLoadForFrame.mm */,
@@ -2013,6 +2020,7 @@
41973B5B1AF2286A006C7B36 /* FileSystem.cpp in Sources */,
CD89D03A1C4EDB2A00040A04 /* WebCoreNSURLSession.mm in Sources */,
83B88A341C80056D00BB2418 /* HTMLParserIdioms.cpp in Sources */,
+ 93CFA8691CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm in Sources */,
A1C4FB6E1BACCE50003742D0 /* QuickLook.mm in Sources */,
51B1EE8E1C80F5880064FB98 /* IndexedDBPersistence.mm in Sources */,
7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html (0 => 201056)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html 2016-05-17 23:24:19 UTC (rev 201056)
@@ -0,0 +1,3 @@
+<body>
+<input id="input" type="text" autofocus/>
+</body>
Added: trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm (0 => 201056)
--- trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm 2016-05-17 23:24:19 UTC (rev 201056)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2016 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"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+
+static bool webViewWasDeallocated = false;
+static bool didFinishLoad = false;
+static bool didCallShowCandidates = false;
+
+@interface DoNotLeakWebView : WebView
+@end
+
+@implementation DoNotLeakWebView
+
+- (void)dealloc
+{
+ webViewWasDeallocated = true;
+ [super dealloc];
+}
+
+- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock
+{
+ [super showCandidates:candidates forString:string inRect:rectOfTypedString forSelectedRange:range view:view completionHandler:completionBlock];
+ didCallShowCandidates = true;
+}
+
+@end
+
+@interface DoNotLeakFrameLoadDelegate : NSObject <WebFrameLoadDelegate> {
+}
+@end
+
+@implementation DoNotLeakFrameLoadDelegate
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(DoNotLeakWebView, ViewThatLoadsEditableArea)
+{
+ DoNotLeakWebView *webView = [[DoNotLeakWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
+ DoNotLeakFrameLoadDelegate *delegate = [[DoNotLeakFrameLoadDelegate alloc] init];
+ [webView setFrameLoadDelegate:delegate];
+
+ NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"autofocused-text-input" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:contentURL]];
+
+ TestWebKitAPI::Util::run(&didFinishLoad);
+ TestWebKitAPI::Util::run(&didCallShowCandidates);
+
+ [webView release];
+ EXPECT_TRUE(webViewWasDeallocated);
+}
+
+}
+
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200