Changeset 38278 in webkit
- Timestamp:
- Nov 10, 2008 4:29:54 PM (15 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r38277 r38278 1 2008-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 1 42 2008-11-10 Anders Carlsson <andersca@apple.com> 2 43 -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
r38277 r38278 74 74 - (void)handleMouseMoved:(NSEvent *)event; 75 75 - (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values; 76 - (void)focusChanged; 76 77 77 78 - (WebFrame *)webFrame; … … 85 86 - (void)stopTimers; 86 87 - (void)startTimers; 88 - (void)restartTimers; 87 89 88 - (void) restartTimers;90 - (void)setHasFocus:(BOOL)hasFocus; 89 91 90 92 @end -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
r38277 r38278 31 31 #import "WebBaseNetscapePluginView.h" 32 32 33 #import "WebKitSystemInterface.h"34 33 #import "WebFrameInternal.h" 35 34 #import "WebKitLogging.h" 35 #import "WebKitSystemInterface.h" 36 36 #import "WebView.h" 37 37 … … 39 39 #import <WebCore/Document.h> 40 40 #import <WebCore/Element.h> 41 #import <WebKit/DOMPrivate.h> 41 42 #import <wtf/Assertions.h> 42 43 … … 103 104 104 105 - (void)handleMouseMoved:(NSEvent *)event 106 { 107 ASSERT_NOT_REACHED(); 108 } 109 110 - (void)focusChanged 105 111 { 106 112 ASSERT_NOT_REACHED(); … … 153 159 } 154 160 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 155 198 - (WebDataSource *)dataSource 156 199 { -
trunk/WebKit/mac/Plugins/WebNetscapePluginView.h
r38277 r38278 119 119 120 120 121 - (BOOL)start; 122 - (BOOL)isStarted; 121 - (void)start; 123 122 - (void)stop; 124 123 -
trunk/WebKit/mac/Plugins/WebNetscapePluginView.mm
r38277 r38278 289 289 } 290 290 291 - (NSRect)visibleRect292 {293 // WebCore may impose an additional clip (via CSS overflow or clip properties). Fetch294 // that clip now.295 return NSIntersectionRect([self convertRect:[_element.get() _windowClipRect] fromView:nil], [super visibleRect]);296 }297 298 291 - (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate 299 292 { … … 744 737 } 745 738 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 { 761 741 // We need to null check the event handler here because 762 742 // the plug-in view can resign focus after it's been stopped … … 764 744 if (_eventHandler) 765 745 _eventHandler->focusChanged(_hasFocus); 766 }767 768 - (BOOL)becomeFirstResponder769 {770 [self setHasFocus:YES];771 return YES;772 }773 774 - (BOOL)resignFirstResponder775 {776 [self setHasFocus:NO];777 return YES;778 746 } 779 747 … … 931 899 } 932 900 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 933 918 - (void)updateAndSetWindow 934 919 { 935 ASSERT(drawingModel != NPDrawingModelCoreAnimation); 920 if (drawingModel != NPDrawingModelCoreAnimation) 921 return; 936 922 937 923 // A plug-in can only update if it's (1) already been started (2) isn't stopped … … 947 933 return; 948 934 #else 949 if (drawingModel != NPDrawingModelQuickDraw && ![self canDraw]) 950 return; 935 if (drawingModel == NPDrawingModelQuickDraw) 936 [self tellQuickTimeToChill]; 937 else if (![self canDraw]) 938 return; 939 951 940 #endif // NP_NO_QUICKDRAW 952 941 … … 1070 1059 } 1071 1060 1072 - ( BOOL)start1061 - (void)start 1073 1062 { 1074 1063 ASSERT([self currentWindow]); 1075 1064 1076 1065 if (_isStarted) 1077 return YES;1066 return; 1078 1067 1079 1068 ASSERT([self webView]); 1080 1069 1081 1070 if (![[[self webView] preferences] arePlugInsEnabled]) 1082 return NO;1071 return; 1083 1072 1084 1073 // Open the plug-in package so it remains loaded while our plugin uses it … … 1096 1085 [self _destroyPlugin]; 1097 1086 [_pluginPackage.get() close]; 1098 return NO;1087 return; 1099 1088 } 1100 1089 … … 1124 1113 [_pluginPackage.get() close]; 1125 1114 1126 return NO;1115 return; 1127 1116 } 1128 1117 #endif // NP_NO_CARBON … … 1162 1151 [[self webView] addPluginInstanceView:self]; 1163 1152 1164 if (drawingModel == NPDrawingModelCoreGraphics || isDrawingModelQuickDraw(drawingModel)) 1165 [self updateAndSetWindow]; 1153 [self updateAndSetWindow]; 1166 1154 1167 1155 if ([self window]) { … … 1177 1165 if (_loadManually) { 1178 1166 [self _redeliverStream]; 1179 return YES;1167 return; 1180 1168 } 1181 1169 … … 1187 1175 [self loadRequest:request inTarget:nil withNotifyData:nil sendNotification:NO]; 1188 1176 } 1189 1190 return YES;1191 1177 } 1192 1178 … … 1210 1196 1211 1197 [[self webView] removePluginInstanceView:self]; 1212 1198 1199 // Stop the timers 1200 [self stopTimers]; 1201 1202 // Stop notifications and callbacks. 1203 [self removeWindowObservers]; 1204 1213 1205 // To stop active streams it's necessary to invoke stop() on a copy 1214 1206 // of streams. This is because calling WebNetscapePluginStream::stop() also has the side effect … … 1219 1211 streamsCopy[i]->stop(); 1220 1212 1221 // Stop the timers1222 [self stopTimers];1223 1224 // Stop notifications and callbacks.1225 [self removeWindowObservers];1226 1213 [[_pendingFrameLoads.get() allKeys] makeObjectsPerformSelector:@selector(_setInternalLoadDelegate:) withObject:nil]; 1227 1214 [NSObject cancelPreviousPerformRequestsWithTarget:self]; … … 1240 1227 1241 1228 textInputFuncs = 0; 1242 }1243 1244 - (BOOL)isStarted1245 {1246 return _isStarted;1247 1229 } 1248 1230 … … 1427 1409 } 1428 1410 1429 -(void)tellQuickTimeToChill1430 {1431 #ifndef NP_NO_QUICKDRAW1432 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 1446 1411 - (void)viewWillMoveToWindow:(NSWindow *)newWindow 1447 1412 { 1448 if (isDrawingModelQuickDraw(drawingModel))1449 [self tellQuickTimeToChill];1450 1451 1413 // We must remove the tracking rect before we move to the new window. 1452 1414 // Once we move to the new window, it will be too late. … … 1589 1551 - (NPObject *)createPluginScriptableObject 1590 1552 { 1591 if (![_pluginPackage.get() pluginFuncs]->getvalue || ! [self isStarted])1553 if (![_pluginPackage.get() pluginFuncs]->getvalue || !_isStarted) 1592 1554 return NULL; 1593 1555 … … 1642 1604 _dataLengthReceived += [data length]; 1643 1605 1644 if (! [self isStarted])1606 if (!_isStarted) 1645 1607 return; 1646 1608 … … 1664 1626 _error = error; 1665 1627 1666 if (! [self isStarted]) {1628 if (!_isStarted) { 1667 1629 return; 1668 1630 } … … 1676 1638 ASSERT(_manualStream); 1677 1639 1678 if ( [self isStarted])1640 if (_isStarted) 1679 1641 _manualStream->didFinishLoading(0); 1680 1642 } … … 1685 1647 { 1686 1648 #ifndef NP_NO_CARBON 1687 if (! [self isStarted]|| eventModel == NPEventModelCarbon)1649 if (!_isStarted || eventModel == NPEventModelCarbon) 1688 1650 return nil; 1689 1651 #endif … … 1695 1657 { 1696 1658 ASSERT(eventModel == NPEventModelCocoa); 1697 ASSERT( [self isStarted]);1659 ASSERT(_isStarted); 1698 1660 1699 1661 if (textInputFuncs && textInputFuncs->hasMarkedText) … … 1706 1668 { 1707 1669 ASSERT(eventModel == NPEventModelCocoa); 1708 ASSERT( [self isStarted]);1670 ASSERT(_isStarted); 1709 1671 1710 1672 if (textInputFuncs && textInputFuncs->insertText) … … 1715 1677 { 1716 1678 ASSERT(eventModel == NPEventModelCocoa); 1717 ASSERT( [self isStarted]);1679 ASSERT(_isStarted); 1718 1680 1719 1681 if (textInputFuncs && textInputFuncs->markedRange) … … 1726 1688 { 1727 1689 ASSERT(eventModel == NPEventModelCocoa); 1728 ASSERT( [self isStarted]);1690 ASSERT(_isStarted); 1729 1691 1730 1692 if (textInputFuncs && textInputFuncs->selectedRange) … … 1737 1699 { 1738 1700 ASSERT(eventModel == NPEventModelCocoa); 1739 ASSERT( [self isStarted]);1701 ASSERT(_isStarted); 1740 1702 1741 1703 if (textInputFuncs && textInputFuncs->setMarkedText) … … 1746 1708 { 1747 1709 ASSERT(eventModel == NPEventModelCocoa); 1748 ASSERT( [self isStarted]);1710 ASSERT(_isStarted); 1749 1711 1750 1712 if (textInputFuncs && textInputFuncs->unmarkText) … … 1755 1717 { 1756 1718 ASSERT(eventModel == NPEventModelCocoa); 1757 ASSERT( [self isStarted]);1719 ASSERT(_isStarted); 1758 1720 1759 1721 if (textInputFuncs && textInputFuncs->validAttributesForMarkedText) … … 1766 1728 { 1767 1729 ASSERT(eventModel == NPEventModelCocoa); 1768 ASSERT( [self isStarted]);1730 ASSERT(_isStarted); 1769 1731 1770 1732 if (textInputFuncs && textInputFuncs->attributedSubstringFromRange) … … 1777 1739 { 1778 1740 ASSERT(eventModel == NPEventModelCocoa); 1779 ASSERT( [self isStarted]);1741 ASSERT(_isStarted); 1780 1742 1781 1743 if (textInputFuncs && textInputFuncs->characterIndexForPoint) { … … 1795 1757 { 1796 1758 ASSERT(eventModel == NPEventModelCocoa); 1797 ASSERT( [self isStarted]);1759 ASSERT(_isStarted); 1798 1760 1799 1761 if (textInputFuncs && textInputFuncs->doCommandBySelector) … … 1804 1766 { 1805 1767 ASSERT(eventModel == NPEventModelCocoa); 1806 ASSERT( [self isStarted]);1768 ASSERT(_isStarted); 1807 1769 1808 1770 if (textInputFuncs && textInputFuncs->firstRectForCharacterRange) { … … 2605 2567 return; 2606 2568 2607 if (isDrawingModelQuickDraw(drawingModel)) 2608 [self tellQuickTimeToChill]; 2609 2610 if (drawingModel == NPDrawingModelCoreGraphics || isDrawingModelQuickDraw(drawingModel)) 2611 [self updateAndSetWindow]; 2569 [self updateAndSetWindow]; 2612 2570 2613 2571 [self resetTrackingRect]; … … 2697 2655 - (void)_redeliverStream 2698 2656 { 2699 if ([self dataSource] && [self isStarted]) {2657 if ([self dataSource] && _isStarted) { 2700 2658 // Deliver what has not been passed to the plug-in up to this point. 2701 2659 if (_dataLengthReceived > 0) {
Note: See TracChangeset
for help on using the changeset viewer.