Changeset 19614 in webkit


Ignore:
Timestamp:
Feb 13, 2007 2:57:31 PM (17 years ago)
Author:
oliver
Message:

2007-02-13 Oliver Hunt <oliver@apple.com>

Reviewed by John.

Modify entry point ASSERTs for dragging functions to allow for the case
where a load has occurred mid-drag. The load may detach the HTMLView
from the WebView so it is no longer possible to check _isTopHTMLView.

The assertion changes match that of revision 14897 which fixed the
more common case ([WebHTMLView draggedImage:endedAt:operation:])

It's also necessary to check for a null Page now prior to accessing
the DragController, which is necessary in all of these methods.

See rdar://problem/4994870


  • WebView/WebHTMLView.mm: (-[WebHTMLView draggingSourceOperationMaskForLocal:]): (-[WebHTMLView draggedImage:movedTo:]): (-[WebHTMLView draggedImage:endedAt:operation:]): (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r19608 r19614  
     12007-02-13  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by John.
     4
     5        Modify entry point ASSERTs for dragging functions to allow for the case
     6        where a load has occurred mid-drag.  The load may detach the HTMLView
     7        from the WebView so it is no longer possible to check _isTopHTMLView.
     8
     9        The assertion changes match that of revision 14897 which fixed the
     10        more common case ([WebHTMLView draggedImage:endedAt:operation:])
     11
     12        It's also necessary to check for a null Page now prior to accessing
     13        the DragController, which is necessary in all of these methods.
     14
     15        See rdar://problem/4994870
     16                                             
     17        * WebView/WebHTMLView.mm:
     18        (-[WebHTMLView draggingSourceOperationMaskForLocal:]):
     19        (-[WebHTMLView draggedImage:movedTo:]):
     20        (-[WebHTMLView draggedImage:endedAt:operation:]):
     21        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
     22
    1232007-02-13  Alexey Proskuryakov  <ap@webkit.org>
    224
  • trunk/WebKit/WebView/WebHTMLView.mm

    r19579 r19614  
    29262926- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
    29272927{
    2928     ASSERT([self _isTopHTMLView]);
     2928    ASSERT(![self _webView] || [self _isTopHTMLView]);
    29292929   
    29302930    Page *page = core([self _webView]);
    2931     ASSERT(page);
     2931   
     2932    if (!page)
     2933        return NSDragOperationNone;
     2934   
    29322935    if (page->dragController()->dragOperation() == DragOperationNone)
    29332936        return NSDragOperationGeneric | NSDragOperationCopy;
     
    29382941- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc
    29392942{
    2940     ASSERT([self _isTopHTMLView]);
    2941     Page* page = core([self _webView]);
    2942     ASSERT(page);
    2943     DragController* dragController = page->dragController();
     2943    ASSERT(![self _webView] || [self _isTopHTMLView]);
     2944   
    29442945    NSPoint windowImageLoc = [[self window] convertScreenToBase:screenLoc];
    2945     NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
     2946    NSPoint windowMouseLoc = windowImageLoc;
     2947   
     2948    if (Page* page = core([self _webView])) {
     2949        DragController* dragController = page->dragController();
     2950        NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
     2951    }
     2952   
    29462953    [[self _bridge] dragSourceMovedTo:windowMouseLoc];
    29472954}
     
    29502957{
    29512958    ASSERT(![self _webView] || [self _isTopHTMLView]);
    2952     Page* page = core([self _webView]);
    2953     ASSERT(page);
    2954     DragController* dragController = page->dragController();
    2955 
     2959   
    29562960    NSPoint windowImageLoc = [[self window] convertScreenToBase:aPoint];
    2957     NSPoint windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
     2961    NSPoint windowMouseLoc = windowImageLoc;
     2962   
     2963    if (Page* page = core([self _webView])) {
     2964        DragController* dragController = page->dragController();
     2965        windowMouseLoc = NSMakePoint(windowImageLoc.x + dragController->dragOffset().x(), windowImageLoc.y + dragController->dragOffset().y());
     2966        dragController->dragEnded();
     2967    }
     2968   
    29582969    [[self _bridge] dragSourceEndedAt:windowMouseLoc operation:operation];
    2959     dragController->dragEnded();
    29602970   
    29612971    // Prevent queued mouseDragged events from coming after the drag and fake mouseUp event.
     
    29792989- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
    29802990{
    2981     ASSERT([self _isTopHTMLView]);
     2991    ASSERT(![self _webView] || [self _isTopHTMLView]);
    29822992    Page* page = core([self _webView]);
     2993   
     2994    //If a load occurs midway through a drag, the view may be detached, which gives
     2995    //us no ability to get to the original Page, so we cannot access any drag state
     2996    //FIXME: is there a way to recover?
     2997    if (!page)
     2998        return nil;
     2999   
    29833000    KURL imageURL = page->dragController()->draggingImageURL();
    29843001    ASSERT(!imageURL.isEmpty());
    2985 
     3002   
    29863003    NSFileWrapper *wrapper = [[self _dataSource] _fileWrapperForURL:imageURL.getNSURL()];
    29873004    if (wrapper == nil) {
Note: See TracChangeset for help on using the changeset viewer.