Changeset 211323 in webkit


Ignore:
Timestamp:
Jan 27, 2017 9:08:31 PM (7 years ago)
Author:
Wenson Hsieh
Message:

[WK1] Do not prevent the drag client from initializing on Mac
https://bugs.webkit.org/show_bug.cgi?id=167541

Reviewed by Dan Bernstein.

Fixes fallout from r211192. To ensure compability with WebKit clients, we need to ensure that WebDragClient is
initialized everywhere when creating a WebView. Stub out method implementations as no-ops for non-Mac platforms.
This caused certain clients, such as Mail, to crash when a webView closes due to null dereference.

  • WebCoreSupport/WebDragClient.mm:

(WebDragClient::WebDragClient):
(WebDragClient::actionMaskForDrag):
(WebDragClient::willPerformDragDestinationAction):
(WebDragClient::dragSourceActionMaskForPoint):
(WebDragClient::willPerformDragSourceAction):
(WebDragClient::startDrag):
(WebDragClient::declareAndWriteDragImage):
(WebDragClient::declareAndWriteAttachment):

  • WebView/WebView.mm:

(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):

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

Legend:

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

    r211254 r211323  
     12017-01-27  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [WK1] Do not prevent the drag client from initializing on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=167541
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Fixes fallout from r211192. To ensure compability with WebKit clients, we need to ensure that WebDragClient is
     9        initialized everywhere when creating a WebView. Stub out method implementations as no-ops for non-Mac platforms.
     10        This caused certain clients, such as Mail, to crash when a webView closes due to  null dereference.
     11
     12        * WebCoreSupport/WebDragClient.mm:
     13        (WebDragClient::WebDragClient):
     14        (WebDragClient::actionMaskForDrag):
     15        (WebDragClient::willPerformDragDestinationAction):
     16        (WebDragClient::dragSourceActionMaskForPoint):
     17        (WebDragClient::willPerformDragSourceAction):
     18        (WebDragClient::startDrag):
     19        (WebDragClient::declareAndWriteDragImage):
     20        (WebDragClient::declareAndWriteAttachment):
     21        * WebView/WebView.mm:
     22        (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
     23
    1242017-01-26  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm

    r211192 r211323  
    2626#import "WebDragClient.h"
    2727
    28 #if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
     28#if ENABLE(DRAG_SUPPORT)
    2929
    3030#import "DOMElementInternal.h"
     
    3737#import "WebKitLogging.h"
    3838#import "WebKitNSStringExtras.h"
    39 #import "WebNSPasteboardExtras.h"
    4039#import "WebNSURLExtras.h"
    4140#import "WebUIDelegate.h"
    4241#import "WebUIDelegatePrivate.h"
    4342#import "WebViewInternal.h"
     43
     44#if PLATFORM(MAC)
     45#import "WebNSPasteboardExtras.h"
     46#endif
     47
    4448#import <WebCore/DataTransfer.h>
    4549#import <WebCore/DragData.h>
     
    5862    : m_webView(webView)
    5963{
     64    UNUSED_PARAM(m_webView);
    6065}
     66
     67#if PLATFORM(MAC)
    6168
    6269static WebHTMLView *getTopHTMLView(Frame* frame)
     
    139146#endif
    140147
     148#else
     149
     150WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(const WebCore::DragData&)
     151{
     152    return DragDestinationActionNone;
     153}
     154
     155void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAction, const WebCore::DragData&)
     156{
     157}
     158
     159WebCore::DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint&)
     160{
     161    return DragSourceActionNone;
     162}
     163
     164void WebDragClient::willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::DataTransfer&)
     165{
     166}
     167
     168void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, DataTransfer&, Frame&, bool)
     169{
     170}
     171
     172void WebDragClient::declareAndWriteDragImage(const String&, Element&, const URL&, const String&, WebCore::Frame*)
     173{
     174}
     175
     176#if ENABLE(ATTACHMENT_ELEMENT)
     177void WebDragClient::declareAndWriteAttachment(const String&, Element&, const URL&, const String&, WebCore::Frame*)
     178{
     179}
     180#endif
     181
     182#endif
     183
    141184void WebDragClient::dragControllerDestroyed()
    142185{
     
    144187}
    145188
    146 #endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
     189#endif // ENABLE(DRAG_SUPPORT)
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r211254 r211323  
    16101610    );
    16111611    pageConfiguration.chromeClient = new WebChromeClientIOS(self);
    1612 #if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
     1612#if ENABLE(DRAG_SUPPORT)
    16131613    pageConfiguration.dragClient = new WebDragClient(self);
    16141614#endif
Note: See TracChangeset for help on using the changeset viewer.