summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/mac/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/mac/WebCoreSupport')
-rw-r--r--Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h60
-rw-r--r--Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm157
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h5
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm26
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebChromeClient.h4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm52
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.h14
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm72
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h4
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm23
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h7
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm19
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h10
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm28
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h46
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m104
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm61
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h6
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm26
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm15
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h6
-rw-r--r--Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm10
22 files changed, 519 insertions, 236 deletions
diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h
new file mode 100644
index 0000000..8adb79f
--- /dev/null
+++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h
@@ -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.
+ */
+
+#ifndef CorrectionPanel_h
+#define CorrectionPanel_h
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#import <AppKit/NSTextChecker.h>
+#import <WebCore/CorrectionPanelInfo.h>
+#import <wtf/RetainPtr.h>
+
+@class WebView;
+
+class CorrectionPanel {
+ WTF_MAKE_NONCOPYABLE(CorrectionPanel);
+public:
+ CorrectionPanel();
+ ~CorrectionPanel();
+ void show(WebView*, WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
+ void dismiss(WebCore::ReasonForDismissingCorrectionPanel);
+ String dismissSoon(WebCore::ReasonForDismissingCorrectionPanel);
+ static void recordAutocorrectionResponse(WebView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
+
+private:
+ bool isShowing() const { return m_view; }
+ void dismissInternal(WebCore::ReasonForDismissingCorrectionPanel, bool dismissingExternally);
+ void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType);
+
+ bool m_wasDismissedExternally;
+ WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissing;
+ RetainPtr<WebView> m_view;
+ RetainPtr<NSString> m_resultForSynchronousDismissal;
+ RetainPtr<NSCondition> m_resultCondition;
+};
+
+#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+
+#endif // CorrectionPanel_h
diff --git a/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm
new file mode 100644
index 0000000..05f3f69
--- /dev/null
+++ b/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+#import "CorrectionPanel.h"
+
+#import "WebViewPrivate.h"
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+using namespace WebCore;
+
+static inline NSCorrectionBubbleType correctionBubbleType(CorrectionPanelInfo::PanelType panelType)
+{
+ switch (panelType) {
+ case CorrectionPanelInfo::PanelTypeCorrection:
+ return NSCorrectionBubbleTypeCorrection;
+ case CorrectionPanelInfo::PanelTypeReversion:
+ return NSCorrectionBubbleTypeReversion;
+ case CorrectionPanelInfo::PanelTypeSpellingSuggestions:
+ return NSCorrectionBubbleTypeGuesses;
+ }
+ ASSERT_NOT_REACHED();
+ return NSCorrectionBubbleTypeCorrection;
+}
+
+CorrectionPanel::CorrectionPanel()
+ : m_wasDismissedExternally(false)
+ , m_reasonForDismissing(ReasonForDismissingCorrectionPanelIgnored)
+ , m_resultCondition(AdoptNS, [[NSCondition alloc] init])
+{
+}
+
+CorrectionPanel::~CorrectionPanel()
+{
+ dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false);
+}
+
+void CorrectionPanel::show(WebView* view, CorrectionPanelInfo::PanelType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+ dismissInternal(ReasonForDismissingCorrectionPanelIgnored, false);
+
+ if (!view)
+ return;
+
+ NSString* replacedStringAsNSString = replacedString;
+ NSString* replacementStringAsNSString = replacementString;
+ m_view = view;
+ NSCorrectionBubbleType bubbleType = correctionBubbleType(type);
+
+ NSMutableArray* alternativeStrings = 0;
+ if (!alternativeReplacementStrings.isEmpty()) {
+ size_t size = alternativeReplacementStrings.size();
+ alternativeStrings = [NSMutableArray arrayWithCapacity:size];
+ for (size_t i = 0; i < size; ++i)
+ [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]];
+ }
+
+ [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_view.get() completionHandler:^(NSString* acceptedString) {
+ handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, bubbleType);
+ }];
+}
+
+void CorrectionPanel::dismiss(ReasonForDismissingCorrectionPanel reason)
+{
+ dismissInternal(reason, true);
+}
+
+String CorrectionPanel::dismissSoon(ReasonForDismissingCorrectionPanel reason)
+{
+ if (!isShowing())
+ return String();
+
+ dismissInternal(reason, true);
+ [m_resultCondition.get() lock];
+ while (!m_resultForSynchronousDismissal)
+ [m_resultCondition.get() wait];
+ [m_resultCondition.get() unlock];
+ return m_resultForSynchronousDismissal.get();
+}
+
+void CorrectionPanel::dismissInternal(ReasonForDismissingCorrectionPanel reason, bool dismissingExternally)
+{
+ m_wasDismissedExternally = dismissingExternally;
+ if (!isShowing())
+ return;
+
+ m_reasonForDismissing = reason;
+ m_resultForSynchronousDismissal.clear();
+ [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_view.get()];
+ m_view.clear();
+}
+
+void CorrectionPanel::recordAutocorrectionResponse(WebView* view, NSCorrectionResponse response, const String& replacedString, const String& replacementString)
+{
+ [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]];
+}
+
+void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionBubbleType correctionBubbleType)
+{
+ NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
+ NSInteger documentTag = [m_view.get() spellCheckerDocumentTag];
+
+ switch (correctionBubbleType) {
+ case NSCorrectionBubbleTypeCorrection:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ else {
+ if (!m_wasDismissedExternally || m_reasonForDismissing == ReasonForDismissingCorrectionPanelCancelled)
+ [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ else
+ [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ }
+ break;
+ case NSCorrectionBubbleTypeReversion:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:documentTag];
+ break;
+ case NSCorrectionBubbleTypeGuesses:
+ if (acceptedReplacement)
+ [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
+ break;
+ }
+
+ if (!m_wasDismissedExternally) {
+ [m_view.get() handleCorrectionPanelResult:acceptedReplacement];
+ return;
+ }
+
+ [m_resultCondition.get() lock];
+ if (acceptedReplacement)
+ m_resultForSynchronousDismissal.adoptNS([acceptedReplacement copy]);
+ [m_resultCondition.get() signal];
+ [m_resultCondition.get() unlock];
+}
+
+#endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+
diff --git a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h
index 976ce18..3d6c91e 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.h
@@ -25,6 +25,8 @@
#import <Foundation/Foundation.h>
+@class WebSecurityOrigin;
+
@interface WebApplicationCache: NSObject
+ (long long)maximumSize;
@@ -34,5 +36,8 @@
+ (void)setDefaultOriginQuota:(long long)size;
+ (void)deleteAllApplicationCaches;
++ (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin;
+
++ (NSArray *)originsWithCache;
@end
diff --git a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
index bf517c1..131bb9c 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
@@ -26,7 +26,12 @@
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
#import "WebApplicationCache.h"
+
+#import "WebSecurityOriginInternal.h"
+#import <WebCore/ApplicationCache.h>
#import <WebCore/ApplicationCacheStorage.h>
+#import <WebCore/SecurityOrigin.h>
+#import <wtf/RetainPtr.h>
using namespace WebCore;
@@ -58,6 +63,27 @@ using namespace WebCore;
cacheStorage().deleteAllEntries();
}
++ (void)deleteCacheForOrigin:(WebSecurityOrigin *)origin
+{
+ ApplicationCache::deleteCacheForOrigin([origin _core]);
+}
+
++ (NSArray *)originsWithCache
+{
+ HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> coreOrigins;
+ cacheStorage().getOriginsWithCache(coreOrigins);
+
+ NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease];
+
+ HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator end = coreOrigins.end();
+ for (HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator it = coreOrigins.begin(); it != end; ++it) {
+ RetainPtr<WebSecurityOrigin> webOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]);
+ [webOrigins addObject:webOrigin.get()];
+ }
+
+ return webOrigins;
+}
+
@end
#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
index 3129fae..004d49b 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -164,7 +164,7 @@ public:
#endif
#if ENABLE(FULLSCREEN_API)
- virtual bool supportsFullScreenForElement(const WebCore::Element*);
+ virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard);
virtual void enterFullScreenForElement(WebCore::Element*);
virtual void exitFullScreenForElement(WebCore::Element*);
#endif
@@ -180,7 +180,7 @@ public:
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
#if ENABLE(CONTEXT_MENUS)
- virtual void showContextMenu() { }
+ virtual void showContextMenu();
#endif
private:
WebView *m_webView;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 99b817b..6bf116b 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -51,14 +51,18 @@
#import <WebCore/BlockExceptions.h>
#import <WebCore/Console.h>
#import <WebCore/Cursor.h>
+#import <WebCore/ContextMenu.h>
+#import <WebCore/ContextMenuController.h>
#import <WebCore/Element.h>
#import <WebCore/FileChooser.h>
#import <WebCore/FloatRect.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoadRequest.h>
+#import <WebCore/FrameView.h>
#import <WebCore/HTMLNames.h>
#import <WebCore/HitTestResult.h>
#import <WebCore/Icon.h>
+#import <WebCore/IntPoint.h>
#import <WebCore/IntRect.h>
#import <WebCore/NavigationAction.h>
#import <WebCore/Page.h>
@@ -174,9 +178,16 @@ FloatRect WebChromeClient::pageRect()
float WebChromeClient::scaleFactor()
{
- if (NSWindow *window = [m_webView window])
- return [window userSpaceScaleFactor];
+ NSWindow *window = [m_webView window];
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ if (window)
+ return [window backingScaleFactor];
+ return [[NSScreen mainScreen] backingScaleFactor];
+#else
+ if (window)
+ return [window userSpaceScaleFactor];
return [[NSScreen mainScreen] userSpaceScaleFactor];
+#endif
}
void WebChromeClient::focus()
@@ -876,6 +887,35 @@ PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebC
return adoptRef(new SearchPopupMenuMac(client));
}
+#if ENABLE(CONTEXT_MENUS)
+void WebChromeClient::showContextMenu()
+{
+ Page* page = [m_webView page];
+ if (!page)
+ return;
+
+ ContextMenuController* controller = page->contextMenuController();
+ Node* node = controller->hitTestResult().innerNonSharedNode();
+ if (!node)
+ return;
+ Frame* frame = node->document()->frame();
+ if (!frame)
+ return;
+ FrameView* frameView = frame->view();
+ if (!frameView)
+ return;
+ NSView* view = frameView->documentView();
+
+ IntPoint point = frameView->contentsToWindow(controller->hitTestResult().point());
+ NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
+ // Show the contextual menu for this event.
+ NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
+ NSMenu* nsMenu = [view menuForEvent:event];
+ if (nsMenu)
+ [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
+}
+#endif
+
#if USE(ACCELERATED_COMPOSITING)
void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
@@ -938,12 +978,12 @@ void WebChromeClient::exitFullscreenForNode(Node*)
#if ENABLE(FULLSCREEN_API)
-bool WebChromeClient::supportsFullScreenForElement(const Element* element)
+bool WebChromeClient::supportsFullScreenForElement(const Element* element, bool withKeyboard)
{
- SEL selector = @selector(webView:supportsFullScreenForElement:);
+ SEL selector = @selector(webView:supportsFullScreenForElement:withKeyboard:);
if ([[m_webView UIDelegate] respondsToSelector:selector])
- return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)));
- return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element)];
+ return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)), withKeyboard);
+ return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element) withKeyboard:withKeyboard];
}
void WebChromeClient::enterFullScreenForElement(Element* element)
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
index 1fa132a..412cb45 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
@@ -27,11 +27,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <WebCore/Editor.h>
+#import "CorrectionPanel.h"
#import <WebCore/EditorClient.h>
#import <WebCore/TextCheckerClient.h>
-#import <wtf/RetainPtr.h>
#import <wtf/Forward.h>
+#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
@class WebView;
@@ -140,10 +140,10 @@ public:
virtual void setInputMethodState(bool enabled);
virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&);
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, const WTF::Vector<WTF::String>& alternativeReplacementStrings, WebCore::Editor*);
+ virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel);
- virtual bool isShowingCorrectionPanel();
- virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const WTF::String& replacedString, const WTF::String& replacementString);
+ virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel);
+ virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String& replacedString, const String& replacementString);
#endif
private:
void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo);
@@ -154,8 +154,6 @@ private:
bool m_haveUndoRedoOperations;
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- BOOL m_correctionPanelIsShown;
- BOOL m_correctionPanelIsDismissedExternally;
- WebCore::ReasonForDismissingCorrectionPanel m_reasonForDismissingCorrectionPanel;
+ CorrectionPanel m_correctionPanel;
#endif
};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
index 69dd574..c205ef6 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
@@ -74,7 +74,6 @@
#endif
using namespace WebCore;
-using namespace WTF;
using namespace HTMLNames;
@@ -202,9 +201,6 @@ WebEditorClient::WebEditorClient(WebView *webView)
: m_webView(webView)
, m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease])
, m_haveUndoRedoOperations(false)
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- , m_correctionPanelIsShown(false)
-#endif
{
}
@@ -625,7 +621,7 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
Frame* frame = event->target()->toNode()->document()->frame();
WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
- if ([webHTMLView _interceptEditingKeyEvent:event shouldSaveCommand:NO])
+ if ([webHTMLView _interpretKeyEvent:event savingCommands:NO])
event->setDefaultHandled();
}
@@ -633,7 +629,7 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
{
Frame* frame = event->target()->toNode()->document()->frame();
WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
- if ([webHTMLView _interceptEditingKeyEvent:event shouldSaveCommand:YES])
+ if ([webHTMLView _interpretKeyEvent:event savingCommands:YES])
event->setDefaultHandled();
}
@@ -891,73 +887,25 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar
}
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-void WebEditorClient::showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings, Editor* editor) {
- dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
-
- // Need to explicitly use these local NSString objects, because the C++ references may be invalidated by the time the block below is executed.
- NSString *replacedStringAsNSString = replacedString;
- NSString *replacementStringAsNSString = replacementString;
-
- m_correctionPanelIsShown = YES;
- m_correctionPanelIsDismissedExternally = NO;
- m_reasonForDismissingCorrectionPanel = ReasonForDismissingCorrectionPanelIgnored;
-
- NSCorrectionBubbleType bubbleType = correctionBubbleType(panelType);
- NSMutableArray *alternativeStrings = nil;
- if (!alternativeReplacementStrings.isEmpty()) {
- size_t size = alternativeReplacementStrings.size();
- alternativeStrings = [NSMutableArray arrayWithCapacity:size];
- for (size_t i = 0; i < size; ++i)
- [alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]];
- }
- NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker];
- [[NSSpellChecker sharedSpellChecker] showCorrectionBubbleOfType:bubbleType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_webView completionHandler:^(NSString *acceptedString) {
- switch (bubbleType) {
- case NSCorrectionBubbleTypeCorrection:
- if (acceptedString)
- [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
- else {
- if (!m_correctionPanelIsDismissedExternally || m_reasonForDismissingCorrectionPanel == ReasonForDismissingCorrectionPanelCancelled)
- [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
- else
- [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
- }
- break;
- case NSCorrectionBubbleTypeReversion:
- if (acceptedString)
- [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replacedStringAsNSString forWord:acceptedString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag()];
- break;
- case NSCorrectionBubbleTypeGuesses:
- if (acceptedString)
- [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
- break;
- }
- editor->handleCorrectionPanelResult(String(acceptedString));
- }];
+void WebEditorClient::showCorrectionPanel(CorrectionPanelInfo::PanelType panelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
+{
+ m_correctionPanel.show(m_webView, panelType, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
}
void WebEditorClient::dismissCorrectionPanel(ReasonForDismissingCorrectionPanel reasonForDismissing)
{
- if (isShowingCorrectionPanel()) {
- m_correctionPanelIsDismissedExternally = YES;
- m_reasonForDismissingCorrectionPanel = reasonForDismissing;
- if (reasonForDismissing == ReasonForDismissingCorrectionPanelAccepted)
- [[NSSpellChecker sharedSpellChecker] dismissCorrectionBubbleForView:m_webView];
- else
- [[NSSpellChecker sharedSpellChecker] cancelCorrectionBubbleForView:m_webView];
- m_correctionPanelIsShown = NO;
- }
+ m_correctionPanel.dismiss(reasonForDismissing);
}
-bool WebEditorClient::isShowingCorrectionPanel()
+String WebEditorClient::dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel reasonForDismissing)
{
- return m_correctionPanelIsShown;
+ return m_correctionPanel.dismissSoon(reasonForDismissing);
}
void WebEditorClient::recordAutocorrectionResponse(EditorClient::AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
{
- NSCorrectionResponse spellCheckerResponse = responseType == EditorClient::AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
- [[NSSpellChecker sharedSpellChecker] recordResponse:spellCheckerResponse toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]];
+ NSCorrectionResponse response = responseType == EditorClient::AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
+ CorrectionPanel::recordAutocorrectionResponse(m_webView, response, replacedString, replacementString);
}
#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index c484729..4fe5664 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 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
@@ -216,7 +216,7 @@ private:
virtual void showMediaPlayerProxyPlugin(WebCore::Widget*);
#endif
- virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WTF::String& mimeType);
+ virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages);
virtual WTF::String overrideMediaType() const;
virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*);
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index a558d83..92c2b03 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 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
@@ -1454,7 +1454,7 @@ void WebFrameLoaderClient::transferLoadingResourceFromPage(unsigned long identif
[kit(oldPage) _removeObjectForIdentifier:identifier];
}
-ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType)
+ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -1491,18 +1491,25 @@ ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const
if (type.isEmpty())
return ObjectContentFrame; // Go ahead and hope that we can display the content.
- if (MIMETypeRegistry::isSupportedImageMIMEType(type))
- return ObjectContentImage;
-
WebBasePluginPackage *package = [getWebView(m_webFrame.get()) _pluginForMIMEType:type];
+ ObjectContentType plugInType = ObjectContentNone;
if (package) {
#if ENABLE(NETSCAPE_PLUGIN_API)
if ([package isKindOfClass:[WebNetscapePluginPackage class]])
- return ObjectContentNetscapePlugin;
+ plugInType = ObjectContentNetscapePlugin;
+ else
#endif
- ASSERT([package isKindOfClass:[WebPluginPackage class]]);
- return ObjectContentOtherPlugin;
+ {
+ ASSERT([package isKindOfClass:[WebPluginPackage class]]);
+ plugInType = ObjectContentOtherPlugin;
+ }
}
+
+ if (MIMETypeRegistry::isSupportedImageMIMEType(type))
+ return shouldPreferPlugInsForImages && plugInType != ObjectContentNone ? plugInType : ObjectContentImage;
+
+ if (plugInType != ObjectContentNone)
+ return plugInType;
if ([m_webFrame->_private->webFrameView _viewClassForMIMEType:type])
return ObjectContentFrame;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h
index 3f9df13..a557ab5 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.h
@@ -32,6 +32,9 @@
class WebIconDatabaseClient : public WebCore::IconDatabaseClient {
public:
virtual bool performImport();
- virtual void dispatchDidRemoveAllIcons();
- virtual void dispatchDidAddIconForPageURL(const WTF::String& pageURL);
+ virtual void didRemoveAllIcons();
+ virtual void didImportIconURLForPageURL(const String&);
+ virtual void didImportIconDataForPageURL(const String&);
+ virtual void didChangeIconForPageURL(const String&);
+ virtual void didFinishURLImport();
};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm
index 3651dea..8214d02 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebIconDatabaseClient.mm
@@ -41,14 +41,14 @@ bool WebIconDatabaseClient::performImport()
return result;
}
-void WebIconDatabaseClient::dispatchDidRemoveAllIcons()
+void WebIconDatabaseClient::didRemoveAllIcons()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[WebIconDatabase sharedIconDatabase] _sendDidRemoveAllIconsNotification];
[pool drain];
}
-void WebIconDatabaseClient::dispatchDidAddIconForPageURL(const WTF::String& pageURL)
+void WebIconDatabaseClient::didImportIconURLForPageURL(const String& pageURL)
{
// This is a quick notification that is likely to fire in a rapidly iterating loop
// Therefore we let WebCore handle autorelease by draining its pool "from time to time"
@@ -56,4 +56,19 @@ void WebIconDatabaseClient::dispatchDidAddIconForPageURL(const WTF::String& page
[[WebIconDatabase sharedIconDatabase] _sendNotificationForURL:pageURL];
}
+void WebIconDatabaseClient::didImportIconDataForPageURL(const String& pageURL)
+{
+ // WebKit1 only has a single "icon did change" notification.
+ didImportIconURLForPageURL(pageURL);
+}
+void WebIconDatabaseClient::didChangeIconForPageURL(const String& pageURL)
+{
+ // WebKit1 only has a single "icon did change" notification.
+ didImportIconURLForPageURL(pageURL);
+}
+
+void WebIconDatabaseClient::didFinishURLImport()
+{
+}
+
#endif // ENABLE(ICONDATABASE)
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
index 108c2cc..7d09109 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
@@ -31,7 +31,9 @@
#import <WebCore/PlatformString.h>
#import <wtf/Forward.h>
+#import <wtf/HashMap.h>
#import <wtf/RetainPtr.h>
+#import <wtf/text/StringHash.h>
#ifdef __OBJC__
@class WebInspectorWindowController;
@@ -67,12 +69,17 @@ public:
void releaseFrontendPage();
+ void saveSessionSetting(const String& key, const String& value);
+ void loadSessionSetting(const String& key, String* value);
+
private:
WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
WebView *m_webView;
RetainPtr<WebNodeHighlighter> m_highlighter;
WebCore::Page* m_frontendPage;
+
+ WTF::HashMap<WTF::String, WTF::String> m_sessionSettings;
};
@@ -95,6 +102,9 @@ public:
virtual void setAttachedWindowHeight(unsigned height);
virtual void inspectedURLChanged(const WTF::String& newURL);
+ virtual void saveSessionSetting(const String& key, const String& value);
+ virtual void loadSessionSetting(const String& key, String* value);
+
private:
void updateWindowTitle() const;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index d5a1d95..9b0c893 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -65,6 +65,7 @@ using namespace WebCore;
- (BOOL)attached;
- (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient;
- (void)setInspectorClient:(WebInspectorClient*)inspectorClient;
+- (WebInspectorClient*)inspectorClient;
- (void)setAttachedWindowHeight:(unsigned)height;
- (void)destroyInspectorView:(bool)notifyInspectorController;
@end
@@ -102,10 +103,10 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon
[windowController.get() setInspectorClient:this];
m_frontendPage = core([windowController.get() webView]);
- WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings());
- m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
-
- [[m_webView inspector] setFrontend:[[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient]];
+ OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings()));
+ RetainPtr<WebInspectorFrontend> webInspectorFrontend(AdoptNS, [[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient.get()]);
+ [[m_webView inspector] setFrontend:webInspectorFrontend.get()];
+ m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
}
void WebInspectorClient::highlight(Node* node)
@@ -201,6 +202,20 @@ void WebInspectorFrontendClient::inspectedURLChanged(const String& newURL)
updateWindowTitle();
}
+void WebInspectorFrontendClient::saveSessionSetting(const String& key, const String& value)
+{
+ WebInspectorClient* client = [m_windowController.get() inspectorClient];
+ if (client)
+ client->saveSessionSetting(key, value);
+}
+
+void WebInspectorFrontendClient::loadSessionSetting(const String& key, String* value)
+{
+ WebInspectorClient* client = [m_windowController.get() inspectorClient];
+ if (client)
+ client->loadSessionSetting(key, value);
+}
+
void WebInspectorFrontendClient::updateWindowTitle() const
{
NSString *title = [NSString stringWithFormat:UI_STRING_INTERNAL("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_inspectedURL];
@@ -422,6 +437,11 @@ void WebInspectorFrontendClient::updateWindowTitle() const
_inspectorClient = inspectorClient;
}
+- (WebInspectorClient*)inspectorClient
+{
+ return _inspectorClient;
+}
+
- (void)setAttachedWindowHeight:(unsigned)height
{
if (!_attachedToInspectedWebView)
diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h
index ed2ff77..7728699 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h
@@ -1,29 +1,26 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 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.
*
- * 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ * 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.
*/
typedef enum {
@@ -34,14 +31,11 @@ typedef enum {
#ifdef __OBJC__
-#import <WebCore/WebCoreKeyGenerator.h>
+@interface WebKeyGenerator : NSObject
-@interface WebKeyGenerator : WebCoreKeyGenerator
-{
- NSArray *strengthMenuItemTitles;
-}
-+ (void)createSharedGenerator;
++ (WebKeyGenerator *)sharedGenerator;
- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data;
+
@end
#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m
deleted file mode 100644
index ea1526f..0000000
--- a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
- */
-
-#import <WebKit/WebKeyGenerator.h>
-
-#import "WebLocalizableStringsInternal.h"
-#import <WebKitSystemInterface.h>
-#import <wtf/Assertions.h>
-
-@implementation WebKeyGenerator
-
-+ (void)createSharedGenerator
-{
- if (![self sharedGenerator]) {
- [[[self alloc] init] release];
- }
- ASSERT([[self sharedGenerator] isKindOfClass:self]);
-}
-
-- (void)dealloc
-{
- [strengthMenuItemTitles release];
- [super dealloc];
-}
-
-- (NSArray *)strengthMenuItemTitles
-{
- if (!strengthMenuItemTitles) {
- strengthMenuItemTitles = [[NSArray alloc] initWithObjects:
- UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu"),
- UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu"),
- UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu"), nil];
- }
- return strengthMenuItemTitles;
-}
-
-- (NSString *)signedPublicKeyAndChallengeStringWithStrengthIndex:(unsigned)index challenge:(NSString *)challenge pageURL:(NSURL *)pageURL
-{
- // This switch statement must always be synced with the UI strings returned by strengthMenuItemTitles.
- UInt32 keySize;
- switch (index) {
- case 0:
- keySize = 2048;
- break;
- case 1:
- keySize = 1024;
- break;
- case 2:
- keySize = 512;
- break;
- default:
- return nil;
- }
-
- NSString *keyDescription = [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "name of keychain key generated by the KEYGEN tag"), [pageURL host]];
- return [(NSString *)WKSignedPublicKeyAndChallengeString(keySize, (CFStringRef)challenge, (CFStringRef)keyDescription) autorelease];
-}
-
-static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result)
-{
- switch (result) {
- case WKCertificateParseResultSucceeded:
- return WebCertificateParseResultSucceeded;
- case WKCertificateParseResultFailed:
- return WebCertificateParseResultFailed;
- case WKCertificateParseResultPKCS7:
- return WebCertificateParseResultPKCS7;
- }
-
- ASSERT_NOT_REACHED();
- return WebCertificateParseResultFailed;
-}
-
-- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data
-{
- return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length]));
-}
-
-@end
diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm
new file mode 100644
index 0000000..3e535ea
--- /dev/null
+++ b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005, 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.
+ */
+
+#import <WebKit/WebKeyGenerator.h>
+
+#import <WebKitSystemInterface.h>
+#import <wtf/Assertions.h>
+
+@implementation WebKeyGenerator
+
++ (WebKeyGenerator *)sharedGenerator
+{
+ static WebKeyGenerator *sharedGenerator = [[WebKeyGenerator alloc] init];
+ return sharedGenerator;
+}
+
+static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result)
+{
+ // FIXME: WebKeyGenerator is not used in WebKit, and this code should be moved to Safari.
+
+ switch (result) {
+ case WKCertificateParseResultSucceeded:
+ return WebCertificateParseResultSucceeded;
+ case WKCertificateParseResultFailed:
+ return WebCertificateParseResultFailed;
+ case WKCertificateParseResultPKCS7:
+ return WebCertificateParseResultPKCS7;
+ }
+
+ ASSERT_NOT_REACHED();
+ return WebCertificateParseResultFailed;
+}
+
+- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data
+{
+ return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length]));
+}
+
+@end
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
index 30cadcf..29bdb8a 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
@@ -80,7 +80,7 @@ private:
virtual WTF::String contextMenuItemTagIgnoreSpelling();
virtual WTF::String contextMenuItemTagLearnSpelling();
virtual WTF::String contextMenuItemTagSearchWeb();
- virtual WTF::String contextMenuItemTagLookUpInDictionary();
+ virtual WTF::String contextMenuItemTagLookUpInDictionary(const WTF::String& selectedString);
virtual WTF::String contextMenuItemTagOpenLink();
virtual WTF::String contextMenuItemTagIgnoreGrammar();
virtual WTF::String contextMenuItemTagSpellingMenu();
@@ -153,6 +153,10 @@ private:
virtual WTF::String crashedPluginText();
virtual WTF::String multipleFileUploadText(unsigned numberOfFiles);
virtual WTF::String unknownFileSizeText();
+ virtual WTF::String keygenMenuItem512();
+ virtual WTF::String keygenMenuItem1024();
+ virtual WTF::String keygenMenuItem2048();
+ virtual WTF::String keygenKeychainItemName(const WTF::String& host);
virtual WTF::String imageTitle(const WTF::String& filename, const WebCore::IntSize& size);
virtual WTF::String mediaElementLoadingStateText();
virtual WTF::String mediaElementLiveBroadcastStateText();
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
index 94fc572..59ba436 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
@@ -274,9 +274,13 @@ String WebPlatformStrategies::contextMenuItemTagSearchWeb()
return UI_STRING_INTERNAL("Search in Google", "Search in Google context menu item");
}
-String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary()
+String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
+#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
return UI_STRING_INTERNAL("Look Up in Dictionary", "Look Up in Dictionary context menu item");
+#else
+ return [NSString stringWithFormat:UI_STRING_INTERNAL("Look Up “%@”", "Look Up context menu item with selected word"), (NSString *)selectedString];
+#endif
}
String WebPlatformStrategies::contextMenuItemTagOpenLink()
@@ -666,6 +670,26 @@ String WebPlatformStrategies::unknownFileSizeText()
return UI_STRING_INTERNAL("Unknown", "Unknown filesize FTP directory listing item");
}
+String WebPlatformStrategies::keygenMenuItem512()
+{
+ return UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem1024()
+{
+ return UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem2048()
+{
+ return UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenKeychainItemName(const WTF::String& host)
+{
+ return [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "Name of keychain key generated by the KEYGEN tag"), (NSString *)host];
+}
+
String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size)
{
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
index 385d869..131a1ac 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -46,23 +46,28 @@ using namespace WebCore;
RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL([url absoluteURL]));
origin->ref();
- _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin.get());
+ _private = reinterpret_cast<WebSecurityOriginPrivate *>(origin.get());
return self;
}
-- (NSString*)protocol
+- (NSString *)protocol
{
return reinterpret_cast<SecurityOrigin*>(_private)->protocol();
}
-- (NSString*)host
+- (NSString *)host
{
return reinterpret_cast<SecurityOrigin*>(_private)->host();
}
+- (NSString *)databaseIdentifier
+{
+ return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier();
+}
+
// Deprecated. Use host instead. This needs to stay here until we ship a new Safari.
-- (NSString*)domain
+- (NSString *)domain
{
return [self host];
}
@@ -111,7 +116,7 @@ using namespace WebCore;
return nil;
origin->ref();
- _private = reinterpret_cast<WebSecurityOriginPrivate*>(origin);
+ _private = reinterpret_cast<WebSecurityOriginPrivate *>(origin);
return self;
}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
index 2973d92..a784aba 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
@@ -37,8 +37,10 @@
- (id)initWithURL:(NSURL *)url;
-- (NSString*)protocol;
-- (NSString*)host;
+- (NSString *)protocol;
+- (NSString *)host;
+
+- (NSString *)databaseIdentifier;
// Returns zero if the port is the default port for the protocol, non-zero otherwise.
- (unsigned short)port;
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 6504f17..1b212a7 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -63,6 +63,7 @@ void InitWebCoreSystemInterface(void)
INIT(GetHTTPPipeliningPriority);
INIT(GetMIMETypeForExtension);
INIT(GetNSURLResponseLastModifiedDate);
+ INIT(SignedPublicKeyAndChallengeString);
INIT(GetPreferredExtensionForMIMEType);
INIT(GetWheelEventDeltas);
INIT(HitTestMediaUIPart);
@@ -128,6 +129,7 @@ void InitWebCoreSystemInterface(void)
INIT(MakeScrollbarPainter);
INIT(ScrollbarPainterSetDelegate);
INIT(ScrollbarPainterPaint);
+ INIT(ScrollbarPainterForceFlashScrollers);
INIT(ScrollbarThickness);
INIT(ScrollbarMinimumThumbLength);
INIT(ScrollbarMinimumTotalLengthNeededForThumb);
@@ -168,11 +170,17 @@ void InitWebCoreSystemInterface(void)
INIT(UnregisterUniqueIdForElement);
INIT(CreatePrivateStorageSession);
INIT(CopyRequestWithStorageSession);
- INIT(CreatePrivateInMemoryHTTPCookieStorage);
+ INIT(CopyHTTPCookieStorage);
INIT(GetHTTPCookieAcceptPolicy);
INIT(HTTPCookiesForURL);
INIT(SetHTTPCookiesForURL);
INIT(DeleteHTTPCookie);
+ INIT(GetCFURLResponseMIMEType);
+ INIT(GetCFURLResponseURL);
+ INIT(GetCFURLResponseHTTPResponse);
+ INIT(CopyCFURLResponseSuggestedFilename);
+ INIT(SetCFURLResponseMIMEType);
+
didInit = true;
}