Changeset 95474 in webkit
- Timestamp:
- Sep 19, 2011 2:25:40 PM (13 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r95470 r95474 1 2011-09-19 Anders Carlsson <andersca@apple.com> 2 3 Remove the last remains of viewless WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=68388 5 6 Reviewed by Darin Adler. 7 8 * WebCoreSupport/WebFrameLoaderClient.mm: 9 (WebFrameLoaderClient::forceLayoutForNonHTML): 10 Remove null check. 11 12 * WebView/WebView.mm: 13 (-[WebView _commonInitializationWithFrameName:groupName:]): 14 Remove usesDocumentViews parameter and checks. 15 16 (-[WebView _initWithFrame:frameName:groupName:usesDocumentViews:]): 17 Add an assertion that usesDocumentViews is always true. 18 19 (-[WebView _isUsingAcceleratedCompositing]): 20 Remove usesDocumentViews check. 21 22 (-[WebView _isSoftwareRenderable]): 23 Remove usesDocumentViews check. 24 25 (-[WebView initWithFrame:frameName:groupName:]): 26 Remove usesDocumentViews parameter and always pass YES to the _initWithFrame method. 27 28 (-[WebView initWithCoder:]): 29 Remove usesDocumentViews parameter. 30 31 (-[WebView _frameViewAtWindowPoint:]): 32 Remove usesDocumentViews check. 33 34 * WebView/WebViewData.h: 35 Remove usesDocumentViews ivar. 36 37 * WebView/WebViewPrivate.h: 38 Remove usesDocumentViews parameters. 39 1 40 2011-09-19 Anders Carlsson <andersca@apple.com> 2 41 -
trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r95459 r95474 248 248 { 249 249 WebFrameView *thisView = m_webFrame->_private->webFrameView; 250 if (!thisView) // Viewless mode.251 return;252 250 NSView <WebDocumentView> *thisDocumentView = [thisView documentView]; 253 251 ASSERT(thisDocumentView != nil); -
trunk/Source/WebKit/mac/WebView/WebView.mm
r95470 r95474 633 633 } 634 634 635 - (BOOL)_usesDocumentViews636 {637 return _private->usesDocumentViews;638 }639 640 635 static NSString *leakMailQuirksUserScriptContents() 641 636 { … … 694 689 } 695 690 696 - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews691 - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName 697 692 { 698 693 WebCoreThreadViolationCheckRoundTwo(); … … 710 705 _private->drawsBackground = YES; 711 706 _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain]; 712 _private->usesDocumentViews = usesDocumentViews;713 707 _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES; 714 708 715 WebFrameView *frameView = nil; 716 if (_private->usesDocumentViews) { 717 NSRect f = [self frame]; 718 frameView = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)]; 719 [frameView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 720 [self addSubview:frameView]; 721 [frameView release]; 722 } 709 NSRect f = [self frame]; 710 WebFrameView *frameView = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)]; 711 [frameView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 712 [self addSubview:frameView]; 713 [frameView release]; 723 714 724 715 static bool didOneTimeInitialization = false; … … 828 819 - (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews 829 820 { 821 // FIXME: Remove the usesDocumentViews parameter; it's only here for compatibility with WebKit nightly builds 822 // running against Safari 5 on Leopard. 823 ASSERT(usesDocumentViews); 824 830 825 self = [super initWithFrame:f]; 831 826 if (!self) … … 845 840 846 841 _private = [[WebViewPrivate alloc] init]; 847 [self _commonInitializationWithFrameName:frameName groupName:groupName usesDocumentViews:usesDocumentViews];842 [self _commonInitializationWithFrameName:frameName groupName:groupName]; 848 843 [self setMaintainsBackForwardList: YES]; 849 844 return self; 850 }851 852 - (BOOL)_mustDrawUnionedRect:(NSRect)rect singleRects:(const NSRect *)rects count:(NSInteger)count853 {854 // If count == 0 here, use the rect passed in for drawing. This is a workaround for:855 // <rdar://problem/3908282> REGRESSION (Mail): No drag image dragging selected text in Blot and Mail856 // The reason for the workaround is that this method is called explicitly from the code857 // to generate a drag image, and at that time, getRectsBeingDrawn:count: will return a zero count.858 const int cRectThreshold = 10;859 const float cWastedSpaceThreshold = 0.75f;860 BOOL useUnionedRect = (count <= 1) || (count > cRectThreshold);861 if (!useUnionedRect) {862 // Attempt to guess whether or not we should use the unioned rect or the individual rects.863 // We do this by computing the percentage of "wasted space" in the union. If that wasted space864 // is too large, then we will do individual rect painting instead.865 float unionPixels = (rect.size.width * rect.size.height);866 float singlePixels = 0;867 for (int i = 0; i < count; ++i)868 singlePixels += rects[i].size.width * rects[i].size.height;869 float wastedSpace = 1 - (singlePixels / unionPixels);870 if (wastedSpace <= cWastedSpaceThreshold)871 useUnionedRect = YES;872 }873 return useUnionedRect;874 }875 876 - (void)drawSingleRect:(NSRect)rect877 {878 ASSERT(!_private->usesDocumentViews);879 880 [NSGraphicsContext saveGraphicsState];881 NSRectClip(rect);882 883 @try {884 [[self mainFrame] _drawRect:rect contentsOnly:NO];885 886 [[self _UIDelegateForwarder] webView:self didDrawRect:rect];887 888 if (WebNodeHighlight *currentHighlight = [self currentNodeHighlight])889 [currentHighlight setNeedsUpdateInTargetViewRect:rect];890 891 [NSGraphicsContext restoreGraphicsState];892 } @catch (NSException *localException) {893 [NSGraphicsContext restoreGraphicsState];894 LOG_ERROR("Exception caught while drawing: %@", localException);895 [localException raise];896 }897 }898 899 - (BOOL)isFlipped900 {901 return _private && !_private->usesDocumentViews;902 }903 904 - (void)setFrameSize:(NSSize)size905 {906 if (!_private->usesDocumentViews && !NSEqualSizes(_private->lastLayoutSize, size)) {907 Frame* frame = [self _mainCoreFrame];908 // FIXME: Viewless WebKit is broken with Safari banners (e.g., the Find banner). We'll have to figure out a way for909 // Safari to communicate that this space is being consumed. For WebKit with document views, there's no910 // need to do an explicit resize, since WebFrameViews have auto resizing turned on and will handle changing911 // their bounds automatically. See <rdar://problem/6835573> for details.912 frame->view()->resize(IntSize(size));913 frame->view()->setNeedsLayout();914 [self setNeedsDisplay:YES];915 _private->lastLayoutSize = size;916 }917 918 [super setFrameSize:size];919 845 } 920 846 … … 924 850 if (frame && frame->view()) 925 851 frame->view()->updateLayoutAndStyleIfNeededRecursive(); 926 }927 928 - (void)viewWillDraw929 {930 if (!_private->usesDocumentViews)931 [self _viewWillDrawInternal];932 [super viewWillDraw];933 }934 935 936 937 - (void)drawRect:(NSRect)rect938 {939 if (_private->usesDocumentViews)940 return [super drawRect:rect];941 942 ASSERT_MAIN_THREAD();943 944 const NSRect *rects;945 NSInteger count;946 [self getRectsBeingDrawn:&rects count:&count];947 948 949 if ([self _mustDrawUnionedRect:rect singleRects:rects count:count])950 [self drawSingleRect:rect];951 else952 for (int i = 0; i < count; ++i)953 [self drawSingleRect:rects[i]];954 852 } 955 853 … … 2483 2381 { 2484 2382 #if USE(ACCELERATED_COMPOSITING) 2485 if (_private->usesDocumentViews) { 2486 Frame* coreFrame = [self _mainCoreFrame]; 2487 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 2488 NSView *documentView = [[kit(frame) frameView] documentView]; 2489 if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing]) 2490 return YES; 2491 } 2383 Frame* coreFrame = [self _mainCoreFrame]; 2384 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 2385 NSView *documentView = [[kit(frame) frameView] documentView]; 2386 if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing]) 2387 return YES; 2492 2388 } 2493 2389 #endif … … 2518 2414 { 2519 2415 #if USE(ACCELERATED_COMPOSITING) 2520 if (_private->usesDocumentViews) { 2521 Frame* coreFrame = [self _mainCoreFrame]; 2522 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 2523 if (FrameView* view = frame->view()) { 2524 if (!view->isSoftwareRenderable()) 2525 return NO; 2526 } 2416 Frame* coreFrame = [self _mainCoreFrame]; 2417 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { 2418 if (FrameView* view = frame->view()) { 2419 if (!view->isSoftwareRenderable()) 2420 return NO; 2527 2421 } 2528 2422 } … … 3197 3091 3198 3092 LOG(Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", frameName, groupName, (int)useBackForwardList); 3199 [result _commonInitializationWithFrameName:frameName groupName:groupName usesDocumentViews:YES];3093 [result _commonInitializationWithFrameName:frameName groupName:groupName]; 3200 3094 static_cast<BackForwardListImpl*>([result page]->backForwardList())->setEnabled(useBackForwardList); 3201 3095 result->_private->allowsUndo = allowsUndo; … … 5768 5662 if (_private->closed) 5769 5663 return nil; 5770 ASSERT(_private->usesDocumentViews);5771 5664 NSView *view = [self hitTest:[[self superview] convertPoint:point fromView:nil]]; 5772 5665 if (![view isDescendantOf:[[self mainFrame] frameView]]) -
trunk/Source/WebKit/mac/WebView/WebViewData.h
r95470 r95474 141 141 142 142 BOOL shouldUpdateWhileOffscreen; 143 144 // When this flag is unset, we will not make any subviews underneath this WebView. This means no WebFrameViews and no WebHTMLViews.145 BOOL usesDocumentViews;146 143 147 144 BOOL includesFlattenedCompositingLayersWhenDrawingToBitmap; -
trunk/Source/WebKit/mac/WebView/WebViewPrivate.h
r94247 r95474 466 466 - (void)_setCustomHTMLTokenizerChunkSize:(int)chunkSize; 467 467 468 - (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews;469 - (BOOL)_usesDocumentViews;470 471 468 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag; 472 469 - (BOOL)isSelectTrailingWhitespaceEnabled;
Note: See TracChangeset
for help on using the changeset viewer.