Changeset 15093 in webkit


Ignore:
Timestamp:
Jun 29, 2006, 11:18:42 AM (19 years ago)
Author:
thatcher
Message:

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:
Location:
trunk/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r15091 r15093  
     12006-06-29  Timothy Hatcher  <timothy@apple.com>
     2
     3        Reviewed by Harrison.
     4
     5        Smart insert and delete, continuous spell checking and autoscroll
     6        can now be used for any WebView, not just editable ones. All of
     7        these make sense for documents that might contain content editable
     8        areas or our new text fields. Autoscroll is usefull for dragging
     9        for file input controls also.
     10
     11        Added a SPI to toggle WebViews tab key behavior, tabKeyCyclesThroughElements.
     12        WebHTMLView's _interceptEditingKeyEvent now uses WebView's
     13        tabKeyCyclesThroughElements state to determine whether or not
     14        to process tab key events. The idea here is that tabKeyCyclesThroughElements
     15        will be YES when this WebView is being used in a browser, and we
     16        desire the behavior where tab moves to the next element in tab order.
     17        If tabKeyCyclesThroughElements is NO, it is likely that the WebView
     18        is being embedded as the whole view, as in Mail, and tabs should input
     19        tabs as expected in a text editor. Using Option-Tab always cycles
     20        through elements.
     21
     22        * WebView/WebHTMLRepresentation.m:
     23        (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
     24        * WebView/WebHTMLView.m:
     25        (-[NSArray _interceptEditingKeyEvent:]):
     26        * WebView/WebView.m:
     27        (-[WebViewPrivate init]):
     28        (-[WebView _autoscrollForDraggingInfo:timeDelta:]):
     29        (-[WebView _shouldAutoscrollForDraggingInfo:]):
     30        (-[WebView validateUserInterfaceItem:]):
     31        (-[WebView toggleSmartInsertDelete:]):
     32        (-[WebView toggleContinuousSpellChecking:]):
     33        (-[WebView setTabKeyCyclesThroughElements:]):
     34        (-[WebView tabKeyCyclesThroughElements]):
     35        * WebView/WebViewPrivate.h:
     36
    1372006-06-29  Anders Carlsson  <acarlsson@apple.com>
    238
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r15091 r15093  
    279279/* End PBXBuildFile section */
    280280
    281 /* Begin PBXBuildStyle section */
    282                 BCEED1470A53334500443D9A /* Development */ = {
    283                         isa = PBXBuildStyle;
    284                         buildSettings = {
    285                                 COPY_PHASE_STRIP = NO;
    286                         };
    287                         name = Development;
    288                 };
    289                 BCEED1480A53334500443D9A /* Deployment */ = {
    290                         isa = PBXBuildStyle;
    291                         buildSettings = {
    292                                 COPY_PHASE_STRIP = YES;
    293                         };
    294                         name = Deployment;
    295                 };
    296 /* End PBXBuildStyle section */
    297 
    298281/* Begin PBXFileReference section */
    299282                1C0706620A431E01001078F6 /* WebScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    12481231                        isa = PBXProject;
    12491232                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
    1250                         buildSettings = {
    1251                         };
    1252                         buildStyles = (
    1253                                 BCEED1470A53334500443D9A /* Development */,
    1254                                 BCEED1480A53334500443D9A /* Deployment */,
    1255                         );
    12561233                        hasScannedForEncodings = 1;
    12571234                        knownRegions = (
  • trunk/WebKit/WebView/WebHTMLRepresentation.m

    r14811 r15093  
    193193       
    194194        WebView *webView = [frame webView];
    195         if ([webView isEditable]) {
     195        if ([webView isEditable])
    196196            [_private->bridge applyEditingStyleToBodyElement];
    197         }
    198197    }
    199198}
  • trunk/WebKit/WebView/WebHTMLView.m

    r14987 r15093  
    34733473- (BOOL)_interceptEditingKeyEvent:(NSEvent *)event
    34743474{   
    3475     // Use the isEditable state to determine whether or not to process tab key events.
    3476     // The idea here is that isEditable will be NO when this WebView is being used
    3477     // in a browser, and we desire the behavior where tab moves to the next element
    3478     // in tab order. If isEditable is YES, it is likely that the WebView is being
    3479     // embedded as the whole view, as in Mail, and tabs should input tabs as expected
    3480     // in a text editor.
    3481     if (![[self _webView] isEditable] && [event _web_isTabKeyEvent])
     3475    // Use WebView's tabKeyCyclesThroughElements state to determine whether or not
     3476    // to process tab key events. The idea here is that tabKeyCyclesThroughElements
     3477    // will be YES when this WebView is being used in a browser, and we desire the
     3478    // behavior where tab moves to the next element in tab order. If tabKeyCyclesThroughElements
     3479    // is NO, it is likely that the WebView is being embedded as the whole view, as in Mail,
     3480    // and tabs should input tabs as expected in a text editor. Using Option-Tab always cycles
     3481    // through elements.
     3482
     3483    if ([[self _webView] tabKeyCyclesThroughElements] && [event _web_isTabKeyEvent])
    34823484        return NO;
    3483    
     3485
     3486    if (![[self _webView] tabKeyCyclesThroughElements] && [event _web_isOptionTabKeyEvent])
     3487        return NO;
     3488
    34843489    // Now process the key normally
    34853490    [self interpretKeyEvents:[NSArray arrayWithObject:event]];
  • trunk/WebKit/WebView/WebView.m

    r15049 r15093  
    276276    BOOL editable;
    277277    BOOL initiatedDrag;
    278        
     278    BOOL tabKeyCyclesThroughElements;
     279
    279280    NSString *mediaStyle;
    280281   
     
    375376    settings = [[WebCoreSettings alloc] init];
    376377    dashboardBehaviorAllowWheelScrolling = YES;
     378    tabKeyCyclesThroughElements = YES;
    377379
    378380    return self;
     
    22312233- (void)_autoscrollForDraggingInfo:(id)draggingInfo timeDelta:(NSTimeInterval)repeatDelta
    22322234{
    2233     if (![self isEditable])
    2234         return;
    2235    
    22362235    NSView <WebDocumentView> *documentView = [self documentViewAtWindowPoint:[draggingInfo draggingLocation]];
    22372236    [documentView _autoscrollForDraggingInfo:draggingInfo timeDelta:repeatDelta];
     
    22402239- (BOOL)_shouldAutoscrollForDraggingInfo:(id)draggingInfo
    22412240{
    2242     if (![self isEditable])
    2243         return NO;
    2244    
    22452241    NSView <WebDocumentView> *documentView = [self documentViewAtWindowPoint:[draggingInfo draggingLocation]];
    22462242    return [documentView _shouldAutoscrollForDraggingInfo:draggingInfo];
     
    26092605        BOOL checkMark = NO;
    26102606        BOOL retVal = NO;
    2611         if ([self isEditable] && [self _continuousCheckingAllowed]) {
     2607        if ([self _continuousCheckingAllowed]) {
    26122608            checkMark = [self isContinuousSpellCheckingEnabled];
    26132609            retVal = YES;
     
    26962692- (void)toggleSmartInsertDelete:(id)sender
    26972693{
    2698     if ([self isEditable]) {
    2699         [self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
    2700     }
     2694    [self setSmartInsertDeleteEnabled:![self smartInsertDeleteEnabled]];
    27012695}
    27022696
    27032697- (IBAction)toggleContinuousSpellChecking:(id)sender
    27042698{
    2705     if ([self isEditable]) {
    2706         [self setContinuousSpellCheckingEnabled:![self isContinuousSpellCheckingEnabled]];
    2707     }
     2699    [self setContinuousSpellCheckingEnabled:![self isContinuousSpellCheckingEnabled]];
    27082700}
    27092701
     
    27462738    BOOL notAlreadyStandard = _private->textSizeMultiplier != 1.0;
    27472739    [self _performTextSizingSelector:@selector(_makeTextStandardSize:) withObject:sender onTrackingDocs:notAlreadyStandard selForNonTrackingDocs:@selector(_canMakeTextStandardSize) newScaleFactor:1.0];
     2740}
     2741
     2742- (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements
     2743{
     2744    _private->tabKeyCyclesThroughElements = cyclesElements;
     2745}
     2746
     2747- (BOOL)tabKeyCyclesThroughElements
     2748{
     2749    return _private->tabKeyCyclesThroughElements;
    27482750}
    27492751
  • trunk/WebKit/WebView/WebViewPrivate.h

    r15049 r15093  
    9393- (IBAction)makeTextStandardSize:(id)sender;
    9494
     95- (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements;
     96- (BOOL)tabKeyCyclesThroughElements;
     97
    9598// If true, the selection will be maintained even when the first responder is outside
    9699// of the webview. Returns true only if self is editable at this level. Subclasses can
Note: See TracChangeset for help on using the changeset viewer.