Changeset 38278 in webkit


Ignore:
Timestamp:
Nov 10, 2008 4:29:54 PM (15 years ago)
Author:
andersca@apple.com
Message:

2008-11-10 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Move even more code down to WebBaseNetscapePluginView, get rid of some unnecessary methods.


  • Plugins/WebBaseNetscapePluginView.h:
  • Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView focusChanged]): (-[WebBaseNetscapePluginView visibleRect]): (-[WebBaseNetscapePluginView acceptsFirstResponder]): (-[WebBaseNetscapePluginView setHasFocus:]): (-[WebBaseNetscapePluginView becomeFirstResponder]): (-[WebBaseNetscapePluginView resignFirstResponder]):
  • Plugins/WebNetscapePluginView.h:
  • Plugins/WebNetscapePluginView.mm: (-[WebNetscapePluginView focusChanged]): (-[WebNetscapePluginView tellQuickTimeToChill]): (-[WebNetscapePluginView updateAndSetWindow]): (-[WebNetscapePluginView start]): (-[WebNetscapePluginView stop]): (-[WebNetscapePluginView viewWillMoveToWindow:]): (-[WebNetscapePluginView createPluginScriptableObject]): (-[WebNetscapePluginView pluginView:receivedData:]): (-[WebNetscapePluginView pluginView:receivedError:]): (-[WebNetscapePluginView pluginViewFinishedLoading:]): (-[WebNetscapePluginView inputContext]): (-[WebNetscapePluginView hasMarkedText]): (-[WebNetscapePluginView insertText:]): (-[WebNetscapePluginView markedRange]): (-[WebNetscapePluginView selectedRange]): (-[WebNetscapePluginView setMarkedText:selectedRange:]): (-[WebNetscapePluginView unmarkText]): (-[WebNetscapePluginView validAttributesForMarkedText]): (-[WebNetscapePluginView attributedSubstringFromRange:]): (-[WebNetscapePluginView characterIndexForPoint:]): (-[WebNetscapePluginView doCommandBySelector:]): (-[WebNetscapePluginView firstRectForCharacterRange:]): (-[WebNetscapePluginView _viewHasMoved]): (-[WebNetscapePluginView _redeliverStream]):
