[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:42:41 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit cdcc35c0679c219ea1b4cca4af559c04c2f21617
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri May 28 17:14:37 2004 +0000
Reviewed by Ken.
- implemented a few more editing operations, moved code from WebView to WebHTMLView
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge respondToChangedContents]): Call _updateFontPanel on the WebHTMLView, not the WebView.
(-[WebBridge respondToChangedSelection]): Ditto.
* WebView.subproj/WebHTMLView.m: Moved WebElementOrTextFilter class here from WebView and
gave it a prefix so it won't conflict with developers' class names.
(-[WebHTMLView _updateFontPanel]): Moved here from WebView.
* WebView.subproj/WebView.m:
(-[WebView toggleSmartInsertDelete:]): Added.
(-[WebView toggleContinuousSpellChecking:]): Added.
(-[WebView isContinuousGrammarCheckingEnabled]): Added.
(-[WebView setContinuousGrammarCheckingEnabled:]): Added.
(-[WebView toggleContinuousGrammarChecking:]): Added.
(-[WebView setSmartInsertDeleteEnabled:]): Implemented. We have the flag now, although we
still don't actually have smart insert and delete implemented.
(-[WebView smartInsertDeleteEnabled]): Ditto.
(-[WebView setContinuousSpellCheckingEnabled:]): Implemented.
(-[WebView isContinuousSpellCheckingEnabled]): Implemented.
(-[WebView spellCheckerDocumentTag]): Implemented.
(-[WebView _preflightSpellCheckerNow:]): Added.
(-[WebView _preflightSpellChecker]): Added.
(-[WebView _continuousCheckingAllowed]): Added.
* WebView.subproj/WebHTMLViewInternal.h: Added. We'll things here from WebHTMLViewPrivate so
they are internal to the framework, rather than SPI.
* WebKit.pbproj/project.pbxproj: Added WebHTMLViewInternal.h.
* WebView.subproj/WebHTMLViewPrivate.h: Moved WebHTMLViewPrivate into the internal header.
Despite its name, it's internal, not SPI.
* WebView.subproj/WebViewPrivate.h: Moved WebViewPrivate into the internal header.
Despite its name, it's internal, not SPI. Added a number of new operations which should
be public API. We'll have to figure out what to do about API review and the WWDC deadline.
* WebView.subproj/WebViewInternal.h: Removed _updateFontPanel method.
* English.lproj/StringsNotToBeLocalized.txt: Update.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d3ba34a..fda0f67 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,46 @@
+2004-05-28 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - implemented a few more editing operations, moved code from WebView to WebHTMLView
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge respondToChangedContents]): Call _updateFontPanel on the WebHTMLView, not the WebView.
+ (-[WebBridge respondToChangedSelection]): Ditto.
+
+ * WebView.subproj/WebHTMLView.m: Moved WebElementOrTextFilter class here from WebView and
+ gave it a prefix so it won't conflict with developers' class names.
+ (-[WebHTMLView _updateFontPanel]): Moved here from WebView.
+
+ * WebView.subproj/WebView.m:
+ (-[WebView toggleSmartInsertDelete:]): Added.
+ (-[WebView toggleContinuousSpellChecking:]): Added.
+ (-[WebView isContinuousGrammarCheckingEnabled]): Added.
+ (-[WebView setContinuousGrammarCheckingEnabled:]): Added.
+ (-[WebView toggleContinuousGrammarChecking:]): Added.
+ (-[WebView setSmartInsertDeleteEnabled:]): Implemented. We have the flag now, although we
+ still don't actually have smart insert and delete implemented.
+ (-[WebView smartInsertDeleteEnabled]): Ditto.
+ (-[WebView setContinuousSpellCheckingEnabled:]): Implemented.
+ (-[WebView isContinuousSpellCheckingEnabled]): Implemented.
+ (-[WebView spellCheckerDocumentTag]): Implemented.
+ (-[WebView _preflightSpellCheckerNow:]): Added.
+ (-[WebView _preflightSpellChecker]): Added.
+ (-[WebView _continuousCheckingAllowed]): Added.
+
+ * WebView.subproj/WebHTMLViewInternal.h: Added. We'll things here from WebHTMLViewPrivate so
+ they are internal to the framework, rather than SPI.
+ * WebKit.pbproj/project.pbxproj: Added WebHTMLViewInternal.h.
+ * WebView.subproj/WebHTMLViewPrivate.h: Moved WebHTMLViewPrivate into the internal header.
+ Despite its name, it's internal, not SPI.
+
+ * WebView.subproj/WebViewPrivate.h: Moved WebViewPrivate into the internal header.
+ Despite its name, it's internal, not SPI. Added a number of new operations which should
+ be public API. We'll have to figure out what to do about API review and the WWDC deadline.
+ * WebView.subproj/WebViewInternal.h: Removed _updateFontPanel method.
+
+ * English.lproj/StringsNotToBeLocalized.txt: Update.
+
2004-05-27 Ken Kocienda <kocienda at apple.com>
Reviewed by John
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index 5eb868d..7575e8e 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -110,6 +110,7 @@
"NP_GetEntryPoints"
"NP_Initialize"
"NP_Shutdown"
+"NSAllowContinuousSpellChecking"
"NSApplicationIcon"
"NSErrorFailingURLKey"
"NSEvent"
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 123ed54..7f3608a 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -21,7 +21,7 @@
#import <WebKit/WebFrameViewPrivate.h>
#import <WebKit/WebHistoryItemPrivate.h>
#import <WebKit/WebHTMLRepresentationPrivate.h>
-#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebHTMLViewInternal.h>
#import <WebKit/WebJavaScriptTextInputPanel.h>
#import <WebKit/WebKitErrorsPrivate.h>
#import <WebKit/WebKitLogging.h>
@@ -1203,14 +1203,20 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
- (void)respondToChangedContents
{
- [[_frame webView] _updateFontPanel];
+ NSView <WebDocumentView> *view = [[_frame frameView] documentView];
+ if ([view isKindOfClass:[WebHTMLView class]]) {
+ [(WebHTMLView *)view _updateFontPanel];
+ }
[[_frame webView] setTypingStyle:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeNotification object:[_frame webView]];
}
- (void)respondToChangedSelection
{
- [[_frame webView] _updateFontPanel];
+ NSView <WebDocumentView> *view = [[_frame frameView] documentView];
+ if ([view isKindOfClass:[WebHTMLView class]]) {
+ [(WebHTMLView *)view _updateFontPanel];
+ }
[[_frame webView] setTypingStyle:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidChangeSelectionNotification object:[_frame webView]];
}
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 011829f..1279889 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -355,6 +355,7 @@
BE4FBECC0653DF47005EDE15,
51863EDA065417DA00E9E8DD,
51863EFD065419EB00E9E8DD,
+ 93185DB606679F42005D5E7E,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2639,6 +2640,20 @@
settings = {
};
};
+ 93185DB506679F42005D5E7E = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = WebHTMLViewInternal.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 93185DB606679F42005D5E7E = {
+ fileRef = 93185DB506679F42005D5E7E;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
931A72D203265920008635CE = {
fileEncoding = 4;
isa = PBXFileReference;
@@ -3788,6 +3803,7 @@
F5A55DC702BAA2E8018635CC,
35081D9402B6D4D80ACA2ACA,
35081D9502B6D4D80ACA2ACA,
+ 93185DB506679F42005D5E7E,
35081D9602B6D4D80ACA2ACA,
);
isa = PBXGroup;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 0d616b8..1db1bfb 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -18,7 +18,7 @@
#import <WebKit/WebException.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebFrameViewPrivate.h>
-#import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebHTMLViewInternal.h>
#import <WebKit/WebHTMLRepresentationPrivate.h>
#import <WebKit/WebImageRenderer.h>
#import <WebKit/WebKitLogging.h>
@@ -85,7 +85,7 @@
static BOOL forceRealHitTest = NO;
- at interface WebHTMLView (WebHTMLViewFileInternal)
+ at interface WebHTMLView (WebFileInternal)
- (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText;
- (void)_replaceSelectionWithPasteboard:(NSPasteboard *)pasteboard selectReplacement:(BOOL)selectReplacement allowPlainText:(BOOL)allowPlainText;
@end
@@ -121,6 +121,12 @@ static BOOL forceRealHitTest = NO;
- (void)_web_setObjectIfNotNil:(id)object forKey:(id)key;
@end
+ at interface WebElementOrTextFilter : NSObject <DOMNodeFilter>
++ (WebElementOrTextFilter *)filter;
+ at end
+
+static WebElementOrTextFilter *elementOrTextFilterInstance = nil;
+
@implementation WebHTMLViewPrivate
- (void)dealloc
@@ -140,7 +146,7 @@ static BOOL forceRealHitTest = NO;
@end
- at implementation WebHTMLView (WebHTMLViewFileInternal)
+ at implementation WebHTMLView (WebFileInternal)
- (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText
{
@@ -2526,7 +2532,7 @@ static WebHTMLView *lastHitView = nil;
@end
- at implementation WebHTMLView (TextSizing)
+ at implementation WebHTMLView (WebTextSizing)
- (void)_web_textSizeMultiplierChanged
{
@@ -2549,3 +2555,95 @@ static WebHTMLView *lastHitView = nil;
}
@end
+
+ at implementation WebElementOrTextFilter
+
++ (WebElementOrTextFilter *)filter
+{
+ if (!elementOrTextFilterInstance)
+ elementOrTextFilterInstance = [[WebElementOrTextFilter alloc] init];
+ return elementOrTextFilterInstance;
+}
+
+- (short)acceptNode:(DOMNode *)n
+{
+ return ([n isKindOfClass:[DOMElement class]] || [n isKindOfClass:[DOMText class]]) ? DOM_FILTER_ACCEPT : DOM_FILTER_SKIP;
+}
+
+ at end
+
+ at implementation WebHTMLView (WebInternal)
+
+// FIXME: Move to WebHTMLView.
+- (void)_updateFontPanel
+{
+ // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
+ // sure if we need to do something similar.
+
+ WebBridge *bridge = [self _bridge];
+
+ if (![bridge isSelectionEditable]) {
+ return;
+ }
+
+ NSWindow *window = [self window];
+ // FIXME: is this first-responder check correct? What happens if a subframe is editable and is first responder?
+ if ([NSApp keyWindow] != window || [window firstResponder] != self) {
+ return;
+ }
+
+ BOOL onlyOneFontInSelection = YES;
+ NSFont *font = nil;
+
+ if (![bridge haveSelection]) {
+ font = [bridge fontForCurrentPosition];
+ }
+ else {
+ DOMRange *selection = [bridge selectedDOMRange];
+ DOMNode *startContainer = [selection startContainer];
+ DOMNode *endContainer = [selection endContainer];
+
+ ASSERT(startContainer);
+ ASSERT(endContainer);
+ ASSERT([[WebElementOrTextFilter filter] acceptNode:startContainer] == DOM_FILTER_ACCEPT);
+ ASSERT([[WebElementOrTextFilter filter] acceptNode:endContainer] == DOM_FILTER_ACCEPT);
+
+ font = [bridge renderedFontForNode:startContainer];
+
+ if (startContainer != endContainer) {
+ DOMDocument *document = [bridge DOMDocument];
+ DOMTreeWalker *treeWalker = [document createTreeWalker:document :DOM_SHOW_ALL :[WebElementOrTextFilter filter] :NO];
+ DOMNode *node = startContainer;
+ [treeWalker setCurrentNode:node];
+ while (node) {
+ NSFont *otherFont = [bridge renderedFontForNode:node];
+ if (![font isEqual:otherFont]) {
+ onlyOneFontInSelection = NO;
+ break;
+ }
+ if (node == endContainer)
+ break;
+ node = [treeWalker nextNode];
+ }
+ }
+ }
+
+ // FIXME: for now, return a bogus font that distinguishes the empty selection from the non-empty
+ // selection. We should be able to remove this once the rest of this code works properly.
+ if (font == nil) {
+ if (![bridge haveSelection]) {
+ font = [NSFont toolTipsFontOfSize:17];
+ } else {
+ font = [NSFont menuFontOfSize:23];
+ }
+ }
+ ASSERT(font != nil);
+
+ NSFontManager *fm = [NSFontManager sharedFontManager];
+ [fm setSelectedFont:font isMultiple:!onlyOneFontInSelection];
+ // FIXME: we don't keep track of selected attributes, or set them on the font panel. This
+ // appears to have no effect on the UI. E.g., underlined text in Mail or TextEdit is
+ // not reflected in the font panel. Maybe someday this will change.
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebHTMLViewInternal.h b/WebKit/WebView.subproj/WebHTMLViewInternal.h
new file mode 100644
index 0000000..9c473e6
--- /dev/null
+++ b/WebKit/WebView.subproj/WebHTMLViewInternal.h
@@ -0,0 +1,46 @@
+// Things internal to the WebKit framework; not SPI.
+
+#import <WebKit/WebHTMLViewPrivate.h>
+
+ at interface WebHTMLViewPrivate : NSObject
+{
+ at public
+ BOOL needsLayout;
+ BOOL needsToApplyStyles;
+ BOOL inWindow;
+ BOOL inNextValidKeyView;
+ BOOL ignoringMouseDraggedEvents;
+ BOOL printing;
+ BOOL initiatedDrag;
+ // Is WebCore handling drag destination duties (DHTML dragging)?
+ BOOL webCoreHandlingDrag;
+
+ id savedSubviews;
+ BOOL subviewsSetAside;
+
+ NSEvent *mouseDownEvent;
+
+ NSURL *draggingImageURL;
+
+ NSSize lastLayoutSize;
+ NSSize lastLayoutFrameSize;
+ BOOL laidOutAtLeastOnce;
+
+ NSPoint lastScrollPosition;
+
+ WebPluginController *pluginController;
+
+ NSString *toolTip;
+ id trackingRectOwner;
+ void *trackingRectUserData;
+
+ NSTimer *autoscrollTimer;
+ NSEvent *autoscrollTriggerEvent;
+
+ NSArray* pageRects;
+}
+ at end
+
+ at interface WebHTMLView (WebInternal)
+- (void)_updateFontPanel;
+ at end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index afd5153..a5a6fcc 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -14,45 +14,6 @@
@class WebFrame;
@class WebPluginController;
- at interface WebHTMLViewPrivate : NSObject
-{
- at public
- BOOL needsLayout;
- BOOL needsToApplyStyles;
- BOOL inWindow;
- BOOL inNextValidKeyView;
- BOOL ignoringMouseDraggedEvents;
- BOOL printing;
- BOOL initiatedDrag;
- // Is WebCore handling drag destination duties (DHTML dragging)?
- BOOL webCoreHandlingDrag;
-
- id savedSubviews;
- BOOL subviewsSetAside;
-
- NSEvent *mouseDownEvent;
-
- NSURL *draggingImageURL;
-
- NSSize lastLayoutSize;
- NSSize lastLayoutFrameSize;
- BOOL laidOutAtLeastOnce;
-
- NSPoint lastScrollPosition;
-
- WebPluginController *pluginController;
-
- NSString *toolTip;
- id trackingRectOwner;
- void *trackingRectUserData;
-
- NSTimer *autoscrollTimer;
- NSEvent *autoscrollTriggerEvent;
-
- NSArray* pageRects;
-}
- at end
-
@interface WebHTMLView (WebPrivate)
- (void)_reset;
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 3f82304..455af34 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -68,6 +68,15 @@
// <rdar://problem/3630640>: "Calling interpretKeyEvents: in a custom text view can fail to process keys right after app startup"
#import <AppKit/NSKeyBindingManager.h>
+ at interface NSSpellChecker (AppKitSecretsIKnow)
+- (void)_preflightChosenSpellServer;
+ at end
+
+ at interface WebView (WebFileInternal)
+- (void)_preflightSpellChecker;
+- (BOOL)_continuousCheckingAllowed;
+ at end
+
NSString *WebElementDOMNodeKey = @"WebElementDOMNode";
NSString *WebElementFrameKey = @"WebElementFrame";
NSString *WebElementImageKey = @"WebElementImage";
@@ -2124,6 +2133,42 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
return _private->drawsBackground;
}
+- (void)toggleSmartInsertDelete:(id)sender
+{
+ if ([self isEditable]) {
+ [self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
+ }
+}
+
+- (void)toggleContinuousSpellChecking:(id)sender
+{
+ if ([self isEditable]) {
+ [self setContinuousSpellCheckingEnabled:![self isContinuousSpellCheckingEnabled]];
+ }
+}
+
+- (BOOL)isContinuousGrammarCheckingEnabled
+{
+ return _private->continuousGrammarCheckingEnabled && [self _continuousCheckingAllowed];
+}
+
+- (void)setContinuousGrammarCheckingEnabled:(BOOL)flag
+{
+ _private->continuousGrammarCheckingEnabled = flag;
+ if ([self isContinuousGrammarCheckingEnabled]) {
+ [self _preflightSpellChecker];
+ } else {
+ // FIXME: Put code here to remove underlines for bad grammar.
+ }
+}
+
+- (void)toggleContinuousGrammarChecking:(id)sender
+{
+ if ([self isEditable]) {
+ [self setContinuousGrammarCheckingEnabled:![self isContinuousGrammarCheckingEnabled]];
+ }
+}
+
@end
@implementation WebView (WebViewPrintingPrivate)
@@ -2240,28 +2285,6 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
//==========================================================================================
// Editing
- at interface ElementOrTextFilter : NSObject <DOMNodeFilter>
-+ (ElementOrTextFilter *)filter;
- at end
-
-static ElementOrTextFilter *elementOrTextFilterInstance = nil;
-
- at implementation ElementOrTextFilter
-
-+ (ElementOrTextFilter *)filter
-{
- if (!elementOrTextFilterInstance)
- elementOrTextFilterInstance = [[ElementOrTextFilter alloc] init];
- return elementOrTextFilterInstance;
-}
-
-- (short)acceptNode:(DOMNode *)n
-{
- return ([n isKindOfClass:[DOMElement class]] || [n isKindOfClass:[DOMText class]]) ? DOM_FILTER_ACCEPT : DOM_FILTER_SKIP;
-}
-
- at end
-
@implementation WebView (WebViewCSS)
- (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement
@@ -2302,77 +2325,6 @@ static ElementOrTextFilter *elementOrTextFilterInstance = nil;
|| [[mainFrame provisionalDataSource] isLoading];
}
-// FIXME: Move to WebHTMLView.
-- (void)_updateFontPanel
-{
- // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
- // sure if we need to do something similar.
-
- if (![[self _bridgeForCurrentSelection] isSelectionEditable]) {
- return;
- }
-
- NSWindow *window = [self window];
- // FIXME: is this first-responder check correct? What happens if a subframe is editable and is first responder?
- if ([NSApp keyWindow] != window || [window firstResponder] != [[[self mainFrame] frameView] documentView]) {
- return;
- }
-
- BOOL onlyOneFontInSelection = YES;
- NSFont *font = nil;
- WebBridge *bridge = [self _bridgeForCurrentSelection];
-
- if (![bridge haveSelection]) {
- font = [bridge fontForCurrentPosition];
- }
- else {
- DOMRange *selection = [self selectedDOMRange];
- DOMNode *startContainer = [selection startContainer];
- DOMNode *endContainer = [selection endContainer];
-
- ASSERT(startContainer);
- ASSERT(endContainer);
- ASSERT([[ElementOrTextFilter filter] acceptNode:startContainer] == DOM_FILTER_ACCEPT);
- ASSERT([[ElementOrTextFilter filter] acceptNode:endContainer] == DOM_FILTER_ACCEPT);
-
- font = [bridge renderedFontForNode:startContainer];
-
- if (startContainer != endContainer) {
- DOMDocument *document = [bridge DOMDocument];
- DOMTreeWalker *treeWalker = [document createTreeWalker:document :DOM_SHOW_ALL :[ElementOrTextFilter filter] :NO];
- DOMNode *node = startContainer;
- [treeWalker setCurrentNode:node];
- while (node) {
- NSFont *otherFont = [bridge renderedFontForNode:node];
- if (![font isEqual:otherFont]) {
- onlyOneFontInSelection = NO;
- break;
- }
- if (node == endContainer)
- break;
- node = [treeWalker nextNode];
- }
- }
- }
-
- // FIXME: for now, return a bogus font that distinguishes the empty selection from the non-empty
- // selection. We should be able to remove this once the rest of this code works properly.
- if (font == nil) {
- if (![[self _bridgeForCurrentSelection] haveSelection]) {
- font = [NSFont toolTipsFontOfSize:17];
- } else {
- font = [NSFont menuFontOfSize:23];
- }
- }
- ASSERT(font != nil);
-
- NSFontManager *fm = [NSFontManager sharedFontManager];
- [fm setSelectedFont:font isMultiple:!onlyOneFontInSelection];
- // FIXME: we don't keep track of selected attributes, or set them on the font panel. This
- // appears to have no effect on the UI. E.g., underlined text in Mail or TextEdit is
- // not reflected in the font panel. Maybe someday this will change.
-}
-
@end
@implementation WebView (WebViewEditing)
@@ -2455,30 +2407,36 @@ static ElementOrTextFilter *elementOrTextFilterInstance = nil;
- (void)setSmartInsertDeleteEnabled:(BOOL)flag
{
- ERROR("unimplemented");
+ _private->smartInsertDeleteEnabled = flag;
}
- (BOOL)smartInsertDeleteEnabled
{
- ERROR("unimplemented");
- return NO;
+ return _private->smartInsertDeleteEnabled;
}
- (void)setContinuousSpellCheckingEnabled:(BOOL)flag
{
- ERROR("unimplemented");
+ _private->continuousSpellCheckingEnabled = flag;
+ if ([self isContinuousSpellCheckingEnabled]) {
+ [self _preflightSpellChecker];
+ } else {
+ // FIXME: Put code here to remove underlines for misspelled words.
+ }
}
- (BOOL)isContinuousSpellCheckingEnabled
{
- ERROR("unimplemented");
- return NO;
+ return _private->continuousSpellCheckingEnabled && [self _continuousCheckingAllowed];
}
- (int)spellCheckerDocumentTag
{
- ERROR("unimplemented");
- return 0;
+ if (!_private->hasSpellCheckerDocumentTag) {
+ _private->spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
+ _private->hasSpellCheckerDocumentTag = YES;
+ }
+ return _private->spellCheckerDocumentTag;
}
- (NSUndoManager *)undoManager
@@ -2990,3 +2948,35 @@ static ElementOrTextFilter *elementOrTextFilterInstance = nil;
}
@end
+
+ at implementation WebView (WebFileInternal)
+
+- (void)_preflightSpellCheckerNow:(id)sender
+{
+ [[NSSpellChecker sharedSpellChecker] _preflightChosenSpellServer];
+}
+
+- (void)_preflightSpellChecker
+{
+ // As AppKit does, we wish to delay tickling the shared spellc hecker into existence on application launch.
+ if ([NSSpellChecker sharedSpellCheckerExists]) {
+ [self _preflightSpellCheckerNow:self];
+ } else {
+ [self performSelector:@selector(_preflightSpellCheckerNow:) withObject:self afterDelay:2.0];
+ }
+}
+
+- (BOOL)_continuousCheckingAllowed
+{
+ static BOOL allowContinuousSpellChecking = YES;
+ static BOOL readAllowContinuousSpellCheckingDefault = NO;
+ if (!readAllowContinuousSpellCheckingDefault) {
+ if ([[NSUserDefaults standardUserDefaults] objectForKey:@"NSAllowContinuousSpellChecking"]) {
+ allowContinuousSpellChecking = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSAllowContinuousSpellChecking"];
+ }
+ readAllowContinuousSpellCheckingDefault = YES;
+ }
+ return allowContinuousSpellChecking;
+}
+
+ at end
diff --git a/WebKit/WebView.subproj/WebViewInternal.h b/WebKit/WebView.subproj/WebViewInternal.h
index 9a5a15e..f5414f2 100644
--- a/WebKit/WebView.subproj/WebViewInternal.h
+++ b/WebKit/WebView.subproj/WebViewInternal.h
@@ -2,11 +2,92 @@
#import <WebKit/WebViewPrivate.h>
+ at class DOMCSSStyleDeclaration;
+ at class WebBackForwardList;
+
+ at protocol WebDocumentDragging;
+
+ at interface WebViewPrivate : NSObject
+{
+ at public
+ WebFrame *mainFrame;
+
+ id UIDelegate;
+ id UIDelegateForwarder;
+ id resourceProgressDelegate;
+ id resourceProgressDelegateForwarder;
+ id downloadDelegate;
+ id policyDelegate;
+ id policyDelegateForwarder;
+ id frameLoadDelegate;
+ id frameLoadDelegateForwarder;
+ id <WebFormDelegate> formDelegate;
+ id editingDelegate;
+ id editingDelegateForwarder;
+
+ WebBackForwardList *backForwardList;
+ BOOL useBackForwardList;
+
+ float textSizeMultiplier;
+
+ NSString *applicationNameForUserAgent;
+ NSString *userAgent;
+ BOOL userAgentOverridden;
+
+ BOOL defersCallbacks;
+
+ NSString *setName;
+
+ WebPreferences *preferences;
+ WebCoreSettings *settings;
+
+ BOOL lastElementWasNonNil;
+
+ NSWindow *hostWindow;
+
+ int programmaticFocusCount;
+
+ WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
+
+ long long totalPageAndResourceBytesToLoad;
+ long long totalBytesReceived;
+ double progressValue;
+ double lastNotifiedProgressValue;
+ double lastNotifiedProgressTime;
+ double progressNotificationInterval;
+ double progressNotificationTimeInterval;
+ BOOL finalProgressChangedSent;
+ WebFrame *orginatingProgressFrame;
+
+ int numProgressTrackedFrames;
+ NSMutableDictionary *progressItems;
+
+ void *observationInfo;
+
+ BOOL drawsBackground;
+ BOOL editable;
+ BOOL initiatedDrag;
+ BOOL doWebKitDragReponse; // should we do the built-in WebKit handling of incoming drags?
+
+ NSString *mediaStyle;
+
+ NSView <WebDocumentDragging> *draggingDocumentView;
+
+ DOMCSSStyleDeclaration *typingStyle;
+
+ BOOL hasSpellCheckerDocumentTag;
+ int spellCheckerDocumentTag;
+
+ BOOL continuousSpellCheckingEnabled;
+ BOOL continuousGrammarCheckingEnabled;
+ BOOL smartInsertDeleteEnabled;
+}
+ at end
+
@interface WebView (WebInternal)
- (WebFrame *)_frameForCurrentSelection;
- (WebBridge *)_bridgeForCurrentSelection;
- (BOOL)_isLoading;
-- (void)_updateFontPanel;
@end;
@interface WebView (WebViewEditingExtras)
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 1142427..c245743 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -6,18 +6,13 @@
#import <WebKit/WebView.h>
#import <WebKit/WebFramePrivate.h>
- at class DOMCSSStyleDeclaration;
@class NSError;
- at class WebBackForwardList;
@class WebFrame;
@class WebPreferences;
@class WebCoreSettings;
- at protocol WebDocumentDragging;
@protocol WebFormDelegate;
-#define NUM_LOCATION_CHANGE_DELEGATE_SELECTORS 10
-
typedef struct _WebResourceDelegateImplementationCache {
uint delegateImplementsDidCancelAuthenticationChallenge:1;
uint delegateImplementsDidReceiveAuthenticationChallenge:1;
@@ -36,76 +31,6 @@ extern NSString *_WebMainFrameIconKey;
extern NSString *_WebMainFrameTitleKey;
extern NSString *_WebMainFrameURLKey;
- at interface WebViewPrivate : NSObject
-{
- at public
- WebFrame *mainFrame;
-
- id UIDelegate;
- id UIDelegateForwarder;
- id resourceProgressDelegate;
- id resourceProgressDelegateForwarder;
- id downloadDelegate;
- id policyDelegate;
- id policyDelegateForwarder;
- id frameLoadDelegate;
- id frameLoadDelegateForwarder;
- id <WebFormDelegate> formDelegate;
- id editingDelegate;
- id editingDelegateForwarder;
-
- WebBackForwardList *backForwardList;
- BOOL useBackForwardList;
-
- float textSizeMultiplier;
-
- NSString *applicationNameForUserAgent;
- NSString *userAgent;
- BOOL userAgentOverridden;
-
- BOOL defersCallbacks;
-
- NSString *setName;
-
- WebPreferences *preferences;
- WebCoreSettings *settings;
-
- BOOL lastElementWasNonNil;
-
- NSWindow *hostWindow;
-
- int programmaticFocusCount;
-
- WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
-
- long long totalPageAndResourceBytesToLoad;
- long long totalBytesReceived;
- double progressValue;
- double lastNotifiedProgressValue;
- double lastNotifiedProgressTime;
- double progressNotificationInterval;
- double progressNotificationTimeInterval;
- BOOL finalProgressChangedSent;
- WebFrame *orginatingProgressFrame;
-
- int numProgressTrackedFrames;
- NSMutableDictionary *progressItems;
-
- void *observationInfo;
-
- BOOL drawsBackground;
- BOOL editable;
- BOOL initiatedDrag;
- BOOL doWebKitDragReponse; // should we do the built-in WebKit handling of incoming drags?
-
- NSString *mediaStyle;
-
- NSView <WebDocumentDragging> *draggingDocumentView;
-
- DOMCSSStyleDeclaration *typingStyle;
-}
- at end
-
@interface WebView (WebPendingPublic)
- (void)setMainFrameURL:(NSString *)URLString;
@@ -117,6 +42,14 @@ extern NSString *_WebMainFrameURLKey;
- (void)setDrawsBackground:(BOOL)drawsBackround;
- (BOOL)drawsBackground;
+- (void)toggleContinuousSpellChecking:(id)sender;
+
+- (BOOL)isContinuousGrammarCheckingEnabled;
+- (void)setContinuousGrammarCheckingEnabled:(BOOL)flag;
+- (void)toggleContinuousGrammarChecking:(id)sender;
+
+- (void)toggleSmartInsertDelete:(id)sender;
+
@end
@interface WebView (WebPrivate)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list