📄 webview.mm
字号:
/* * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 David Smith (catfish.man@gmail.com) * * 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 "WebViewInternal.h"#import "DOMRangeInternal.h"#import "WebBackForwardListInternal.h"#import "WebCache.h"#import "WebChromeClient.h"#import "WebContextMenuClient.h"#import "WebDOMOperationsPrivate.h"#import "WebDataSourceInternal.h"#import "WebDatabaseManagerInternal.h"#import "WebDefaultEditingDelegate.h"#import "WebDefaultPolicyDelegate.h"#import "WebDefaultUIDelegate.h"#import "WebDocument.h"#import "WebDocumentInternal.h"#import "WebDownload.h"#import "WebDownloadInternal.h"#import "WebDragClient.h"#import "WebDynamicScrollBarsViewInternal.h"#import "WebEditingDelegate.h"#import "WebEditorClient.h"#import "WebFormDelegatePrivate.h"#import "WebFrameInternal.h"#import "WebFrameViewInternal.h"#import "WebHTMLRepresentation.h"#import "WebHTMLViewInternal.h"#import "WebHistoryItemInternal.h"#import "WebIconDatabaseInternal.h"#import "WebInspector.h"#import "WebInspectorClient.h"#import "WebKitErrors.h"#import "WebKitLogging.h"#import "WebKitNSStringExtras.h"#import "WebKitStatisticsPrivate.h"#import "WebKitSystemBits.h"#import "WebKitVersionChecks.h"#import "WebLocalizableStrings.h"#import "WebNodeHighlight.h"#import "WebNSDataExtras.h"#import "WebNSDataExtrasPrivate.h"#import "WebNSDictionaryExtras.h"#import "WebNSEventExtras.h"#import "WebNSObjectExtras.h"#import "WebNSPasteboardExtras.h"#import "WebNSPrintOperationExtras.h"#import "WebNSURLExtras.h"#import "WebNSURLRequestExtras.h"#import "WebNSUserDefaultsExtras.h"#import "WebNSViewExtras.h"#import "WebPDFView.h"#import "WebPanelAuthenticationHandler.h"#import "WebPasteboardHelper.h"#import "WebPluginDatabase.h"#import "WebPolicyDelegate.h"#import "WebPreferenceKeysPrivate.h"#import "WebPreferencesPrivate.h"#import "WebScriptDebugDelegate.h"#import "WebTextIterator.h"#import "WebUIDelegate.h"#import "WebUIDelegatePrivate.h"#import <CoreFoundation/CFSet.h>#import <Foundation/NSURLConnection.h>#import <WebCore/ApplicationCacheStorage.h>#import <WebCore/Cache.h>#import <WebCore/ColorMac.h>#import <WebCore/Cursor.h>#import <WebCore/Document.h>#import <WebCore/DocumentLoader.h>#import <WebCore/DragController.h>#import <WebCore/DragData.h>#import <WebCore/Editor.h>#import <WebCore/EventHandler.h>#import <WebCore/ExceptionHandlers.h>#import <WebCore/FocusController.h>#import <WebCore/Frame.h>#import <WebCore/FrameLoader.h>#import <WebCore/FrameView.h>#import <WebCore/FrameTree.h>#import <WebCore/GCController.h>#import <WebCore/HTMLNames.h>#import <WebCore/HistoryItem.h>#import <WebCore/IconDatabase.h>#import <WebCore/Logging.h>#import <WebCore/MIMETypeRegistry.h>#import <WebCore/Page.h>#import <WebCore/PageCache.h>#import <WebCore/PageGroup.h>#import <WebCore/PlatformMouseEvent.h>#import <WebCore/ProgressTracker.h>#import <WebCore/ScriptController.h>#import <WebCore/ScriptValue.h>#import <WebCore/SelectionController.h>#import <WebCore/Settings.h>#import <WebCore/TextResourceDecoder.h>#import <WebCore/ThreadCheck.h>#import <WebCore/WebCoreObjCExtras.h>#import <WebCore/WebCoreTextRenderer.h>#import <WebCore/WebCoreView.h>#import <WebKit/DOM.h>#import <WebKit/DOMExtensions.h>#import <WebKit/DOMPrivate.h>#import <WebKitSystemInterface.h>#import <runtime/ArrayPrototype.h>#import <runtime/DateInstance.h>#import <runtime/InitializeThreading.h>#import <runtime/JSLock.h>#import <runtime/JSValue.h>#import <mach-o/dyld.h>#import <objc/objc-auto.h>#import <objc/objc-runtime.h>#import <runtime/InitializeThreading.h>#import <wtf/Assertions.h>#import <wtf/HashTraits.h>#import <wtf/RefCountedLeakCounter.h>#import <wtf/RefPtr.h>#import <wtf/StdLibExtras.h>#if ENABLE(DASHBOARD_SUPPORT)#import <WebKit/WebDashboardRegion.h>#endifusing namespace WebCore;using namespace JSC;#if defined(__ppc__) || defined(__ppc64__)#define PROCESSOR "PPC"#elif defined(__i386__) || defined(__x86_64__)#define PROCESSOR "Intel"#else#error Unknown architecture#endif#define FOR_EACH_RESPONDER_SELECTOR(macro) \macro(alignCenter) \macro(alignJustified) \macro(alignLeft) \macro(alignRight) \macro(capitalizeWord) \macro(centerSelectionInVisibleArea) \macro(changeAttributes) \macro(changeBaseWritingDirection) \macro(changeBaseWritingDirectionToLTR) \macro(changeBaseWritingDirectionToRTL) \macro(changeColor) \macro(changeDocumentBackgroundColor) \macro(changeFont) \macro(changeSpelling) \macro(checkSpelling) \macro(complete) \macro(copy) \macro(copyFont) \macro(cut) \macro(delete) \macro(deleteBackward) \macro(deleteBackwardByDecomposingPreviousCharacter) \macro(deleteForward) \macro(deleteToBeginningOfLine) \macro(deleteToBeginningOfParagraph) \macro(deleteToEndOfLine) \macro(deleteToEndOfParagraph) \macro(deleteToMark) \macro(deleteWordBackward) \macro(deleteWordForward) \macro(ignoreSpelling) \macro(indent) \macro(insertBacktab) \macro(insertLineBreak) \macro(insertNewline) \macro(insertNewlineIgnoringFieldEditor) \macro(insertParagraphSeparator) \macro(insertTab) \macro(insertTabIgnoringFieldEditor) \macro(lowercaseWord) \macro(makeBaseWritingDirectionLeftToRight) \macro(makeBaseWritingDirectionRightToLeft) \macro(makeTextWritingDirectionLeftToRight) \macro(makeTextWritingDirectionNatural) \macro(makeTextWritingDirectionRightToLeft) \macro(moveBackward) \macro(moveBackwardAndModifySelection) \macro(moveDown) \macro(moveDownAndModifySelection) \macro(moveForward) \macro(moveForwardAndModifySelection) \macro(moveLeft) \macro(moveLeftAndModifySelection) \macro(moveParagraphBackwardAndModifySelection) \macro(moveParagraphForwardAndModifySelection) \macro(moveRight) \macro(moveRightAndModifySelection) \macro(moveToBeginningOfDocument) \macro(moveToBeginningOfDocumentAndModifySelection) \macro(moveToBeginningOfLine) \macro(moveToBeginningOfLineAndModifySelection) \macro(moveToBeginningOfParagraph) \macro(moveToBeginningOfParagraphAndModifySelection) \macro(moveToBeginningOfSentence) \macro(moveToBeginningOfSentenceAndModifySelection) \macro(moveToEndOfDocument) \macro(moveToEndOfDocumentAndModifySelection) \macro(moveToEndOfLine) \macro(moveToEndOfLineAndModifySelection) \macro(moveToEndOfParagraph) \macro(moveToEndOfParagraphAndModifySelection) \macro(moveToEndOfSentence) \macro(moveToEndOfSentenceAndModifySelection) \macro(moveUp) \macro(moveUpAndModifySelection) \macro(moveWordBackward) \macro(moveWordBackwardAndModifySelection) \macro(moveWordForward) \macro(moveWordForwardAndModifySelection) \macro(moveWordLeft) \macro(moveWordLeftAndModifySelection) \macro(moveWordRight) \macro(moveWordRightAndModifySelection) \macro(outdent) \macro(pageDown) \macro(pageDownAndModifySelection) \macro(pageUp) \macro(pageUpAndModifySelection) \macro(paste) \macro(pasteAsPlainText) \macro(pasteAsRichText) \macro(pasteFont) \macro(performFindPanelAction) \macro(scrollLineDown) \macro(scrollLineUp) \macro(scrollPageDown) \macro(scrollPageUp) \macro(scrollToBeginningOfDocument) \macro(scrollToEndOfDocument) \macro(selectAll) \macro(selectLine) \macro(selectParagraph) \macro(selectSentence) \macro(selectToMark) \macro(selectWord) \macro(setMark) \macro(showGuessPanel) \macro(startSpeaking) \macro(stopSpeaking) \macro(subscript) \macro(superscript) \macro(swapWithMark) \macro(takeFindStringFromSelection) \macro(toggleBaseWritingDirection) \macro(transpose) \macro(underline) \macro(unscript) \macro(uppercaseWord) \macro(yank) \macro(yankAndSelect) \#define WebKitOriginalTopPrintingMarginKey @"WebKitOriginalTopMargin"#define WebKitOriginalBottomPrintingMarginKey @"WebKitOriginalBottomMargin"#define KeyboardUIModeDidChangeNotification @"com.apple.KeyboardUIModeDidChange"#define AppleKeyboardUIMode CFSTR("AppleKeyboardUIMode")#define UniversalAccessDomain CFSTR("com.apple.universalaccess")#if USE(ACCELERATED_COMPOSITING)#define UsingAcceleratedCompositingProperty @"_isUsingAcceleratedCompositing"#endif static BOOL s_didSetCacheModel;static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;static BOOL applicationIsTerminating;static int pluginDatabaseClientCount = 0;#ifndef NDEBUGstatic const char webViewIsOpen[] = "At least one WebView is still open.";#endif@interface NSSpellChecker (AppKitSecretsIKnow)- (void)_preflightChosenSpellServer;@end@interface NSView (AppKitSecretsIKnow)- (NSView *)_hitTest:(NSPoint *)aPoint dragTypes:(NSSet *)types;- (void)_autoscrollForDraggingInfo:(id)dragInfo timeDelta:(NSTimeInterval)repeatDelta;- (BOOL)_shouldAutoscrollForDraggingInfo:(id)dragInfo;@end@interface NSWindow (AppKitSecretsIKnow) - (id)_oldFirstResponderBeforeBecoming;@end@interface NSObject (ValidateWithoutDelegate)- (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item;@end@interface _WebSafeForwarder : NSObject{ id target; // Non-retained. Don't retain delegates. id defaultTarget; BOOL catchExceptions;}- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget catchExceptions:(BOOL)catchExceptions;@end@interface WebViewPrivate : NSObject {@public Page* page; id UIDelegate; id UIDelegateForwarder; id resourceProgressDelegate; id downloadDelegate; id policyDelegate; id policyDelegateForwarder; id frameLoadDelegate; id frameLoadDelegateForwarder; id <WebFormDelegate> formDelegate; id editingDelegate; id editingDelegateForwarder; id scriptDebugDelegate; WebInspector *inspector;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -