Changeset 217074 in webkit


Ignore:
Timestamp:
May 18, 2017 4:20:34 PM (7 years ago)
Author:
Wenson Hsieh
Message:

Selection around attachment elements should not persist when beginning a drag
https://bugs.webkit.org/show_bug.cgi?id=172319
<rdar://problem/32283008>

Reviewed by Tim Horton.

Source/WebCore:

When beginning to drag an attachment element, save and restore the visible selection when calling out to the
injected bundle for additional data, and when creating the drag image.

Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.

  • page/DragController.cpp:

(WebCore::DragController::startDrag):

Tools:

Tests that temporary selection around an attachment does not persist longer than it needs to.

  • TestWebKitAPI/Tests/ios/DataInteractionTests.mm:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r217071 r217074  
     12017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Selection around attachment elements should not persist when beginning a drag
     4        https://bugs.webkit.org/show_bug.cgi?id=172319
     5        <rdar://problem/32283008>
     6
     7        Reviewed by Tim Horton.
     8
     9        When beginning to drag an attachment element, save and restore the visible selection when calling out to the
     10        injected bundle for additional data, and when creating the drag image.
     11
     12        Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
     13
     14        * page/DragController.cpp:
     15        (WebCore::DragController::startDrag):
     16
    1172017-05-18  Daniel Bates  <dabates@apple.com>
    218
  • trunk/Source/WebCore/page/DragController.cpp

    r216351 r217074  
    10571057#if ENABLE(ATTACHMENT_ELEMENT)
    10581058    if (is<HTMLAttachmentElement>(element) && m_dragSourceAction & DragSourceActionAttachment) {
     1059        src.editor().setIgnoreSelectionChanges(true);
     1060        auto previousSelection = src.selection().selection();
    10591061        if (!dataTransfer.pasteboard().hasData()) {
    10601062            selectElement(element);
     
    10851087        }
    10861088        doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionAttachment);
     1089        src.selection().setSelection(previousSelection);
     1090        src.editor().setIgnoreSelectionChanges(false);
    10871091        return true;
    10881092    }
  • trunk/Tools/ChangeLog

    r217068 r217074  
     12017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Selection around attachment elements should not persist when beginning a drag
     4        https://bugs.webkit.org/show_bug.cgi?id=172319
     5        <rdar://problem/32283008>
     6
     7        Reviewed by Tim Horton.
     8
     9        Tests that temporary selection around an attachment does not persist longer than it needs to.
     10
     11        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
     12        (TestWebKitAPI::TEST):
     13
    1142017-05-18  John Wilander  <wilander@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm

    r216997 r217074  
    645645
    646646    EXPECT_WK_STREQ("hello", [injectedString UTF8String]);
     647    EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"getSelection().isCollapsed"].boolValue);
    647648}
    648649
Note: See TracChangeset for help on using the changeset viewer.