+2013-12-23 Andy Estes <aestes@apple.com>
+
+ Roll out r161043. It broke 32-bit Mac builds.
+
2013-12-23 Andy Estes <aestes@apple.com>
[iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; };
5185F62610712B80007AA393 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F62510712B80007AA393 /* WebNavigationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; };
- 51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; };
51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; };
51CBFCAD0D10E6C5002DBF51 /* WebCachedFramePlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */; };
51A8B579042834F700CA2D3A /* WebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51A8B57A042834F700CA2D3A /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseManagerInternal.h; sourceTree = "<group>"; };
51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIconDatabaseDelegate.h; sourceTree = "<group>"; };
51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListInternal.h; sourceTree = "<group>"; };
51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCachedFramePlatformData.h; sourceTree = "<group>"; };
F834AAD60E64B1C700E2737C /* WebTextIterator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextIterator.mm; sourceTree = "<group>"; };
F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F8CA15B6029A39D901000122 /* WebAuthenticationPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebAuthenticationPanel.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- FEE7D6910D99B06A005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1C904FD50BA9DD0F0081E9D0 /* Base.xcconfig */,
1C904FD40BA9DD0F0081E9D0 /* DebugRelease.xcconfig */,
449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */,
- FEE7D6910D99B06A005351F6 /* iOS.xcconfig */,
1C904FD30BA9DD0F0081E9D0 /* Version.xcconfig */,
1C904FD20BA9DD0F0081E9D0 /* WebKit.xcconfig */,
);
511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */,
511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */,
- 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
939810160824BF01008DF038 /* WebCoreStatistics.h in Headers */,
93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */,
511F3FD70CECC88F00852565 /* WebDatabaseManagerClient.h in Headers */,
- 51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */,
511F3FD60CECC88F00852565 /* WebDatabaseManagerPrivate.h in Headers */,
A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
+2013-12-23 Andy Estes <aestes@apple.com>
+
+ Roll out r161043. It broke 32-bit Mac builds.
+
2013-12-23 Andy Estes <aestes@apple.com>
[iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
{
// Ripped from WebCore::Frame::moveSelectionToStartOrEndOfCurrentWord
- // Note: this is the iOS notion, not the unicode notion.
+ // Note: this is the iPhone notion, not the unicode notion.
// Here, a word starts with non-whitespace or at the start of a line and
// ends at the next whitespace, or at the end of a line.
+2013-12-23 Andy Estes <aestes@apple.com>
+
+ Roll out r161043. It broke 32-bit Mac builds.
+
2013-12-23 Andy Estes <aestes@apple.com>
[iOS] Upstream PLATFORM(IOS) changes to Source/WebKit/
// 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 "iOS.xcconfig"
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
CLANG_CXX_LIBRARY = libc++;
DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
-GCC_OPTIMIZATION_LEVEL_normal = $(GCC_OPTIMIZATION_LEVEL_normal_$(PLATFORM_NAME));
-GCC_OPTIMIZATION_LEVEL_normal_iphoneos = 3;
-GCC_OPTIMIZATION_LEVEL_normal_iphonesimulator = 3;
-GCC_OPTIMIZATION_LEVEL_normal_macosx = 2;
+GCC_OPTIMIZATION_LEVEL_normal = 2;
GCC_OPTIMIZATION_LEVEL_debug = 0;
STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
// building the MiG bindings for WebKitPluginClient even when the functions that the bindings wrap are not built.
DEAD_CODE_STRIPPING = YES;
-SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(PLATFORM_NAME));
-SECTORDER_FLAGS_iphoneos = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebKit.order;
-SECTORDER_FLAGS_macosx = -Wl,-order_file,mac/WebKit.order;
+SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit.order;
SDKROOT = macosx.internal;
-SUPPORTED_PLATFORMS = iphonesimulator iphoneos macosx;
-
TOOLCHAINS = $(TOOLCHAINS_$(PLATFORM_NAME));
TOOLCHAINS_iphoneos = $(TOOLCHAINS);
TOOLCHAINS_iphonesimulator = $(TOOLCHAINS);
ONLY_ACTIVE_ARCH = YES;
MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME));
-MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.8;
-MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.8;
+MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5;
+MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5;
MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
MACOSX_DEPLOYMENT_TARGET_macosx_1080 = 10.8;
MACOSX_DEPLOYMENT_TARGET_macosx_1090 = 10.9;
// The system version prefix is based on the current system version.
SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(PLATFORM_NAME));
-SYSTEM_VERSION_PREFIX_iphoneos = 8;
+SYSTEM_VERSION_PREFIX_iphoneos = 6; // iPhone OS is most like SnowLeopard currently.
SYSTEM_VERSION_PREFIX_iphonesimulator = $(SYSTEM_VERSION_PREFIX_iphoneos);
SYSTEM_VERSION_PREFIX_macosx = $(SYSTEM_VERSION_PREFIX_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
SYSTEM_VERSION_PREFIX_macosx_1080 = 8;
EXPORTED_SYMBOLS_FILE_ = mac/WebKit.exp;
EXPORTED_SYMBOLS_FILE_armv6 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
EXPORTED_SYMBOLS_FILE_armv7 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_armv7f = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_armv7s = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_arm64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_i386 = $(EXPORTED_SYMBOLS_FILE_i386_$(PLATFORM_NAME));
-EXPORTED_SYMBOLS_FILE_i386_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_i386_macosx = mac/WebKit.exp;
+EXPORTED_SYMBOLS_FILE_i386 = mac/WebKit.exp;
EXPORTED_SYMBOLS_FILE_ppc = mac/WebKit.exp;
-EXPORTED_SYMBOLS_FILE_x86_64 = $(EXPORTED_SYMBOLS_FILE_x86_64_$(PLATFORM_NAME));
-EXPORTED_SYMBOLS_FILE_x86_64_iphonesimulator = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.generated.exp;
-EXPORTED_SYMBOLS_FILE_x86_64_macosx = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp;
+EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit/WebKit.LP64.exp;
FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(PLATFORM_NAME));
FRAMEWORK_SEARCH_PATHS_iphoneos = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION));
GCC_PREFIX_HEADER = mac/WebKitPrefix.h;
GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) FRAMEWORK_NAME=WebKit WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS);
-HEADER_SEARCH_PATHS = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit" "$(BUILT_PRODUCTS_DIR)/usr/local/include" $(HEADER_SEARCH_PATHS);
+HEADER_SEARCH_PATHS = $(WEBKITSYSTEMINTERFACE_STATIC_LIBRARY_HEADERS_FOLDER_PATH) $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit" $(HEADER_SEARCH_PATHS);
INFOPLIST_FILE = mac/Info.plist;
INSTALL_PATH = $(INSTALL_PATH_$(PLATFORM_NAME));
INSTALL_PATH_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
OTHER_LDFLAGS_BASE = -licucore -framework JavaScriptCore -framework QuartzCore -framework WebCore;
OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_BASE) $(OTHER_LDFLAGS_$(PLATFORM_NAME));
-OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -lMobileGestalt;
+OTHER_LDFLAGS_iphoneos = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO;
OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos);
OTHER_LDFLAGS_macosx = -sub_umbrella WebCore -framework Carbon -framework Cocoa -framework DiskArbitration -framework IOKit -framework OpenGL -framework Security;
+++ /dev/null
-#include "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/AspenFamily.xcconfig"
return [webArchive autorelease];
}
-#if PLATFORM(IOS)
-- (BOOL)isHorizontalWritingMode
-{
- Node* node = core(self);
- if (!node)
- return YES;
-
- RenderObject* renderer = node->renderer();
- if (!renderer)
- return YES;
-
- return renderer->style().isHorizontalWritingMode();
-}
-
-- (void)hidePlaceholder
-{
- if (![self isKindOfClass:[DOMHTMLInputElement class]]
- && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
- return;
-
- Node *node = core(self);
- HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(node);
- formControl->hidePlaceholder();
-}
-
-- (void)showPlaceholderIfNecessary
-{
- if (![self isKindOfClass:[DOMHTMLInputElement class]]
- && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
- return;
-
- HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(core(self));
- formControl->showPlaceholderIfNecessary();
-}
-#endif
-
@end
@implementation DOMNode (WebDOMNodeOperationsPendingPublic)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebDefaultContextMenuDelegate.h"
#import "WebDOMOperations.h"
}
@end
-
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import <Cocoa/Cocoa.h>
+
#import <WebKit/WebDefaultEditingDelegate.h>
#import <WebKit/DOM.h>
return NO;
}
-#if !PLATFORM(IOS)
- (void)webView:(WebView *)webView didWriteSelectionToPasteboard:(NSPasteboard *)pasteboard
{
}
-#else
-- (NSArray *)supportedPasteboardTypesForCurrentSelection
-{
- return nil;
-}
-
-- (DOMDocumentFragment *)documentFragmentForPasteboardItemAtIndex:(NSInteger)index
-{
- return nil;
-}
-#endif
- (void)webViewDidBeginEditing:(NSNotification *)notification
{
// A file URL shouldn't fall through to here, but if it did,
// it would be a security risk to open it.
if (![[request URL] isFileURL]) {
-#if !PLATFORM(IOS)
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
-#endif
}
[listener ignore];
}
@interface WebDefaultUIDelegate : NSObject
{
-#if !PLATFORM(IOS)
IBOutlet NSMenu *defaultMenu;
-#endif
}
+ (WebDefaultUIDelegate *)sharedUIDelegate;
@end
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "WebDefaultUIDelegate.h"
+#import <Cocoa/Cocoa.h>
-#import "WebJavaScriptTextInputPanel.h"
-#import "WebTypesInternal.h"
-#import "WebUIDelegatePrivate.h"
-#import "WebView.h"
+#import <Foundation/NSURLRequest.h>
-#if PLATFORM(IOS)
-#import <WebCore/WAKViewPrivate.h>
-#import <WebCore/WAKWindow.h>
-#import <WebCore/WKViewPrivate.h>
-#endif
+#import <WebKit/WebDefaultUIDelegate.h>
+#import <WebKit/WebJavaScriptTextInputPanel.h>
+#import <WebKit/WebView.h>
+#import <WebKit/WebUIDelegatePrivate.h>
+#import <WebKit/DOM.h>
+#import "WebTypesInternal.h"
-#if !PLATFORM(IOS)
@interface NSApplication (DeclarationStolenFromAppKit)
- (void)_cycleWindowsReversed:(BOOL)reversed;
@end
-#endif
@implementation WebDefaultUIDelegate
return nil;
}
-#if PLATFORM(IOS)
-- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request userGesture:(BOOL)userGesture
-{
- return nil;
-}
-#endif
-
- (void)webViewShow: (WebView *)wv
{
}
- (void)webViewClose: (WebView *)wv
{
-#if !PLATFORM(IOS)
[[wv window] close];
-#endif
}
- (void)webViewFocus: (WebView *)wv
{
-#if !PLATFORM(IOS)
[[wv window] makeKeyAndOrderFront:wv];
-#endif
}
- (void)webViewUnfocus: (WebView *)wv
{
-#if !PLATFORM(IOS)
if ([[wv window] isKeyWindow] || [[[wv window] attachedSheet] isKeyWindow]) {
[NSApp _cycleWindowsReversed:FALSE];
}
-#endif
}
- (NSResponder *)webViewFirstResponder: (WebView *)wv
- (BOOL)webViewIsResizable: (WebView *)wv
{
-#if PLATFORM(IOS)
- return NO;
-#else
return [[wv window] showsResizeIndicator];
-#endif
}
- (void)webView: (WebView *)wv setResizable:(BOOL)resizable
{
-#if !PLATFORM(IOS)
// FIXME: This doesn't actually change the resizability of the window,
// only visibility of the indicator.
[[wv window] setShowsResizeIndicator:resizable];
-#endif
}
- (void)webView: (WebView *)wv setFrame:(NSRect)frame
{
-#if !PLATFORM(IOS)
[[wv window] setFrame:frame display:YES];
-#endif
}
- (NSRect)webViewFrame: (WebView *)wv
- (NSString *)webView: (WebView *)wv runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame
{
-#if !PLATFORM(IOS)
WebJavaScriptTextInputPanel *panel = [[WebJavaScriptTextInputPanel alloc] initWithPrompt:prompt text:defaultText];
[panel showWindow:nil];
NSString *result;
[[panel window] close];
[panel release];
return result;
-#else
- return nil;
-#endif
}
- (void)webView: (WebView *)wv runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
}
-#if !PLATFORM(IOS)
- (BOOL)webView:(WebView *)webView shouldBeginDragForElement:(NSDictionary *)element dragImage:(NSImage *)dragImage mouseDownEvent:(NSEvent *)mouseDownEvent mouseDraggedEvent:(NSEvent *)mouseDraggedEvent
{
return YES;
- (void)webView:(WebView *)webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard
{
}
-#endif
- (void)webView:(WebView *)sender didDrawRect:(NSRect)rect
{
{
}
-#if !PLATFORM(IOS)
- (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu
{
}
- (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element
{
}
-#endif
- (void)webView:(WebView *)sender exceededApplicationCacheOriginQuotaForSecurityOrigin:(WebSecurityOrigin *)origin totalSpaceNeeded:(NSUInteger)totalSpaceNeeded
{
return nil;
}
-#if PLATFORM(IOS)
-- (void)webViewSupportedOrientationsUpdated:(WebView *)sender
-{
-}
-#endif
-
@end
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
core(self)->removeItem(core(item));
}
-#if PLATFORM(IOS)
-
-// FIXME: Move into WebCore the code that deals directly with WebCore::BackForwardList.
-
-#define WebBackForwardListDictionaryEntriesKey @"entries"
-#define WebBackForwardListDictionaryCapacityKey @"capacity"
-#define WebBackForwardListDictionaryCurrentKey @"current"
-
-- (NSDictionary *)dictionaryRepresentation
-{
- BackForwardList *coreBFList = core(self);
-
- HistoryItemVector historyItems = coreBFList->entries();
- NSMutableArray *entriesArray = [[NSMutableArray alloc] init];
- for (auto it : historyItems)
- [entriesArray addObject:[(WebHistoryItem *)kit((*it).get()) dictionaryRepresentationIncludingChildren:NO]];
-
- NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
- entriesArray, WebBackForwardListDictionaryEntriesKey,
- [NSNumber numberWithUnsignedInt:coreBFList->current()], WebBackForwardListDictionaryCurrentKey,
- [NSNumber numberWithInt:coreBFList->capacity()], WebBackForwardListDictionaryCapacityKey,
- nil];
-
- [entriesArray release];
-
- return dictionary;
-}
-
-- (void)setToMatchDictionaryRepresentation:(NSDictionary *)dictionary
-{
- BackForwardList *coreBFList = core(self);
-
- coreBFList->setCapacity([[dictionary objectForKey:WebBackForwardListDictionaryCapacityKey] intValue]);
-
- for (NSDictionary *itemDictionary in [dictionary objectForKey:WebBackForwardListDictionaryEntriesKey]) {
- WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemDictionary];
- coreBFList->addItem(core(item));
- [item release];
- }
-
- unsigned currentIndex = [[dictionary objectForKey:WebBackForwardListDictionaryCurrentKey] unsignedIntValue];
- size_t listSize = coreBFList->entries().size();
- if (currentIndex >= listSize)
- currentIndex = listSize - 1;
- coreBFList->setCurrent(currentIndex);
-}
-#endif // PLATFORM(IOS)
-
- (BOOL)containsItem:(WebHistoryItem *)item
{
return core(self)->containsItem(core(item));
static bool bumperCarBackForwardHackNeeded()
{
-#if !PLATFORM(IOS)
static bool hackNeeded = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.freeverse.bumpercar"] &&
!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_BUMPERCAR_BACK_FORWARD_QUIRK);
return hackNeeded;
-#else
- return false;
-#endif
}
- (NSArray *)backListWithLimit:(int)limit
#import <WebCore/HistoryItem.h>
#import <WebCore/PageGroup.h>
-#if PLATFORM(IOS)
-#import <WebCore/WebCoreThreadMessage.h>
-#endif
-
using namespace WebCore;
typedef int64_t WebHistoryDateKey;
static void getDayBoundaries(NSTimeInterval interval, NSTimeInterval& beginningOfDay, NSTimeInterval& beginningOfNextDay)
{
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:interval];
NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
NSString *URLString = [entry URLString];
-#if !PLATFORM(IOS)
WebHistoryItem *oldEntry = [_entriesByURL objectForKey:URLString];
if (oldEntry) {
if (discardDuplicate)
[self addItemToDateCaches:entry];
[_entriesByURL setObject:entry forKey:URLString];
-#else
- WebHistoryItem *otherEntry = [_entriesByURL objectForKey:URLString];
- if (otherEntry) {
- if (discardDuplicate)
- return NO;
-
- if ([otherEntry lastVisitedTimeInterval] < [entry lastVisitedTimeInterval]) {
- // The last reference to oldEntry might be this dictionary, so we hold onto a reference
- // until we're done with oldEntry.
- [otherEntry retain];
- [self removeItemForURLString:URLString];
-
- // If we already have an item with this URL, we need to merge info that drives the
- // URL autocomplete heuristics from that item into the new one.
- [entry _mergeAutoCompleteHints:otherEntry];
- [otherEntry release];
-
- [self addItemToDateCaches:entry];
- [_entriesByURL setObject:entry forKey:URLString];
- } else
- return NO; // Special case for merges when new items may be older than pre-existing entries.
- } else {
- [self addItemToDateCaches:entry];
- [_entriesByURL setObject:entry forKey:URLString];
- }
-#endif
return YES;
}
- (void)_sendNotification:(NSString *)name entries:(NSArray *)entries
{
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:entries, WebHistoryItemsKey, nil];
-#if PLATFORM(IOS)
- WebThreadPostNotification(name, self, userInfo);
-#else
[[NSNotificationCenter defaultCenter]
postNotificationName:name object:self userInfo:userInfo];
-#endif
}
- (void)removeItems:(NSArray *)entries
return NO;
}
-#if PLATFORM(IOS)
- WebThreadPostNotification(WebHistoryLoadedNotification, self, nil);
-#else
[[NSNotificationCenter defaultCenter]
postNotificationName:WebHistoryLoadedNotification
object:self];
-#endif
if ([discardedItems count])
[self _sendNotification:WebHistoryItemsDiscardedWhileLoadingNotification entries:discardedItems];
{
if (![_historyPrivate saveToURL:URL error:error])
return NO;
-#if PLATFORM(IOS)
- WebThreadPostNotification(WebHistorySavedNotification, self, nil);
-#else
[[NSNotificationCenter defaultCenter]
postNotificationName:WebHistorySavedNotification
object:self];
-#endif
return YES;
}
#import <wtf/StdLibExtras.h>
#import <wtf/text/WTFString.h>
-#if PLATFORM(IOS)
-#import <WebCore/WebCoreThreadMessage.h>
-
-NSString *WebViewportInitialScaleKey = @"initial-scale";
-NSString *WebViewportMinimumScaleKey = @"minimum-scale";
-NSString *WebViewportMaximumScaleKey = @"maximum-scale";
-NSString *WebViewportUserScalableKey = @"user-scalable";
-NSString *WebViewportWidthKey = @"width";
-NSString *WebViewportHeightKey = @"height";
-NSString *WebViewportMinimalUIKey = @"minimal-ui";
-
-static NSString *scaleKey = @"scale";
-static NSString *scaleIsInitialKey = @"scaleIsInitial";
-static NSString *scrollPointXKey = @"scrollPointX";
-static NSString *scrollPointYKey = @"scrollPointY";
-
-static NSString * const bookmarkIDKey = @"bookmarkID";
-static NSString * const sharedLinkUniqueIdentifierKey = @"sharedLinkUniqueIdentifier";
-#endif
-
// Private keys used in the WebHistoryItem's dictionary representation.
// see 3245793 for explanation of "lastVisitedDate"
static NSString *lastVisitedTimeIntervalKey = @"lastVisitedDate";
void WKNotifyHistoryItemChanged(HistoryItem*)
{
-#if !PLATFORM(IOS)
[[NSNotificationCenter defaultCenter]
postNotificationName:WebHistoryItemChangedNotification object:nil userInfo:nil];
-#else
- WebThreadPostNotification(WebHistoryItemChangedNotification, nil, nil);
-#endif
}
@implementation WebHistoryItem
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
return nsStringNilIfEmpty(core(_private)->alternateTitle());
}
-#if !PLATFORM(IOS)
- (NSImage *)icon
{
return [[WebIconDatabase sharedIconDatabase] iconForURL:[self URLString] withSize:WebIconSmallSize];
}
-#endif
- (NSTimeInterval)lastVisitedTimeInterval
{
}
}
-#if PLATFORM(IOS)
- NSNumber *scaleValue = [dict objectForKey:scaleKey];
- NSNumber *scaleIsInitialValue = [dict objectForKey:scaleIsInitialKey];
- if (scaleValue && scaleIsInitialValue)
- core(_private)->setScale([scaleValue floatValue], [scaleIsInitialValue boolValue]);
-
- if (id viewportArguments = [dict objectForKey:@"WebViewportArguments"])
- [self _setViewportArguments:viewportArguments];
-
- NSNumber *scrollPointXValue = [dict objectForKey:scrollPointXKey];
- NSNumber *scrollPointYValue = [dict objectForKey:scrollPointYKey];
- if (scrollPointXValue && scrollPointYValue)
- core(_private)->setScrollPoint(IntPoint([scrollPointXValue intValue], [scrollPointYValue intValue]));
-
- uint32_t bookmarkIDValue = [[dict objectForKey:bookmarkIDKey] unsignedIntValue];
- if (bookmarkIDValue)
- core(_private)->setBookmarkID(bookmarkIDValue);
-
- NSString *sharedLinkUniqueIdentifierValue = [dict objectForKey:sharedLinkUniqueIdentifierKey];
- if (sharedLinkUniqueIdentifierValue)
- core(_private)->setSharedLinkUniqueIdentifier(sharedLinkUniqueIdentifierValue);
-#endif
-
return self;
}
return [self initWithURLString:[URL _web_originalDataAsString] title:title lastVisitedTimeInterval:0];
}
-// FIXME: The only iOS difference here should be whether YES or NO is passed to dictionaryRepresentationIncludingChildren:
-#if PLATFORM(IOS)
- (NSDictionary *)dictionaryRepresentation
-{
- return [self dictionaryRepresentationIncludingChildren:YES];
-}
-
-- (NSDictionary *)dictionaryRepresentationIncludingChildren:(BOOL)includesChildren
-#else
-- (NSDictionary *)dictionaryRepresentation
-#endif
{
ASSERT_MAIN_THREAD();
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:8];
[dict setObject:array forKey:weeklyVisitCountKey];
[array release];
}
-
-#if PLATFORM(IOS)
- if (includesChildren && coreItem->children().size()) {
-#else
+
if (coreItem->children().size()) {
-#endif
const HistoryItemVector& children = coreItem->children();
NSMutableArray *childDicts = [NSMutableArray arrayWithCapacity:children.size()];
[dict setObject: childDicts forKey:childrenKey];
}
-#if PLATFORM(IOS)
- [dict setObject:[NSNumber numberWithFloat:core(_private)->scale()] forKey:scaleKey];
- [dict setObject:[NSNumber numberWithBool:core(_private)->scaleIsInitial()] forKey:scaleIsInitialKey];
-
- NSDictionary *viewportArguments = [self _viewportArguments];
- if (viewportArguments)
- [dict setObject:viewportArguments forKey:@"WebViewportArguments"];
-
- IntPoint scrollPoint = core(_private)->scrollPoint();
- [dict setObject:[NSNumber numberWithInt:scrollPoint.x()] forKey:scrollPointXKey];
- [dict setObject:[NSNumber numberWithInt:scrollPoint.y()] forKey:scrollPointYKey];
-
- uint32_t bookmarkID = core(_private)->bookmarkID();
- if (bookmarkID)
- [dict setObject:[NSNumber numberWithUnsignedInt:bookmarkID] forKey:bookmarkIDKey];
-
- NSString *sharedLinkUniqueIdentifier = [self _sharedLinkUniqueIdentifier];
- if (sharedLinkUniqueIdentifier)
- [dict setObject:sharedLinkUniqueIdentifier forKey:sharedLinkUniqueIdentifierKey];
-#endif
-
return dict;
}
return kit(core(_private)->targetItem());
}
-#if !PLATFORM(IOS)
+ (void)_releaseAllPendingPageCaches
{
}
-#endif
- (id)_transientPropertyForKey:(NSString *)key
{
return coreItem->weeklyVisitCounts().size();
}
-#if PLATFORM(IOS)
-- (void)_setScale:(float)scale isInitial:(BOOL)aFlag
-{
- core(_private)->setScale(scale, aFlag);
-}
-
-- (float)_scale
-{
- return core(_private)->scale();
-}
-
-- (BOOL)_scaleIsInitial
-{
- return core(_private)->scaleIsInitial();
-}
-
-- (NSDictionary *)_viewportArguments
-{
- const ViewportArguments& viewportArguments = core(_private)->viewportArguments();
- NSMutableDictionary *argumentsDictionary = [NSMutableDictionary dictionary];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.zoom] forKey:WebViewportInitialScaleKey];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.minZoom] forKey:WebViewportMinimumScaleKey];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.maxZoom] forKey:WebViewportMaximumScaleKey];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.width] forKey:WebViewportWidthKey];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.height] forKey:WebViewportHeightKey];
- [argumentsDictionary setObject:[NSNumber numberWithFloat:viewportArguments.userZoom] forKey:WebViewportUserScalableKey];
- [argumentsDictionary setObject:[NSNumber numberWithBool:viewportArguments.minimalUI] forKey:WebViewportMinimalUIKey];
- return argumentsDictionary;
-}
-
-- (void)_setViewportArguments:(NSDictionary *)arguments
-{
- ViewportArguments viewportArguments;
- viewportArguments.zoom = [[arguments objectForKey:WebViewportInitialScaleKey] floatValue];
- viewportArguments.minZoom = [[arguments objectForKey:WebViewportMinimumScaleKey] floatValue];
- viewportArguments.maxZoom = [[arguments objectForKey:WebViewportMaximumScaleKey] floatValue];
- viewportArguments.width = [[arguments objectForKey:WebViewportWidthKey] floatValue];
- viewportArguments.height = [[arguments objectForKey:WebViewportHeightKey] floatValue];
- viewportArguments.userZoom = [[arguments objectForKey:WebViewportUserScalableKey] floatValue];
- viewportArguments.minimalUI = [[arguments objectForKey:WebViewportMinimalUIKey] boolValue];
- core(_private)->setViewportArguments(viewportArguments);
-}
-
-- (CGPoint)_scrollPoint
-{
- return core(_private)->scrollPoint();
-}
-
-- (void)_setScrollPoint:(CGPoint)scrollPoint
-{
- core(_private)->setScrollPoint(IntPoint(scrollPoint));
-}
-
-- (uint32_t)_bookmarkID
-{
- return core(_private)->bookmarkID();
-}
-
-- (void)_setBookmarkID:(uint32_t)bookmarkID
-{
- core(_private)->setBookmarkID(bookmarkID);
-}
-
-- (NSString *)_sharedLinkUniqueIdentifier
-{
- return nsStringNilIfEmpty(core(_private)->sharedLinkUniqueIdentifier());
-}
-
-- (void)_setSharedLinkUniqueIdentifier:(NSString *)identifier
-{
- core(_private)->setSharedLinkUniqueIdentifier(identifier);
-}
-#endif // PLATFORM(IOS)
-
- (BOOL)_isInPageCache
{
return core(_private)->isInPageCache();
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebURLsWithTitles.h"
#import <WebKit/WebNSURLExtras.h>
}
@end
-
-#endif // !PLATFORM(IOS)
#import <wtf/MainThread.h>
#import <wtf/RunLoop.h>
-#if PLATFORM(IOS)
-#import "MemoryMeasure.h"
-#import "WebFrameInternal.h"
-#import <WebCore/CachedImage.h>
-#import <WebCore/CredentialStorage.h>
-#import <WebCore/Frame.h>
-#import <WebCore/PageCache.h>
-#import <WebCore/WebCoreThreadRun.h>
-#endif
-
@implementation WebCache
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
InitWebCoreSystemInterface();
}
WebCore::CrossOriginPreflightResultCache::shared().empty();
}
-#if PLATFORM(IOS)
-+ (void)emptyInMemoryResources
-{
- // This method gets called from MobileSafari after it calls [WebView
- // _close]. [WebView _close] schedules its work on the WebThread. So we
- // schedule this method on the WebThread as well so as to pick up all the
- // dead resources left behind after closing the WebViews
- WebThreadRun(^{
- WebKit::MemoryMeasure measurer("[WebCache emptyInMemoryResources]");
-
- // Toggling the cache model like this forces the cache to evict all its in-memory resources.
- WebCacheModel cacheModel = [WebView _cacheModel];
- [WebView _setCacheModel:WebCacheModelDocumentViewer];
- [WebView _setCacheModel:cacheModel];
-
- WebCore::memoryCache()->pruneLiveResources(true);
- });
-}
-
-+ (void)sizeOfDeadResources:(int *)resources
-{
- WebCore::MemoryCache::Statistics stats = WebCore::memoryCache()->getStatistics();
- if (resources) {
- *resources = (stats.images.size - stats.images.liveSize)
- + (stats.cssStyleSheets.size - stats.cssStyleSheets.liveSize)
-#if ENABLE(XSLT)
- + (stats.xslStyleSheets.size - stats.xslStyleSheets.liveSize)
-#endif
- + (stats.scripts.size - stats.scripts.liveSize);
- }
-}
-
-+ (void)clearCachedCredentials
-{
- WebCore::CredentialStorage::clearCredentials();
-}
-
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url
-{
- return [WebCache addImageToCache:image forURL:url forFrame:nil];
-}
-
-+ (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url forFrame:(WebFrame *)frame
-{
- if (!image || !url || ![[url absoluteString] length])
- return false;
- WebCore::SecurityOrigin* topOrigin = nullptr;
-#if ENABLE(CACHE_PARTITIONING)
- if (frame)
- topOrigin = core(frame)->document()->topOrigin();
-#endif
- return WebCore::memoryCache()->addImageToCache(image, url, topOrigin ? topOrigin->cachePartition() : emptyString());
-}
-
-+ (void)removeImageFromCacheForURL:(NSURL *)url
-{
- [WebCache removeImageFromCacheForURL:url forFrame:nil];
-}
-
-+ (void)removeImageFromCacheForURL:(NSURL *)url forFrame:(WebFrame *)frame
-{
- if (!url)
- return;
- WebCore::SecurityOrigin* topOrigin = nullptr;
-#if ENABLE(CACHE_PARTITIONING)
- if (frame)
- topOrigin = core(frame)->document()->topOrigin();
-#endif
- WebCore::memoryCache()->removeImageFromCache(url, topOrigin ? topOrigin->cachePartition() : emptyString());
-}
-
-+ (CGImageRef)imageForURL:(NSURL *)url
-{
- if (!url)
- return nullptr;
-
- WebCore::CachedResource* cachedResource = WebCore::memoryCache()->resourceForURL(url);
- if (!cachedResource || cachedResource->type() != WebCore::CachedResource::ImageResource)
- return nullptr;
- WebCore::CachedImage* cachedImage = static_cast<WebCore::CachedImage*>(cachedResource);
- if (!cachedImage || !cachedImage->hasImage())
- return nullptr;
- return cachedImage->image()->getCGImageRef();
-}
-
-#endif // PLATFORM(IOS)
-
+ (void)setDisabled:(BOOL)disabled
{
if (!pthread_main_np())
- (void)download:(NSURLDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
-#if !PLATFORM(IOS)
// Try previously stored credential first.
if (![challenge previousFailureCount]) {
NSURLCredential *credential = mac(CredentialStorage::get(core([challenge protectionSpace])));
[[WebPanelAuthenticationHandler sharedHandler] startAuthentication:challenge window:window];
}
-#endif
}
- (void)download:(NSURLDownload *)download didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
-#if !PLATFORM(IOS)
if ([realDelegate respondsToSelector:@selector(download:didCancelAuthenticationChallenge:)]) {
[realDelegate download:download didCancelAuthenticationChallenge:challenge];
} else {
[[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:challenge];
}
-#endif
}
- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
- (NSValue *)_imageRect
{
-#if !PLATFORM(IOS)
IntRect rect = _result->imageRect();
return rect.isEmpty() ? nil : [NSValue valueWithRect:rect];
-#else
- return nil;
-#endif
}
- (NSURL *)_absoluteImageURL
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebIconDatabaseInternal.h"
#import "WebIconDatabaseClient.h"
}
return nsImage;
}
-
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebIconDatabasePrivate.h"
namespace WebCore {
@end
NSImage *webGetNSImage(WebCore::Image*, NSSize);
-
-#endif
#import <unicode/uchar.h>
#import <sys/param.h>
-#if PLATFORM(IOS)
-#import <WebCore/WAKViewPrivate.h>
-#import <WebKit/DOM.h>
-#import <WebKit/WebFrame.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebViewPrivate.h>
-#endif
-
NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
-#if !PLATFORM(IOS)
static inline CGFloat webkit_CGCeiling(CGFloat value)
{
if (sizeof(value) == sizeof(float))
return ceilf(value);
return ceil(value);
}
-#endif
using namespace WebCore;
@implementation NSString (WebKitExtras)
-#if !PLATFORM(IOS)
static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
{
unsigned i;
return [self sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]].width;
}
-#endif // !PLATFORM(IOS)
- (NSString *)_web_stringByAbbreviatingWithTildeInPath
{
return newString;
}
-#if !PLATFORM(IOS)
+ (NSStringEncoding)_web_encodingForResource:(Handle)resource
{
return CFStringConvertEncodingToNSStringEncoding(stringEncodingForResource(resource));
}
-#endif
- (BOOL)_webkit_isCaseInsensitiveEqualToString:(NSString *)string
{
return [result autorelease];
}
-#if !PLATFORM(IOS)
-(NSString *)_webkit_fixedCarbonPOSIXPath
{
NSFileManager *fileManager = [NSFileManager defaultManager];
return path;
}
-#endif // !PLATFORM(IOS)
-
-#if PLATFORM(IOS)
-+ (NSString *)_web_stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName
-{
- return [WebFrame stringWithData:data textEncodingName:textEncodingName];
-}
-#endif
+ (NSString *)_webkit_localCacheDirectoryWithBundleIdentifier:(NSString*)bundleIdentifier
{
NSString *cacheDir = [defaults objectForKey:WebKitLocalCacheDefaultsKey];
if (!cacheDir || ![cacheDir isKindOfClass:[NSString class]]) {
-#if PLATFORM(IOS)
- cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
-#else
char cacheDirectory[MAXPATHLEN];
size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
if (cacheDirectoryLen)
cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];
-#endif
}
return [cacheDir stringByAppendingPathComponent:bundleIdentifier];
uint64_t WebMemorySize(void)
{
-#if PLATFORM(IOS_SIMULATOR)
- // Pretend we have 512MB of memory to make cache sizes behave like on device
- return 512 * 1024 * 1024;
-#endif
pthread_once(&initControl, initCapabilities);
-#if PLATFORM(IOS)
- // On iOS, round up the memory size to a power of 2 because max_mem may not be exactly 256MB
- // (for example) and we have code that depends on those boundaries.
- return powf(2.0, ceilf(log2f(gHostBasicInfo.max_mem)));
-#else
return gHostBasicInfo.max_mem;
-#endif
}
int WebNumberOfCPUs(void)
when adding a new version constant.
*/
-#if !PLATFORM(IOS)
#define WEBKIT_FIRST_VERSION_WITH_3_0_CONTEXT_MENU_TAGS 0x020A0000 // 522.0.0
#define WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION 0x020A0000 // 522.0.0
#define WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK 0x020A0000 // 522.0.0
#define WEBKIT_FIRST_VERSION_WITH_GET_MATCHED_CSS_RULES_RESTRICTIONS 0x02160B00 // 534.11.0
#define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 0x02170D00 // 535.13.0
#define WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR 0x02190100 // 537.1.0
-#else
-// <rdar://problem/6627758> Need to implement WebKitLinkedOnOrAfter
-// Actually UIKit version numbers, since applications don't link against WebKit
-#define WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION 229 // iOS 2.0
-#define WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION 818 // iOS 3.0
-#define WEBKIT_FIRST_VERSION_WITH_FLIPPED_SHADOWS 1100 // iOS 3.2
-#define WEBKIT_FIRST_VERSION_WITHOUT_MULTIPLE_IFRAME_TOUCH_EVENT_DISPATCH 1400 // iOS 4.2
-#define WEBKIT_FIRST_VERSION_WITH_CSS_TRANSFORMS_AFFECTING_OVERFLOW 1600 // iOS 5.0
-#define WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER 1600 // iOS 5.0
-#define WEBKIT_FIRST_VERSION_WITH_WINDOW_ON_ERROR 1600 // iOS 5.0
-#define WEBKIT_FIRST_VERSION_WITH_DELEGATE_CALLS_IN_COMMON_RUNLOOP_MODES 1600 // iOS 5.0
-#define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 2239 // iOS 6.0
-#define WEBKIT_FIRST_VERSION_WITH_YOUTUBE_EMBED_IFRAME_TRANSFORM 2239 // iOS 6.0
-#define WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR 2665 // iOS 7.0
-#endif // PLATFORM(IOS)
#ifdef __cplusplus
extern "C" {
BOOL WebKitLinkedOnOrAfter(int version)
{
-#if !PLATFORM(IOS)
return (WebKitLinkTimeVersion() >= version);
-#else
- int32_t linkTimeVersion = WebKitLinkTimeVersion();
- int32_t majorVersion = linkTimeVersion >> 16 & 0x0000FFFF;
-
- // The application was not linked against UIKit so assume most recent WebKit
- if (linkTimeVersion == -1)
- return YES;
-
- return (majorVersion >= version);
-#endif
}
void setWebKitLinkTimeVersion(int version)
if (overridenWebKitLinkTimeVersion)
return overridenWebKitLinkTimeVersion;
-#if !PLATFORM(IOS)
return NSVersionOfLinkTimeLibrary("WebKit");
-#else
- // <rdar://problem/6627758> Need to implement WebKitLinkedOnOrAfter
- // Third party applications do not link against WebKit, but rather against UIKit.
- return NSVersionOfLinkTimeLibrary("UIKit");
-#endif
}
#import <wtf/Assertions.h>
#import <wtf/MainThread.h>
-#if PLATFORM(IOS)
-#import "WebLocalizableStringsInternal.h"
-#import <dispatch/dispatch.h>
-#endif
-
WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
NSString *WebLocalizedString(WebLocalizableStringsBundle *stringsBundle, const char *key)
// and its use of [NSBundle localizedStringForKey:::], which is not guaranteed to be thread-safe. If
// we decide we need to use this on background threads, we'll need to add locking here and make sure
// it doesn't affect performance.
-#if !PLATFORM(IOS)
ASSERT(isMainThread());
-#endif
NSBundle *bundle;
if (stringsBundle == NULL) {
ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
return result;
}
-
-#if PLATFORM(IOS)
-// See <rdar://problem/7902473> Optimize WebLocalizedString for why we do this on a background thread on a timer callback
-static void LoadWebLocalizedStringsTimerCallback(CFRunLoopTimerRef timer, void *info)
-{
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
- UI_STRING_KEY_INTERNAL("Typing", "Typing (Undo action name)", "We don't care if we find this string, but searching for it will load the plist and save the results.");
- });
-}
-
-void LoadWebLocalizedStrings(void)
-{
- CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, &LoadWebLocalizedStringsTimerCallback, NULL);
- CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopCommonModes);
- CFRelease(timer);
-}
-#endif
*/
#import "WebTypesInternal.h"
+#import <Cocoa/Cocoa.h>
@interface NSArray (WebNSArrayExtras)
@end
-#if !PLATFORM(IOS)
@interface NSMutableArray (WebNSArrayExtras)
- (void)_webkit_removeUselessMenuItemSeparators;
@end
-#endif
@end
-#if !PLATFORM(IOS)
@implementation NSMutableArray (WebNSArrayExtras)
- (void)_webkit_removeUselessMenuItemSeparators
}
@end
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <Cocoa/Cocoa.h>
@interface NSControl (WebExtras)
- (void)sizeToFitAndAdjustWindowHeight;
@end
-
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebNSControlExtras.h"
@implementation NSControl (WebExtras)
}
@end
-
-#endif
- (void)_webkit_setBool:(BOOL)value forKey:(id)key;
- (void)_webkit_setLongLong:(long long)value forKey:(id)key;
- (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key;
-#if PLATFORM(IOS)
-- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key;
-#endif
@end
[object release];
}
-#if PLATFORM(IOS)
-- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key
-{
- NSNumber *object = [[NSNumber alloc] initWithUnsignedInt:value];
- [self setObject:object forKey:key];
- [object release];
-}
-#endif
-
@end
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <WebKit/WebNSEventExtras.h>
@implementation NSEvent (WebExtras)
}
@end
-
-#endif // !PLATFORM(IOS)
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
-#if PLATFORM(IOS)
-#import <WebCore/FileSystemIOS.h>
-#endif
-
@implementation NSFileManager (WebNSFileManagerExtras)
-#if !PLATFORM(IOS)
typedef struct MetaDataInfo
{
return [[(NSString *)CFDictionaryGetValue(adoptCF(DADiskCopyDescription(disk.get())).get(), kDADiskDescriptionVolumeNameKey) copy] autorelease];
}
-#endif // !PLATFORM(IOS)
-
// -[NSFileManager fileExistsAtPath:] returns NO if there is a broken symlink at the path.
// So we use this function instead, which returns YES if there is anything there, including
// a broken symlink.
return path;
}
-#if PLATFORM(IOS)
-- (NSString *)_webkit_createTemporaryDirectoryWithTemplatePrefix:(NSString *)prefix
-{
- return WebCore::createTemporaryDirectory(prefix);
-}
-#endif
-
@end
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <Cocoa/Cocoa.h>
@interface NSImage (WebExtras)
- (void)_web_saveAndOpen;
@end
-
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <WebKit/WebNSImageExtras.h>
#import <WebKit/WebKitLogging.h>
}
@end
-
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebNSPasteboardExtras.h"
#import "DOMElementInternal.h"
}
@end
-
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <Cocoa/Cocoa.h>
@interface NSPrintOperation (WebKitExtras)
- (float)_web_availablePaperHeight;
@end
-
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebNSPrintOperationExtras.h"
@implementation NSPrintOperation (WebKitExtras)
}
@end
-
-#endif
#import <unicode/uchar.h>
#import <unicode/uscript.h>
-#if PLATFORM(IOS)
-#import <Foundation/NSString_NSURLExtras.h>
-#endif
-
using namespace WebCore;
using namespace WTF;
-#if PLATFORM(IOS)
-// Fake URL scheme.
-#define WebDataProtocolScheme @"webkit-fake-url"
-#endif
-
#define URL_BYTES_BUFFER_LENGTH 2048
@implementation NSURL (WebNSURLExtras)
return [NSURL URLWithString:[@"file:" stringByAppendingString:[self absoluteString]]];
}
-#if PLATFORM(IOS)
-static inline NSURL *createYouTubeURL(NSString *videoID, NSString *timeID)
-{
- // This method creates a youtube: URL, which is an internal format that is passed to YouTube.app.
- // If the format of these internal links is changed below, then the app probably needs to be updated as well.
-
- ASSERT(videoID && [videoID length] > 0 && ![videoID isEqualToString:@"/"]);
-
- if ([timeID length])
- return [NSURL URLWithString:[NSString stringWithFormat:@"youtube:%@?t=%@", videoID, timeID]];
- return [NSURL URLWithString:[NSString stringWithFormat:@"youtube:%@", videoID]];
-}
-
-- (NSURL *)_webkit_youTubeURL
-{
- // Bail out early if we aren't even on www.youtube.com or youtube.com.
- NSString *scheme = [[self scheme] lowercaseString];
- if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"])
- return nil;
-
- NSString *hostName = [[self host] lowercaseString];
- BOOL isYouTubeMobileWebAppURL = [hostName isEqualToString:@"m.youtube.com"];
- BOOL isYouTubeShortenedURL = [hostName isEqualToString:@"youtu.be"];
- if (!isYouTubeMobileWebAppURL
- && !isYouTubeShortenedURL
- && ![hostName isEqualToString:@"www.youtube.com"]
- && ![hostName isEqualToString:@"youtube.com"])
- return nil;
-
- NSString *path = [self path];
-
- // Short URL of the form: http://youtu.be/v1d301D
- if (isYouTubeShortenedURL) {
- NSString *videoID = [path lastPathComponent];
- if (videoID && ![videoID isEqualToString:@"/"])
- return createYouTubeURL(videoID, nil);
- return nil;
- }
-
- NSString *query = [self query];
- NSString *fragment = [self fragment];
-
- // On the YouTube mobile web app, the path and query string are put into the
- // fragment so that one web page is only ever loaded (see <rdar://problem/9550639>).
- if (isYouTubeMobileWebAppURL) {
- NSRange range = [fragment rangeOfString:@"?"];
- if (range.location == NSNotFound) {
- path = fragment;
- query = nil;
- } else {
- path = [fragment substringToIndex:range.location];
- query = [fragment substringFromIndex:(range.location + 1)];
- }
- fragment = nil;
- }
-
- if ([[path lowercaseString] isEqualToString:@"/watch"]) {
- if ([query length]) {
- NSString *videoID = [[query _webkit_queryKeysAndValues] objectForKey:@"v"];
- if (videoID) {
- NSDictionary *fragmentDict = [[self fragment] _webkit_queryKeysAndValues];
- NSString *timeID = [fragmentDict objectForKey:@"t"];
- return createYouTubeURL(videoID, timeID);
- }
- }
-
- // May be a new-style link (see <rdar://problem/7733692>).
- if ([fragment hasPrefix:@"!"]) {
- query = [fragment substringFromIndex:1];
-
- if ([query length]) {
- NSDictionary *queryDict = [query _webkit_queryKeysAndValues];
- NSString *videoID = [queryDict objectForKey:@"v"];
- if (videoID) {
- NSString *timeID = [queryDict objectForKey:@"t"];
- return createYouTubeURL(videoID, timeID);
- }
- }
- }
- } else if ([path _web_hasCaseInsensitivePrefix:@"/v/"] || [path _web_hasCaseInsensitivePrefix:@"/e/"]) {
- NSString *videoID = [path lastPathComponent];
-
- // These URLs are funny - they don't have a ? for the first query parameter.
- // Strip all characters after and including '&' to remove extraneous parameters after the video ID.
- NSRange ampersand = [videoID rangeOfString:@"&"];
- if (ampersand.location != NSNotFound)
- videoID = [videoID substringToIndex:ampersand.location];
-
- if (videoID)
- return createYouTubeURL(videoID, nil);
- }
-
- return nil;
-}
-
-+ (NSURL *)uniqueURLWithRelativePart:(NSString *)relativePart
-{
- CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault);
- NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef);
- CFRelease(UUIDRef);
- NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", WebDataProtocolScheme, UUIDString, relativePart]];
- CFRelease(UUIDString);
-
- return URL;
-}
-
-#endif // PLATFORM(IOS)
@end
@implementation NSString (WebNSURLExtras)
return [self substringFromIndex:fragmentRange.location + 1];
}
-#if PLATFORM(IOS)
-
-- (NSString *)_webkit_unescapedQueryValue
-{
- NSMutableString *string = [[[self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] mutableCopy] autorelease];
- if (!string) // If we failed to decode the URL as UTF8, fall back to Latin1
- string = [[[self stringByReplacingPercentEscapesUsingEncoding:NSISOLatin1StringEncoding] mutableCopy] autorelease];
- [string replaceOccurrencesOfString:@"+" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [string length])];
- return string;
-}
-
-- (NSDictionary *)_webkit_queryKeysAndValues
-{
- unsigned queryLength = [self length];
- if (!queryLength)
- return nil;
-
- NSMutableDictionary *queryKeysAndValues = nil;
- NSRange equalSearchRange = NSMakeRange(0, queryLength);
-
- while (equalSearchRange.location < queryLength - 1 && equalSearchRange.length) {
-
- // Search for "=".
- NSRange equalRange = [self rangeOfString:@"=" options:NSLiteralSearch range:equalSearchRange];
- if (equalRange.location == NSNotFound)
- break;
-
- unsigned indexAfterEqual = equalRange.location + 1;
- if (indexAfterEqual > queryLength - 1)
- break;
-
- // Get the key before the "=".
- NSRange keyRange = NSMakeRange(equalSearchRange.location, equalRange.location - equalSearchRange.location);
-
- // Seach for the ampersand.
- NSRange ampersandSearchRange = NSMakeRange(indexAfterEqual, queryLength - indexAfterEqual);
- NSRange ampersandRange = [self rangeOfString:@"&" options:NSLiteralSearch range:ampersandSearchRange];
-
- // Get the value after the "=", before the ampersand.
- NSRange valueRange;
- if (ampersandRange.location != NSNotFound)
- valueRange = NSMakeRange(indexAfterEqual, ampersandRange.location - indexAfterEqual);
- else
- valueRange = NSMakeRange(indexAfterEqual, queryLength - indexAfterEqual);
-
- // Save the key and the value.
- if (keyRange.length && valueRange.length) {
- if (queryKeysAndValues == nil)
- queryKeysAndValues = [NSMutableDictionary dictionary];
- NSString *key = [[self substringWithRange:keyRange] lowercaseString];
- NSString *value = [[self substringWithRange:valueRange] _webkit_unescapedQueryValue];
- if ([key length] && [value length])
- [queryKeysAndValues setObject:value forKey:key];
- }
-
- // At the end.
- if (ampersandRange.location == NSNotFound)
- break;
-
- // Continue searching after the ampersand.
- unsigned indexAfterAmpersand = ampersandRange.location + 1;
- equalSearchRange = NSMakeRange(indexAfterAmpersand, queryLength - indexAfterAmpersand);
- }
-
- return queryKeysAndValues;
-}
-
-#endif // PLATFORM(IOS)
-
@end
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebView.h>
-#if PLATFORM(IOS)
-#import <WebCore/WAKViewPrivate.h>
-#import <WebCore/WAKWindow.h>
-#endif
-
#define WebDragStartHysteresisX 5.0f
#define WebDragStartHysteresisY 5.0f
#define WebMaxDragImageSize NSMakeSize(400.0f, 400.0f)
return (WebFrameView *)[self _web_superviewOfClass:[WebFrameView class]];
}
-#if !PLATFORM(IOS)
// FIXME: Mail is the only client of _webView, remove this method once no versions of Mail need it.
- (WebView *)_webView
{
[self dragImage:dragImage at:origin offset:NSZeroSize event:event pasteboard:pasteboard source:source slideBack:YES];
#pragma clang diagnostic pop
}
-#endif // !PLATFORM(IOS)
- (BOOL)_web_firstResponderIsSelfOrDescendantView
{
}
@end
-
-#if PLATFORM(IOS)
-@implementation NSView (WebDocumentViewExtras)
-
-- (WebFrame *)_frame
-{
- WebFrameView *webFrameView = [self _web_parentWebFrameView];
- return [webFrameView webFrame];
-}
-
-- (WebView *)_webView
-{
- // We used to use the view hierarchy exclusively here, but that won't work
- // right when the first viewDidMoveToSuperview call is done, and this will.
- return [[self _frame] webView];
-}
-
-@end
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebNSWindowExtras.h"
@implementation NSWindow (WebExtras)
}
@end
-
-#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <Cocoa/Cocoa.h>
#import <Foundation/NSURLCredentialStorage.h>
@interface WebNonBlockingPanel : NSPanel
@end
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <WebKit/WebAuthenticationPanel.h>
#import "WebLocalizableStringsInternal.h"
}
@end
-
-#endif // !PLATFORM(IOS)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <WebKit/WebPanelAuthenticationHandler.h>
#import <Foundation/NSURLAuthenticationChallenge.h>
}
@end
-
-#endif // !PLATFORM(IOS)
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
WKSendUserChangeNotifications();
}
typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
#endif
-#if PLATFORM(IOS)
-#import <WebCore/WAKAppKitStubs.h>
-#endif
-
@class WebPluginDatabase;
@protocol WebPluginManualLoader
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
{
NSString *newPath = [thePath stringByResolvingSymlinksInPath];
-#if !PLATFORM(IOS)
FSRef fref;
OSStatus err;
newPath = [(NSURL *)URL path];
CFRelease(URL);
}
-#endif
return newPath;
}
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <JavaVM/jni.h>
/*!
exceptionDescription:(NSString **)exceptionString;
@end
-#endif // PLATFORM(IOS)
using namespace WebCore;
-#if PLATFORM(IOS)
-@interface WebPluginController (SecretsIKnow)
-- (WebFrame *)webFrame; // FIXME: This file calls -[WebPluginController webFrame], which is not declared in WebPluginController.h. Merge issue? Are the plug-in files out of date?
-@end
-#endif
-
@implementation WebPluginContainerCheck
- (id)initWithRequest:(NSURLRequest *)request target:(NSString *)target resultObject:(id)obj selector:(SEL)selector controller:(id <WebPluginContainerCheckController>)controller contextInfo:(id)contextInfo /*optional*/
@class WebPluginPackage;
@class WebView;
@class WebDataSource;
-#if PLATFORM(IOS)
-@class CALayer;
-#endif
@interface WebPluginController : NSObject <WebPluginManualLoader, WebPluginContainerCheckController>
{
+ (void)pluginViewHidden:(NSView *)view;
#endif
-#if PLATFORM(IOS)
-+ (void)addPlugInView:(NSView *)view;
-- (BOOL)plugInsAreRunning;
-- (CALayer *)superlayerForPluginView:(NSView *)view;
-#endif
- (void)startAllPlugins;
- (void)stopAllPlugins;
- (void)destroyAllPlugins;
-#if PLATFORM(IOS)
-- (void)stopPluginsForPageCache;
-- (void)restorePluginsFromCache;
-#endif
- (WebFrame *)webFrame;
- (WebView *)webView;
#import <runtime/JSLock.h>
#import <wtf/text/WTFString.h>
-#if PLATFORM(IOS)
-#import "DOMElementInternal.h"
-#import "WebUIKitDelegate.h"
-#import <WebCore/FrameView.h>
-#import <WebCore/GraphicsLayer.h>
-#import <WebCore/Page.h>
-#import <WebCore/RuntimeApplicationChecksIOS.h>
-#import <WebCore/SoftLinking.h>
-#import <WebCore/WebCoreThreadRun.h>
-#endif
-
using namespace WebCore;
using namespace HTMLNames;
- (void)setContainingWindow:(NSWindow *)w;
@end
-#if !PLATFORM(IOS)
// For compatibility only.
@interface NSObject (OldPluginAPI)
+ (NSView *)pluginViewWithArguments:(NSDictionary *)arguments;
@end
-#endif
@interface NSView (OldPluginAPI)
- (void)pluginInitialize;
- (void)pluginDestroy;
@end
-#if !PLATFORM(IOS)
static bool isKindOfClass(id, NSString* className);
static void installFlip4MacPlugInWorkaroundIfNecessary();
-#endif
static NSMutableSet *pluginViews = nil;
-#if PLATFORM(IOS)
-static void initializeAudioSession()
-{
- static bool wasAudioSessionInitialized;
- if (wasAudioSessionInitialized)
- return;
-
- wasAudioSessionInitialized = true;
- if (!WebCore::applicationIsMobileSafari())
- return;
-
- AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback);
-}
-#endif
-
@implementation WebPluginController
+ (NSView *)plugInViewWithArguments:(NSDictionary *)arguments fromPluginPackage:(WebPluginPackage *)pluginPackage
{
-#if PLATFORM(IOS)
- initializeAudioSession();
-#endif
-
[pluginPackage load];
Class viewFactory = [pluginPackage viewFactory];
NSView *view = nil;
-#if PLATFORM(IOS)
- {
- WebView *webView = [_documentView _webView];
- JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
- view = [[webView _UIKitDelegateForwarder] webView:webView plugInViewWithArguments:arguments fromPlugInPackage:pluginPackage];
- }
-#else
if ([viewFactory respondsToSelector:@selector(plugInViewWithArguments:)]) {
JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
view = [viewFactory plugInViewWithArguments:arguments];
JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
view = [viewFactory pluginViewWithArguments:arguments];
}
-#endif
if (view == nil) {
return nil;
return view;
}
-#if PLATFORM(IOS)
-+ (void)addPlugInView:(NSView *)view
-{
- if (pluginViews == nil)
- pluginViews = [[NSMutableSet alloc] init];
- [pluginViews addObject:view];
-}
-#endif
-
+ (BOOL)isPlugInView:(NSView *)view
{
return [pluginViews containsObject:view];
[super dealloc];
}
-#if PLATFORM(IOS)
-- (BOOL)plugInsAreRunning
-{
- NSUInteger pluginViewCount = [_views count];
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- pluginViewCount += [_viewsNotInDocument count];
-#endif
- return _started && pluginViewCount;
-}
-
-- (CALayer *)superlayerForPluginView:(NSView *)view
-{
-#if USE(ACCELERATED_COMPOSITING)
- Frame* coreFrame = core([self webFrame]);
- FrameView* coreView = coreFrame ? coreFrame->view() : nullptr;
- if (!coreView)
- return nil;
-
- // Get a GraphicsLayer;
- GraphicsLayer* layerForWidget = coreView->graphicsLayerForPlatformWidget(view);
- if (!layerForWidget)
- return nil;
-
- return layerForWidget->platformLayer();
-#else
- return nil;
-#endif
-}
-#endif
-
- (void)stopOnePlugin:(NSView *)view
{
if ([view respondsToSelector:@selector(webPlugInStop)]) {
}
}
-#if PLATFORM(IOS)
-- (void)stopOnePluginForPageCache:(NSView *)view
-{
- if ([view respondsToSelector:@selector(webPlugInStopForPageCache)]) {
- JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM());
- [view webPlugInStopForPageCache];
- } else
- [self stopOnePlugin:view];
-}
-#endif
-
- (void)destroyOnePlugin:(NSView *)view
{
if ([view respondsToSelector:@selector(webPlugInDestroy)]) {
_started = NO;
}
-#if PLATFORM(IOS)
-- (void)stopPluginsForPageCache
-{
- if (!_started)
- return;
-
- NSUInteger viewsCount = [_views count];
- if (viewsCount > 0)
- LOG(Plugins, "stopping WebKit plugins for PageCache: %@", [_views description]);
-
- for (NSUInteger i = 0; i < viewsCount; ++i)
- [self stopOnePluginForPageCache:[_views objectAtIndex:i]];
-
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- NSUInteger viewsNotInDocumentCount = [_viewsNotInDocument count];
- for (NSUInteger i = 0; i < viewsNotInDocumentCount; ++i)
- [self stopOnePluginForPageCache:[_viewsNotInDocument objectAtIndex:i]];
-#endif
-
- _started = NO;
-}
-
-- (void)restorePluginsFromCache
-{
- WebView *webView = [_documentView _webView];
-
- NSUInteger viewsCount = [_views count];
- if (viewsCount > 0)
- LOG(Plugins, "restoring WebKit plugins from PageCache: %@", [_views description]);
-
- for (NSUInteger i = 0; i < viewsCount; ++i)
- [[webView _UIKitDelegateForwarder] webView:webView willAddPlugInView:[_views objectAtIndex:i]];
-
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- NSUInteger viewsNotInDocumentCount = [_viewsNotInDocument count];
- for (NSUInteger i = 0; i < viewsNotInDocumentCount; ++i)
- [[webView _UIKitDelegateForwarder] webView:webView willAddPlugInView:[_viewsNotInDocument objectAtIndex:i]];
-#endif
-}
-#endif // PLATFORM(IOS)
-
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- (void)pluginViewCreated:(NSView *)view
{
if (![_views containsObject:view]) {
[_views addObject:view];
-#if !PLATFORM(IOS)
[[_documentView _webView] addPluginInstanceView:view];
-#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
if ([_viewsNotInDocument containsObject:view])
[_viewsNotInDocument removeObject:view];
#endif
-#if !PLATFORM(IOS)
BOOL oldDefersCallbacks = [[self webView] defersCallbacks];
if (!oldDefersCallbacks)
[[self webView] setDefersCallbacks:YES];
if (isKindOfClass(view, @"WmvPlugin"))
installFlip4MacPlugInWorkaroundIfNecessary();
-#endif
LOG(Plugins, "initializing plug-in %@", view);
if ([view respondsToSelector:@selector(webPlugInInitialize)]) {
[view pluginInitialize];
}
-#if !PLATFORM(IOS)
if (!oldDefersCallbacks)
[[self webView] setDefersCallbacks:NO];
-#endif
if (_started) {
LOG(Plugins, "starting plug-in %@", view);
#endif
[pluginViews removeObject:view];
-#if !PLATFORM(IOS)
[[_documentView _webView] removePluginInstanceView:view];
-#endif
[_views removeObject:view];
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
[_viewsNotInDocument removeObject:view];
#endif
[pluginViews removeObject:aView];
-#if !PLATFORM(IOS)
[[_documentView _webView] removePluginInstanceView:aView];
-#endif
}
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
[self destroyOnePlugin:[_viewsNotInDocument objectAtIndex:i]];
#endif
-#if !PLATFORM(IOS)
[_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
-#else
- [_views makeObjectsPerformSelector:@selector(removeFromSuperview)];
-#endif
[_views release];
_views = nil;
_documentView = nil;
}
-#if PLATFORM(IOS)
-- (BOOL)processingUserGesture
-{
- return ScriptController::processingUserGesture();
-}
-#endif
-
- (id)_webPluginContainerCheckIfAllowedToLoadRequest:(NSURLRequest *)request inFrame:(NSString *)target resultObject:(id)obj selector:(SEL)selector
{
WebPluginContainerCheck *check = [WebPluginContainerCheck checkWithRequest:request target:target resultObject:obj selector:selector controller:self contextInfo:nil];
}
}
-#if PLATFORM(IOS)
-- (void)webPlugInContainerWillShowFullScreenForView:(id)plugInView
-{
- WebView *webView = [_dataSource _webView];
- [[webView _UIKitDelegateForwarder] webView:webView willShowFullScreenForPlugInView:plugInView];
-}
-
-- (void)webPlugInContainerDidHideFullScreenForView:(id)plugInView
-{
- WebView *webView = [_dataSource _webView];
- [[webView _UIKitDelegateForwarder] webView:webView didHideFullScreenForPlugInView:plugInView];
-}
-#endif
-
- (void)webPlugInContainerShowStatus:(NSString *)message
{
if (!message)
[self webPlugInContainerShowStatus:message];
}
-#if !PLATFORM(IOS)
- (NSColor *)webPlugInContainerSelectionColor
{
bool primary = true;
{
return [self webPlugInContainerSelectionColor];
}
-#endif
- (WebFrame *)webFrame
{
- (void)_webPluginContainerSetMediaPlayerProxy:(WebMediaPlayerProxy *)proxy forElement:(DOMElement *)element
{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
WebCore::HTMLMediaElement* client = mediaProxyClient(element);
if (client)
client->setMediaPlayerProxy(proxy);
-#if PLATFORM(IOS)
- });
-#endif
}
- (void)_webPluginContainerPostMediaPlayerNotification:(int)notification forElement:(DOMElement *)element
{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
WebCore::HTMLMediaElement* client = mediaProxyClient(element);
if (client)
client->deliverNotification((MediaPlayerProxyNotificationType)notification);
-#if PLATFORM(IOS)
- });
-#endif
}
#endif
@end
-#if !PLATFORM(IOS)
static bool isKindOfClass(id object, NSString *className)
{
Class cls = NSClassFromString(className);
hasInstalledFlip4MacPlugInWorkaround = true;
}
}
-#endif // !PLATFORM(IOS)
#import <WebKitSystemInterface.h>
#import <wtf/Assertions.h>
-#if PLATFORM(IOS)
-#import "WebUIKitSupport.h"
-#endif
-
using namespace WebCore;
static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPackage **candidatePlugin);
+ (NSArray *)_defaultPlugInPaths
{
-#if !PLATFORM(IOS)
// Plug-ins are found in order of precedence.
// If there are duplicates, the first found plug-in is used.
// For example, if there is a QuickTime.plugin in the users's home directory
@"/Library/Internet Plug-Ins",
[[NSBundle mainBundle] builtInPlugInsPath],
nil];
-#else
- // iOS plug-ins are all located in /System/Library/Internet Plug-Ins
-#if !PLATFORM(IOS_SIMULATOR)
- NSArray *systemLibrary = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, YES);
- if (!systemLibrary || [systemLibrary count] == 0)
- return nil;
- NSString *systemDir = (NSString*)[systemLibrary objectAtIndex:0];
-#else
- NSString* platformRootDir = [NSString stringWithUTF8String:WebKitPlatformSystemRootDirectory()];
- NSString *systemDir = [platformRootDir stringByAppendingPathComponent:@"System/Library"];
-#endif
- return [NSArray arrayWithObject:[systemDir stringByAppendingPathComponent:@"Internet Plug-Ins"]];
-#endif
}
- (NSArray *)_plugInPaths
}
}
-#if !PLATFORM(IOS)
NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[nsBundle executablePath]];
NSData *data = [executableFile readDataOfLength:512];
[executableFile closeFile];
[self release];
return nil;
}
-#endif
if (![self getPluginInfoFromPLists]) {
[self release];
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#include "WebPluginsPrivate.h"
NSString *WebPluginWillPresentNativeUserInterfaceNotification = @"WebPluginWillPresentNativeUserInterface";
-
-#endif
#import <WebCore/DatabaseManager.h>
#import <WebCore/SecurityOrigin.h>
-#if PLATFORM(IOS)
-#import "WebDatabaseManagerInternal.h"
-#import <WebCore/DatabaseTracker.h>
-#import <WebCore/WebCoreThread.h>
-#endif
-
using namespace WebCore;
NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
NSString *WebDatabaseDidModifyDatabaseNotification = @"WebDatabaseDidModifyDatabaseNotification";
NSString *WebDatabaseIdentifierKey = @"WebDatabaseIdentifierKey";
-#if PLATFORM(IOS)
-CFStringRef WebDatabaseOriginsDidChangeNotification = CFSTR("WebDatabaseOriginsDidChangeNotification");
-#endif
-
static NSString *databasesDirectoryPath();
@implementation WebDatabaseManager
- (void)deleteAllDatabases
{
DatabaseManager::manager().deleteAllDatabases();
-#if PLATFORM(IOS)
- // FIXME: This needs to be removed once DatabaseTrackers in multiple processes
- // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
- [[NSFileManager defaultManager] removeItemAtPath:databasesDirectoryPath() error:NULL];
-#endif
}
- (BOOL)deleteOrigin:(WebSecurityOrigin *)origin
return DatabaseManager::manager().deleteDatabase([origin _core], databaseIdentifier);
}
-#if PLATFORM(IOS)
-static bool isFileHidden(NSString *file)
-{
- ASSERT([file length]);
- return [file characterAtIndex:0] == '.';
-}
-
-+ (void)removeEmptyDatabaseFiles
-{
- NSString *databasesDirectory = databasesDirectoryPath();
- NSFileManager *fileManager = [NSFileManager defaultManager];
- NSArray *array = [fileManager contentsOfDirectoryAtPath:databasesDirectory error:0];
- if (!array)
- return;
-
- NSUInteger count = [array count];
- for (NSUInteger i = 0; i < count; ++i) {
- NSString *fileName = [array objectAtIndex:i];
- // Skip hidden files.
- if (![fileName length] || isFileHidden(fileName))
- continue;
-
- NSString *path = [databasesDirectory stringByAppendingPathComponent:fileName];
- // Look for directories that contain database files belonging to the same origins.
- BOOL isDirectory;
- if (![fileManager fileExistsAtPath:path isDirectory:&isDirectory] || !isDirectory)
- continue;
-
- // Make sure the directory is not a symbolic link that points to something else.
- NSDictionary *attributes = [fileManager attributesOfItemAtPath:path error:0];
- if ([attributes fileType] == NSFileTypeSymbolicLink)
- continue;
-
- NSArray *databaseFilesInOrigin = [fileManager contentsOfDirectoryAtPath:path error:0];
- NSUInteger databaseFileCount = [databaseFilesInOrigin count];
- NSUInteger deletedDatabaseFileCount = 0;
- for (NSUInteger j = 0; j < databaseFileCount; ++j) {
- NSString *dbFileName = [databaseFilesInOrigin objectAtIndex:j];
- // Skip hidden files.
- if (![dbFileName length] || isFileHidden(dbFileName))
- continue;
-
- NSString *dbFilePath = [path stringByAppendingPathComponent:dbFileName];
-
- // There shouldn't be any directories in this folder - but check for it anyway.
- if (![fileManager fileExistsAtPath:dbFilePath isDirectory:&isDirectory] || isDirectory)
- continue;
-
- if (DatabaseTracker::deleteDatabaseFileIfEmpty(dbFilePath))
- ++deletedDatabaseFileCount;
- }
-
- // If we have removed every database file for this origin, delete the folder for this origin.
- if (databaseFileCount == deletedDatabaseFileCount) {
- // Use rmdir - we don't want the deletion to happen if the folder is not empty.
- rmdir([path fileSystemRepresentation]);
- }
- }
-}
-
-+ (void)scheduleEmptyDatabaseRemoval
-{
- DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled();
-
- dispatch_async(dispatch_get_global_queue(0, 0), ^{
- [WebDatabaseManager removeEmptyDatabaseFiles];
- DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish();
- });
-}
-#endif // PLATFORM(IOS)
-
-@end
-
-#if PLATFORM(IOS)
-@implementation WebDatabaseManager (WebDatabaseManagerInternal)
-
-static Mutex& transactionBackgroundTaskIdentifierLock()
-{
- DEFINE_STATIC_LOCAL(Mutex, mutex, ());
- return mutex;
-}
-
-static WebBackgroundTaskIdentifier transactionBackgroundTaskIdentifier;
-
-static void setTransactionBackgroundTaskIdentifier(WebBackgroundTaskIdentifier identifier)
-{
- transactionBackgroundTaskIdentifier = identifier;
-}
-
-static WebBackgroundTaskIdentifier getTransactionBackgroundTaskIdentifier()
-{
- static dispatch_once_t pred;
- dispatch_once(&pred, ^{
- setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
- });
-
- return transactionBackgroundTaskIdentifier;
-}
-
-+ (void)willBeginFirstTransaction
-{
- [self startBackgroundTask];
-}
-
-+ (void)didFinishLastTransaction
-{
- [self endBackgroundTask];
-}
-
-+ (void)startBackgroundTask
-{
- MutexLocker lock(transactionBackgroundTaskIdentifierLock());
-
- // If there's already an existing background task going on, there's no need to start a new one.
- if (getTransactionBackgroundTaskIdentifier() != invalidWebBackgroundTaskIdentifier())
- return;
-
- setTransactionBackgroundTaskIdentifier(startBackgroundTask(^ { [WebDatabaseManager endBackgroundTask]; }));
-}
-
-+ (void)endBackgroundTask
-{
- MutexLocker lock(transactionBackgroundTaskIdentifierLock());
-
- // It is possible that we were unable to start the background task when the first transaction began.
- // Don't try to end the task in that case.
- // It is also possible we finally finish the last transaction right when the background task expires
- // and this will end up being called twice for the same background task. transactionBackgroundTaskIdentifier
- // will be invalid for the second caller.
- if (getTransactionBackgroundTaskIdentifier() == invalidWebBackgroundTaskIdentifier())
- return;
-
- endBackgroundTask(getTransactionBackgroundTaskIdentifier());
- setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
-}
-
@end
-void WebKitSetWebDatabasePaused(bool paused)
-{
- DatabaseTracker::tracker().setDatabasesPaused(paused);
-}
-#endif // PLATFORM(IOS)
-
static NSString *databasesDirectoryPath()
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
virtual ~WebDatabaseManagerClient();
virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*);
virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WTF::String& databaseIdentifier);
-#if PLATFORM(IOS)
- virtual void dispatchDidAddNewOrigin(WebCore::SecurityOrigin*) OVERRIDE;
- virtual void dispatchDidDeleteDatabase() OVERRIDE;
- virtual void dispatchDidDeleteDatabaseOrigin() OVERRIDE;
- void newDatabaseOriginWasAdded();
- void databaseWasDeleted();
- void databaseOriginWasDeleted();
-#endif
-
private:
WebDatabaseManagerClient();
-
-#if PLATFORM(IOS)
- void databaseOriginsDidChange();
-
- bool m_isHandlingNewDatabaseOriginNotification;
- bool m_isHandlingDeleteDatabaseNotification;
- bool m_isHandlingDeleteDatabaseOriginNotification;
-#endif
};
#endif
#import <wtf/RetainPtr.h>
#import <WebCore/SecurityOrigin.h>
-#if PLATFORM(IOS)
-#import <WebCore/WebCoreThread.h>
-#endif
-
using namespace WebCore;
-#if PLATFORM(IOS)
-static CFStringRef WebDatabaseOriginWasAddedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseOriginWasAddedNotification");
-static CFStringRef WebDatabaseWasDeletedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseWasDeletedNotification");
-static CFStringRef WebDatabaseOriginWasDeletedNotification = CFSTR("com.apple.MobileSafariSettings.WebDatabaseOriginWasDeletedNotification");
-#endif
-
WebDatabaseManagerClient* WebDatabaseManagerClient::sharedWebDatabaseManagerClient()
{
static WebDatabaseManagerClient* sharedClient = new WebDatabaseManagerClient();
return sharedClient;
}
-#if PLATFORM(IOS)
-static void onNewDatabaseOriginAdded(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
-{
- ASSERT(observer);
-
- WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
- client->newDatabaseOriginWasAdded();
-}
-
-static void onDatabaseDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
-{
- ASSERT(observer);
-
- WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
- client->databaseWasDeleted();
-}
-
-static void onDatabaseOriginDeleted(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
-{
- ASSERT(observer);
-
- WebDatabaseManagerClient* client = reinterpret_cast<WebDatabaseManagerClient*>(observer);
- client->databaseOriginWasDeleted();
-}
-#endif
-
WebDatabaseManagerClient::WebDatabaseManagerClient()
-#if PLATFORM(IOS)
- : m_isHandlingNewDatabaseOriginNotification(false)
- , m_isHandlingDeleteDatabaseNotification(false)
- , m_isHandlingDeleteDatabaseOriginNotification(false)
-#endif
{
-#if PLATFORM(IOS)
- CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
- CFNotificationCenterAddObserver(center, this, onNewDatabaseOriginAdded, WebDatabaseOriginWasAddedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
- CFNotificationCenterAddObserver(center, this, onDatabaseDeleted, WebDatabaseWasDeletedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
- CFNotificationCenterAddObserver(center, this, onDatabaseOriginDeleted, WebDatabaseOriginWasDeletedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
-#endif
}
WebDatabaseManagerClient::~WebDatabaseManagerClient()
{
-#if PLATFORM(IOS)
- CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, 0, 0);
-#endif
}
class DidModifyOriginData {
userInfo:userInfo.get()];
}
-#if PLATFORM(IOS)
-void WebDatabaseManagerClient::dispatchDidAddNewOrigin(SecurityOrigin*)
-{
- m_isHandlingNewDatabaseOriginNotification = true;
- // Send a notification to all apps that a new origin has been added, so other apps with opened database can refresh their origin maps.
- CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseOriginWasAddedNotification, 0, 0, true);
-}
-
-void WebDatabaseManagerClient::dispatchDidDeleteDatabase()
-{
- m_isHandlingDeleteDatabaseNotification = true;
- // Send a notification to all apps that a database has been deleted, so other apps with the deleted database open will close it properly.
- CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseWasDeletedNotification, 0, 0, true);
-}
-
-void WebDatabaseManagerClient::dispatchDidDeleteDatabaseOrigin()
-{
- m_isHandlingDeleteDatabaseOriginNotification = true;
- // Send a notification to all apps that an origin has been deleted, so other apps can update their origin maps.
- CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), WebDatabaseOriginWasDeletedNotification, 0, 0, true);
-}
-
-void WebDatabaseManagerClient::newDatabaseOriginWasAdded()
-{
- // Locks the WebThread for the rest of the run loop.
- WebThreadLock();
-
- // If this is the process that added the new origin, its quota map should have been updated
- // and does not need to be invalidated.
- if (m_isHandlingNewDatabaseOriginNotification) {
- m_isHandlingNewDatabaseOriginNotification = false;
- return;
- }
-
- databaseOriginsDidChange();
-}
-
-void WebDatabaseManagerClient::databaseWasDeleted()
-{
- // Locks the WebThread for the rest of the run loop.
- WebThreadLock();
-
- // If this is the process that added the new origin, its quota map should have been updated
- // and does not need to be invalidated.
- if (m_isHandlingDeleteDatabaseNotification) {
- m_isHandlingDeleteDatabaseNotification = false;
- return;
- }
-
- DatabaseTracker::tracker().removeDeletedOpenedDatabases();
-}
-
-void WebDatabaseManagerClient::databaseOriginWasDeleted()
-{
- // Locks the WebThread for the rest of the run loop.
- WebThreadLock();
-
- // If this is the process that added the new origin, its quota map should have been updated
- // and does not need to be invalidated.
- if (m_isHandlingDeleteDatabaseOriginNotification) {
- m_isHandlingDeleteDatabaseOriginNotification = false;
- return;
- }
-
- databaseOriginsDidChange();
-}
-
-void WebDatabaseManagerClient::databaseOriginsDidChange()
-{
- // Send a notification (within the app) about the origins change. If an app needs to update its UI when the origins change
- // (such as Safari Settings), it can listen for that notification.
- CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), WebDatabaseOriginsDidChangeNotification, 0, 0, true);
-}
-
-#endif // PLATFORM(IOS)
-
#endif
+++ /dev/null
-/*
- * Copyright (C) 2007 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.
- * 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 "WebDatabaseManagerPrivate.h"
-
-#if ENABLE(SQL_DATABASE)
-
-#if PLATFORM(IOS)
-@interface WebDatabaseManager (WebDatabaseManagerInternal)
-+ (void)willBeginFirstTransaction;
-+ (void)didFinishLastTransaction;
-+ (void)startBackgroundTask;
-+ (void)endBackgroundTask;
-@end
-
-void WebKitSetWebDatabasePaused(bool);
-#endif
-
-#endif
return sharedManager;
}
-#if PLATFORM(IOS)
-- (id)init
-{
- if (!(self = [super init]))
- return nil;
-
- WebKitInitializeStorageIfNecessary();
-
- return self;
-}
-#endif
-
- (NSArray *)origins
{
Vector<RefPtr<SecurityOrigin>> coreOrigins;
- (void)deleteAllOrigins
{
StorageTracker::tracker().deleteAllOrigins();
-#if PLATFORM(IOS)
- // FIXME: This needs to be removed once StorageTrackers in multiple processes
- // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
- [[NSFileManager defaultManager] removeItemAtPath:[WebStorageManager _storageDirectoryPath] error:NULL];
-#endif
}
- (void)deleteOrigin:(WebSecurityOrigin *)origin
#ifndef CorrectionPanel_h
#define CorrectionPanel_h
-#if USE(AUTOCORRECTION_PANEL)
-
#import <AppKit/NSSpellChecker.h>
#import <WebCore/AlternativeTextClient.h>
#import <wtf/RetainPtr.h>
+#if USE(AUTOCORRECTION_PANEL)
+
@class WebView;
class CorrectionPanel {
virtual Vector<String> dictationAlternatives(uint64_t dictationContext) OVERRIDE;
#endif
private:
-#if PLATFORM(IOS)
-#pragma clang diagnostic push
-#if defined(__has_warning) && __has_warning("-Wunused-private-field")
-#pragma clang diagnostic ignored "-Wunused-private-field"
-#endif
-#endif
WebView* m_webView;
-#if PLATFORM(IOS)
-#pragma clang diagnostic pop
-#endif
#if USE(AUTOCORRECTION_PANEL)
CorrectionPanel m_correctionPanel;
#endif
#import <WebCore/SecurityOrigin.h>
#import <wtf/RetainPtr.h>
-#if PLATFORM(IOS)
-#import "WebKitNSStringExtras.h"
-#import "WebSQLiteDatabaseTrackerClient.h"
-#import <WebCore/SQLiteDatabaseTracker.h>
-#endif
-
using namespace WebCore;
@implementation WebApplicationCache
-#if PLATFORM(IOS)
-// FIXME: This will be removed when WebKitInitializeApplicationCachePathIfNecessary()
-// is moved from WebView.mm to WebKitInitializeApplicationCacheIfNecessary() in this file.
-// https://bugs.webkit.org/show_bug.cgi?id=57567
-+ (void)initializeWithBundleIdentifier:(NSString *)bundleIdentifier
-{
- static BOOL initialized = NO;
- if (initialized)
- return;
-
- SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
-
- cacheStorage().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
-
- initialized = YES;
-}
-#endif
-
+ (long long)maximumSize
{
return cacheStorage().maximumSize();
#import <WebCore/FocusDirection.h>
#import <wtf/Forward.h>
-#if PLATFORM(IOS)
-#import <wtf/Platform.h>
-#import <wtf/text/WTFString.h>
-#import <WebCore/Chrome.h>
-
-using WebCore::MessageLevel;
-using WebCore::MessageSource;
-#endif
-
@class WebView;
class WebChromeClient : public WebCore::ChromeClient {
virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>) OVERRIDE;
virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*) OVERRIDE;
-#if !PLATFORM(IOS)
virtual void setCursor(const WebCore::Cursor&) OVERRIDE;
virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
-#endif
virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& lineRect) OVERRIDE;
virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect, bool behindText, bool entireLine) OVERRIDE;
VideoTrigger |
PluginTrigger|
CanvasTrigger |
-#if PLATFORM(IOS)
- AnimatedOpacityTrigger | // Allow opacity animations to trigger compositing mode for iOS: <rdar://problem/7830677>
-#endif
AnimationTrigger);
}
#endif
-#if ENABLE(VIDEO) && !PLATFORM(IOS)
+#if ENABLE(VIDEO)
virtual bool supportsFullscreenForNode(const WebCore::Node*) OVERRIDE;
virtual void enterFullscreenForNode(WebCore::Node*) OVERRIDE;
virtual void exitFullscreenForNode(WebCore::Node*) OVERRIDE;
virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
-#if PLATFORM(IOS)
- WebView* webView() const { return m_webView; }
-#else
WebView* webView() { return m_webView; }
-#endif
private:
WebView *m_webView;
#import "NetscapePluginHostManager.h"
#endif
-#if PLATFORM(IOS) && ENABLE(GEOLOCATION)
-#import <WebCore/Geolocation.h>
-#endif
-
-#if PLATFORM(IOS)
-#import <WebCore/Console.h>
-#import <WebCore/WAKClipView.h>
-#import <WebCore/WAKWindow.h>
-#import <WebCore/WebCoreThreadMessage.h>
-#endif
-
NSString *WebConsoleMessageXMLMessageSource = @"XMLMessageSource";
NSString *WebConsoleMessageJSMessageSource = @"JSMessageSource";
NSString *WebConsoleMessageNetworkMessageSource = @"NetworkMessageSource";
NSString *WebConsoleMessageErrorMessageLevel = @"ErrorMessageLevel";
-#if !PLATFORM(IOS)
@interface NSApplication (WebNSApplicationDetails)
- (NSCursor *)_cursorRectCursor;
@end
-#endif
@interface NSView (WebNSViewDetails)
- (NSView *)_findLastViewInKeyViewLoop;
- (void)setIsSelected:(BOOL)isSelected;
@end
-#if !PLATFORM(IOS)
@interface NSWindow (AppKitSecretsIKnowAbout)
- (NSRect)_growBoxRect;
@end
-#endif
using namespace WebCore;
using namespace HTMLNames;
void WebChromeClient::setWindowRect(const FloatRect& rect)
{
-#if !PLATFORM(IOS)
NSRect windowRect = toDeviceSpace(rect, [m_webView window]);
[[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect];
-#endif
}
FloatRect WebChromeClient::windowRect()
{
-#if !PLATFORM(IOS)
NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView];
return toUserSpace(windowRect, [m_webView window]);
-#else
- return FloatRect();
-#endif
}
// FIXME: We need to add API for setting and getting this.
void WebChromeClient::takeFocus(FocusDirection direction)
{
-#if !PLATFORM(IOS)
if (direction == FocusDirectionForward) {
// Since we're trying to move focus out of m_webView, and because
// m_webView may contain subviews within it, we ask it for the next key
return;
[[m_webView window] selectKeyViewPrecedingView:m_webView];
}
-#endif
}
void WebChromeClient::focusedElementChanged(Element* element)
void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned int lineNumber, unsigned columnNumber, const String& sourceURL)
{
-#if !PLATFORM(IOS)
id delegate = [m_webView UIDelegate];
-#else
- if (![m_webView _allowsMessaging])
- return;
-
- id delegate = [m_webView _UIKitDelegate];
- // No delegate means nothing to send this data to so bail.
- if (!delegate)
- return;
-#endif
-
BOOL respondsToNewSelector = NO;
SEL selector = @selector(webView:addMessageToConsole:withSource:);
stringForMessageLevel(level), @"MessageLevel",
NULL];
-#if PLATFORM(IOS)
- [[[m_webView _UIKitDelegateForwarder] asyncForwarder] webView:m_webView addMessageToConsole:dictionary withSource:messageSource];
-#else
if (respondsToNewSelector)
CallUIDelegate(m_webView, selector, dictionary, messageSource);
else
CallUIDelegate(m_webView, selector, dictionary);
-#endif
[dictionary release];
}
IntRect WebChromeClient::windowResizerRect() const
{
-#if !PLATFORM(IOS)
return enclosingIntRect([[m_webView window] _growBoxRect]);
-#else
- return IntRect();
-#endif
}
bool WebChromeClient::supportsImmediateInvalidation()
void WebChromeClient::invalidateRootView(const IntRect&, bool immediate)
{
-#if !PLATFORM(IOS)
if (immediate) {
[[m_webView window] displayIfNeeded];
[[m_webView window] flushWindowIfNeeded];
}
-#else
- UNUSED_PARAM(immediate);
-#endif
}
void WebChromeClient::invalidateContentsAndRootView(const IntRect& rect, bool immediate)
BEGIN_BLOCK_OBJC_EXCEPTIONS;
WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
-#if !PLATFORM(IOS)
// FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
[[webOrigin databaseQuotaManager] setQuota:defaultQuota];
} else
-#endif
CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
[webOrigin release];
iconLoader->notifyFinished(Icon::createIconForFiles(filenames));
}
-#if !PLATFORM(IOS)
void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
{
if ([NSApp _cursorRectCursor])
{
[NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
}
-#endif
KeyboardUIMode WebChromeClient::keyboardUIMode()
{
void WebChromeClient::enableSuddenTermination()
{
-#if !PLATFORM(IOS)
[[NSProcessInfo processInfo] enableSuddenTermination];
-#endif
}
void WebChromeClient::disableSuddenTermination()
{
-#if !PLATFORM(IOS)
[[NSProcessInfo processInfo] disableSuddenTermination];
-#endif
}
bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename)
PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
{
-#if !PLATFORM(IOS)
return adoptRef(new PopupMenuMac(client));
-#else
- return nullptr;
-#endif
}
PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
{
-#if !PLATFORM(IOS)
return adoptRef(new SearchPopupMenuMac(client));
-#else
- return nullptr;
-#endif
}
bool WebChromeClient::shouldPaintEntireContents() const
{
-#if PLATFORM(IOS)
- return false;
-#else
NSView *documentView = [[[m_webView mainFrame] frameView] documentView];
return [documentView layer];
-#endif
}
#if USE(ACCELERATED_COMPOSITING)
#endif
-#if ENABLE(VIDEO) && !PLATFORM(IOS)
+#if ENABLE(VIDEO)
bool WebChromeClient::supportsFullscreenForNode(const Node* node)
{
SEL selector = @selector(webView:supportsFullScreenForElement:withKeyboard:);
if ([[m_webView UIDelegate] respondsToSelector:selector])
return CallUIDelegateReturningBoolean(false, m_webView, selector, kit(const_cast<WebCore::Element*>(element)), withKeyboard);
-#if !PLATFORM(IOS)
return [m_webView _supportsFullScreenForElement:const_cast<WebCore::Element*>(element) withKeyboard:withKeyboard];
-#else
- return NO;
-#endif
}
void WebChromeClient::enterFullScreenForElement(Element* element)
WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
CallUIDelegate(m_webView, selector, kit(element), listener);
[listener release];
- }
-#if !PLATFORM(IOS)
- else
+ } else
[m_webView _enterFullScreenForElement:element];
-#endif
}
void WebChromeClient::exitFullScreenForElement(Element* element)
WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element];
CallUIDelegate(m_webView, selector, kit(element), listener);
[listener release];
- }
-#if !PLATFORM(IOS)
- else
+ } else
[m_webView _exitFullScreenForElement:element];
-#endif
}
void WebChromeClient::fullScreenRendererChanged(RenderBox* renderer)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebContextMenuClient.h"
#import "WebDelegateImplementationCaching.h"
if (nsMenu)
[NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
}
-
-#endif // !PLATFORM(IOS)
virtual ~WebEditorClient();
virtual void pageDestroyed() OVERRIDE;
-#if !PLATFORM(IOS)
virtual bool isGrammarCheckingEnabled() OVERRIDE;
virtual void toggleGrammarChecking() OVERRIDE;
virtual bool isContinuousSpellCheckingEnabled() OVERRIDE;
virtual void toggleContinuousSpellChecking() OVERRIDE;
virtual int spellCheckerDocumentTag() OVERRIDE;
-#else
- virtual bool isGrammarCheckingEnabled() OVERRIDE { return false; }
- virtual void toggleGrammarChecking() OVERRIDE { }
- // Note: isContinuousSpellCheckingEnabled() is implemented.
- virtual bool isContinuousSpellCheckingEnabled() OVERRIDE;
- virtual void toggleContinuousSpellChecking() OVERRIDE { }
- virtual int spellCheckerDocumentTag() OVERRIDE { return 0; }
-#endif
virtual bool smartInsertDeleteEnabled() OVERRIDE;
virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE;
virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) OVERRIDE;
virtual void textWillBeDeletedInTextField(WebCore::Element*) OVERRIDE;
virtual void textDidChangeInTextArea(WebCore::Element*) OVERRIDE;
-
-#if PLATFORM(IOS)
- virtual void suppressSelectionNotifications() OVERRIDE;
- virtual void restoreSelectionNotifications() OVERRIDE;
- virtual void startDelayingAndCoalescingContentChangeNotifications() OVERRIDE;
- virtual void stopDelayingAndCoalescingContentChangeNotifications() OVERRIDE;
- virtual void writeDataToPasteboard(NSDictionary*) OVERRIDE;
- virtual NSArray* supportedPasteboardTypesForCurrentSelection() OVERRIDE;
- virtual NSArray* readDataFromPasteboard(NSString* type, int index) OVERRIDE;
- virtual bool hasRichlyEditableSelection() OVERRIDE;
- virtual int getPasteboardItemsCount() OVERRIDE;
- virtual WebCore::DocumentFragment* documentFragmentFromDelegate(int index) OVERRIDE;
- virtual bool performsTwoStepPaste(WebCore::DocumentFragment*) OVERRIDE;
- virtual int pasteboardChangeCount() OVERRIDE;
-#endif
-#if !PLATFORM(IOS)
virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const OVERRIDE;
virtual void ignoreWordInSpellDocument(const WTF::String&) OVERRIDE;
virtual void learnWord(const WTF::String&) OVERRIDE;
virtual void showSpellingUI(bool show) OVERRIDE;
virtual bool spellingUIIsShowing() OVERRIDE;
virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE;
-#else
- virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const OVERRIDE { return true; }
- virtual void ignoreWordInSpellDocument(const WTF::String&) OVERRIDE { }
- virtual void learnWord(const WTF::String&) OVERRIDE { }
- virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) OVERRIDE { }
- virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&) OVERRIDE { return ""; }
- virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) OVERRIDE { }
- // Note: checkTextOfParagraph() is implemented.
- virtual void checkTextOfParagraph(const UChar* text, int length, WebCore::TextCheckingTypeMask checkingTypes, WTF::Vector<WebCore::TextCheckingResult>& results) OVERRIDE;
- virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&) OVERRIDE { }
- virtual void updateSpellingUIWithMisspelledWord(const WTF::String&) OVERRIDE { }
- virtual void showSpellingUI(bool show) OVERRIDE { }
- virtual bool spellingUIIsShowing() OVERRIDE { return false; }
- virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses) OVERRIDE { }
-#endif // PLATFORM(IOS)
virtual void willSetInputMethodState() OVERRIDE;
virtual void setInputMethodState(bool enabled) OVERRIDE;
virtual void requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest>) OVERRIDE;
RetainPtr<WebEditorUndoTarget> m_undoTarget;
bool m_haveUndoRedoOperations;
RefPtr<WebCore::TextCheckingRequest> m_textCheckingRequest;
-#if PLATFORM(IOS)
- int m_selectionNotificationSuppressions;
- bool m_delayingContentChangeNotifications;
- bool m_hasDelayedContentChangeNotification;
-#endif
};
#import <wtf/RunLoop.h>
#import <wtf/text/WTFString.h>
-#if PLATFORM(IOS)
-#import <WebCore/WebCoreThreadMessage.h>
-#import "DOMElementInternal.h"
-#import "WebFrameView.h"
-#import "WebUIKitDelegate.h"
-#endif
-
using namespace WebCore;
using namespace HTMLNames;
-#if !PLATFORM(IOS)
@interface NSSpellChecker (WebNSSpellCheckerDetails)
- (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography;
@end
-#endif
@interface NSAttributedString (WebNSAttributedStringDetails)
- (id)_initWithDOMRange:(DOMRange*)range;
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
: m_webView(webView)
, m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease])
, m_haveUndoRedoOperations(false)
-#if PLATFORM(IOS)
- , m_selectionNotificationSuppressions(0)
- , m_delayingContentChangeNotifications(0)
- , m_hasDelayedContentChangeNotification(0)
-#endif
{
}
return [m_webView isContinuousSpellCheckingEnabled];
}
-#if !PLATFORM(IOS)
void WebEditorClient::toggleContinuousSpellChecking()
{
[m_webView toggleContinuousSpellChecking:nil];
{
return [m_webView spellCheckerDocumentTag];
}
-#endif
bool WebEditorClient::shouldDeleteRange(Range* range)
{
void WebEditorClient::didBeginEditing()
{
-#if !PLATFORM(IOS)
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidBeginEditingNotification object:m_webView];
-#else
- WebThreadPostNotification(WebViewDidBeginEditingNotification, m_webView, nil);
-#endif
}
-#if PLATFORM(IOS)
-void WebEditorClient::startDelayingAndCoalescingContentChangeNotifications()
-{
- m_delayingContentChangeNotifications = true;
-}
-
-void WebEditorClient::stopDelayingAndCoalescingContentChangeNotifications()
-{
- m_delayingContentChangeNotifications = false;
-
- if (m_hasDelayedContentChangeNotification)
- this->respondToChangedContents();
-
- m_hasDelayedContentChangeNotification = false;
-}
-#endif
-
void WebEditorClient::respondToChangedContents()
{
-#if !PLATFORM(IOS)
NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView];
if ([view isKindOfClass:[WebHTMLView class]])
[(WebHTMLView *)view _updateFontPanel];
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeNotification object:m_webView];
-#else
- if (m_delayingContentChangeNotifications) {
- m_hasDelayedContentChangeNotification = true;
- } else {
- WebThreadPostNotification(WebViewDidChangeNotification, m_webView, nil);
- }
-#endif
}
void WebEditorClient::respondToChangedSelection(Frame* frame)
if ([documentView isKindOfClass:[WebHTMLView class]])
[(WebHTMLView *)documentView _selectionChanged];
-#if !PLATFORM(IOS)
// FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"])
return;
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeSelectionNotification object:m_webView];
-#else
- // Selection can be changed while deallocating down the WebView / Frame / Editor. Do not post in that case because it's already too late
- // for the NSInvocation to retain the WebView.
- if (![m_webView _isClosing] && m_selectionNotificationSuppressions == 0)
- WebThreadPostNotification(WebViewDidChangeSelectionNotification, m_webView, nil);
-#endif
}
void WebEditorClient::didEndEditing()
{
-#if !PLATFORM(IOS)
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidEndEditingNotification object:m_webView];
-#else
- WebThreadPostNotification(WebViewDidEndEditingNotification, m_webView, nil);
-#endif
}
void WebEditorClient::didWriteSelectionToPasteboard()
{
-#if !PLATFORM(IOS)
[[m_webView _editingDelegateForwarder] webView:m_webView didWriteSelectionToPasteboard:[NSPasteboard generalPasteboard]];
-#endif
}
void WebEditorClient::willWriteSelectionToPasteboard(WebCore::Range*)
return elements;
}
-#if PLATFORM(IOS)
-static NSString *NSExcludedElementsDocumentAttribute = @"ExcludedElements";
-#endif
-
DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource>>& resources)
{
static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion();
void WebEditorClient::setInsertionPasteboard(const String& pasteboardName)
{
-#if !PLATFORM(IOS)
NSPasteboard *pasteboard = pasteboardName.isEmpty() ? nil : [NSPasteboard pasteboardWithName:pasteboardName];
[m_webView _setInsertionPasteboard:pasteboard];
-#endif
}
#if USE(APPKIT)
case EditActionOutdent: return UI_STRING_KEY_INTERNAL("Outdent", "Outdent (Undo action name)", "Undo action name");
case EditActionBold: return UI_STRING_KEY_INTERNAL("Bold", "Bold (Undo action name)", "Undo action name");
case EditActionItalics: return UI_STRING_KEY_INTERNAL("Italics", "Italics (Undo action name)", "Undo action name");
-#if PLATFORM(IOS)
- case EditActionDelete: return UI_STRING_KEY_INTERNAL("Delete", "Delete (Undo action name)", "Undo action name (Used only by PLATFORM(IOS) code)");
- case EditActionDictation: return UI_STRING_KEY_INTERNAL("Dictation", "Dictation (Undo action name)", "Undo action name (Used only by PLATFORM(IOS) code)");
-#endif
}
return nil;
}
ASSERT(step);
NSUndoManager *undoManager = [m_webView undoManager];
-#if PLATFORM(IOS)
- // While we are undoing, we shouldn't be asked to register another Undo operation, we shouldn't even be touching the DOM. But
- // just in case this happens, return to avoid putting the undo manager into an inconsistent state. Same for being
- // asked to register a Redo operation in the midst of another Redo.
- if (([undoManager isUndoing] && !isRedo) || ([undoManager isRedoing] && isRedo))
- return;
-#endif
NSString *actionName = undoNameForEditAction(step->editingAction());
WebUndoStep *webEntry = [WebUndoStep stepWithUndoStep:step];
[undoManager registerUndoWithTarget:m_undoTarget.get() selector:(isRedo ? @selector(redoEditing:) : @selector(undoEditing:)) object:webEntry];
void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
Frame* frame = event->target()->toNode()->document().frame();
-#if !PLATFORM(IOS)
WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
if ([webHTMLView _interpretKeyEvent:event savingCommands:NO])
event->setDefaultHandled();
-#else
- WebHTMLView *webHTMLView = (WebHTMLView *)[[kit(frame) frameView] documentView];
- if ([webHTMLView _handleEditingKeyEvent:event])
- event->setDefaultHandled();
-#endif
}
void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
{
-#if !PLATFORM(IOS)
Frame* frame = event->target()->toNode()->document().frame();
WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
if ([webHTMLView _interpretKeyEvent:event savingCommands:YES])
event->setDefaultHandled();
-#else
- // iOS does not use input manager this way
-#endif
}
#define FormDelegateLog(ctrl) LOG(FormDelegate, "control=%@", ctrl)
if (!isHTMLInputElement(element))
return;
-#if !PLATFORM(IOS)
if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element)
return;
-#endif
DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
FormDelegateLog(inputElement);
CallFormDelegate(m_webView, @selector(textDidChangeInTextArea:inFrame:), textAreaElement, kit(element->document().frame()));
}
-#if PLATFORM(IOS)
-void WebEditorClient::suppressSelectionNotifications()
-{
- m_selectionNotificationSuppressions++;
-}
-
-void WebEditorClient::restoreSelectionNotifications()
-{
- --m_selectionNotificationSuppressions;
- if (m_selectionNotificationSuppressions < 0)
- m_selectionNotificationSuppressions = 0;
-}
-
-void WebEditorClient::writeDataToPasteboard(NSDictionary* representation)
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(writeDataToPasteboard:)])
- [[m_webView _UIKitDelegateForwarder] writeDataToPasteboard:representation];
-}
-
-NSArray* WebEditorClient::supportedPasteboardTypesForCurrentSelection()
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(supportedPasteboardTypesForCurrentSelection)])
- return [[m_webView _UIKitDelegateForwarder] supportedPasteboardTypesForCurrentSelection];
-
- return nil;
-}
-
-NSArray* WebEditorClient::readDataFromPasteboard(NSString* type, int index)
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(readDataFromPasteboard:withIndex:)])
- return [[m_webView _UIKitDelegateForwarder] readDataFromPasteboard:type withIndex:index];
-
- return nil;
-}
-
-bool WebEditorClient::hasRichlyEditableSelection()
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(hasRichlyEditableSelection)])
- return [[m_webView _UIKitDelegateForwarder] hasRichlyEditableSelection];
-
- return false;
-}
-
-int WebEditorClient::getPasteboardItemsCount()
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(getPasteboardItemsCount)])
- return [[m_webView _UIKitDelegateForwarder] getPasteboardItemsCount];
-
- return 0;
-}
-
-WebCore::DocumentFragment* WebEditorClient::documentFragmentFromDelegate(int index)
-{
- if ([[m_webView _editingDelegateForwarder] respondsToSelector:@selector(documentFragmentForPasteboardItemAtIndex:)]) {
- DOMDocumentFragment *fragmentFromDelegate = [[m_webView _editingDelegateForwarder] documentFragmentForPasteboardItemAtIndex:index];
- if (fragmentFromDelegate)
- return core(fragmentFromDelegate);
- }
-
- return 0;
-}
-
-bool WebEditorClient::performsTwoStepPaste(WebCore::DocumentFragment* fragment)
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(performsTwoStepPaste:)])
- return [[m_webView _UIKitDelegateForwarder] performsTwoStepPaste:kit(fragment)];
-
- return false;
-}
-
-int WebEditorClient::pasteboardChangeCount()
-{
- if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(getPasteboardChangeCount)])
- return [[m_webView _UIKitDelegateForwarder] getPasteboardChangeCount];
-
- return 0;
-}
-
-void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
-{
- ASSERT(checkingTypes & NSTextCheckingTypeSpelling);
- NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO];
- NSArray *incomingResults = [[m_webView _UIKitDelegateForwarder] checkSpellingOfString:textString];
- [textString release];
- for (NSValue *incomingResult in incomingResults) {
- NSRange resultRange = [incomingResult rangeValue];
- ASSERT(resultRange.location != NSNotFound && resultRange.length > 0);
- TextCheckingResult result;
- result.type = TextCheckingTypeSpelling;
- result.location = resultRange.location;
- result.length = resultRange.length;
- results.append(result);
- }
-}
-#endif // PLATFORM(IOS)
-
-#if !PLATFORM(IOS)
bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const
{
// This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions.
guesses.append(string);
}
}
-#endif // !PLATFORM(IOS)
void WebEditorClient::willSetInputMethodState()
{
{
}
-#if !PLATFORM(IOS)
@interface WebEditorSpellCheckResponder : NSObject
{
WebEditorClient* _client;
m_textCheckingRequest->didSucceed(core(results, m_textCheckingRequest->data().mask()));
m_textCheckingRequest.clear();
}
-#endif
void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request)
{
-#if !PLATFORM(IOS)
ASSERT(!m_textCheckingRequest);
m_textCheckingRequest = request;
target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease]
argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
}];
-#endif
}
virtual void makeRepresentation(WebCore::DocumentLoader*) OVERRIDE;
virtual bool hasHTMLView() const OVERRIDE;
virtual void forceLayout() OVERRIDE;
-#if PLATFORM(IOS)
- virtual void forceLayoutWithoutRecalculatingStyles() OVERRIDE;
-#endif
virtual void forceLayoutForNonHTML() OVERRIDE;
virtual void setCopiesOnScroll() OVERRIDE;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&) OVERRIDE;
#endif
-
-#if PLATFORM(IOS)
- virtual RetainPtr<CFDictionaryRef> connectionProperties(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
-#endif
-
virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) OVERRIDE;
virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) OVERRIDE;
virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) OVERRIDE;
virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) OVERRIDE;
-#if !PLATFORM(IOS)
virtual void willChangeEstimatedProgress() OVERRIDE;
virtual void didChangeEstimatedProgress() OVERRIDE;
-#endif
virtual void postProgressStartedNotification() OVERRIDE;
virtual void postProgressEstimateChangedNotification() OVERRIDE;
-#if !PLATFORM(IOS)
virtual void postProgressFinishedNotification() OVERRIDE;
-#else
- virtual void postProgressFinishedNotification() OVERRIDE { }
-#endif
virtual void setMainFrameDocumentReady(bool) OVERRIDE;
virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*) OVERRIDE;
virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) OVERRIDE;
-#if PLATFORM(IOS)
- virtual void didRestoreFrameHierarchyForCachedFrame() OVERRIDE;
-#endif
virtual void transitionToCommittedForNewPage() OVERRIDE;
virtual void didSaveToPageCache() OVERRIDE;
virtual void registerForIconNotification(bool listen) OVERRIDE;
-#if PLATFORM(IOS)
- virtual bool shouldLoadMediaElementURL(const WebCore::URL&) const OVERRIDE;
-#endif
-
#if PLATFORM(MAC)
virtual RemoteAXObjectRef accessibilityRemoteObject() OVERRIDE { return 0; }
#endif
#import "WebHostedNetscapePluginView.h"
#endif
-#if PLATFORM(IOS)
-#import <WebCore/HTMLPlugInImageElement.h>
-#import <WebCore/WAKClipView.h>
-#import <WebCore/WAKScrollView.h>
-#import <WebCore/WAKViewPrivate.h>
-#import <WebCore/WAKWindow.h>
-#import <WebCore/WebCoreThreadMessage.h>
-#import "WebKitVersionChecks.h"
-#import "WebMailDelegate.h"
-#import "WebUIKitDelegate.h"
-#endif
-
using namespace WebCore;
using namespace HTMLNames;
-#if PLATFORM(IOS)
-@interface WebHTMLView (Init)
-- (id)initWithFrame:(CGRect)frame;
-@end
-#endif
-
// For backwards compatibility with older WebKit plug-ins.
NSString *WebPluginBaseURLKey = @"WebPluginBaseURL";
NSString *WebPluginAttributesKey = @"WebPluginAttributes";
return loader ? static_cast<WebDocumentLoaderMac*>(loader)->dataSource() : nil;
}
-#if !PLATFORM(IOS)
// Quirk for the Apple Dictionary application.
//
// If a top level frame has a <script> element in its <head> for a script named MainPageJavaScript.js,
}
}
}
-#endif
static inline void applyAppleDictionaryApplicationQuirk(WebFrameLoaderClient* client, const ResourceRequest& request)
{
-#if !PLATFORM(IOS)
// Use a one-time-initialized global variable so we can quickly determine there's nothing to do in
// all applications other than Apple Dictionary.
static bool isAppleDictionary = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Dictionary"];
if (isAppleDictionary)
applyAppleDictionaryApplicationQuirkNonInlinePart(client, request);
-#endif
}
WebFrameLoaderClient::WebFrameLoaderClient(WebFrame *webFrame)
void WebFrameLoaderClient::forceLayout()
{
NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
-#if PLATFORM(IOS)
- // This gets called to lay out a page restored from the page cache.
- // To work around timing problems with UIKit, restore fixed
- // layout settings here.
- WebView* webView = getWebView(m_webFrame.get());
- bool isMainFrame = [webView mainFrame] == m_webFrame.get();
- Frame* coreFrame = core(m_webFrame.get());
- if (isMainFrame && coreFrame->view()) {
- IntSize newSize([webView _fixedLayoutSize]);
- coreFrame->view()->setFixedLayoutSize(newSize);
- coreFrame->view()->setUseFixedLayout(!newSize.isEmpty());
- }
-#endif
- [view setNeedsLayout:YES];
- [view layout];
-}
-
-#if PLATFORM(IOS)
-void WebFrameLoaderClient::forceLayoutWithoutRecalculatingStyles()
-{
- NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView];
- // This gets called to lay out a page restored from the page cache.
- // To work around timing problems with UIKit, restore fixed
- // layout settings here.
- WebView* webView = getWebView(m_webFrame.get());
- bool isMainFrame = [webView mainFrame] == m_webFrame.get();
- Frame* coreFrame = core(m_webFrame.get());
- if (isMainFrame && coreFrame->view()) {
- IntSize newSize([webView _fixedLayoutSize]);
- coreFrame->view()->setFixedLayoutSize(newSize);
- coreFrame->view()->setUseFixedLayout(!newSize.isEmpty());
- }
[view setNeedsLayout:YES];
[view layout];
}
-#endif
void WebFrameLoaderClient::forceLayoutForNonHTML()
{
{
//remove any NetScape plugins that are children of this frame because they are about to be detached
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
[webView removePluginInstanceViewsFor:(m_webFrame.get())];
-#endif
[m_webFrame->_private->webFrameView _setWebFrame:nil]; // needed for now to be compatible w/ old behavior
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadDidLoadResourceFromMemoryCacheFunc) {
- CallResourceLoadDelegateInWebThread(implementations->webThreadDidLoadResourceFromMemoryCacheFunc, webView, @selector(webThreadWebView:didLoadResourceFromMemoryCache:response:length:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), response.nsURLResponse(), length, dataSource(loader));
- return true;
- }
-#endif
if (!implementations->didLoadResourceFromMemoryCacheFunc)
return false;
id object = nil;
BOOL shouldRelease = NO;
-#if PLATFORM(IOS)
- if (implementations->webThreadIdentifierForRequestFunc) {
- object = CallResourceLoadDelegateInWebThread(implementations->webThreadIdentifierForRequestFunc, webView, @selector(webThreadWebView:identifierForInitialRequest:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), dataSource(loader));
- } else
-#endif
if (implementations->identifierForRequestFunc)
object = CallResourceLoadDelegate(implementations->identifierForRequestFunc, webView, @selector(webView:identifierForInitialRequest:fromDataSource:), request.nsURLRequest(UpdateHTTPBody), dataSource(loader));
else {
NSURLRequest *currentURLRequest = request.nsURLRequest(UpdateHTTPBody);
NSURLRequest *newURLRequest = currentURLRequest;
-#if PLATFORM(IOS)
- bool isMainResourceRequest = request.isMainResourceRequest();
- if (implementations->webThreadWillSendRequestFunc) {
- newURLRequest = (NSURLRequest *)CallResourceLoadDelegateInWebThread(implementations->webThreadWillSendRequestFunc, webView, @selector(webThreadWebView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
- } else
-#endif
if (implementations->willSendRequestFunc)
newURLRequest = (NSURLRequest *)CallResourceLoadDelegate(implementations->willSendRequestFunc, webView, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
if (newURLRequest != currentURLRequest)
request = newURLRequest;
-#if PLATFORM(IOS)
- request.setMainResourceRequest(isMainResourceRequest);
-#endif
}
bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, unsigned long identifier)
}
}
-#if !PLATFORM(IOS)
NSWindow *window = [webView hostWindow] ? [webView hostWindow] : [webView window];
[[WebPanelAuthenticationHandler sharedHandler] startAuthentication:webChallenge window:window];
-#endif
}
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
}
// If our resource load delegate doesn't handle the question, then only send authentication
- // challenges for pre-iOS-3.0, pre-10.6 protection spaces. This is the same as the default implementation
+ // challenges for pre-10.6 protection spaces. This is the same as the default implementation
// in CFNetwork.
return (protectionSpace.authenticationScheme() < ProtectionSpaceAuthenticationSchemeClientCertificateRequested);
}
#endif
-#if PLATFORM(IOS)
-RetainPtr<CFDictionaryRef> WebFrameLoaderClient::connectionProperties(DocumentLoader* loader, unsigned long identifier)
-{
- WebView *webView = getWebView(m_webFrame.get());
- id resource = [webView _objectForIdentifier:identifier];
- if (!resource)
- return nullptr;
-
- WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
- if (implementations->connectionPropertiesFunc)
- return (CFDictionaryRef)CallResourceLoadDelegate(implementations->connectionPropertiesFunc, webView, @selector(webView:connectionPropertiesForResource:dataSource:), resource, dataSource(loader));
-
- return nullptr;
-}
-#endif
-
bool WebFrameLoaderClient::shouldPaintBrokenImage(const URL& imageURL) const
{
WebView *webView = getWebView(m_webFrame.get());
}
}
-#if !PLATFORM(IOS)
[(WebPanelAuthenticationHandler *)[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:webChallenge];
-#endif
}
void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response)
{
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-
-#if PLATFORM(IOS)
- if (implementations->webThreadDidReceiveResponseFunc) {
- if (id resource = [webView _objectForIdentifier:identifier])
- CallResourceLoadDelegateInWebThread(implementations->webThreadDidReceiveResponseFunc, webView, @selector(webThreadWebView:resource:didReceiveResponse:fromDataSource:), resource, response.nsURLResponse(), dataSource(loader));
-
- } else
-#endif
if (implementations->didReceiveResponseFunc) {
if (id resource = [webView _objectForIdentifier:identifier])
CallResourceLoadDelegate(implementations->didReceiveResponseFunc, webView, @selector(webView:resource:didReceiveResponse:fromDataSource:), resource, response.nsURLResponse(), dataSource(loader));
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadWillCacheResponseFunc) {
- if (id resource = [webView _objectForIdentifier:identifier])
- return CallResourceLoadDelegateInWebThread(implementations->webThreadWillCacheResponseFunc, webView, @selector(webThreadWebView:resource:willCacheResponse:fromDataSource:), resource, response, dataSource(loader));
-
- } else
-#endif
if (implementations->willCacheResponseFunc) {
if (id resource = [webView _objectForIdentifier:identifier])
return CallResourceLoadDelegate(implementations->willCacheResponseFunc, webView, @selector(webView:resource:willCacheResponse:fromDataSource:), resource, response, dataSource(loader));
{
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadDidReceiveContentLengthFunc) {
- if (id resource = [webView _objectForIdentifier:identifier])
- CallResourceLoadDelegateInWebThread(implementations->webThreadDidReceiveContentLengthFunc, webView, @selector(webThreadWebView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader));
- } else
-#endif
if (implementations->didReceiveContentLengthFunc) {
if (id resource = [webView _objectForIdentifier:identifier])
CallResourceLoadDelegate(implementations->didReceiveContentLengthFunc, webView, @selector(webView:resource:didReceiveContentLength:fromDataSource:), resource, (NSInteger)dataLength, dataSource(loader));
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadDidFinishLoadingFromDataSourceFunc) {
- if (id resource = [webView _objectForIdentifier:identifier])
- CallResourceLoadDelegateInWebThread(implementations->webThreadDidFinishLoadingFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFinishLoadingFromDataSource:), resource, dataSource(loader));
- } else
-#endif
-
if (implementations->didFinishLoadingFromDataSourceFunc) {
if (id resource = [webView _objectForIdentifier:identifier])
CallResourceLoadDelegate(implementations->didFinishLoadingFromDataSourceFunc, webView, @selector(webView:resource:didFinishLoadingFromDataSource:), resource, dataSource(loader));
WebView *webView = getWebView(m_webFrame.get());
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadDidFailLoadingWithErrorFromDataSourceFunc) {
- if (id resource = [webView _objectForIdentifier:identifier])
- CallResourceLoadDelegateInWebThread(implementations->webThreadDidFailLoadingWithErrorFromDataSourceFunc, webView, @selector(webThreadWebView:resource:didFailLoadingWithError:fromDataSource:), resource, (NSError *)error, dataSource(loader));
- } else
-#endif
if (implementations->didFailLoadingWithErrorFromDataSourceFunc) {
if (id resource = [webView _objectForIdentifier:identifier])
CallResourceLoadDelegate(implementations->didFailLoadingWithErrorFromDataSourceFunc, webView, @selector(webView:resource:didFailLoadingWithError:fromDataSource:), resource, (NSError *)error, dataSource(loader));
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didChangeLocationWithinPageForFrameFunc)
CallFrameLoadDelegate(implementations->didChangeLocationWithinPageForFrameFunc, webView, @selector(webView:didChangeLocationWithinPageForFrame:), m_webFrame.get());
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView didChangeLocationWithinPageForFrame:m_webFrame.get()];
-#endif
}
void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->willCloseFrameFunc)
CallFrameLoadDelegate(implementations->willCloseFrameFunc, webView, @selector(webView:willCloseFrame:), m_webFrame.get());
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView willCloseFrame:m_webFrame.get()];
-#endif
}
void WebFrameLoaderClient::dispatchDidReceiveIcon()
m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader().provisionalDocumentLoader()->url().string();
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
[webView _didStartProvisionalLoadForFrame:m_webFrame.get()];
-#endif
-
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView didStartProvisionalLoadForFrame:m_webFrame.get()];
-#endif
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didStartProvisionalLoadForFrameFunc)
m_webFrame->_private->url = m_webFrame->_private->provisionalURL;
m_webFrame->_private->provisionalURL = nullptr;
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView didCommitLoadForFrame:m_webFrame.get()];
-#endif
-
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didCommitLoadForFrameFunc)
CallFrameLoadDelegate(implementations->didCommitLoadForFrameFunc, webView, @selector(webView:didCommitLoadForFrame:), m_webFrame.get());
m_webFrame->_private->provisionalURL = nullptr;
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
[webView _didFailProvisionalLoadWithError:error forFrame:m_webFrame.get()];
-#endif
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didFailProvisionalLoadWithErrorForFrameFunc)
ASSERT(!m_webFrame->_private->provisionalURL);
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
[webView _didFailLoadWithError:error forFrame:m_webFrame.get()];
-#endif
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didFailLoadWithErrorForFrameFunc)
CallFrameLoadDelegate(implementations->didFailLoadWithErrorForFrameFunc, webView, @selector(webView:didFailLoadWithError:forFrame:), (NSError *)error, m_webFrame.get());
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView didFailLoadWithError:((NSError *)error) forFrame:m_webFrame.get()];
-#endif
[m_webFrame->_private->internalLoadDelegate webFrame:m_webFrame.get() didFinishLoadWithError:error];
}
void WebFrameLoaderClient::dispatchDidFinishDocumentLoad()
{
WebView *webView = getWebView(m_webFrame.get());
-
-#if PLATFORM(IOS)
- id webThreadDel = [webView _webMailDelegate];
- if ([webThreadDel respondsToSelector:@selector(_webthread_webView:didFinishDocumentLoadForFrame:)]) {
- [webThreadDel _webthread_webView:webView didFinishDocumentLoadForFrame:m_webFrame.get()];
- }
-#endif
-
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didFinishDocumentLoadForFrameFunc)
CallFrameLoadDelegate(implementations->didFinishDocumentLoadForFrameFunc, webView, @selector(webView:didFinishDocumentLoadForFrame:), m_webFrame.get());
ASSERT(!m_webFrame->_private->provisionalURL);
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
[webView _didFinishLoadForFrame:m_webFrame.get()];
-#else
- [[webView _UIKitDelegateForwarder] webView:webView didFinishLoadForFrame:m_webFrame.get()];
-
- id webThreadDel = [webView _webMailDelegate];
- if ([webThreadDel respondsToSelector:@selector(_webthread_webView:didFinishLoadForFrame:)]) {
- [webThreadDel _webthread_webView:webView didFinishLoadForFrame:m_webFrame.get()];
- }
-#endif
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didFinishLoadForFrameFunc)
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
-#if PLATFORM(IOS)
- if (implementations->webThreadDidLayoutFunc)
- CallFrameLoadDelegateInWebThread(implementations->webThreadDidLayoutFunc, webView, @selector(webThreadWebView:didLayout:), kitLayoutMilestones(milestones));
-#else
if (implementations->didLayoutFunc)
CallFrameLoadDelegate(implementations->didLayoutFunc, webView, @selector(webView:didLayout:), kitLayoutMilestones(milestones));
-#endif
if (milestones & DidFirstLayout) {
// FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the
if (implementations->didFirstLayoutInFrameFunc)
CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get());
-#if PLATFORM(IOS)
- [[webView _UIKitDelegateForwarder] webView:webView didFirstLayoutInFrame:m_webFrame.get()];
-#endif
-
// See WebFrameLoaderClient::provisionalLoadStarted.
WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
if ([getWebView(m_webFrame.get()) drawsBackground])
[scrollView setDrawsBackground:YES];
-#if !PLATFORM(IOS)
[scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic];
[scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic];
-#endif
}
if (milestones & DidFirstVisuallyNonEmptyLayout) {
// double duty with the new didLayout API.
if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc)
CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get());
-#if PLATFORM(IOS)
- if ([webView mainFrame] == m_webFrame.get())
- [[webView _UIKitDelegateForwarder] webView:webView didFirstVisuallyNonEmptyLayoutInFrame:m_webFrame.get()];
-#endif
}
}
[dataSource(loader) _setMainDocumentError:error];
}
-#if !PLATFORM(IOS)
void WebFrameLoaderClient::willChangeEstimatedProgress()
{
[getWebView(m_webFrame.get()) _willChangeValueForKey:_WebEstimatedProgressKey];
{
[getWebView(m_webFrame.get()) _didChangeValueForKey:_WebEstimatedProgressKey];
}
-#endif
void WebFrameLoaderClient::postProgressStartedNotification()
{
-#if !PLATFORM(IOS)
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressStartedNotification object:getWebView(m_webFrame.get())];
-#else
- WebThreadPostNotification(WebViewProgressStartedNotification, getWebView(m_webFrame.get()), nil);
-#endif
}
void WebFrameLoaderClient::postProgressEstimateChangedNotification()
{
-#if !PLATFORM(IOS)
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressEstimateChangedNotification object:getWebView(m_webFrame.get())];
-#else
- WebView *webView = getWebView(m_webFrame.get());
- NSNumber *progress = [NSNumber numberWithFloat:[webView estimatedProgress]];
- CGColorRef bodyBackgroundColor = [[webView mainFrame] _bodyBackgroundColor];
-
- // Use a CFDictionary so we can add the CGColorRef without compile errors. And then thanks to
- // toll-free bridging we can pass the CFDictionary as an NSDictionary to postNotification.
- CFMutableDictionaryRef userInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(userInfo, WebViewProgressEstimatedProgressKey, progress);
- if (bodyBackgroundColor)
- CFDictionaryAddValue(userInfo, WebViewProgressBackgroundColorKey, bodyBackgroundColor);
-
- WebThreadPostNotification(WebViewProgressEstimateChangedNotification, webView, (NSDictionary *) userInfo);
- CFRelease(userInfo);
-#endif
}
-#if !PLATFORM(IOS)
void WebFrameLoaderClient::postProgressFinishedNotification()
{
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewProgressFinishedNotification object:getWebView(m_webFrame.get())];
}
-#endif
void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready)
{
void WebFrameLoaderClient::willChangeTitle(DocumentLoader* loader)
{
-#if !PLATFORM(IOS)
// FIXME: Should do this only in main frame case, right?
[getWebView(m_webFrame.get()) _willChangeValueForKey:_WebMainFrameTitleKey];
-#endif
}
void WebFrameLoaderClient::didChangeTitle(DocumentLoader* loader)
{
-#if !PLATFORM(IOS)
// FIXME: Should do this only in main frame case, right?
[getWebView(m_webFrame.get()) _didChangeValueForKey:_WebMainFrameTitleKey];
-#endif
}
void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
{
WebView* view = getWebView(m_webFrame.get());
DocumentLoader* loader = core(m_webFrame.get())->loader().documentLoader();
-#if PLATFORM(IOS)
- if (loader->urlForHistory() == blankURL())
- return;
-#endif
if ([view historyDelegate]) {
WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
{
if (!item)
return;
-
-#if PLATFORM(IOS)
- // Let UIKit handle the scroll point for the main frame.
- WebFrame *webFrame = m_webFrame.get();
- WebView *webView = getWebView(webFrame);
- if (webFrame == [webView mainFrame]) {
- [[webView _UIKitDelegateForwarder] webView:webView saveStateToHistoryItem:kit(item) forFrame:webFrame];
- return;
- }
-#endif
NSView <WebDocumentView> *docView = [m_webFrame->_private->webFrameView documentView];
// so there *is* no scroll state to restore!
if (!currentItem)
return;
-
-#if PLATFORM(IOS)
- // Let UIKit handle the scroll point for the main frame.
- WebFrame *webFrame = m_webFrame.get();
- WebView *webView = getWebView(webFrame);
- if (webFrame == [webView mainFrame]) {
- [[webView _UIKitDelegateForwarder] webView:webView restoreStateFromHistoryItem:kit(currentItem) forFrame:webFrame force:NO];
- return;
- }
-#endif
NSView <WebDocumentView> *docView = [m_webFrame->_private->webFrameView documentView];
if ([docView conformsToProtocol:@protocol(_WebDocumentViewState)]) {
WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView];
[scrollView setDrawsBackground:NO];
-#if !PLATFORM(IOS)
[scrollView setVerticalScrollElasticity:NSScrollElasticityNone];
[scrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
-#endif
}
void WebFrameLoaderClient::didFinishLoad()
return;
}
-#if !PLATFORM(IOS)
// Make sure that any work that is triggered by resigning first reponder can get done.
// The main example where this came up is the textDidEndEditing that is sent to the
// FormsDelegate (3223413). We need to do this before _detachChildren, since that will
NSResponder *firstResp = [window firstResponder];
if ([firstResp isKindOfClass:[NSView class]] && [(NSView *)firstResp isDescendantOf:frameView])
[window endEditingFor:firstResp];
-#endif
}
PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
nsURL = [nsURL _webkit_canonicalize];
if(!nsURL)
return;
-#if PLATFORM(IOS)
- if ([[nsURL absoluteString] isEqualToString:@"about:blank"])
- return;
-#endif
NSString *titleNSString = title.string();
[[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
{
OwnPtr<WebCachedFramePlatformData> webPlatformData = adoptPtr(new WebCachedFramePlatformData([m_webFrame->_private->webFrameView documentView]));
cachedFrame->setCachedFramePlatformData(webPlatformData.release());
-
-#if PLATFORM(IOS)
- // At this point we know this frame is going to be cached. Stop all plugins.
- WebView *webView = getWebView(m_webFrame.get());
- [webView _stopAllPlugInsForPageCache];
-#endif
}
void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cachedFrame)
ASSERT(cachedFrame->documentLoader());
[cachedView setDataSource:dataSource(cachedFrame->documentLoader())];
-#if !PLATFORM(IOS)
// clean up webkit plugin instances before WebHTMLView gets freed.
WebView *webView = getWebView(m_webFrame.get());
[webView removePluginInstanceViewsFor:(m_webFrame.get())];
-#endif
[m_webFrame->_private->webFrameView _setDocumentView:cachedView];
}
-#if PLATFORM(IOS)
-void WebFrameLoaderClient::didRestoreFrameHierarchyForCachedFrame()
-{
- // When entering the PageCache the Document is detached and the plugin view may
- // have cleaned itself up (removing its webview and layer references). Now, when
- // restoring the page we want to recreate whatever is necessary.
- WebView *webView = getWebView(m_webFrame.get());
- [webView _restorePlugInsFromCache];
-}
-#endif
-
void WebFrameLoaderClient::transitionToCommittedForNewPage()
{
WebView *webView = getWebView(m_webFrame.get());
WebDataSource *dataSource = [m_webFrame.get() _dataSource];
-#if PLATFORM(IOS)
- bool willProduceHTMLView;
- // Fast path that skips initialization of objc class objects.
- if ([dataSource _documentLoader]->responseMIMEType() == "text/html")
- willProduceHTMLView = true;
- else
- willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
-#else
- // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
-#endif
bool canSkipCreation = core(m_webFrame.get())->loader().stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
if (canSkipCreation) {
[[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
return;
}
-#if !PLATFORM(IOS)
// Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
if (!willProduceHTMLView)
[[m_webFrame->_private->webFrameView _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
[webView removePluginInstanceViewsFor:(m_webFrame.get())];
NSView <WebDocumentView> *documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
-#else
- NSView <WebDocumentView> *documentView = nil;
-
- // Fast path that skips initialization of objc class objects.
- if (willProduceHTMLView) {
- documentView = [[WebHTMLView alloc] initWithFrame:[m_webFrame->_private->webFrameView bounds]];
- [m_webFrame->_private->webFrameView _setDocumentView:documentView];
- [documentView release];
- } else
- documentView = [m_webFrame->_private->webFrameView _makeDocumentViewForDataSource:dataSource];
-#endif
if (!documentView)
return;
[m_webFrame.get() _updateBackgroundAndUpdatesWhileOffscreen];
[m_webFrame->_private->webFrameView _install];
- if (isMainFrame) {
-#if PLATFORM(IOS)
- coreView->setDelegatesScrolling(true);
-#endif
+ if (isMainFrame)
coreView->setParentVisible(true);
- }
// Call setDataSource on the document view after it has been placed in the view hierarchy.
// This what we for the top-level view, so should do this for views in subframes as well.
void WebFrameLoaderClient::didRestoreFromPageCache()
{
-#if PLATFORM(IOS)
- WebView *webView = getWebView(m_webFrame.get());
- if ([webView mainFrame] == m_webFrame.get())
- [[webView _UIKitDelegateForwarder] webViewDidRestoreFromPageCache:webView];
-#endif
}
void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool)
{
unsigned modifierFlags = 0;
const Event* event = action.event();
-#if !PLATFORM(IOS)
if (const UIEventWithKeyState* keyStateEvent = findEventWithKeyState(const_cast<Event*>(event))) {
if (keyStateEvent->ctrlKey())
modifierFlags |= NSControlKeyMask;
if (keyStateEvent->metaKey())
modifierFlags |= NSCommandKeyMask;
}
-#else
- // No modifier flags on iOS right now
- modifierFlags = 0;
-#endif
NSURL *originalURL = action.url();
}
};
-#if PLATFORM(IOS)
-@interface WAKView (UIKitSecretsWebKitKnowsAboutSeeUIWebPlugInView)
-#if USE(ACCELERATED_COMPOSITING)
-- (PlatformLayer *)pluginLayer;
-- (BOOL)willProvidePluginLayer;
-- (void)attachPluginLayer;
-- (void)detachPluginLayer;
-#endif
-@end
-
-class PluginWidgetIOS : public PluginWidget {
-public:
- PluginWidgetIOS(WAKView *view)
- : PluginWidget(view)
- {
- }
-
-#if USE(ACCELERATED_COMPOSITING)
- virtual PlatformLayer* platformLayer() const
- {
- if (![platformWidget() respondsToSelector:@selector(pluginLayer)])
- return nullptr;
-
- return [platformWidget() pluginLayer];
- }
-
- virtual bool willProvidePluginLayer() const
- {
- return [platformWidget() respondsToSelector:@selector(willProvidePluginLayer)]
- && [platformWidget() willProvidePluginLayer];
- }
-
- virtual void attachPluginLayer()
- {
- if ([platformWidget() respondsToSelector:@selector(attachPluginLayer)])
- [platformWidget() attachPluginLayer];
- }
-
- virtual void detachPluginLayer()
- {
- if ([platformWidget() respondsToSelector:@selector(detachPluginLayer)])
- [platformWidget() detachPluginLayer];
- }
-#endif
-};
-#endif // PLATFORM(IOS)
-
#if ENABLE(NETSCAPE_PLUGIN_API)
class NetscapePluginWidget : public PluginWidget {
int errorCode = 0;
WebView *webView = getWebView(m_webFrame.get());
-#if !PLATFORM(IOS)
SEL selector = @selector(webView:plugInViewWithArguments:);
-#endif
Document* document = core(m_webFrame.get())->document();
NSURL *baseURL = document->baseURL();
// embeds its plug-in. This site-specific hack works around the issue by
// converting the parameter names to lowercase before passing them to the
// plug-in.
-#if !PLATFORM(IOS)
Frame* frame = core(m_webFrame.get());
-#endif
NSMutableArray *attributeKeys = kit(paramNames);
-#if !PLATFORM(IOS)
if (frame && frame->settings().needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) {
for (NSUInteger i = 0; i < [attributeKeys count]; ++i)
[attributeKeys replaceObjectAtIndex:i withObject:[[attributeKeys objectAtIndex:i] lowercaseString]];
if (view)
return adoptRef(new PluginWidget(view));
}
-#endif
NSString *MIMEType;
WebBasePluginPackage *pluginPackage;
}
NSString *extension = [[pluginURL path] pathExtension];
-
-#if PLATFORM(IOS)
- if (!pluginPackage && [extension length]) {
-#else
if (!pluginPackage && [extension length] && ![MIMEType length]) {
-#endif
pluginPackage = [webView _pluginForExtension:extension];
if (pluginPackage) {
NSString *newMIMEType = [pluginPackage MIMETypeForExtension:extension];
[error release];
}
-#if PLATFORM(IOS)
- // See if this is a YouTube Flash plug-in
- if ([MIMEType isEqualToString:@"application/x-shockwave-flash"]) {
- NSDictionary *attributes = [NSDictionary dictionaryWithObjects:kit(paramValues) forKeys:kit(paramNames)];
- NSString *srcString = [attributes objectForKey:@"src"];
- if (srcString) {
- NSURL *srcURL = [NSURL URLWithString:srcString];
- NSURL *youtubeURL = [srcURL _webkit_youTubeURL];
- if (srcURL && youtubeURL) {
- // Transform the youtubeURL (youtube:VideoID) to iframe embed url which has the format: http://www.youtube.com/embed/VideoID
- NSString *srcPath = [srcURL path];
- NSString *videoID = [[youtubeURL absoluteString] substringFromIndex:[[youtubeURL scheme] length] + 1];
- NSRange rangeOfVideoIDInPath = [srcPath rangeOfString:videoID];
- NSString *srcURLPrefix = nil;
- if (rangeOfVideoIDInPath.location == NSNotFound && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_YOUTUBE_EMBED_IFRAME_TRANSFORM)) {
- // If the videoID is not inside srcPath, the embed src url is in wrong format. We still want to support them for apps build against 5.1 and older.
- // For embed src like http://www.youtube.com/watch?v=VideoID, we make srcURLPrefix "http://www.youtube.com".
- // See: <rdar://problem/11517502> youtube videos don't work in FAO Forestry
- srcURLPrefix = [srcString substringToIndex:[srcString rangeOfString:srcPath].location];
- } else {
- ASSERT(rangeOfVideoIDInPath.length);
-
- // From the original URL, we need to get the part before /path/VideoId.
- NSRange rangeOfPathBeforeVideoID = [srcString rangeOfString:[srcPath substringToIndex:rangeOfVideoIDInPath.location]];
- ASSERT(rangeOfPathBeforeVideoID.length);
-
- srcURLPrefix = [srcString substringToIndex:rangeOfPathBeforeVideoID.location];
- }
- NSString *query = [srcURL query];
- // By default, the iframe will display information like the video title and uploader on top of the video. Don't display
- // them if the embeding html doesn't specify it.
- if (query && [query length] && [query rangeOfString:@"showinfo"].location == NSNotFound)
- query = [query stringByAppendingFormat:@"&showinfo=0"];
- else
- query = @"showinfo=0";
-
- // Append the query string if it is valid. Some sites apparently forget to add "?" for the query string, in that case,
- // we will discard the parameters in the url.
- // See: <rdar://problem/11535155> [Bincompat] Regression: SC2Casts app: Videos don't play in SC2Casts
- NSString *embedSrc = query ? [srcURLPrefix stringByAppendingFormat:@"/embed/%@?%@", videoID, query] : [srcURLPrefix stringByAppendingFormat:@"/embed/%@", videoID];
-
- if (element->hasTagName(HTMLNames::embedTag) || element->hasTagName(HTMLNames::objectTag)) {
- // Create a shadow subtree for the plugin element, the iframe player is injected in the shadow tree.
- HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);
- pluginElement->createShadowIFrameSubtree(embedSrc);
- return nullptr;
- }
-
- // If this is a YouTube Flash plug-in. We don't have Flash. Create an instance of Apple's special YouTube plug-in instead
- pluginPackage = [webView _pluginForMIMEType:@"application/x-apple-fake-youtube-plugin"];
- if (pluginPackage) {
- view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), loadManually);
- if (view)
- return adoptRef(new PluginWidgetIOS(view));
- }
- }
- }
- }
-#endif // PLATFORM(IOS)
-
return 0;
}
ASSERT(view);
-#if PLATFORM(IOS)
- return adoptRef(new PluginWidgetIOS(view));
-#else
return adoptRef(new PluginWidget(view));
-#endif
END_BLOCK_OBJC_EXCEPTIONS;
WebView *webView = getWebView(m_webFrame.get());
NSURL *URL = url;
-#if !PLATFORM(IOS)
SEL selector = @selector(webView:plugInViewWithArguments:);
if ([[webView UIDelegate] respondsToSelector:selector]) {
if (view)
return adoptRef(new PluginWidget(view));
}
-#endif
WebBasePluginPackage *pluginPackage = [webView _videoProxyPluginForMIMEType:mimeType];
Document* document = core(m_webFrame.get())->document();
}
ASSERT(view);
-#if PLATFORM(IOS)
- return adoptRef(new PluginWidgetIOS(view));
-#else
return adoptRef(new PluginWidget(view));
-#endif
END_BLOCK_OBJC_EXCEPTIONS;
return WebFrameNetworkingContext::create(core(m_webFrame.get()));
}
-#if PLATFORM(IOS)
-bool WebFrameLoaderClient::shouldLoadMediaElementURL(const URL& url) const
-{
- WebView *webView = getWebView(m_webFrame.get());
-
- if (id policyDelegate = [webView policyDelegate]) {
- if ([policyDelegate respondsToSelector:@selector(webView:shouldLoadMediaURL:inFrame:)])
- return [policyDelegate webView:webView shouldLoadMediaURL:url inFrame:m_webFrame.get()];
- }
- return true;
-}
-#endif
-
@implementation WebFramePolicyListener
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
static void ensurePrivateBrowsingSession();
static void destroyPrivateBrowsingSession();
-#if PLATFORM(IOS)
- // FIXME: If MobileSafari ever switches to per-tab or non-shared private storage, then this can be removed.
- // <rdar://problem/10075665> Sub-TLF: Per-tab private browsing
- static void clearPrivateBrowsingSessionCookieStorage();
-#endif
-
private:
WebFrameNetworkingContext(WebCore::Frame* frame)
#include <WebCore/Settings.h>
#include <wtf/NeverDestroyed.h>
-#if PLATFORM(IOS)
-#import <CFNetwork/CFHTTPCookiesPriv.h>
-#import <WebCore/WebCoreThread.h>
-#import <WebKit/WebFrameLoadDelegate.h>
-#endif
-
using namespace WebCore;
static std::unique_ptr<NetworkStorageSession>& privateSession()
privateSession() = nullptr;
}
-#if PLATFORM(IOS)
-void WebFrameNetworkingContext::clearPrivateBrowsingSessionCookieStorage()
-{
- ASSERT(isMainThread());
- ASSERT(privateSession());
-
- CFHTTPCookieStorageDeleteAllCookies(privateSession()->cookieStorage().get());
-}
-#endif
-
bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
{
return frame() && frame()->settings().needsSiteSpecificQuirks();
virtual void geolocationDestroyed() OVERRIDE;
virtual void startUpdating() OVERRIDE;
virtual void stopUpdating() OVERRIDE;
-#if PLATFORM(IOS)
- // FIXME: unify this with Mac on OpenSource.
- virtual void setEnableHighAccuracy(bool) OVERRIDE;
-#else
virtual void setEnableHighAccuracy(bool) OVERRIDE { }
-#endif
virtual WebCore::GeolocationPosition* lastPosition() OVERRIDE;
#import <WebCore/Frame.h>
#import <WebCore/Geolocation.h>
-#if PLATFORM(IOS)
-#import <WebCore/WAKResponder.h>
-#import <WebKit/WebCoreThreadRun.h>
-#endif
-
using namespace WebCore;
-#if !PLATFORM(IOS)
-@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
-{
- RefPtr<Geolocation> _geolocation;
-}
-- (id)initWithGeolocation:(Geolocation*)geolocation;
-@end
-#else
@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
{
RefPtr<Geolocation> _geolocation;
- RetainPtr<WebView *> _webView;
- RetainPtr<id<WebGeolocationProvider> > _geolocationProvider;
-}
-- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView provider:(id<WebGeolocationProvider>)provider;
-@end
-#endif
-
-#if PLATFORM(IOS)
-@interface WebGeolocationProviderInitializationListener : NSObject <WebGeolocationProviderInitializationListener> {
-@private
- RefPtr<Geolocation> m_geolocation;
}
- (id)initWithGeolocation:(Geolocation*)geolocation;
@end
-#endif
WebGeolocationClient::WebGeolocationClient(WebView *webView)
: m_webView(webView)
[[m_webView _geolocationProvider] unregisterWebView:m_webView];
}
-#if PLATFORM(IOS)
-void WebGeolocationClient::setEnableHighAccuracy(bool wantsHighAccuracy)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [[m_webView _geolocationProvider] setEnableHighAccuracy:wantsHighAccuracy];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-#endif
-
void WebGeolocationClient::requestPermission(Geolocation* geolocation)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return;
}
-#if !PLATFORM(IOS)
Frame *frame = geolocation->frame();
WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
WebGeolocationPolicyListener* listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:geolocation];
[webOrigin release];
[listener release];
-#else
- RetainPtr<WebGeolocationProviderInitializationListener> listener = adoptNS([[WebGeolocationProviderInitializationListener alloc] initWithGeolocation:geolocation]);
- [[m_webView _geolocationProvider] initializeGeolocationForWebView:m_webView listener:listener.get()];
-#endif
+
END_BLOCK_OBJC_EXCEPTIONS;
}
return core([[m_webView _geolocationProvider] lastPosition]);
}
-#if !PLATFORM(IOS)
@implementation WebGeolocationPolicyListener
- (id)initWithGeolocation:(Geolocation*)geolocation
@end
-#else
-@implementation WebGeolocationPolicyListener
-- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView provider:(id<WebGeolocationProvider>)provider
-{
- self = [super init];
- if (!self)
- return nil;
- _geolocation = geolocation;
- _webView = webView;
- _geolocationProvider = provider;
- return self;
-}
-
-- (void)allow
-{
- WebThreadRun(^{
- _geolocation->setIsAllowed(true);
- });
-}
-
-- (void)deny
-{
- WebThreadRun(^{
- _geolocation->setIsAllowed(false);
- [_geolocationProvider.get() cancelWarmUpForWebView:_webView.get()];
- });
-}
-
-- (void)denyOnlyThisRequest
-{
- WebThreadRun(^{
- // A soft deny does not prevent subsequent request from the Geolocation object.
- [self deny];
- _geolocation->resetAllGeolocationPermission();
- });
-}
-
-- (BOOL)shouldClearCache
-{
- // Theoretically, WebView could changes the WebPreferences after we get the pointer.
- // We lock to be on the safe side.
- WebThreadLock();
-
- return [[_webView.get() preferences] _alwaysRequestGeolocationPermission];
-}
-@end
-
-@implementation WebGeolocationProviderInitializationListener
-- (id)initWithGeolocation:(Geolocation*)geolocation
-{
- self = [super init];
- if (self)
- m_geolocation = geolocation;
- return self;
-}
-
-- (void)initializationAllowedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- Frame* frame = m_geolocation->frame();
- if (!frame) {
- [provider cancelWarmUpForWebView:webView];
- return;
- }
- WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
- WebGeolocationPolicyListener *listener = [[WebGeolocationPolicyListener alloc] initWithGeolocation:m_geolocation.get() forWebView:webView provider:provider];
- SEL selector = @selector(webView:decidePolicyForGeolocationRequestFromOrigin:frame:listener:);
- CallUIDelegate(webView, selector, webOrigin, kit(frame), listener);
- [webOrigin release];
- [listener release];
-
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-- (void)initializationDeniedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider
-{
- m_geolocation->setIsAllowed(false);
-}
-@end
-#endif // PLATFORM(IOS)
-
#endif // ENABLE(GEOLOCATION)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebJavaScriptTextInputPanel.h"
#import <wtf/Assertions.h>
}
@end
-
-#endif // !PLATFORM(IOS)
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <WebKit/WebKeyGenerator.h>
#import <WebKitSystemInterface.h>
}
@end
-
-#endif // !PLATFORM(IOS)
#endif
}
-#if PLATFORM(IOS)
-- (void)denyOnlyThisRequest
-{
- ASSERT_NOT_REACHED();
-}
-
-- (BOOL)shouldClearCache
-{
- ASSERT_NOT_REACHED();
- return NO;
-}
-#endif
-
@end
#endif
_chooser = 0;
}
-#if PLATFORM(IOS)
-- (void)chooseFilename:(NSString *)filename displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef
-{
- [self chooseFilenames:[NSArray arrayWithObject:filename] displayString:displayString iconImage:imageRef];
-}
-
-- (void)chooseFilenames:(NSArray *)filenames displayString:(NSString *)displayString iconImage:(CGImageRef)imageRef
-{
- ASSERT(_chooser);
- if (!_chooser)
- return;
-
- RefPtr<Icon> icon = Icon::createIconForImage(imageRef);
-
- NSUInteger count = [filenames count];
- Vector<String> names(count);
- for (NSUInteger i = 0; i < count; ++i)
- names[i] = [filenames objectAtIndex:i];
- _chooser->chooseMediaFiles(names, displayString, icon.get());
-
- // FIXME: we shouldn't be manually deref()'ing here.
- _chooser->deref();
- _chooser = nullptr;
-}
-#endif
-
@end
return reinterpret_cast<SecurityOrigin*>(_private)->databaseIdentifier();
}
-#if PLATFORM(IOS)
-- (NSString *)toString
-{
- return reinterpret_cast<SecurityOrigin*>(_private)->toString();
-}
-#endif
-
- (NSString *)stringValue
{
return reinterpret_cast<SecurityOrigin*>(_private)->toString();
if (didInit)
return;
-#if !PLATFORM(IOS)
INIT(AdvanceDefaultButtonPulseAnimation);
-#endif
INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
-#if !PLATFORM(IOS)
INIT(CGContextGetShouldSmoothFonts);
-#endif
INIT(CGPatternCreateWithImageAndTransform);
INIT(CGContextResetClip);
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
INIT(CGContextDrawsWithCorrectShadowOffsets);
#endif
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
INIT(CTFontTransformGlyphs);
#endif
INIT(CopyCFLocalizationPreferredName);
INIT(CopyNSURLResponseCertificateChain);
#endif
INIT(CreateCustomCFReadStream);
-#if !PLATFORM(IOS)
INIT(DrawCapsLockIndicator);
INIT(DrawBezeledTextArea);
INIT(DrawBezeledTextFieldCell);
INIT(GetFontInLanguageForCharacter);
INIT(GetFontInLanguageForRange);
INIT(GetGlyphTransformedAdvances);
-#endif
INIT(GetHTTPPipeliningPriority);
INIT(GetMIMETypeForExtension);
INIT(GetNSURLResponseLastModifiedDate);
-#if !PLATFORM(IOS)
INIT(SignedPublicKeyAndChallengeString);
INIT(GetPreferredExtensionForMIMEType);
INIT(GetWheelEventDeltas);
INIT(GetNSEventKeyChar);
#endif
INIT(HitTestMediaUIPart);
-#endif
INIT(InitializeMaximumHTTPConnectionCountPerHost);
-#if !PLATFORM(IOS)
INIT(MeasureMediaUIPart);
INIT(CreateMediaUIBackgroundView);
INIT(CreateMediaUIControl);
INIT(WindowSetAlpha);
INIT(WindowSetScaledFrame);
INIT(PopupMenu);
- INIT(SetCGFontRenderingMode);
-#endif
INIT(SetBaseCTM);
+ INIT(SetCGFontRenderingMode);
INIT(SetCONNECTProxyAuthorizationForStream);
INIT(SetCONNECTProxyForStream);
-#if !PLATFORM(IOS)
INIT(SetDragImage);
-#endif
INIT(SetHTTPPipeliningMaximumPriority);
INIT(SetHTTPPipeliningPriority);
INIT(SetHTTPPipeliningMinimumFastLanePriority);
INIT(SignalCFReadStreamEnd);
INIT(SignalCFReadStreamError);
INIT(SignalCFReadStreamHasBytes);
-#if ENABLE(VIDEO) && !PLATFORM(IOS)
INIT(QTIncludeOnlyModernMediaFileTypes);
INIT(QTMovieDataRate);
INIT(QTMovieDisableComponent);
INIT(QTGetSitesInMediaDownloadCache);
INIT(QTClearMediaDownloadCacheForSite);
INIT(QTClearMediaDownloadCache);
-#endif
-#if !PLATFORM(IOS)
INIT(GetGlyphsForCharacters);
-#endif
INIT(GetVerticalGlyphsForCharacters);
-#if PLATFORM(IOS)
- INIT(ExecutableWasLinkedOnOrAfterIOSVersion);
- INIT(GetDeviceClass);
- INIT(GetViewportScreenSize);
- INIT(GetScreenScaleFactor);
- INIT(IsGB18030ComplianceRequired);
-#endif
INIT(CreateCTLineWithUniCharProvider);
-#if !PLATFORM(IOS_SIMULATOR)
INIT(IOSurfaceContextCreate);
INIT(IOSurfaceContextCreateImage);
-#endif
INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
INIT(CTRunGetInitialAdvance);
-#if !PLATFORM(IOS)
INIT(RecommendedScrollerStyle);
INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
INIT(SetCrashReportApplicationSpecificInformation);
INIT(CopyDefaultSearchProviderDisplayName);
INIT(AVAssetResolvedURL);
INIT(Cursor);
-#endif
#if USE(CFNETWORK)
INIT(GetDefaultHTTPCookieStorage);
INIT(SetRequestStorageSession);
#endif
-#if !PLATFORM(IOS)
#if PLATFORM(MAC)
INIT(SpeechSynthesisGetVoiceIdentifiers);
INIT(SpeechSynthesisGetDefaultVoiceIdentifierForLocale);
INIT(AccessibilityHandleFocusChanged);
INIT(CreateAXUIElementRef);
INIT(UnregisterUniqueIdForElement);
-#endif
INIT(CreatePrivateStorageSession);
INIT(CopyRequestWithStorageSession);
INIT(CopyHTTPCookieStorage);
INIT(CopyCFURLResponseSuggestedFilename);
INIT(SetCFURLResponseMIMEType);
-#if !PLATFORM(IOS)
INIT(SetMetadataURL);
-#endif
#if PLATFORM(MAC)
// FIXME: We should stop using this file in Chromium.
INIT(DestroyRenderingResources);
-#if !PLATFORM(IOS)
INIT(CreateVMPressureDispatchOnMainQueue);
-#endif
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
INIT(CreateMemoryStatusPressureCriticalDispatchOnMainQueue);
#endif
-#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
INIT(ExecutableWasLinkedOnOrBeforeLion);
#endif
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <wtf/Platform.h>
-
#ifdef __cplusplus
#define NULL __null
#else
#endif
-#if !PLATFORM(IOS)
#import <ApplicationServices/ApplicationServices.h>
#import <Carbon/Carbon.h>
#endif
#define CGFLOAT_DEFINED 1
#endif
-#endif
#ifdef __OBJC__
-#if !PLATFORM(IOS)
#import <Cocoa/Cocoa.h>
-#else
-#import <Foundation/Foundation.h>
-#endif
#endif
#include <wtf/Platform.h>
+ (void)initialize
{
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import <AppKit/AppKit.h>
@interface WebClipView : NSClipView
- (NSRect)additionalClip;
@end
-
-#endif
#import <wtf/RetainPtr.h>
#import <wtf/RunLoop.h>
-#if PLATFORM(IOS)
-#import "WebPDFViewIOS.h"
-#endif
-
using namespace WebCore;
class WebDataSourcePrivate
: loader(loader)
, representationFinishedLoading(NO)
, includedInWebKitStatistics(NO)
-#if PLATFORM(IOS)
- , _dataSourceDelegate(nil)
-#endif
{
ASSERT(this->loader);
}
RetainPtr<id<WebDocumentRepresentation> > representation;
BOOL representationFinishedLoading;
BOOL includedInWebKitStatistics;
-#if PLATFORM(IOS)
- NSObject<WebDataSourcePrivateDelegate> *_dataSourceDelegate;
-#endif
};
static inline WebDataSourcePrivate* toPrivate(void* privateAttribute)
+ (void)initialize
{
if (self == [WebDataSource class]) {
-#if !PLATFORM(IOS)
JSC::initializeThreading();
WTF::initializeMainThreadToProcessMainThread();
RunLoop::initializeMainRunLoop();
-#endif
WebCoreObjCFinalizeOnMainThread(self);
}
}
toPrivate(_private)->loader->addAllArchiveResources([archive _coreLegacyWebArchive]);
}
-#if !PLATFORM(IOS)
- (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL
{
if ([URL isFileURL])
return nil;
}
-#endif
- (NSString *)_responseMIMEType
{
toPrivate(_private)->loader->setDeferMainResourceDataLoad(flag);
}
-#if PLATFORM(IOS)
-- (void)_setOverrideTextEncodingName:(NSString *)encoding
-{
- toPrivate(_private)->loader->setOverrideEncoding([encoding UTF8String]);
-}
-#endif
-
- (void)_setAllowToBeMemoryMapped
{
#if ENABLE(DISK_IMAGE_CACHE) && PLATFORM(IOS)
// Since this is a "secret default" we don't both registering it.
BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
if (!omitPDFSupport)
-#if PLATFORM(IOS)
-#define WebPDFRepresentation ([WebView _getPDFRepresentationClass])
-#endif
addTypesFromClass(repTypes, [WebPDFRepresentation class], [WebPDFRepresentation supportedMIMETypes]);
-#if PLATFORM(IOS)
-#undef WebPDFRepresentation
-#endif
}
if (!addedImageTypes && !allowImageTypeOmission) {
- (void)_makeRepresentation
{
Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
-
-#if PLATFORM(IOS)
- if ([repClass respondsToSelector:@selector(_representationClassForWebFrame:)])
- repClass = [repClass performSelector:@selector(_representationClassForWebFrame:) withObject:[self webFrame]];
-#endif
-
+
// Check if the data source was already bound?
if (![[self representation] isKindOfClass:repClass]) {
id newRep = repClass != nil ? [[repClass alloc] init] : nil;
id<WebDocumentRepresentation> representation = toPrivate(_private)->representation.get();
[representation setDataSource:self];
-#if PLATFORM(IOS)
- toPrivate(_private)->loader->setResponseMIMEType([self _responseMIMEType]);
-#endif
}
- (DocumentLoader*)_documentLoader
#import "WebTypesInternal.h"
#import <JavaScriptCore/JSBase.h>
-#if PLATFORM(IOS)
-#import <WebKit/WAKAppKitStubs.h>
-#endif
-
@class WebView;
struct WebResourceDelegateImplementationCache {
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
IMP canAuthenticateAgainstProtectionSpaceFunc;
#endif
-
-#if PLATFORM(IOS)
- IMP connectionPropertiesFunc;
- IMP webThreadDidFinishLoadingFromDataSourceFunc;
- IMP webThreadDidFailLoadingWithErrorFromDataSourceFunc;
- IMP webThreadIdentifierForRequestFunc;
- IMP webThreadDidLoadResourceFromMemoryCacheFunc;
- IMP webThreadWillSendRequestFunc;
- IMP webThreadDidReceiveResponseFunc;
- IMP webThreadDidReceiveContentLengthFunc;
- IMP webThreadWillCacheResponseFunc;
-#endif
-
IMP identifierForRequestFunc;
IMP willSendRequestFunc;
IMP didReceiveResponseFunc;
IMP didRunInsecureContentFunc;
IMP didDetectXSSFunc;
IMP didRemoveFrameFromHierarchyFunc;
-#if PLATFORM(IOS)
- IMP webThreadDidLayoutFunc;
-#endif
};
struct WebScriptDebugDelegateImplementationCache {
BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id);
BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL);
BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL, id);
-#if PLATFORM(IOS)
-BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id, BOOL);
-#endif
id CallFrameLoadDelegate(IMP, WebView *, SEL);
id CallFrameLoadDelegate(IMP, WebView *, SEL, NSUInteger);
id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id);
id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
id CallFrameLoadDelegate(IMP, WebView *, SEL, id, NSTimeInterval, id, id);
-#if PLATFORM(IOS)
-id CallFrameLoadDelegate(IMP, WebView *, SEL, id, double);
-id CallFrameLoadDelegateInWebThread(IMP, WebView *, SEL, NSUInteger);
-#endif
BOOL CallFrameLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL);
id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id);
id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
-#if PLATFORM(IOS)
-id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id);
-id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, id);
-id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, id, id);
-id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, NSInteger, id);
-id CallResourceLoadDelegateInWebThread(IMP, WebView *, SEL, id, id, NSInteger, id);
-#endif
BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id);
BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
#import "WebViewData.h"
#import <wtf/ObjcRuntimeExtras.h>
-#if PLATFORM(IOS)
-#import "WebViewInternal.h"
-#import <WebCore/WebCoreThreadMessage.h>
-#endif
-
@implementation WebView (WebDelegateImplementationCaching)
WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView)
// preventing more ObjC message dispatch and compensating for the expense of the @try/@catch.
typedef float (*ObjCMsgSendFPRet)(id, SEL, ...);
-#if !PLATFORM(IOS)
#if defined(__i386__)
static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend_fpret);
#else
static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend);
#endif
-#endif
static inline id CallDelegate(WebView *self, id delegate, SEL selector)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, NSRect rect)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&rect atIndex:3];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, BOOL boolean)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
- [invocation setArgument:&boolean atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
- [invocation setArgument:&object3 atIndex:5];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, NSUInteger integer)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
- [invocation setArgument:&integer atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline float CallDelegateReturningFloat(WebView *self, id delegate, SEL selector)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return 0.0f;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return 0.0f;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return 0.0f;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
-
- float returnValue = 0.0f;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return 0.0f;
-#endif
}
static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return result;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
-#endif
}
static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return result;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
-#endif
}
static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return result;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
- [invocation setArgument:&boolean atIndex:4];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
-#endif
}
static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean, id object2)
static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return result;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
-#endif
-}
-
-#if PLATFORM(IOS)
-static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2, BOOL boolean)
-{
- if (!delegate || ![delegate respondsToSelector:selector])
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
- [invocation setArgument:&boolean atIndex:5];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
}
-#endif
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate || ![delegate respondsToSelector:selector])
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&integer atIndex:3];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
-#if PLATFORM(IOS)
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, object3);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3, id object4)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, object3, object4);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, integer);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-
-#endif // PLATFORM(IOS)
-
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
-#if PLATFORM(IOS)
-static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object, double double1)
-{
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object atIndex:3];
- [invocation setArgument:&double1 atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-#endif
-
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
- [invocation setArgument:&object3 atIndex:5];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3, id object4)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
- [invocation setArgument:&object3 atIndex:5];
- [invocation setArgument:&object4 atIndex:6];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&integer atIndex:4];
- [invocation setArgument:&object2 atIndex:5];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
-#if !PLATFORM(IOS)
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
-#else
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
-#endif
{
if (!delegate)
return nil;
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
- [invocation setArgument:&integer atIndex:5];
- [invocation setArgument:&object3 atIndex:6];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
-#if PLATFORM(IOS)
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, object1, integer, object2);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
-{
- if (!delegate)
- return nil;
- @try {
- return wtfCallIMP<id>(implementation, delegate, selector, self, object1, object2, integer, object3);
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-}
-#endif
-
-#if !PLATFORM(IOS)
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
-#else
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
-#endif
{
if (!delegate)
return nil;
return nil;
}
-#if !PLATFORM(IOS)
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
-#else
-static inline id CallDelegateInWebThread(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
-#endif
{
if (!delegate)
return nil;
static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
{
-#if !PLATFORM(IOS)
if (!delegate)
return nil;
@try {
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&self atIndex:2];
- [invocation setArgument:&object1 atIndex:3];
- [invocation setArgument:&interval atIndex:4];
- [invocation setArgument:&object2 atIndex:5];
- [invocation setArgument:&object3 atIndex:6];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
id CallUIDelegate(WebView *self, SEL selector)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, id object)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, object);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, id object, BOOL boolean)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, object, boolean);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object, boolean);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, NSRect rect)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, rect);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, rect);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object1, object2);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2, object3);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object1, object2, object3);
-#endif
}
id CallUIDelegate(WebView *self, SEL selector, id object, NSUInteger integer)
{
-#if !PLATFORM(IOS)
return CallDelegate(self, self->_private->UIDelegate, selector, object, integer);
-#else
- return CallDelegate(self, [self _UIDelegateForSelector:selector], selector, object, integer);
-#endif
}
float CallUIDelegateReturningFloat(WebView *self, SEL selector)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningFloat(self, self->_private->UIDelegate, selector);
-#else
- return CallDelegateReturningFloat(self, [self _UIDelegateForSelector:selector], selector);
-#endif
}
BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector);
-#else
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector);
-#endif
}
BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object);
-#else
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object);
-#endif
}
BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean);
-#else
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object, boolean);
-#endif
}
BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean, object2);
-#else
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object, boolean, object2);
-#endif
}
BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object1, object2);
-#else
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object1, object2);
-#endif
}
-#if PLATFORM(IOS)
-BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2, BOOL boolean)
-{
- return CallDelegateReturningBoolean(result, self, [self _UIDelegateForSelector:selector], selector, object1, object2, boolean);
-}
-#endif
-
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, integer);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, integer);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2, object3);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3, object4);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, object2, object3, object4);
-#endif
}
id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, interval, object2, object3);
-#else
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object1, interval, object2, object3);
-#endif
}
-#if PLATFORM(IOS)
-id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object, double double1)
-{
- return CallDelegate(implementation, self, [self _frameLoadDelegateForwarder], selector, object, double1);
-}
-#endif
-
BOOL CallFrameLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector)
{
@try {
-#if !PLATFORM(IOS)
return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(self->_private->frameLoadDelegate, selector, self);
-#else
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)([self _frameLoadDelegateForwarder], selector, self);
-#endif
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2);
-#else
- return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2);
-#endif
}
id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3);
-#else
- return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, object3);
-#endif
}
id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3, object4);
-#else
- return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, object3, object4);
-#endif
}
id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, integer, object2);
-#else
- return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, integer, object2);
-#endif
}
id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, integer, object3);
-#else
- return CallDelegate(implementation, self, [self _resourceLoadDelegateForwarder], selector, object1, object2, integer, object3);
-#endif
-}
-
-#if PLATFORM(IOS)
-id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2);
-}
-
-id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3);
}
-id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3, object4);
-}
-
-id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, integer, object2);
-}
-
-id CallResourceLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, integer, object3);
-}
-
-id CallFrameLoadDelegateInWebThread(IMP implementation, WebView *self, SEL selector, NSUInteger integer)
-{
- return CallDelegateInWebThread(implementation, self, self->_private->frameLoadDelegate, selector, integer);
-}
-#endif // PLATFORM(IOS)
-
BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
{
@try {
id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3);
-#else
- return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3);
-#endif
}
id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
-#else
- return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
-#endif
}
id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
-#else
- return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
-#endif
}
id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
{
-#if !PLATFORM(IOS)
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
-#else
- return CallDelegateInWebThread(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
-#endif
}
id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2)
{
-#if !PLATFORM(IOS)
id delegate = self->_private->formDelegate;
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- id delegate = [self _formDelegateForSelector:selector];
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&object1 atIndex:2];
- [invocation setArgument:&object2 atIndex:3];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3)
{
-#if !PLATFORM(IOS)
id delegate = self->_private->formDelegate;
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- id delegate = [self _formDelegateForSelector:selector];
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&object1 atIndex:2];
- [invocation setArgument:&object2 atIndex:3];
- [invocation setArgument:&object3 atIndex:4];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5)
{
-#if !PLATFORM(IOS)
id delegate = self->_private->formDelegate;
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
ReportDiscardedDelegateException(selector, exception);
}
return nil;
-#else
- id delegate = [self _formDelegateForSelector:selector];
- if (!delegate)
- return nil;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&object1 atIndex:2];
- [invocation setArgument:&object2 atIndex:3];
- [invocation setArgument:&object3 atIndex:4];
- [invocation setArgument:&object4 atIndex:5];
- [invocation setArgument:&object5 atIndex:6];
-
- id returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- if ([[invocation methodSignature] methodReturnLength] == 0) {
- return nil;
- }
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return nil;
-#endif
}
BOOL CallFormDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, SEL selectorArg, id object2)
{
-#if !PLATFORM(IOS)
id delegate = self->_private->formDelegate;
if (!delegate || ![delegate respondsToSelector:selector])
return result;
ReportDiscardedDelegateException(selector, exception);
}
return result;
-#else
- id delegate = [self _formDelegateForSelector:selector];
- if (!delegate)
- return result;
-
- NSInvocation *invocation = WebThreadMakeNSInvocation(delegate, selector);
- [invocation setArgument:&object1 atIndex:2];
- [invocation setArgument:&selectorArg atIndex:3];
- [invocation setArgument:&object2 atIndex:4];
-
- BOOL returnValue;
- @try {
- WebThreadCallDelegate(invocation);
- [invocation getReturnValue:&returnValue];
- return returnValue;
- } @catch(id exception) {
- ReportDiscardedDelegateException(selector, exception);
- }
- return result;
-#endif
}
@end
self = [super init];
if (!self)
return nil;
-#if PLATFORM(IOS)
- // We don't use this API, but make sure that it compiles with the new
- // compass parameters.
- m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, false, 0, false, 0)];
-#else
m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)];
-#endif
return self;
}
#import <WebKit/WebHTMLView.h>
#import <WebKit/WebViewPrivate.h>
-#if PLATFORM(IOS)
-#if !defined(IBAction)
-#define IBAction void
-#endif
-#endif
-
/*!
@protocol _WebDocumentZooming
@discussion Optional protocol for a view that wants to handle its own zoom.
static inline bool needsDataLoadWorkaround(WebView *webView)
{
-#if !PLATFORM(IOS)
static bool needsWorkaround = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_ADOBE_INSTALLER_QUIRK)
&& [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.adobe.Installers.Setup"];
return needsWorkaround;
-#else
- return NO;
-#endif
}
void WebDocumentLoaderMac::setDataSource(WebDataSource *dataSource, WebView *webView)
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if !PLATFORM(IOS)
-
#import "WebDynamicScrollBarsView.h"
#import <WebCore/WebCoreFrameView.h>
// scrollers from inside this class should not fire JS events.
- (BOOL)inProgrammaticScroll;
@end
-
-#endif // !PLATFORM(IOS)
return NO;
}
-#if !PLATFORM(IOS)
- (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event inFrame:(WebFrame *)frame
{
return NO;
}
-#endif
- (void)frame:(WebFrame *)frame sourceFrame:(WebFrame *)sourceFrame willSubmitForm:(DOMElement *)form
withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
#import <runtime/JSCJSValue.h>
#import <wtf/CurrentTime.h>
-#if PLATFORM(IOS)
-#import "WebMailDelegate.h"
-#import "WebResource.h"
-#import "WebUIKitDelegate.h"
-#import <JavaScriptCore/APIShims.h>
-#import <WebCore/Document.h>
-#import <WebCore/Editor.h>
-#import <WebCore/EditorClient.h>
-#import <WebCore/FocusController.h>
-#import <WebCore/FrameSelection.h>
-#import <WebCore/HistoryController.h>
-#import <WebCore/NodeTraversal.h>
-#import <WebCore/RenderLayer.h>
-#import <WebCore/SimpleFontData.h>
-#import <WebCore/TextResourceDecoder.h>
-#import <WebCore/WAKScrollView.h>
-#import <WebCore/WAKViewPrivate.h>
-#import <WebCore/WKGraphics.h>
-#import <WebCore/WebCoreThreadRun.h>
-#endif
-
using namespace WebCore;
using namespace HTMLNames;
return _private && _private->includedInWebKitStatistics;
}
-#if PLATFORM(IOS)
-static NSURL *createUniqueWebDataURL();
-
-+ (void)_createMainFrameWithSimpleHTMLDocumentWithPage:(Page*)page frameView:(WebFrameView *)frameView style:(NSString *)style
-{
- WebView *webView = kit(page);
-
- WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
- frame->_private->coreFrame = &page->mainFrame();
- static_cast<WebFrameLoaderClient&>(page->mainFrame().loader().client()).setWebFrame(frame);
- [frame release];
-
- frame->_private->coreFrame->initWithSimpleHTMLDocument(style, createUniqueWebDataURL());
-}
-#endif
-
- (void)_attachScriptDebugger
{
ScriptController& scriptController = _private->coreFrame->script();
{
WebView *webView = getWebView(self);
BOOL drawsBackground = [webView drawsBackground];
-#if !PLATFORM(IOS)
NSColor *backgroundColor = [webView backgroundColor];
-#else
- CGColorRef backgroundColor = [webView backgroundColor];
-#endif
Frame* coreFrame = _private->coreFrame;
for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame)) {
WebFrame *webFrame = kit(frame);
if (!drawsBackground)
[[[webFrame frameView] _scrollView] setDrawsBackground:NO];
-#if !PLATFORM(IOS)
[[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
-#endif
if (FrameView* view = frame->view()) {
view->setTransparent(!drawsBackground);
-#if !PLATFORM(IOS)
- Color color = colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
-#else
- Color color = Color(backgroundColor);
-#endif
- view->setBaseBackgroundColor(color);
+ view->setBaseBackgroundColor(colorFromNSColor([backgroundColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]));
view->setShouldUpdateWhileOffscreen([webView shouldUpdateWhileOffscreen]);
}
}
- (void)_unmarkAllMisspellings
{
-#if !PLATFORM(IOS)
Frame* coreFrame = _private->coreFrame;
for (Frame* frame = coreFrame; frame; frame = frame->tree().traverseNext(coreFrame)) {
if (Document* document = frame->document())
document->markers().removeMarkers(DocumentMarker::Spelling);
}
-#endif
}
- (BOOL)_hasSelection
return dataSource(_private->coreFrame->loader().documentLoader());
}
-#if PLATFORM(IOS)
-- (BOOL)_isCommitting
-{
- return _private->isCommitting;
-}
-
-- (void)_setIsCommitting:(BOOL)value
-{
- _private->isCommitting = value;
-}
-#endif
-
- (NSArray *)_nodesFromList:(Vector<Node*> *)nodesVector
{
size_t size = nodesVector->size();
- (BOOL)_shouldFlattenCompositingLayers:(CGContextRef)context
{
-#if !PLATFORM(IOS)
// -currentContextDrawingToScreen returns YES for bitmap contexts.
BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
if (isPrinting)
return YES;
-#endif
if (!WKCGContextIsBitmapContext(context))
return NO;
- (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly
{
-#if !PLATFORM(IOS)
ASSERT([[NSGraphicsContext currentContext] isFlipped]);
CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
-#else
- CGContextRef ctx = WKGetCurrentGraphicsContext();
-#endif
GraphicsContext context(ctx);
-#if PLATFORM(IOS)
- // FIXME: when <rdar://problem/9034977> is fixed there will be no need to do this here.
- WebCore::Frame *frame = core(self);
- if (WebCore::Page* page = frame->page())
- context.setIsAcceleratedContext(page->settings().acceleratedDrawingEnabled());
-#endif
-
FrameView* view = _private->coreFrame->view();
bool shouldFlatten = false;
ASSERT(_private->coreFrame->document());
RetainPtr<WebFrame> protect(self); // Executing arbitrary JavaScript can destroy the frame.
-#if PLATFORM(IOS)
- ASSERT(WebThreadIsLockedOrDisabled());
- JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
- // Need to use the full entry shim to prevent crashes arising from the UI thread being unknown
- // to the JSC GC: <rdar://problem/11553172> Crash when breaking in the Web Inspector during stringByEvaluatingJavaScriptFromString:
- JSC::APIEntryShim jscLock(exec);
-#endif
-
JSC::JSValue result = _private->coreFrame->script().executeScript(string, forceUserGesture).jsValue();
if (!_private->coreFrame) // In case the script removed our frame from the page.
if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
return @"";
-#if !PLATFORM(IOS)
JSC::ExecState* exec = _private->coreFrame->script().globalObject(mainThreadNormalWorld())->globalExec();
JSC::JSLockHolder lock(exec);
-#endif
return result.toWTFString(exec);
}
NSRect rangeRect = [self _firstRectForDOMRange:range];
Node *startNode = core([range startContainer]);
- if (startNode && startNode->renderer()) {
-#if !PLATFORM(IOS)
+ if (startNode && startNode->renderer())
startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
-#else
- RenderLayer* layer = startNode->renderer()->enclosingLayer();
- if (layer) {
- layer->setAdjustForIOSCaretWhenScrolling(true);
- startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
- layer->setAdjustForIOSCaretWhenScrolling(false);
- _private->coreFrame->selection().setCaretRectNeedsUpdate();
- _private->coreFrame->selection().updateAppearance();
- }
-#endif
- }
-}
-
-#if PLATFORM(IOS)
-- (void)_scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset
-{
- NSRect rangeRect = NSInsetRect([self _firstRectForDOMRange:range], inset, inset);
- Node *startNode = core([range startContainer]);
-
- if (startNode && startNode->renderer()) {
- RenderLayer* layer = startNode->renderer()->enclosingLayer();
- if (layer) {
- layer->setAdjustForIOSCaretWhenScrolling(true);
- startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
- layer->setAdjustForIOSCaretWhenScrolling(false);
-
- Frame *coreFrame = core(self);
- if (coreFrame) {
- FrameSelection& frameSelection = coreFrame->selection();
- frameSelection.setCaretRectNeedsUpdate();
- frameSelection.updateAppearance();
- }
- }
- }
}
-#endif
- (BOOL)_needsLayout
{
return _private->coreFrame->view() ? _private->coreFrame->view()->needsLayout() : false;
}
-#if !PLATFORM(IOS)
- (DOMRange *)_rangeByAlteringCurrentSelection:(FrameSelection::EAlteration)alteration direction:(SelectionDirection)direction granularity:(TextGranularity)granularity
{
if (_private->coreFrame->selection().isNone())
selection.modify(alteration, direction, granularity);
return kit(selection.toNormalizedRange().get());
}
-#endif
- (TextGranularity)_selectionGranularity
{
_private->shouldCreateRenderers = shouldCreateRenderers;
}
-#if !PLATFORM(IOS)
- (NSColor *)_bodyBackgroundColor
-#else
-- (CGColorRef)_bodyBackgroundColor
-#endif
{
Document* document = _private->coreFrame->document();
if (!document)
Color color = bodyRenderer->style().visitedDependentColor(CSSPropertyBackgroundColor);
if (!color.isValid())
return nil;
-#if !PLATFORM(IOS)
return nsColor(color);
-#else
- return cachedCGColor(color, ColorSpaceDeviceRGB);
-#endif
}
- (BOOL)_isFrameSet
return (WebFrameLoadType)_private->coreFrame->loader().loadType();
}
-#if PLATFORM(IOS)
-- (BOOL)needsLayout
-{
- // Needed for Mail <rdar://problem/6228038>
- return _private->coreFrame ? [self _needsLayout] : NO;
-}
-
-- (void)_setLoadsSynchronously:(BOOL)flag
-{
- _private->coreFrame->loader().setLoadsSynchronously(flag);
-}
-
-- (BOOL)_loadsSynchronously
-{
- return _private->coreFrame->loader().loadsSynchronously();
-}
-
-// FIXME: selection
-
-- (NSArray *)_rectsForRange:(DOMRange *)domRange
-{
- Range *range = core(domRange);
-
-
- Vector<IntRect> intRects;
- range->textRects(intRects, NO);
- unsigned size = intRects.size();
-
- NSMutableArray *rectArray = [NSMutableArray arrayWithCapacity:size];
- for (unsigned i = 0; i < size; i++) {
- [rectArray addObject:[NSValue valueWithRect:(CGRect )intRects[i]]];
- }
-
- return rectArray;
-}
-
-- (DOMRange *)_selectionRangeForFirstPoint:(CGPoint)first secondPoint:(CGPoint)second
-{
- VisiblePosition firstPos = [self _visiblePositionForPoint:first];
- VisiblePosition secondPos = [self _visiblePositionForPoint:second];
- VisibleSelection selection(firstPos, secondPos);
- DOMRange *range = kit(selection.toNormalizedRange().get());
- return range;
-}
-
-- (DOMRange *)_selectionRangeForPoint:(CGPoint)point
-{
- VisiblePosition pos = [self _visiblePositionForPoint:point];
- VisibleSelection selection(pos);
- DOMRange *range = kit(selection.toNormalizedRange().get());
- return range;
-}
-
-#endif // PLATFORM(IOS)
-
- (NSRange)_selectedNSRange
{
return [self _convertToNSRange:_private->coreFrame->selection().toNormalizedRange().get()];
}
#endif
-#if PLATFORM(IOS)
-- (unsigned)formElementsCharacterCount
-{
- WebCore::Frame *frame = core(self);
- return frame->formElementsCharacterCount();
-}
-
-- (void)setTimeoutsPaused:(BOOL)flag
-{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
- if (Frame* coreFrame = _private->coreFrame)
- coreFrame->setTimersPaused(flag);
- }
-}
-
-- (void)setPluginsPaused:(BOOL)flag
-{
- WebView *webView = getWebView(self);
- if (!webView)
- return;
-
- if (flag)
- [webView _stopAllPlugIns];
- else
- [webView _startAllPlugIns];
-}
-
-- (void)prepareForPause
-{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
- if (Frame* coreFrame = _private->coreFrame)
- coreFrame->dispatchPageHideEventBeforePause();
- }
-}
-
-- (void)resumeFromPause
-{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
- if (Frame* coreFrame = _private->coreFrame)
- coreFrame->dispatchPageShowEventBeforeResume();
- }
-}
-
-- (void)selectNSRange:(NSRange)range
-{
- [self _selectNSRange:range];
-}
-
-- (void)selectWithoutClosingTypingNSRange:(NSRange)range
-{
- RefPtr<Range> domRange = [self _convertToDOMRange:range];
- if (domRange) {
- const VisibleSelection& newSelection = VisibleSelection(domRange.get(), SEL_DEFAULT_AFFINITY);
- _private->coreFrame->selection().setSelection(newSelection, 0);
-
- _private->coreFrame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
- }
-}
-
-- (NSRange)selectedNSRange
-{
- return [self _selectedNSRange];
-}
-
-- (void)forceLayoutAdjustingViewSize:(BOOL)adjust
-{
- _private->coreFrame->view()->forceLayout(!adjust);
- if (adjust)
- _private->coreFrame->view()->adjustViewSize();
-}
-
-- (void)_handleKeyEvent:(WebEvent *)event
-{
- core(self)->eventHandler().keyEvent(event);
-}
-
-- (void)_selectAll
-{
- core(self)->selection().selectAll();
-}
-
-- (void)_setSelectionFromNone
-{
- core(self)->selection().setSelectionFromNone();
-}
-
-- (void)_restoreViewState
-{
- ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
- _private->coreFrame->loader().client().restoreViewState();
-}
-
-- (void)_saveViewState
-{
- ASSERT(!WebThreadIsEnabled() || WebThreadIsLocked());
- FrameLoader& frameLoader = _private->coreFrame->loader();
- frameLoader.client().saveViewStateToItem(frameLoader.history().currentItem());
-}
-
-- (void)sendOrientationChangeEvent:(int)newOrientation
-{
- WebThreadRun(^{
- WebCore::Frame *frame = core(self);
- if (frame)
- frame->sendOrientationChangeEvent(newOrientation);
- });
-}
-
-- (void)setNeedsLayout
-{
- WebCore::Frame *frame = core(self);
- if (frame->view())
- frame->view()->setNeedsLayout();
-}
-
-- (CGSize)renderedSizeOfNode:(DOMNode *)node constrainedToWidth:(float)width
-{
- Node *n = core(node);
- RenderObject *r = n ? n->renderer() : 0;
- float w = std::min((float)r->maxPreferredLogicalWidth(), width);
- return r && r->isBox() ? CGSizeMake(w, toRenderBox(r)->height()) : CGSizeMake(0,0);
-}
-
-- (DOMNode *)deepestNodeAtViewportLocation:(CGPoint)aViewportLocation
-{
- WebCore::Frame *frame = core(self);
- return kit(frame->deepestNodeAtLocation(FloatPoint(aViewportLocation)));
-}
-
-- (DOMNode *)scrollableNodeAtViewportLocation:(CGPoint)aViewportLocation
-{
- WebCore::Frame *frame = core(self);
- WebCore::Node *node = frame->nodeRespondingToScrollWheelEvents(FloatPoint(aViewportLocation));
- return kit(node);
-}
-
-- (DOMNode *)approximateNodeAtViewportLocation:(CGPoint *)aViewportLocation
-{
- WebCore::Frame *frame = core(self);
- FloatPoint viewportLocation(*aViewportLocation);
- FloatPoint adjustedLocation;
- WebCore::Node *node = frame->nodeRespondingToClickEvents(viewportLocation, adjustedLocation);
- *aViewportLocation = adjustedLocation;
- return kit(node);
-}
-
-- (CGRect)renderRectForPoint:(CGPoint)point isReplaced:(BOOL *)isReplaced fontSize:(float *)fontSize
-{
- WebCore::Frame *frame = core(self);
- bool replaced = false;
- CGRect rect = frame->renderRectForPoint(point, &replaced, fontSize);
- *isReplaced = replaced;
- return rect;
-}
-
-- (void)_setProhibitsScrolling:(BOOL)flag
-{
- WebCore::Frame *frame = core(self);
- frame->view()->setProhibitsScrolling(flag);
-}
-
-- (void)revealSelectionAtExtent:(BOOL)revealExtent
-{
- WebCore::Frame *frame = core(self);
- RevealExtentOption revealExtentOption = revealExtent ? RevealExtent : DoNotRevealExtent;
- frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);
-}
-
-- (void)resetSelection
-{
- WebCore::Frame *frame = core(self);
- frame->selection().setSelection(frame->selection().selection());
-}
-
-- (BOOL)hasEditableSelection
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().isContentEditable();
-}
-
-- (int)preferredHeight
-{
- WebCore::Frame *frame = core(self);
- return frame->preferredHeight();
-}
-
-- (int)innerLineHeight:(DOMNode *)node
-{
- WebCore::Frame *frame = core(self);
- return frame->innerLineHeight(node);
-}
-
-- (void)updateLayout
-{
- WebCore::Frame *frame = core(self);
- frame->updateLayout();
-}
-
-- (void)setIsActive:(BOOL)flag
-{
- WebCore::Frame *frame = core(self);
- frame->page()->focusController().setActive(flag);
-}
-
-- (void)setSelectionChangeCallbacksDisabled:(BOOL)flag
-{
- WebCore::Frame *frame = core(self);
- frame->setSelectionChangeCallbacksDisabled(flag);
-}
-
-- (NSRect)caretRect
-{
- WebCore::Frame *frame = core(self);
- return frame->caretRect();
-}
-
-- (NSRect)rectForScrollToVisible
-{
- WebCore::Frame *frame = core(self);
- return frame->rectForScrollToVisible();
-}
-
-- (void)setCaretColor:(CGColorRef)color
-{
- Color qColor = color ? Color(color) : Color::black;
- WebCore::Frame *frame = core(self);
- frame->selection().setCaretColor(qColor);
-}
-
-- (NSView *)documentView
-{
- WebCore::Frame *frame = core(self);
- return [[kit(frame) frameView] documentView];
-}
-
-- (int)layoutCount
-{
- WebCore::Frame *frame = core(self);
- if (!frame || !frame->view())
- return 0;
- return frame->view()->layoutCount();
-}
-
-- (BOOL)isTelephoneNumberParsingAllowed
-{
- Document *document = core(self)->document();
- return document->isTelephoneNumberParsingAllowed();
-}
-
-- (BOOL)isTelephoneNumberParsingEnabled
-{
- Document *document = core(self)->document();
- return document->isTelephoneNumberParsingEnabled();
-}
-
-- (BOOL)mediaDataLoadsAutomatically
-{
- WebCore::Frame *frame = core(self);
- if (WebCore::Page* page = frame->page())
- return page->settings().mediaDataLoadsAutomatically();
-
- return NO;
-}
-
-- (void)setMediaDataLoadsAutomatically:(BOOL)flag
-{
- WebCore::Frame *frame = core(self);
- if (WebCore::Page* page = frame->page())
- page->settings().setMediaDataLoadsAutomatically(flag);
-}
-
-- (DOMRange *)selectedDOMRange
-{
- WebCore::Frame *frame = core(self);
- RefPtr<WebCore::Range> range = frame->selection().toNormalizedRange();
- return kit(range.get());
-}
-
-- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)affinity closeTyping:(BOOL)closeTyping
-{
- WebCore::Frame *frame = core(self);
-#if PLATFORM(IOS)
- // Ensure the view becomes first responder.
- // This does not happen automatically on iOS because we don't forward
- // all the click events to WebKit.
- if (FrameView* frameView = frame->view()) {
- if (NSView *documentView = frameView->documentView()) {
- Page* page = frame->page();
- if (!page)
- return;
- page->chrome().focusNSView(documentView);
- }
- }
-#endif
- frame->selection().setSelectedRange(core(range), (EAffinity)affinity, closeTyping);
- if (!closeTyping)
- frame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
-}
-
-- (NSSelectionAffinity)selectionAffinity
-{
- WebCore::Frame *frame = core(self);
- return (NSSelectionAffinity)(frame->selection().affinity());
-}
-
-- (void)expandSelectionToElementContainingCaretSelection
-{
- WebCore::Frame *frame = core(self);
- frame->selection().expandSelectionToElementContainingCaretSelection();
-}
-
-- (DOMRange *)elementRangeContainingCaretSelection
-{
- WebCore::Frame *frame = core(self);
- RefPtr<WebCore::Range> range = frame->selection().elementRangeContainingCaretSelection();
- return kit(range.get());
-}
-
-- (void)expandSelectionToWordContainingCaretSelection
-{
- WebCore::Frame *frame = core(self);
- frame->selection().expandSelectionToWordContainingCaretSelection();
-}
-
-- (void)expandSelectionToStartOfWordContainingCaretSelection
-{
- WebCore::Frame *frame = core(self);
- frame->selection().expandSelectionToStartOfWordContainingCaretSelection();
-}
-
-- (unichar)characterInRelationToCaretSelection:(int)amount
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().characterInRelationToCaretSelection(amount);
-}
-
-- (unichar)characterBeforeCaretSelection
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().characterBeforeCaretSelection();
-}
-
-- (unichar)characterAfterCaretSelection
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().characterAfterCaretSelection();
-}
-
-- (DOMRange *)wordRangeContainingCaretSelection
-{
- WebCore::Frame *frame = core(self);
- RefPtr<WebCore::Range> range = frame->selection().wordRangeContainingCaretSelection();
- return kit(range.get());
-}
-
-- (NSString *)wordInRange:(DOMRange *)range
-{
- if (!range)
- return nil;
- return [self _stringForRange:range];
-}
-
-- (int)wordOffsetInRange:(DOMRange *)range
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().wordOffsetInRange(core(range));
-}
-
-- (BOOL)spaceFollowsWordInRange:(DOMRange *)range
-{
- WebCore::Frame *frame = core(self);
- return frame->selection().spaceFollowsWordInRange(core(range));
-}
-
-- (NSArray *)wordsInCurrentParagraph
-{
- WebCore::Frame *frame = core(self);
- return frame->wordsInCurrentParagraph();
-}
-
-- (BOOL)selectionAtDocumentStart
-{
- WebCore::Frame *frame = core(self);
-
- if (frame->selection().selection().isNone())
- return NO;
-
- frame->document()->updateLayout();
-
- return frame->selection().selectionAtDocumentStart();
-}
-
-- (BOOL)selectionAtSentenceStart
-{
- WebCore::Frame *frame = core(self);
-
- if (frame->selection().selection().isNone())
- return NO;
-
- frame->document()->updateLayout();
-
- return frame->selection().selectionAtSentenceStart();
-}
-
-- (BOOL)selectionAtWordStart
-{
- WebCore::Frame *frame = core(self);
-
- if (frame->selection().selection().isNone())
- return NO;
-
- frame->document()->updateLayout();
-
- return frame->selection().selectionAtWordStart();
-}
-
-- (DOMRange *)rangeByMovingCurrentSelection:(int)amount
-{
- WebCore::Frame *frame = core(self);
- RefPtr<WebCore::Range> range = frame->selection().rangeByMovingCurrentSelection(amount);
- return kit(range.get());
-}
-
-- (DOMRange *)rangeByExtendingCurrentSelection:(int)amount
-{
- WebCore::Frame *frame = core(self);
- RefPtr<WebCore::Range> range = frame->selection().rangeByExtendingCurrentSelection(amount);
- return kit(range.get());
-}
-
-- (void)selectNSRange:(NSRange)range onElement:(DOMElement *)element
-{
- WebCore::Frame *frame = core(self);
-
- Document *doc = frame->document();
- if (!doc)
- return;
-
- Node *node = core(element);
- if (!node->inDocument())
- return;
-
- frame->selection().selectRangeOnElement(range.location, range.length, node);
-}
-
-- (DOMRange *)markedTextDOMRange
-{
- WebCore::Frame *frame = core(self);
- if (!frame)
- return nil;
-
- return kit(frame->editor().compositionRange().get());
-}
-
-- (void)setMarkedText:(NSString *)text selectedRange:(NSRange)newSelRange
-{
- WebCore::Frame *frame = core(self);
- if (!frame)
- return;
-
- Vector<CompositionUnderline> underlines;
- frame->page()->chrome().client().suppressFormNotifications();
- frame->editor().setComposition(text, underlines, newSelRange.location, NSMaxRange(newSelRange));
- frame->page()->chrome().client().restoreFormNotifications();
-}
-
-- (void)setMarkedText:(NSString *)text forCandidates:(BOOL)forCandidates
-{
- WebCore::Frame *frame = core(self);
- if (!frame)
- return;
-
- Vector<CompositionUnderline> underlines;
- frame->editor().setComposition(text, underlines, 0, [text length]);
-}
-
-- (void)confirmMarkedText:(NSString *)text
-{
- WebCore::Frame *frame = core(self);
- if (!frame || !frame->editor().client())
- return;
-
- frame->page()->chrome().client().suppressFormNotifications();
- if (text)
- frame->editor().confirmComposition(text);
- else
- frame->editor().confirmMarkedText();
- frame->page()->chrome().client().restoreFormNotifications();
-}
-
-- (void)setText:(NSString *)text asChildOfElement:(DOMElement *)element
-{
- if (!element)
- return;
-
- WebCore::Frame *frame = core(self);
- if (!frame || !frame->document())
- return;
-
- frame->editor().setTextAsChildOfElement(text, core(element));
-}
-
-- (void)setDictationPhrases:(NSArray *)dictationPhrases metadata:(id)metadata asChildOfElement:(DOMElement *)element
-{
- if (!element)
- return;
-
- WebCore::Frame *frame = core(self);
- if (!frame)
- return;
-
- frame->editor().setDictationPhrasesAsChildOfElement(vectorForDictationPhrasesArray(dictationPhrases), metadata, core(element));
-}
-
-- (NSArray *)interpretationsForCurrentRoot
-{
- return core(self)->interpretationsForCurrentRoot();
-}
-
-// Collects the ranges and metadata for all of the mars voltas in the root editable element.
-- (void)getDictationResultRanges:(NSArray **)outRanges andMetadatas:(NSArray **)outMetadatas
-{
- ASSERT(outRanges);
- if (!outRanges)
- return;
-
- // *outRanges should not already point to an array.
- ASSERT(!(*outRanges));
- *outRanges = nil;
-
- ASSERT(outMetadatas);
- if (!outMetadatas)
- return;
-
- // *metadata should not already point to an array.
- ASSERT(!(*outMetadatas));
- *outMetadatas = nil;
-
- NSMutableArray *ranges = [NSMutableArray array];
- NSMutableArray *metadatas = [NSMutableArray array];
-