Location:
trunk/WebKit/mac
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/mac/ChangeLog

    r38277 r38278  
     12008-11-10  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Move even more code down to WebBaseNetscapePluginView, get rid of some unnecessary methods.
     6       
     7        * Plugins/WebBaseNetscapePluginView.h:
     8        * Plugins/WebBaseNetscapePluginView.mm:
     9        (-[WebBaseNetscapePluginView focusChanged]):
     10        (-[WebBaseNetscapePluginView visibleRect]):
     11        (-[WebBaseNetscapePluginView acceptsFirstResponder]):
     12        (-[WebBaseNetscapePluginView setHasFocus:]):
     13        (-[WebBaseNetscapePluginView becomeFirstResponder]):
     14        (-[WebBaseNetscapePluginView resignFirstResponder]):
     15        * Plugins/WebNetscapePluginView.h:
     16        * Plugins/WebNetscapePluginView.mm:
     17        (-[WebNetscapePluginView focusChanged]):
     18        (-[WebNetscapePluginView tellQuickTimeToChill]):
     19        (-[WebNetscapePluginView updateAndSetWindow]):
     20        (-[WebNetscapePluginView start]):
     21        (-[WebNetscapePluginView stop]):
     22        (-[WebNetscapePluginView viewWillMoveToWindow:]):
     23        (-[WebNetscapePluginView createPluginScriptableObject]):
     24        (-[WebNetscapePluginView pluginView:receivedData:]):
     25        (-[WebNetscapePluginView pluginView:receivedError:]):
     26        (-[WebNetscapePluginView pluginViewFinishedLoading:]):
     27        (-[WebNetscapePluginView inputContext]):
     28        (-[WebNetscapePluginView hasMarkedText]):
     29        (-[WebNetscapePluginView insertText:]):
     30        (-[WebNetscapePluginView markedRange]):
     31        (-[WebNetscapePluginView selectedRange]):
     32        (-[WebNetscapePluginView setMarkedText:selectedRange:]):
     33        (-[WebNetscapePluginView unmarkText]):
     34        (-[WebNetscapePluginView validAttributesForMarkedText]):
     35        (-[WebNetscapePluginView attributedSubstringFromRange:]):
     36        (-[WebNetscapePluginView characterIndexForPoint:]):
     37        (-[WebNetscapePluginView doCommandBySelector:]):
     38        (-[WebNetscapePluginView firstRectForCharacterRange:]):
     39        (-[WebNetscapePluginView _viewHasMoved]):
     40        (-[WebNetscapePluginView _redeliverStream]):
     41
    1422008-11-10  Anders Carlsson  <andersca@apple.com>
    243
  • trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.h

    r38277 r38278  
    7474- (void)handleMouseMoved:(NSEvent *)event;
    7575- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
     76- (void)focusChanged;
    7677
    7778- (WebFrame *)webFrame;
     
    8586- (void)stopTimers;
    8687- (void)startTimers;
     88- (void)restartTimers;
    8789
    88 - (void)restartTimers;
     90- (void)setHasFocus:(BOOL)hasFocus;
    8991
    9092@end
  • trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm

    r38277 r38278  
    3131#import "WebBaseNetscapePluginView.h"
    3232
    33 #import "WebKitSystemInterface.h"
    3433#import "WebFrameInternal.h"
    3534#import "WebKitLogging.h"
     35#import "WebKitSystemInterface.h"
    3636#import "WebView.h"
    3737
     
    3939#import <WebCore/Document.h>
    4040#import <WebCore/Element.h>
     41#import <WebKit/DOMPrivate.h>
    4142#import <wtf/Assertions.h>
    4243
     
    103104
    104105- (void)handleMouseMoved:(NSEvent *)event
     106{
     107    ASSERT_NOT_REACHED();
     108}
     109
     110- (void)focusChanged
    105111{
    106112    ASSERT_NOT_REACHED();
     
    153159}
    154160
     161- (NSRect)visibleRect
     162{
     163    // WebCore may impose an additional clip (via CSS overflow or clip properties).  Fetch
     164    // that clip now.   
     165    return NSIntersectionRect([self convertRect:[_element.get() _windowClipRect] fromView:nil], [super visibleRect]);
     166}
     167
     168- (BOOL)acceptsFirstResponder
     169{
     170    return YES;
     171}
     172
     173- (void)setHasFocus:(BOOL)flag
     174{
     175    if (!_isStarted)
     176        return;
     177   
     178    if (_hasFocus == flag)
     179        return;
     180   
     181    _hasFocus = flag;
     182   
     183    [self focusChanged];
     184}
     185
     186- (BOOL)becomeFirstResponder
     187{
     188    [self setHasFocus:YES];
     189    return YES;
     190}
     191
     192- (BOOL)resignFirstResponder
     193{
     194    [self setHasFocus:NO];   
     195    return YES;
     196}
     197
    155198- (WebDataSource *)dataSource
    156199{
  • trunk/WebKit/mac/Plugins/WebNetscapePluginView.h

    r38277 r38278  
    119119
    120120
    121 - (BOOL)start;
    122 - (BOOL)isStarted;
     121- (void)start;
    123122- (void)stop;
    124123
  • trunk/WebKit/mac/Plugins/WebNetscapePluginView.mm

    r38277 r38278  
    289289}
    290290
    291 - (NSRect)visibleRect
    292 {
    293     // WebCore may impose an additional clip (via CSS overflow or clip properties).  Fetch
    294     // that clip now.   
    295     return NSIntersectionRect([self convertRect:[_element.get() _windowClipRect] fromView:nil], [super visibleRect]);
    296 }
    297 
    298291- (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate
    299292{
     
    744737}
    745738
    746 - (BOOL)acceptsFirstResponder
    747 {
    748     return YES;
    749 }
    750 
    751 - (void)setHasFocus:(BOOL)flag
    752 {
    753     if (!_isStarted)
    754         return;
    755 
    756     if (_hasFocus == flag)
    757         return;
    758    
    759     _hasFocus = flag;
    760    
     739- (void)focusChanged
     740{
    761741    // We need to null check the event handler here because
    762742    // the plug-in view can resign focus after it's been stopped
     
    764744    if (_eventHandler)
    765745        _eventHandler->focusChanged(_hasFocus);
    766 }
    767 
    768 - (BOOL)becomeFirstResponder
    769 {
    770     [self setHasFocus:YES];
    771     return YES;
    772 }
    773 
    774 - (BOOL)resignFirstResponder
    775 {
    776     [self setHasFocus:NO];   
    777     return YES;
    778746}
    779747
     
    931899}
    932900
     901-(void)tellQuickTimeToChill
     902{
     903#ifndef NP_NO_QUICKDRAW
     904    ASSERT(isDrawingModelQuickDraw(drawingModel));
     905   
     906    // Make a call to the secret QuickDraw API that makes QuickTime calm down.
     907    WindowRef windowRef = (WindowRef)[[self window] windowRef];
     908    if (!windowRef) {
     909        return;
     910    }
     911    CGrafPtr port = GetWindowPort(windowRef);
     912    ::Rect bounds;
     913    GetPortBounds(port, &bounds);
     914    WKCallDrawingNotification(port, &bounds);
     915#endif /* NP_NO_QUICKDRAW */
     916}
     917
    933918- (void)updateAndSetWindow
    934919{
    935     ASSERT(drawingModel != NPDrawingModelCoreAnimation);
     920    if (drawingModel != NPDrawingModelCoreAnimation)
     921        return;
    936922
    937923    // A plug-in can only update if it's (1) already been started (2) isn't stopped
     
    947933        return;
    948934#else
    949     if (drawingModel != NPDrawingModelQuickDraw && ![self canDraw])
    950         return;
     935    if (drawingModel == NPDrawingModelQuickDraw)
     936        [self tellQuickTimeToChill];
     937    else if (![self canDraw])
     938        return;
     939   
    951940#endif // NP_NO_QUICKDRAW
    952941   
     
    10701059}
    10711060
    1072 - (BOOL)start
     1061- (void)start
    10731062{
    10741063    ASSERT([self currentWindow]);
    10751064   
    10761065    if (_isStarted)
    1077         return YES;
     1066        return;
    10781067
    10791068    ASSERT([self webView]);
    10801069   
    10811070    if (![[[self webView] preferences] arePlugInsEnabled])
    1082         return NO;
     1071        return;
    10831072
    10841073    // Open the plug-in package so it remains loaded while our plugin uses it
     
    10961085        [self _destroyPlugin];
    10971086        [_pluginPackage.get() close];
    1098         return NO;
     1087        return;
    10991088    }
    11001089   
     
    11241113        [_pluginPackage.get() close];
    11251114       
    1126         return NO;
     1115        return;
    11271116    }       
    11281117#endif // NP_NO_CARBON
     
    11621151    [[self webView] addPluginInstanceView:self];
    11631152
    1164     if (drawingModel == NPDrawingModelCoreGraphics || isDrawingModelQuickDraw(drawingModel))
    1165         [self updateAndSetWindow];
     1153    [self updateAndSetWindow];
    11661154
    11671155    if ([self window]) {
     
    11771165    if (_loadManually) {
    11781166        [self _redeliverStream];
    1179         return YES;
     1167        return;
    11801168    }
    11811169   
     
    11871175        [self loadRequest:request inTarget:nil withNotifyData:nil sendNotification:NO];
    11881176    }
    1189    
    1190     return YES;
    11911177}
    11921178
     
    12101196   
    12111197    [[self webView] removePluginInstanceView:self];
    1212 
     1198   
     1199    // Stop the timers
     1200    [self stopTimers];
     1201   
     1202    // Stop notifications and callbacks.
     1203    [self removeWindowObservers];
     1204   
    12131205    // To stop active streams it's necessary to invoke stop() on a copy
    12141206    // of streams. This is because calling WebNetscapePluginStream::stop() also has the side effect
     
    12191211        streamsCopy[i]->stop();
    12201212   
    1221     // Stop the timers
    1222     [self stopTimers];
    1223    
    1224     // Stop notifications and callbacks.
    1225     [self removeWindowObservers];
    12261213    [[_pendingFrameLoads.get() allKeys] makeObjectsPerformSelector:@selector(_setInternalLoadDelegate:) withObject:nil];
    12271214    [NSObject cancelPreviousPerformRequestsWithTarget:self];
     
    12401227   
    12411228    textInputFuncs = 0;
    1242 }
    1243 
    1244 - (BOOL)isStarted
    1245 {
    1246     return _isStarted;
    12471229}
    12481230
     
    14271409}
    14281410
    1429 -(void)tellQuickTimeToChill
    1430 {
    1431 #ifndef NP_NO_QUICKDRAW
    1432     ASSERT(isDrawingModelQuickDraw(drawingModel));
    1433    
    1434     // Make a call to the secret QuickDraw API that makes QuickTime calm down.
    1435     WindowRef windowRef = (WindowRef)[[self window] windowRef];
    1436     if (!windowRef) {
    1437         return;
    1438     }
    1439     CGrafPtr port = GetWindowPort(windowRef);
    1440     ::Rect bounds;
    1441     GetPortBounds(port, &bounds);
    1442     WKCallDrawingNotification(port, &bounds);
    1443 #endif /* NP_NO_QUICKDRAW */
    1444 }
    1445 
    14461411- (void)viewWillMoveToWindow:(NSWindow *)newWindow
    14471412{
    1448     if (isDrawingModelQuickDraw(drawingModel))
    1449         [self tellQuickTimeToChill];
    1450 
    14511413    // We must remove the tracking rect before we move to the new window.
    14521414    // Once we move to the new window, it will be too late.
     
    15891551- (NPObject *)createPluginScriptableObject
    15901552{
    1591     if (![_pluginPackage.get() pluginFuncs]->getvalue || ![self isStarted])
     1553    if (![_pluginPackage.get() pluginFuncs]->getvalue || !_isStarted)
    15921554        return NULL;
    15931555       
     
    16421604    _dataLengthReceived += [data length];
    16431605   
    1644     if (![self isStarted])
     1606    if (!_isStarted)
    16451607        return;
    16461608
     
    16641626    _error = error;
    16651627   
    1666     if (![self isStarted]) {
     1628    if (!_isStarted) {
    16671629        return;
    16681630    }
     
    16761638    ASSERT(_manualStream);
    16771639   
    1678     if ([self isStarted])
     1640    if (_isStarted)
    16791641        _manualStream->didFinishLoading(0);
    16801642}
     
    16851647{
    16861648#ifndef NP_NO_CARBON
    1687     if (![self isStarted] || eventModel == NPEventModelCarbon)
     1649    if (!_isStarted || eventModel == NPEventModelCarbon)
    16881650        return nil;
    16891651#endif
     
    16951657{
    16961658    ASSERT(eventModel == NPEventModelCocoa);
    1697     ASSERT([self isStarted]);
     1659    ASSERT(_isStarted);
    16981660   
    16991661    if (textInputFuncs && textInputFuncs->hasMarkedText)
     
    17061668{
    17071669    ASSERT(eventModel == NPEventModelCocoa);
    1708     ASSERT([self isStarted]);
     1670    ASSERT(_isStarted);
    17091671   
    17101672    if (textInputFuncs && textInputFuncs->insertText)
     
    17151677{
    17161678    ASSERT(eventModel == NPEventModelCocoa);
    1717     ASSERT([self isStarted]);
     1679    ASSERT(_isStarted);
    17181680
    17191681    if (textInputFuncs && textInputFuncs->markedRange)
     
    17261688{
    17271689    ASSERT(eventModel == NPEventModelCocoa);
    1728     ASSERT([self isStarted]);
     1690    ASSERT(_isStarted);
    17291691
    17301692    if (textInputFuncs && textInputFuncs->selectedRange)
     
    17371699{
    17381700    ASSERT(eventModel == NPEventModelCocoa);
    1739     ASSERT([self isStarted]);
     1701    ASSERT(_isStarted);
    17401702
    17411703    if (textInputFuncs && textInputFuncs->setMarkedText)
     
    17461708{
    17471709    ASSERT(eventModel == NPEventModelCocoa);
    1748     ASSERT([self isStarted]);
     1710    ASSERT(_isStarted);
    17491711   
    17501712    if (textInputFuncs && textInputFuncs->unmarkText)
     
    17551717{
    17561718    ASSERT(eventModel == NPEventModelCocoa);
    1757     ASSERT([self isStarted]);
     1719    ASSERT(_isStarted);
    17581720       
    17591721    if (textInputFuncs && textInputFuncs->validAttributesForMarkedText)
     
    17661728{
    17671729    ASSERT(eventModel == NPEventModelCocoa);
    1768     ASSERT([self isStarted]);
     1730    ASSERT(_isStarted);
    17691731   
    17701732    if (textInputFuncs && textInputFuncs->attributedSubstringFromRange)
     
    17771739{
    17781740    ASSERT(eventModel == NPEventModelCocoa);
    1779     ASSERT([self isStarted]);
     1741    ASSERT(_isStarted);
    17801742
    17811743    if (textInputFuncs && textInputFuncs->characterIndexForPoint) {
     
    17951757{
    17961758    ASSERT(eventModel == NPEventModelCocoa);
    1797     ASSERT([self isStarted]);
     1759    ASSERT(_isStarted);
    17981760
    17991761    if (textInputFuncs && textInputFuncs->doCommandBySelector)
     
    18041766{
    18051767    ASSERT(eventModel == NPEventModelCocoa);
    1806     ASSERT([self isStarted]);
     1768    ASSERT(_isStarted);
    18071769
    18081770    if (textInputFuncs && textInputFuncs->firstRectForCharacterRange) {
     
    26052567        return;
    26062568
    2607     if (isDrawingModelQuickDraw(drawingModel))
    2608         [self tellQuickTimeToChill];
    2609 
    2610     if (drawingModel == NPDrawingModelCoreGraphics || isDrawingModelQuickDraw(drawingModel))
    2611         [self updateAndSetWindow];
     2569    [self updateAndSetWindow];
    26122570   
    26132571    [self resetTrackingRect];
     
    26972655- (void)_redeliverStream
    26982656{
    2699     if ([self dataSource] && [self isStarted]) {
     2657    if ([self dataSource] && _isStarted) {
    27002658        // Deliver what has not been passed to the plug-in up to this point.
    27012659        if (_dataLengthReceived > 0) {
Note: See TracChangeset for help on using the changeset viewer.