diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/UIProcess/API/C/win | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C/win')
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h | 11 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp | 65 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h | 47 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp | 60 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h | 87 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/win/WKView.h | 4 |
6 files changed, 274 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h index 09cf06f..24891f5 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h @@ -30,14 +30,25 @@ #error "Please #include \"WKAPICast.h\" instead of this file directly." #endif +#include "WebGrammarDetail.h" +#include <WebCore/TextCheckerClient.h> + namespace WebKit { class WebView; class WebEditCommandProxy; +class WebTextChecker; WK_ADD_API_MAPPING(WKViewRef, WebView) WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy) +WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker) +WK_ADD_API_MAPPING(WKGrammarDetailRef, WebGrammarDetail) +inline ProxyingRefPtr<WebGrammarDetail> toAPI(const WebCore::GrammarDetail& grammarDetail) +{ + return ProxyingRefPtr<WebGrammarDetail>(WebGrammarDetail::create(grammarDetail)); } +} // namespace WebKit + #endif // WKAPICastWin_h diff --git a/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp new file mode 100644 index 0000000..5ab0fc4 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 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 "WKGrammarDetail.h" + +#include "APIObject.h" +#include "ImmutableArray.h" +#include "WKAPICast.h" +#include "WebGrammarDetail.h" + +using namespace WebKit; + +WKTypeID WKGrammarDetailGetTypeID() +{ + return toAPI(APIObject::TypeGrammarDetail); +} + +WKGrammarDetailRef WKGrammarDetailCreate(int location, int length, WKArrayRef guesses, WKStringRef userDescription) +{ + RefPtr<WebGrammarDetail> detail = WebGrammarDetail::create(location, length, toImpl(guesses), toWTFString(userDescription)); + return toAPI(detail.release().releaseRef()); +} + +int WKGrammarDetailGetLocation(WKGrammarDetailRef grammarDetailRef) +{ + return toImpl(grammarDetailRef)->location(); +} + +int WKGrammarDetailGetLength(WKGrammarDetailRef grammarDetailRef) +{ + return toImpl(grammarDetailRef)->length(); +} + +WKArrayRef WKGrammarDetailCopyGuesses(WKGrammarDetailRef grammarDetailRef) +{ + return toAPI(toImpl(grammarDetailRef)->guesses().leakRef()); +} + +WKStringRef WKGrammarDetailCopyUserDescription(WKGrammarDetailRef grammarDetailRef) +{ + return toCopiedAPI(toImpl(grammarDetailRef)->userDescription()); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h new file mode 100644 index 0000000..c187ce6 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKGrammarDetail.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 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. + */ + +#ifndef WKGrammarDetail_h +#define WKGrammarDetail_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKGrammarDetailGetTypeID(); +WK_EXPORT WKGrammarDetailRef WKGrammarDetailCreate(int location, int length, WKArrayRef guesses, WKStringRef userDescription); + +WK_EXPORT int WKGrammarDetailGetLocation(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT int WKGrammarDetailGetLength(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT WKArrayRef WKGrammarDetailCopyGuesses(WKGrammarDetailRef grammarDetailRef); +WK_EXPORT WKStringRef WKGrammarDetailCopyUserDescription(WKGrammarDetailRef grammarDetailRef); + +#ifdef __cplusplus +} +#endif + +#endif /* WKGrammarDetail_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp new file mode 100644 index 0000000..3329da2 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 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 "WKTextChecker.h" + +#include "WKAPICast.h" +#include "WebPageProxy.h" +#include "WebTextChecker.h" + +using namespace WebKit; + +void WKTextCheckerSetClient(const WKTextCheckerClient* wkClient) +{ + if (wkClient && wkClient->version) + return; + WebTextChecker::shared()->setClient(wkClient); +} + +void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled) +{ + WebTextChecker::shared()->continuousSpellCheckingEnabledStateChanged(enabled); +} + +void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled) +{ + WebTextChecker::shared()->grammarCheckingEnabledStateChanged(enabled); +} + +void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection) +{ + WebTextChecker::shared()->checkSpelling(toImpl(page), startBeforeSelection); +} + +void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word) +{ + WebTextChecker::shared()->changeSpellingToWord(toImpl(page), toWTFString(word)); +} diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h new file mode 100644 index 0000000..31a855d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2011 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. + */ + +#ifndef WKTextChecker_h +#define WKTextChecker_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// TextChecker Client +typedef bool (*WKTextCheckerContinousSpellCheckingAllowed)(const void *clientInfo); +typedef bool (*WKTextCheckerContinousSpellCheckingEnabled)(const void *clientInfo); +typedef void (*WKTextCheckerSetContinousSpellCheckingEnabled)(bool enabled, const void *clientInfo); +typedef bool (*WKTextCheckerGrammarCheckingEnabled)(const void *clientInfo); +typedef void (*WKTextCheckerSetGrammarCheckingEnabled)(bool enabled, const void *clientInfo); +typedef uint64_t (*WKTextCheckerUniqueSpellDocumentTag)(WKPageRef page, const void *clientInfo); +typedef void (*WKTextCheckerCloseSpellDocumentWithTag)(uint64_t tag, const void *clientInfo); +typedef void (*WKTextCheckerCheckSpellingOfString)(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void *clientInfo); +typedef void (*WKTextCheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo); +typedef bool (*WKTextCheckerSpellingUIIsShowing)(const void *clientInfo); +typedef void (*WKTextCheckerToggleSpellingUIIsShowing)(const void *clientInfo); +typedef void (*WKTextCheckerUpdateSpellingUIWithMisspelledWord)(uint64_t tag, WKStringRef misspelledWord, const void *clientInfo); +typedef void (*WKTextCheckerUpdateSpellingUIWithGrammarString)(uint64_t tag, WKStringRef badGrammarPhrase, WKGrammarDetailRef grammarDetail, const void *clientInfo); +typedef WKArrayRef (*WKTextCheckerGuessesForWord)(uint64_t tag, WKStringRef word, const void *clientInfo); +typedef void (*WKTextCheckerLearnWord)(uint64_t tag, WKStringRef word, const void *clientInfo); +typedef void (*WKTextCheckerIgnoreWord)(uint64_t tag, WKStringRef word, const void *clientInfo); + +struct WKTextCheckerClient { + int version; + const void * clientInfo; + WKTextCheckerContinousSpellCheckingAllowed continuousSpellCheckingAllowed; + WKTextCheckerContinousSpellCheckingEnabled continuousSpellCheckingEnabled; + WKTextCheckerSetContinousSpellCheckingEnabled setContinuousSpellCheckingEnabled; + WKTextCheckerGrammarCheckingEnabled grammarCheckingEnabled; + WKTextCheckerSetGrammarCheckingEnabled setGrammarCheckingEnabled; + WKTextCheckerUniqueSpellDocumentTag uniqueSpellDocumentTag; + WKTextCheckerCloseSpellDocumentWithTag closeSpellDocumentWithTag; + WKTextCheckerCheckSpellingOfString checkSpellingOfString; + WKTextCheckerCheckGrammarOfString checkGrammarOfString; + WKTextCheckerSpellingUIIsShowing spellingUIIsShowing; + WKTextCheckerToggleSpellingUIIsShowing toggleSpellingUIIsShowing; + WKTextCheckerUpdateSpellingUIWithMisspelledWord updateSpellingUIWithMisspelledWord; + WKTextCheckerUpdateSpellingUIWithGrammarString updateSpellingUIWithGrammarString; + WKTextCheckerGuessesForWord guessesForWord; + WKTextCheckerLearnWord learnWord; + WKTextCheckerIgnoreWord ignoreWord; +}; +typedef struct WKTextCheckerClient WKTextCheckerClient; + +WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClient* client); + +WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool); +WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool); + +WK_EXPORT void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection); +WK_EXPORT void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word); + +#ifdef __cplusplus +} +#endif + +#endif /* WKTextChecker_h */ diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h index c8ac44c..8b5e5b2 100644 --- a/Source/WebKit2/UIProcess/API/C/win/WKView.h +++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h @@ -43,12 +43,16 @@ typedef uint32_t WKViewUndoType; typedef void (*WKViewRegisterEditCommandCallback)(WKViewRef, WKEditCommandRef, WKViewUndoType undoOrRedo, const void *clientInfo); typedef void (*WKViewClearAllEditCommandsCallback)(WKViewRef, const void *clientInfo); +typedef bool (*WKViewCanUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); +typedef void (*WKViewExecuteUndoRedoCallback)(WKViewRef, WKViewUndoType undoOrRedo, const void *clientInfo); struct WKViewUndoClient { int version; const void * clientInfo; WKViewRegisterEditCommandCallback registerEditCommand; WKViewClearAllEditCommandsCallback clearAllEditCommands; + WKViewCanUndoRedoCallback canUndoRedo; + WKViewExecuteUndoRedoCallback executeUndoRedo; }; typedef struct WKViewUndoClient WKViewUndoClient; |