Changeset 95474 in webkit


Ignore:
Timestamp:
Sep 19, 2011 2:25:40 PM (13 years ago)
Author:
andersca@apple.com
Message:

Remove the last remains of viewless WebKit1
https://bugs.webkit.org/show_bug.cgi?id=68388

Reviewed by Darin Adler.

  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::forceLayoutForNonHTML):
Remove null check.

  • WebView/WebView.mm:

(-[WebView _commonInitializationWithFrameName:groupName:]):
Remove usesDocumentViews parameter and checks.

(-[WebView _initWithFrame:frameName:groupName:usesDocumentViews:]):
Add an assertion that usesDocumentViews is always true.

(-[WebView _isUsingAcceleratedCompositing]):
Remove usesDocumentViews check.

(-[WebView _isSoftwareRenderable]):
Remove usesDocumentViews check.

(-[WebView initWithFrame:frameName:groupName:]):
Remove usesDocumentViews parameter and always pass YES to the _initWithFrame method.

(-[WebView initWithCoder:]):
Remove usesDocumentViews parameter.

(-[WebView _frameViewAtWindowPoint:]):
Remove usesDocumentViews check.

  • WebView/WebViewData.h:

Remove usesDocumentViews ivar.

  • WebView/WebViewPrivate.h:

Remove usesDocumentViews parameters.

Location:
trunk/Source/WebKit/mac
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r95470 r95474  
     12011-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
    1402011-09-19  Anders Carlsson  <andersca@apple.com>
    241
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r95459 r95474  
    248248{
    249249    WebFrameView *thisView = m_webFrame->_private->webFrameView;
    250     if (!thisView) // Viewless mode.
    251         return;
    252250    NSView <WebDocumentView> *thisDocumentView = [thisView documentView];
    253251    ASSERT(thisDocumentView != nil);
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r95470 r95474  
    633633}
    634634
    635 - (BOOL)_usesDocumentViews
    636 {
    637     return _private->usesDocumentViews;
    638 }
    639 
    640635static NSString *leakMailQuirksUserScriptContents()
    641636{
     
    694689}
    695690
    696 - (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
     691- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName
    697692{
    698693    WebCoreThreadViolationCheckRoundTwo();
     
    710705    _private->drawsBackground = YES;
    711706    _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
    712     _private->usesDocumentViews = usesDocumentViews;
    713707    _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES;
    714708
    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];
    723714
    724715    static bool didOneTimeInitialization = false;
     
    828819- (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
    829820{
     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
    830825    self = [super initWithFrame:f];
    831826    if (!self)
     
    845840
    846841    _private = [[WebViewPrivate alloc] init];
    847     [self _commonInitializationWithFrameName:frameName groupName:groupName usesDocumentViews:usesDocumentViews];
     842    [self _commonInitializationWithFrameName:frameName groupName:groupName];
    848843    [self setMaintainsBackForwardList: YES];
    849844    return self;
    850 }
    851 
    852 - (BOOL)_mustDrawUnionedRect:(NSRect)rect singleRects:(const NSRect *)rects count:(NSInteger)count
    853 {
    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 Mail
    856     // The reason for the workaround is that this method is called explicitly from the code
    857     // 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 space
    864         // 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)rect
    877 {
    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)isFlipped
    900 {
    901     return _private && !_private->usesDocumentViews;
    902 }
    903 
    904 - (void)setFrameSize:(NSSize)size
    905 {
    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 for
    909         // Safari to communicate that this space is being consumed.  For WebKit with document views, there's no
    910         // need to do an explicit resize, since WebFrameViews have auto resizing turned on and will handle changing
    911         // 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];
    919845}
    920846
     
    924850    if (frame && frame->view())
    925851        frame->view()->updateLayoutAndStyleIfNeededRecursive();
    926 }
    927 
    928 - (void)viewWillDraw
    929 {
    930     if (!_private->usesDocumentViews)
    931         [self _viewWillDrawInternal];
    932     [super viewWillDraw];
    933 }
    934 
    935 
    936 
    937 - (void)drawRect:(NSRect)rect
    938 {
    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     else
    952         for (int i = 0; i < count; ++i)
    953             [self drawSingleRect:rects[i]];
    954852}
    955853
     
    24832381{
    24842382#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;
    24922388    }
    24932389#endif
     
    25182414{
    25192415#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;
    25272421        }
    25282422    }
     
    31973091
    31983092        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];
    32003094        static_cast<BackForwardListImpl*>([result page]->backForwardList())->setEnabled(useBackForwardList);
    32013095        result->_private->allowsUndo = allowsUndo;
     
    57685662    if (_private->closed)
    57695663        return nil;
    5770     ASSERT(_private->usesDocumentViews);
    57715664    NSView *view = [self hitTest:[[self superview] convertPoint:point fromView:nil]];
    57725665    if (![view isDescendantOf:[[self mainFrame] frameView]])
  • trunk/Source/WebKit/mac/WebView/WebViewData.h

    r95470 r95474  
    141141
    142142    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;
    146143
    147144    BOOL includesFlattenedCompositingLayersWhenDrawingToBitmap;
  • trunk/Source/WebKit/mac/WebView/WebViewPrivate.h

    r94247 r95474  
    466466- (void)_setCustomHTMLTokenizerChunkSize:(int)chunkSize;
    467467
    468 - (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews;
    469 - (BOOL)_usesDocumentViews;
    470 
    471468- (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag;
    472469- (BOOL)isSelectTrailingWhitespaceEnabled;
Note: See TracChangeset for help on using the changeset viewer.