Changeset 176687 in webkit


Ignore:
Timestamp:
Dec 2, 2014 1:00:07 PM (10 years ago)
Author:
mitz@apple.com
Message:

REGRESSION: Dragging selected text changes the selection
https://bugs.webkit.org/show_bug.cgi?id=139110

Reviewed by Simon Fraser.

After it sent the UI process the message to start dragging, the Web process handled mouse
move events that had already been in flight, interpreting them as a drag to start a new
selection. This is fixed by ignoring any mouse events received after asking the UI process
to start dragging.

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::setDragImage): Send the new DidStartDrag message back to the Web
process, so that it stops ignoring mouse events.

  • WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:

(WebKit::WebDragClient::startDrag): Call the new WebPage::willStartDrag, so that it starts
ignoring mouse events.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage): Initialize new member variable.
(WebKit::WebPage::mouseEvent): Don’t handle the event if we have asked the UI process to
start dragging.

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::willStartDrag): Added. Sets new member variable m_isStartingDrag to true.
(WebKit::WebPage::didStartDrag): Added. Handles the message from the UI process by setting
m_isStartingDrag back to false.

  • WebProcess/WebPage/WebPage.messages.in: Added DidStartDrag.
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r176684 r176687  
     12014-12-02  Dan Bernstein  <mitz@apple.com>
     2
     3        REGRESSION: Dragging selected text changes the selection
     4        https://bugs.webkit.org/show_bug.cgi?id=139110
     5
     6        Reviewed by Simon Fraser.
     7
     8        After it sent the UI process the message to start dragging, the Web process handled mouse
     9        move events that had already been in flight, interpreting them as a drag to start a new
     10        selection. This is fixed by ignoring any mouse events received after asking the UI process
     11        to start dragging.
     12
     13        * UIProcess/mac/WebPageProxyMac.mm:
     14        (WebKit::WebPageProxy::setDragImage): Send the new DidStartDrag message back to the Web
     15        process, so that it stops ignoring mouse events.
     16
     17        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
     18        (WebKit::WebDragClient::startDrag): Call the new WebPage::willStartDrag, so that it starts
     19        ignoring mouse events.
     20
     21        * WebProcess/WebPage/WebPage.cpp:
     22        (WebKit::WebPage::WebPage): Initialize new member variable.
     23        (WebKit::WebPage::mouseEvent): Don’t handle the event if we have asked the UI process to
     24        start dragging.
     25
     26        * WebProcess/WebPage/WebPage.h:
     27        (WebKit::WebPage::willStartDrag): Added. Sets new member variable m_isStartingDrag to true.
     28        (WebKit::WebPage::didStartDrag): Added. Handles the message from the UI process by setting
     29        m_isStartingDrag back to false.
     30
     31        * WebProcess/WebPage/WebPage.messages.in: Added DidStartDrag.
     32
    1332014-12-02  Beth Dakin  <bdakin@apple.com>
    234
  • trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r176164 r176687  
    379379void WebPageProxy::setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag)
    380380{
    381     RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle);
    382     if (!dragImage)
    383         return;
    384    
    385     m_pageClient.setDragImage(clientPosition, dragImage.release(), isLinkDrag);
     381    if (RefPtr<ShareableBitmap> dragImage = ShareableBitmap::create(dragImageHandle))
     382        m_pageClient.setDragImage(clientPosition, dragImage.release(), isLinkDrag);
     383
     384    process().send(Messages::WebPage::DidStartDrag(), m_pageID);
    386385}
    387386
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm

    r174676 r176687  
    8181        return;
    8282
     83    m_page->willStartDrag();
     84
    8385    // FIXME: Seems this message should be named StartDrag, not SetDragImage.
    8486    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, linkDrag));
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r176544 r176687  
    291291    , m_canRunModal(parameters.canRunModal)
    292292    , m_isRunningModal(false)
     293#if ENABLE(DRAG_SUPPORT)
     294    , m_isStartingDrag(false)
     295#endif
    293296    , m_cachedMainFrameIsPinnedToLeftSide(true)
    294297    , m_cachedMainFrameIsPinnedToRightSide(true)
     
    19101913    m_page->pageThrottler().didReceiveUserInput();
    19111914
     1915    bool shouldHandleEvent = true;
     1916
    19121917#if ENABLE(CONTEXT_MENUS)
    19131918    // Don't try to handle any pending mouse events if a context menu is showing.
    1914     if (m_isShowingContextMenu) {
     1919    if (m_isShowingContextMenu)
     1920        shouldHandleEvent = false;
     1921#endif
     1922#if ENABLE(DRAG_SUPPORT)
     1923    if (m_isStartingDrag)
     1924        shouldHandleEvent = false;
     1925#endif
     1926
     1927    if (!shouldHandleEvent) {
    19151928        send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), false));
    19161929        return;
    19171930    }
    1918 #endif
     1931
    19191932    bool handled = false;
    19201933
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r176462 r176687  
    696696    void willPerformLoadDragDestinationAction();
    697697    void mayPerformUploadDragDestinationAction();
     698
     699    void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
     700    void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
    698701#endif // ENABLE(DRAG_SUPPORT)
    699702
     
    12331236    bool m_canRunModal;
    12341237    bool m_isRunningModal;
     1238
     1239#if ENABLE(DRAG_SUPPORT)
     1240    bool m_isStartingDrag;
     1241#endif
    12351242
    12361243    bool m_cachedMainFrameIsPinnedToLeftSide;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r176337 r176687  
    230230#endif
    231231#if ENABLE(DRAG_SUPPORT)
     232    DidStartDrag()
    232233    DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
    233234#endif
Note: See TracChangeset for help on using the changeset viewer.