Commit eb1db16a authored by thatcher's avatar thatcher

Reviewed by Harrison.

        Smart insert and delete, continuous spell checking and autoscroll
        can now be used for any WebView, not just editable ones. All of
        these make sense for documents that might contain content editable 
        areas or our new text fields. Autoscroll is usefull for dragging
        for file input controls also.

        Added a SPI to toggle WebViews tab key behavior, tabKeyCyclesThroughElements.
        WebHTMLView's _interceptEditingKeyEvent now uses WebView's
        tabKeyCyclesThroughElements state to determine whether or not
        to process tab key events. The idea here is that tabKeyCyclesThroughElements
        will be YES when this WebView is being used in a browser, and we
        desire the behavior where tab moves to the next element in tab order.
        If tabKeyCyclesThroughElements is NO, it is likely that the WebView
        is being embedded as the whole view, as in Mail, and tabs should input
        tabs as expected in a text editor. Using Option-Tab always cycles
        through elements.

        * WebView/WebHTMLRepresentation.m:
        (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
        * WebView/WebHTMLView.m:
        (-[NSArray _interceptEditingKeyEvent:]):
        * WebView/WebView.m:
        (-[WebViewPrivate init]):
        (-[WebView _autoscrollForDraggingInfo:timeDelta:]):
        (-[WebView _shouldAutoscrollForDraggingInfo:]):
        (-[WebView validateUserInterfaceItem:]):
        (-[WebView toggleSmartInsertDelete:]):
        (-[WebView toggleContinuousSpellChecking:]):
        (-[WebView setTabKeyCyclesThroughElements:]):
        (-[WebView tabKeyCyclesThroughElements]):
        * WebView/WebViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f769e308
2006-06-29 Timothy Hatcher <timothy@apple.com>
Reviewed by Harrison.
Smart insert and delete, continuous spell checking and autoscroll
can now be used for any WebView, not just editable ones. All of
these make sense for documents that might contain content editable
areas or our new text fields. Autoscroll is usefull for dragging
for file input controls also.
Added a SPI to toggle WebViews tab key behavior, tabKeyCyclesThroughElements.
WebHTMLView's _interceptEditingKeyEvent now uses WebView's
tabKeyCyclesThroughElements state to determine whether or not
to process tab key events. The idea here is that tabKeyCyclesThroughElements
will be YES when this WebView is being used in a browser, and we
desire the behavior where tab moves to the next element in tab order.
If tabKeyCyclesThroughElements is NO, it is likely that the WebView
is being embedded as the whole view, as in Mail, and tabs should input
tabs as expected in a text editor. Using Option-Tab always cycles
through elements.
* WebView/WebHTMLRepresentation.m:
(-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
* WebView/WebHTMLView.m:
(-[NSArray _interceptEditingKeyEvent:]):
* WebView/WebView.m:
(-[WebViewPrivate init]):
(-[WebView _autoscrollForDraggingInfo:timeDelta:]):
(-[WebView _shouldAutoscrollForDraggingInfo:]):
(-[WebView validateUserInterfaceItem:]):
(-[WebView toggleSmartInsertDelete:]):
(-[WebView toggleContinuousSpellChecking:]):
(-[WebView setTabKeyCyclesThroughElements:]):
(-[WebView tabKeyCyclesThroughElements]):
* WebView/WebViewPrivate.h:
2006-06-29 Anders Carlsson <acarlsson@apple.com>
Reviewed by Tim O.
......
......@@ -278,23 +278,6 @@
ED7F6D8B0980683500C235ED /* WebNSDataExtrasPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
BCEED1470A53334500443D9A /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
BCEED1480A53334500443D9A /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXFileReference section */
1C0706620A431E01001078F6 /* WebScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
1C07073C0A433BD8001078F6 /* WebScriptDebugServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebScriptDebugServer.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -1247,12 +1230,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
buildSettings = {
};
buildStyles = (
BCEED1470A53334500443D9A /* Development */,
BCEED1480A53334500443D9A /* Deployment */,
);
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -191,9 +191,8 @@ - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
}
WebView *webView = [frame webView];
if ([webView isEditable]) {
if ([webView isEditable])
[_private->bridge applyEditingStyleToBodyElement];
}
}
}
......
......@@ -3472,15 +3472,20 @@ - (void)endDocument
- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event
{
// Use the isEditable state to determine whether or not to process tab key events.
// The idea here is that isEditable will be NO when this WebView is being used
// in a browser, and we desire the behavior where tab moves to the next element
// in tab order. If isEditable is YES, it is likely that the WebView is being
// embedded as the whole view, as in Mail, and tabs should input tabs as expected
// in a text editor.
if (![[self _webView] isEditable] && [event _web_isTabKeyEvent])
// Use WebView's tabKeyCyclesThroughElements state to determine whether or not
// to process tab key events. The idea here is that tabKeyCyclesThroughElements
// will be YES when this WebView is being used in a browser, and we desire the
// behavior where tab moves to the next element in tab order. If tabKeyCyclesThroughElements
// is NO, it is likely that the WebView is being embedded as the whole view, as in Mail,
// and tabs should input tabs as expected in a text editor. Using Option-Tab always cycles
// through elements.
if ([[self _webView] tabKeyCyclesThroughElements] && [event _web_isTabKeyEvent])
return NO;
if (![[self _webView] tabKeyCyclesThroughElements] && [event _web_isOptionTabKeyEvent])
return NO;
// Now process the key normally
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
return YES;
......
......@@ -275,7 +275,8 @@ @interface WebViewPrivate : NSObject
BOOL drawsBackground;
BOOL editable;
BOOL initiatedDrag;
BOOL tabKeyCyclesThroughElements;
NSString *mediaStyle;
NSView <WebDocumentDragging> *draggingDocumentView;
......@@ -374,6 +375,7 @@ @implementation WebViewPrivate
progressNotificationTimeInterval = 0.1;
settings = [[WebCoreSettings alloc] init];
dashboardBehaviorAllowWheelScrolling = YES;
tabKeyCyclesThroughElements = YES;
return self;
}
......@@ -2230,18 +2232,12 @@ - (NSDragOperation)_delegateDragOperationForDraggingInfo:(id <NSDraggingInfo>)dr
// Forward these calls to the document subview to make its scroll view scroll.
- (void)_autoscrollForDraggingInfo:(id)draggingInfo timeDelta:(NSTimeInterval)repeatDelta
{
if (![self isEditable])
return;
NSView <WebDocumentView> *documentView = [self documentViewAtWindowPoint:[draggingInfo draggingLocation]];
[documentView _autoscrollForDraggingInfo:draggingInfo timeDelta:repeatDelta];
}
- (BOOL)_shouldAutoscrollForDraggingInfo:(id)draggingInfo
{
if (![self isEditable])
return NO;
NSView <WebDocumentView> *documentView = [self documentViewAtWindowPoint:[draggingInfo draggingLocation]];
return [documentView _shouldAutoscrollForDraggingInfo:draggingInfo];
}
......@@ -2608,7 +2604,7 @@ - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
} else if (action == @selector(toggleContinuousSpellChecking:)) {
BOOL checkMark = NO;
BOOL retVal = NO;
if ([self isEditable] && [self _continuousCheckingAllowed]) {
if ([self _continuousCheckingAllowed]) {
checkMark = [self isContinuousSpellCheckingEnabled];
retVal = YES;
}
......@@ -2695,16 +2691,12 @@ - (BOOL)drawsBackground
- (void)toggleSmartInsertDelete:(id)sender
{
if ([self isEditable]) {
[self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
}
[self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
}
- (IBAction)toggleContinuousSpellChecking:(id)sender
{
if ([self isEditable]) {
[self setContinuousSpellCheckingEnabled:![self isContinuousSpellCheckingEnabled]];
}
[self setContinuousSpellCheckingEnabled:![self isContinuousSpellCheckingEnabled]];
}
- (BOOL)maintainsInactiveSelection
......@@ -2747,6 +2739,16 @@ - (IBAction)makeTextStandardSize:(id)sender
[self _performTextSizingSelector:@selector(_makeTextStandardSize:) withObject:sender onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize) newScaleFactor:1.0];
}
- (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements
{
_private->tabKeyCyclesThroughElements = cyclesElements;
}
- (BOOL)tabKeyCyclesThroughElements
{
return _private->tabKeyCyclesThroughElements;
}
- (void)setScriptDebugDelegate:delegate
{
_private->scriptDebugDelegate = delegate;
......
......@@ -92,6 +92,9 @@ typedef enum {
- (BOOL)canMakeTextStandardSize;
- (IBAction)makeTextStandardSize:(id)sender;
- (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements;
- (BOOL)tabKeyCyclesThroughElements;
// If true, the selection will be maintained even when the first responder is outside
// of the webview. Returns true only if self is editable at this level. Subclasses can
// override to enforce additional criteria.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment