Changeset 99108 in webkit


Ignore:
Timestamp:
Nov 2, 2011 3:32:26 PM (12 years ago)
Author:
jonlee@apple.com
Message:

Expand DragController to provide more information about the dragging session
https://bugs.webkit.org/show_bug.cgi?id=71324
<rdar://problem/10379175>

Reviewed by Darin Adler.

Source/WebCore:

  • WebCore.xcodeproj/project.pbxproj:
  • page/DragController.cpp:

(WebCore::DragController::dragEntered):
(WebCore::DragController::dragUpdated):
(WebCore::DragController::dragEnteredOrUpdated):
(WebCore::DragController::tryDocumentDrag): In addition to determining the
drag operation, DragSession is updated with data regarding whether the mouse
is over a file input, and the number of items that would be accepted based on
the mouse's location.

  • page/DragController.h:
  • page/DragSession.h: Added.

(WebCore::DragSession::DragSession): Keep track of current operation, whether
the mouse is over a file input element, and how many files would be accepted if
dropped.

  • platform/DragData.h: Added numberOfFiles()
  • platform/chromium/DragDataChromium.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/efl/DragDataEfl.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/gtk/DragDataGtk.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/mac/DragDataMac.mm:

(WebCore::DragData::numberOfFiles):

  • platform/qt/DragDataQt.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/win/DragDataWin.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/wince/DragDataWinCE.cpp:

(WebCore::DragData::numberOfFiles):

  • platform/wx/DragDataWx.cpp:

(WebCore::DragData::numberOfFiles):

Source/WebKit/chromium:

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::dragTargetDragEnterOrOver): The drag operation is contained
within the new DragSession struct. Minor refactor.

Source/WebKit/gtk:

  • webkit/webkitwebview.cpp:

(webkit_web_view_drag_motion): Minor refactoring.
(webkit_web_view_drag_data_received): Minor refactoring.

Source/WebKit/mac:

  • WebView/WebView.mm:

(-[WebView draggingEntered:]): DragOperation is now inside the DragSession struct.
(-[WebView draggingUpdated:]):

Source/WebKit/qt:

  • Api/qwebpage.cpp:

(QWebPagePrivate::dragEnterEvent): Minor refactoring because operation is stored in
new DragSession struct.
(QWebPagePrivate::dragMoveEvent): Ditto.

Source/WebKit/win:

  • WebView.cpp:

(WebView::DragEnter): Minor refactoring because operation is stored in
new DragSession struct.
(WebView::DragOver): Ditto.

Source/WebKit2:

We now pass the DragSession struct from the Web to the UI process, instead of the
DragOperation enum.

  • Scripts/webkit2/messages.py:
  • Shared/WebCoreArgumentCoders.cpp:

(CoreIPC::::encode):
(CoreIPC::::decode):

  • Shared/WebCoreArgumentCoders.h:
  • UIProcess/API/mac/WKView.mm:

(-[WKView draggingUpdated:]):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::WebPageProxy): We now cache the last known DragSession state
(WebKit::WebPageProxy::didPerformDragControllerAction):

  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::dragSession):
(WebKit::WebPageProxy::resetDragOperation):

  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/win/WebView.cpp:

(WebKit::WebView::keyStateToDragOperation):
(WebKit::WebView::DragEnter):
(WebKit::WebView::DragOver):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::performDragControllerAction):

LayoutTests:

  • editing/pasteboard/script-tests/file-input-files-access.js:

(runTest): Change the expected behavior of the test-- dragging a file over a disabled
control should not load that file. Instead, the file should be ignored, and the page
remains as is.

Location:
trunk
Files:
35 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r99105 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * editing/pasteboard/script-tests/file-input-files-access.js:
     10        (runTest): Change the expected behavior of the test-- dragging a file over a disabled
     11        control should not load that file. Instead, the file should be ignored, and the page
     12        remains as is.
     13
    1142011-11-02  Tony Chang  <tony@chromium.org>
    215
  • trunk/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js

    r74510 r99108  
    111111    debug("Dragging to a disabled file input control:");
    112112    fileInput.disabled = true;
    113     window.onbeforeunload = function() {
    114         // Since the drop triggered a navigation, verify the properties of the file input here.
    115         shouldBeEqualToString("fileInput.value", "");
    116         filesShouldBe([]);
    117         shouldBeTrue("successfullyParsed");
    118         debug('<br /><span class="pass">TEST COMPLETE</span>');
     113    draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
    119114
    120         // Clean up after ourselves
    121         fileInput.parentNode.removeChild(fileInput);
     115    // Clean up after ourselves
     116    fileInput.parentNode.removeChild(fileInput);
    122117
    123         layoutTestController.notifyDone();
    124 
    125         window.onbeforeunload = null;
    126     };
    127     draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
    128     testFailed("The final test case should have resulted in navigation");
     118    layoutTestController.notifyDone();
    129119}
    130120
  • trunk/Source/WebCore/ChangeLog

    r99104 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * WebCore.xcodeproj/project.pbxproj:
     10        * page/DragController.cpp:
     11        (WebCore::DragController::dragEntered):
     12        (WebCore::DragController::dragUpdated):
     13        (WebCore::DragController::dragEnteredOrUpdated):
     14        (WebCore::DragController::tryDocumentDrag): In addition to determining the
     15        drag operation, DragSession is updated with data regarding whether the mouse
     16        is over a file input, and the number of items that would be accepted based on
     17        the mouse's location.
     18        * page/DragController.h:
     19        * page/DragSession.h: Added.
     20        (WebCore::DragSession::DragSession): Keep track of current operation, whether
     21        the mouse is over a file input element, and how many files would be accepted if
     22        dropped.
     23        * platform/DragData.h: Added numberOfFiles()
     24        * platform/chromium/DragDataChromium.cpp:
     25        (WebCore::DragData::numberOfFiles):
     26        * platform/efl/DragDataEfl.cpp:
     27        (WebCore::DragData::numberOfFiles):
     28        * platform/gtk/DragDataGtk.cpp:
     29        (WebCore::DragData::numberOfFiles):
     30        * platform/mac/DragDataMac.mm:
     31        (WebCore::DragData::numberOfFiles):
     32        * platform/qt/DragDataQt.cpp:
     33        (WebCore::DragData::numberOfFiles):
     34        * platform/win/DragDataWin.cpp:
     35        (WebCore::DragData::numberOfFiles):
     36        * platform/wince/DragDataWinCE.cpp:
     37        (WebCore::DragData::numberOfFiles):
     38        * platform/wx/DragDataWx.cpp:
     39        (WebCore::DragData::numberOfFiles):
     40
    1412011-11-02  Alexey Proskuryakov  <ap@apple.com>
    242
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r98853 r99108  
    779779                31611E620E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */; };
    780780                31611E630E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */; };
     781                3169379C14609C6C00C01362 /* DragSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 3169379A14609C5B00C01362 /* DragSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
    781782                316FE0710E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06D0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp */; };
    782783                316FE0720E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h */; };
     
    78567857                31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitCSSTransformValue.mm; sourceTree = "<group>"; };
    78577858                31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSTransformValueInternal.h; sourceTree = "<group>"; };
     7859                3169379A14609C5B00C01362 /* DragSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragSession.h; sourceTree = "<group>"; };
    78587860                316FE06D0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; };
    78597861                316FE06E0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSKeyframeRule.h; sourceTree = "<group>"; };
     
    1543815440                                A7CA595B0B27BD9E00FA021D /* DragController.h */,
    1543915441                                81F65FF513788FAA00FF6F2D /* DragState.h */,
     15442                                3169379A14609C5B00C01362 /* DragSession.h */,
    1544015443                                1AF326770D78B9440068F0C4 /* EditorClient.h */,
    1544115444                                93C09A800B064F00005ABD4D /* EventHandler.cpp */,
     
    2454224545                                FD62F52E145898D80094B0ED /* AudioSourceProviderClient.h in Headers */,
    2454324546                                2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
     24547                                3169379C14609C6C00C01362 /* DragSession.h in Headers */,
    2454424548                        );
    2454524549                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/page/DragController.cpp

    r99085 r99108  
    3737#include "DragClient.h"
    3838#include "DragData.h"
     39#include "DragSession.h"
    3940#include "Editor.h"
    4041#include "EditorClient.h"
     
    163164}
    164165
    165 DragOperation DragController::dragEntered(DragData* dragData)
     166DragSession DragController::dragEntered(DragData* dragData)
    166167{
    167168    return dragEnteredOrUpdated(dragData);
     
    183184}
    184185
    185 DragOperation DragController::dragUpdated(DragData* dragData)
     186DragSession DragController::dragUpdated(DragData* dragData)
    186187{
    187188    return dragEnteredOrUpdated(dragData);
     
    233234}
    234235
    235 DragOperation DragController::dragEnteredOrUpdated(DragData* dragData)
     236DragSession DragController::dragEnteredOrUpdated(DragData* dragData)
    236237{
    237238    ASSERT(dragData);
     
    242243    if (m_dragDestinationAction == DragDestinationActionNone) {
    243244        cancelDrag(); // FIXME: Why not call mouseMovedIntoDocument(0)?
    244         return DragOperationNone;
    245     }
    246 
    247     DragOperation operation = DragOperationNone;
    248     bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, operation);
     245        return DragSession();
     246    }
     247
     248    DragSession dragSession;
     249    bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, dragSession);
    249250    if (!handledByDocument && (m_dragDestinationAction & DragDestinationActionLoad))
    250         return operationForLoad(dragData);
    251     return operation;
     251        dragSession.operation = operationForLoad(dragData);
     252    return dragSession;
    252253}
    253254
     
    285286}
    286287
    287 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragOperation& operation)
     288bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragSession& dragSession)
    288289{
    289290    ASSERT(dragData);
     
    297298    m_isHandlingDrag = false;
    298299    if (actionMask & DragDestinationActionDHTML) {
    299         m_isHandlingDrag = tryDHTMLDrag(dragData, operation);
     300        m_isHandlingDrag = tryDHTMLDrag(dragData, dragSession.operation);
    300301        // Do not continue if m_documentUnderMouse has been reset by tryDHTMLDrag.
    301302        // tryDHTMLDrag fires dragenter event. The event listener that listens
     
    318319    } else if ((actionMask & DragDestinationActionEdit) && canProcessDrag(dragData)) {
    319320        if (dragData->containsColor()) {
    320             operation = DragOperationGeneric;
     321            dragSession.operation = DragOperationGeneric;
    321322            return true;
    322323        }
     
    326327        if (!element)
    327328            return false;
    328         if (!asFileInput(element))
     329       
     330        HTMLInputElement* elementAsFileInput = asFileInput(element);
     331        if (!elementAsFileInput)
    329332            m_page->dragCaretController()->setCaretPosition(m_documentUnderMouse->frame()->visiblePositionForPoint(point));
    330333
    331334        Frame* innerFrame = element->document()->frame();
    332         operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
     335        dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
     336        dragSession.mouseIsOverFileInput = elementAsFileInput;
     337        dragSession.numberOfItemsToBeAccepted = 0;
     338
     339        unsigned numberOfFiles = dragData->numberOfFiles();
     340        if (elementAsFileInput) {
     341            if (elementAsFileInput->disabled())
     342                dragSession.numberOfItemsToBeAccepted = 0;
     343            else if (elementAsFileInput->multiple())
     344                dragSession.numberOfItemsToBeAccepted = numberOfFiles;
     345            else
     346                dragSession.numberOfItemsToBeAccepted = 1;
     347           
     348            if (!dragSession.numberOfItemsToBeAccepted)
     349                dragSession.operation = DragOperationNone;
     350        } else {
     351            // We are not over a file input element. The dragged item(s) will only
     352            // be loaded into the view the number of dragged items is 1.
     353            dragSession.numberOfItemsToBeAccepted = numberOfFiles != 1 ? 0 : 1;
     354        }
     355       
    333356        return true;
    334357    }
  • trunk/Source/WebCore/page/DragController.h

    r86472 r99108  
    3838    class DragClient;
    3939    class DragData;
     40    struct DragSession;
    4041    struct DragState;
    4142    class Element;
     
    5657        DragClient* client() const { return m_client; }
    5758
    58         DragOperation dragEntered(DragData*);
     59        DragSession dragEntered(DragData*);
    5960        void dragExited(DragData*);
    60         DragOperation dragUpdated(DragData*);
     61        DragSession dragUpdated(DragData*);
    6162        bool performDrag(DragData*);
    6263       
     
    9596        bool canProcessDrag(DragData*);
    9697        bool concludeEditDrag(DragData*);
    97         DragOperation dragEnteredOrUpdated(DragData*);
     98        DragSession dragEnteredOrUpdated(DragData*);
    9899        DragOperation operationForLoad(DragData*);
    99         bool tryDocumentDrag(DragData*, DragDestinationAction, DragOperation&);
     100        bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&);
    100101        bool tryDHTMLDrag(DragData*, DragOperation&);
    101102        DragOperation dragOperation(DragData*);
  • trunk/Source/WebCore/page/DragSession.h

    r99107 r99108  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "DragData.h"
     26#ifndef DragSession_h
     27#define DragSession_h
    2828
    29 #include "Document.h"
    30 #include "DocumentFragment.h"
    31 #include "Range.h"
     29#include "DragActions.h"
    3230
    3331namespace WebCore {
     32   
     33struct DragSession {
     34    DragOperation operation;
     35    bool mouseIsOverFileInput;
     36    unsigned numberOfItemsToBeAccepted;
    3437
    35 bool DragData::canSmartReplace() const
    36 {
    37     return false;
    38 }
    39    
    40 bool DragData::containsColor() const
    41 {
    42     return false;
     38    DragSession()
     39        : operation(DragOperationNone)
     40        , mouseIsOverFileInput(false)
     41        , numberOfItemsToBeAccepted(0)
     42    {
     43    }
     44};
     45
    4346}
    4447
    45 bool DragData::containsFiles() const
    46 {
    47     return false;
    48 }
    49 
    50 void DragData::asFilenames(Vector<String>& result) const
    51 {
    52 }
    53 
    54 bool DragData::containsPlainText() const
    55 {
    56     return false;
    57 }
    58 
    59 String DragData::asPlainText(Frame*) const
    60 {
    61     return String();
    62 }
    63    
    64 Color DragData::asColor() const
    65 {
    66     return Color();
    67 }
    68 
    69 bool DragData::containsCompatibleContent() const
    70 {
    71     return false;
    72 }
    73    
    74 bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const
    75 {
    76     return false;
    77 }
    78    
    79 String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const
    80 {
    81     return String();
    82 }
    83    
    84    
    85 PassRefPtr<DocumentFragment> DragData::asFragment(Frame*, PassRefPtr<Range>, bool, bool&) const
    86 {
    87     return 0;
    88 }
    89    
    90 }
    91 
     48#endif
  • trunk/Source/WebCore/platform/DragData.h

    r97012 r99108  
    117117    bool containsColor() const;
    118118    bool containsFiles() const;
     119    unsigned numberOfFiles() const;
    119120#if PLATFORM(MAC)
    120121    NSPasteboard *pasteboard() { return m_pasteboard.get(); }
  • trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp

    r95901 r99108  
    7272{
    7373    return m_platformDragData->containsFilenames();
     74}
     75
     76unsigned DragData::numberOfFiles() const
     77{
     78    return m_platformDragData->filenames().size();
    7479}
    7580
  • trunk/Source/WebCore/platform/efl/DragDataEfl.cpp

    r95901 r99108  
    4242}
    4343
     44unsigned DragData::numberOfFiles() const
     45{
     46    return 0;
     47}
     48
    4449void DragData::asFilenames(Vector<String>& result) const
    4550{
  • trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp

    r76039 r99108  
    4040{
    4141    return m_platformDragData->hasFilenames();
     42}
     43
     44unsigned DragData::numberOfFiles() const
     45{
     46    return m_platformDragData->filenames().size();
    4247}
    4348
  • trunk/Source/WebCore/platform/mac/DragDataMac.mm

    r85036 r99108  
    7575{
    7676    return [[m_pasteboard.get() types] containsObject:NSFilenamesPboardType];
     77}
     78
     79unsigned DragData::numberOfFiles() const
     80{
     81    if (![[m_pasteboard.get() types] containsObject:NSFilenamesPboardType])
     82        return 0;
     83    return [[m_pasteboard.get() propertyListForType:NSFilenamesPboardType] count];
    7784}
    7885
  • trunk/Source/WebCore/platform/qt/DragDataQt.cpp

    r78438 r99108  
    6161    }
    6262    return false;
     63}
     64
     65unsigned DragData::numberOfFiles() const
     66{
     67    return 0;
    6368}
    6469
  • trunk/Source/WebCore/platform/win/DragDataWin.cpp

    r86477 r99108  
    111111}
    112112
     113unsigned DragData::numberOfFiles() const
     114{
     115    return 0;
     116}
     117
    113118void DragData::asFilenames(Vector<String>& result) const
    114119{
  • trunk/Source/WebCore/platform/wince/DragDataWinCE.cpp

    r76854 r99108  
    4848}
    4949
     50unsigned DragData::numberOfFiles() const
     51{
     52    return 0;
     53}
     54
    5055void DragData::asFilenames(Vector<String>&) const
    5156{
  • trunk/Source/WebCore/platform/wx/DragDataWx.cpp

    r80287 r99108  
    4848}
    4949
     50unsigned DragData::numberOfFiles() const
     51{
     52    return 0;
     53}
     54
    5055void DragData::asFilenames(Vector<String>& result) const
    5156{
  • trunk/Source/WebKit/chromium/ChangeLog

    r99100 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * src/WebViewImpl.cpp:
     10        (WebKit::WebViewImpl::dragTargetDragEnterOrOver): The drag operation is contained
     11        within the new DragSession struct. Minor refactor.
     12
    1132011-10-31  Nat Duca  <nduca@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r99033 r99108  
    5151#include "DragData.h"
    5252#include "DragScrollTimer.h"
     53#include "DragSession.h"
    5354#include "Editor.h"
    5455#include "EventHandler.h"
     
    20682069        static_cast<DragOperation>(m_operationsAllowed));
    20692070
    2070     DragOperation dropEffect;
     2071    DragSession dragSession;
    20712072    if (dragAction == DragEnter)
    2072         dropEffect = m_page->dragController()->dragEntered(&dragData);
     2073        dragSession = m_page->dragController()->dragEntered(&dragData);
    20732074    else
    2074         dropEffect = m_page->dragController()->dragUpdated(&dragData);
     2075        dragSession = m_page->dragController()->dragUpdated(&dragData);
     2076
     2077    DragOperation dropEffect = dragSession.operation;
    20752078
    20762079    // Mask the drop effect operation against the drag source's allowed operations.
  • trunk/Source/WebKit/gtk/ChangeLog

    r99096 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * webkit/webkitwebview.cpp:
     10        (webkit_web_view_drag_motion): Minor refactoring.
     11        (webkit_web_view_drag_data_received): Minor refactoring.
     12
    1132011-11-02  Tom Sepez  <tsepez@chromium.org>
    214
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r98827 r99108  
    4848#include "DragController.h"
    4949#include "DragData.h"
     50#include "DragSession.h"
    5051#include "DumpRenderTreeSupportGtk.h"
    5152#include "Editor.h"
     
    14421443        return TRUE;
    14431444
    1444     DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get());
     1445    DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
    14451446    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
    14461447    return TRUE;
     
    14541455        return;
    14551456
    1456     DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get());
     1457    DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
    14571458    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
    14581459}
  • trunk/Source/WebKit/mac/ChangeLog

    r99096 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * WebView/WebView.mm:
     10        (-[WebView draggingEntered:]): DragOperation is now inside the DragSession struct.
     11        (-[WebView draggingUpdated:]):
     12
    1132011-11-02  Tom Sepez  <tsepez@chromium.org>
    214
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r99096 r99108  
    118118#import <WebCore/DragController.h>
    119119#import <WebCore/DragData.h>
     120#import <WebCore/DragSession.h>
    120121#import <WebCore/Editor.h>
    121122#import <WebCore/EventHandler.h>
     
    38663867    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    38673868    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    3868     return core(self)->dragController()->dragEntered(&dragData);
     3869    return core(self)->dragController()->dragEntered(&dragData).operation;
    38693870}
    38703871
     
    38783879    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    38793880    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    3880     return page->dragController()->dragUpdated(&dragData);
     3881    return page->dragController()->dragUpdated(&dragData).operation;
    38813882}
    38823883
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r98951 r99108  
    5252#include "DragController.h"
    5353#include "DragData.h"
     54#include "DragSession.h"
    5455#include "Editor.h"
    5556#include "EditorClientQt.h"
     
    992993    DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
    993994            QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
    994     Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData));
     995    Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData).operation);
    995996    ev->setDropAction(action);
    996997    ev->acceptProposedAction();
     
    10141015    DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
    10151016            QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
    1016     m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
     1017    m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData).operation);
    10171018    ev->setDropAction(m_lastDropAction);
    10181019    if (m_lastDropAction != Qt::IgnoreAction)
  • trunk/Source/WebKit/qt/ChangeLog

    r99096 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Api/qwebpage.cpp:
     10        (QWebPagePrivate::dragEnterEvent): Minor refactoring because operation is stored in
     11        new DragSession struct.
     12        (QWebPagePrivate::dragMoveEvent): Ditto.
     13
    1142011-11-02  Tom Sepez  <tsepez@chromium.org>
    215
  • trunk/Source/WebKit/win/ChangeLog

    r99096 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        * WebView.cpp:
     10        (WebView::DragEnter): Minor refactoring because operation is stored in
     11        new DragSession struct.
     12        (WebView::DragOver): Ditto.
     13
    1142011-11-02  Tom Sepez  <tsepez@chromium.org>
    215
  • trunk/Source/WebKit/win/WebView.cpp

    r98730 r99108  
    7979#include <WebCore/DragController.h>
    8080#include <WebCore/DragData.h>
     81#include <WebCore/DragSession.h>
    8182#include <WebCore/Editor.h>
    8283#include <WebCore/EventHandler.h>
     
    50855086    DragData data(pDataObject, IntPoint(localpt.x, localpt.y),
    50865087        IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    5087     *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragEntered(&data));
     5088    *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragEntered(&data).operation);
    50885089
    50895090    m_lastDropEffect = *pdwEffect;
     
    51045105        DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y),
    51055106            IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    5106         *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragUpdated(&data));
     5107        *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragUpdated(&data).operation);
    51075108    } else
    51085109        *pdwEffect = DROPEFFECT_NONE;
  • trunk/Source/WebKit2/ChangeLog

    r99107 r99108  
     12011-11-02  Jon Lee  <jonlee@apple.com>
     2
     3        Expand DragController to provide more information about the dragging session
     4        https://bugs.webkit.org/show_bug.cgi?id=71324
     5        <rdar://problem/10379175>
     6
     7        Reviewed by Darin Adler.
     8
     9        We now pass the DragSession struct from the Web to the UI process, instead of the
     10        DragOperation enum.
     11
     12        * Scripts/webkit2/messages.py:
     13        * Shared/WebCoreArgumentCoders.cpp:
     14        (CoreIPC::::encode):
     15        (CoreIPC::::decode):
     16        * Shared/WebCoreArgumentCoders.h:
     17        * UIProcess/API/mac/WKView.mm:
     18        (-[WKView draggingUpdated:]):
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::WebPageProxy): We now cache the last known DragSession state
     21        (WebKit::WebPageProxy::didPerformDragControllerAction):
     22        * UIProcess/WebPageProxy.h:
     23        (WebKit::WebPageProxy::dragSession):
     24        (WebKit::WebPageProxy::resetDragOperation):
     25        * UIProcess/WebPageProxy.messages.in:
     26        * UIProcess/win/WebView.cpp:
     27        (WebKit::WebView::keyStateToDragOperation):
     28        (WebKit::WebView::DragEnter):
     29        (WebKit::WebView::DragOver):
     30        * WebProcess/WebPage/WebPage.cpp:
     31        (WebKit::WebPage::performDragControllerAction):
     32
    1332011-11-02  Anders Carlsson  <andersca@apple.com>
    234
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r97639 r99108  
    171171        'WebCore::EditorCommandsForKeyEvent',
    172172        'WebCore::CompositionUnderline',
     173        'WebCore::DragSession',
    173174        'WebCore::FloatPoint3D',
    174175        'WebCore::FileChooserSettings',
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp

    r98923 r99108  
    3232#include <WebCore/Cursor.h>
    3333#include <WebCore/DatabaseDetails.h>
     34#include <WebCore/DragSession.h>
    3435#include <WebCore/Editor.h>
    3536#include <WebCore/FileChooser.h>
     
    601602        return false;
    602603    if (!decoder->decode(result.replacement))
     604        return false;
     605    return true;
     606}
     607
     608void ArgumentCoder<DragSession>::encode(ArgumentEncoder* encoder, const DragSession& result)
     609{
     610    encoder->encodeEnum(result.operation);
     611    encoder->encode(result.mouseIsOverFileInput);
     612    encoder->encode(result.numberOfItemsToBeAccepted);
     613}
     614
     615bool ArgumentCoder<DragSession>::decode(ArgumentDecoder* decoder, DragSession& result)
     616{
     617    if (!decoder->decodeEnum(result.operation))
     618        return false;
     619    if (!decoder->decode(result.mouseIsOverFileInput))
     620        return false;
     621    if (!decoder->decode(result.numberOfItemsToBeAccepted))
    603622        return false;
    604623    return true;
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h

    r98923 r99108  
    4848    class ResourceResponse;
    4949    struct CompositionUnderline;
     50    struct DragSession;
    5051    struct FileChooserSettings;
    5152    struct GrammarDetail;
     
    214215    static bool decode(ArgumentDecoder*, WebCore::TextCheckingResult&);
    215216};
     217   
     218template<> struct ArgumentCoder<WebCore::DragSession> {
     219    static void encode(ArgumentEncoder*, const WebCore::DragSession&);
     220    static bool decode(ArgumentDecoder*, WebCore::DragSession&);
     221};
    216222
    217223#if PLATFORM(QT)
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r98184 r99108  
    6262#import <WebCore/DragController.h>
    6363#import <WebCore/DragData.h>
     64#import <WebCore/DragSession.h>
    6465#import <WebCore/FloatRect.h>
    6566#import <WebCore/IntRect.h>
     
    15871588    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    15881589    _data->_page->dragUpdated(&dragData, [[draggingInfo draggingPasteboard] name]);
    1589     return _data->_page->dragOperation();
     1590   
     1591    WebCore::DragSession dragSession = _data->_page->dragSession();
     1592    return dragSession.operation;
    15901593}
    15911594
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r99096 r99108  
    7272#include "WebSecurityOrigin.h"
    7373#include "WebURLRequest.h"
     74#include <WebCore/DragController.h>
    7475#include <WebCore/DragData.h>
     76#include <WebCore/DragSession.h>
    7577#include <WebCore/FloatRect.h>
    7678#include <WebCore/FocusDirection.h>
     
    182184    , m_pendingLearnOrIgnoreWordMessageCount(0)
    183185    , m_mainFrameHasCustomRepresentation(false)
    184     , m_currentDragOperation(DragOperationNone)
    185186    , m_mainFrameHasHorizontalScrollbar(false)
    186187    , m_mainFrameHasVerticalScrollbar(false)
     
    851852}
    852853
    853 void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation)
    854 {
    855     m_currentDragOperation = static_cast<DragOperation>(resultOperation);
     854void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
     855{
     856    m_currentDragSession = dragSession;
    856857}
    857858
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r99096 r99108  
    5555#include "WebUIClient.h"
    5656#include <WebCore/DragActions.h>
     57#include <WebCore/DragSession.h>
    5758#include <WebCore/HitTestResult.h>
    5859#include <WebCore/PlatformScreen.h>
     
    468469    void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
    469470
    470     void didPerformDragControllerAction(uint64_t resultOperation);
     471    void didPerformDragControllerAction(WebCore::DragSession);
    471472    void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
    472473#if PLATFORM(MAC)
     
    506507    bool isValid();
    507508   
    508     WebCore::DragOperation dragOperation() { return m_currentDragOperation; }
    509     void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; }
     509    WebCore::DragSession dragSession() const { return m_currentDragSession; }
     510    void resetDragOperation() { m_currentDragSession = WebCore::DragSession(); }
    510511
    511512    void preferencesDidChange();
     
    926927
    927928    bool m_mainFrameHasCustomRepresentation;
    928     WebCore::DragOperation m_currentDragOperation;
     929    WebCore::DragSession m_currentDragSession;
    929930
    930931    String m_pendingAPIRequestURL;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r99096 r99108  
    207207
    208208    # Drag and drop messages
    209     DidPerformDragControllerAction(uint64_t resultOperation)
     209    DidPerformDragControllerAction(WebCore::DragSession dragSession)
    210210#if PLATFORM(MAC)
    211211    SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag)
  • trunk/Source/WebKit2/UIProcess/win/WebView.cpp

    r98472 r99108  
    4747#include <WebCore/BitmapInfo.h>
    4848#include <WebCore/Cursor.h>
     49#include <WebCore/DragSession.h>
    4950#include <WebCore/Editor.h>
    5051#include <WebCore/FloatRect.h>
     
    16421643    // state of the keyboard modifier keys on the keyboard. See:
    16431644    // <http://msdn.microsoft.com/en-us/library/ms680129(VS.85).aspx>.
    1644     DragOperation operation = m_page->dragOperation();
     1645    DragOperation operation = m_page->dragSession().operation;
    16451646
    16461647    if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == (MK_CONTROL | MK_SHIFT))
     
    16661667    DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    16671668    m_page->dragEntered(&data);
    1668     *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
     1669    *pdwEffect = dragOperationToDragCursor(m_page->dragSession().operation);
    16691670
    16701671    m_lastDropEffect = *pdwEffect;
     
    16841685        DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    16851686        m_page->dragUpdated(&data);
    1686         *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
     1687        *pdwEffect = dragOperationToDragCursor(m_page->dragSession().operation);
    16871688    } else
    16881689        *pdwEffect = DROPEFFECT_NONE;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r99051 r99108  
    8080#include <WebCore/DragController.h>
    8181#include <WebCore/DragData.h>
     82#include <WebCore/DragSession.h>
    8283#include <WebCore/EventHandler.h>
    8384#include <WebCore/FocusController.h>
     
    18161817{
    18171818    if (!m_page) {
    1818         send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
     1819        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession());
    18191820        return;
    18201821    }
     
    18471848{
    18481849    if (!m_page) {
    1849         send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
     1850        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession()));
    18501851#if PLATFORM(QT)
    18511852        QMimeData* data = const_cast<QMimeData*>(dragData.platformData());
     
    18911892{
    18921893    if (!m_page) {
    1893         send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
     1894        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession()));
    18941895        return;
    18951896    }
Note: See TracChangeset for help on using the changeset viewer.