Changeset 238375 in webkit


Ignore:
Timestamp:
Nov 19, 2018 8:31:22 AM (5 years ago)
Author:
Wenson Hsieh
Message:

Dragging image with a border-image larger than the image element crashes
https://bugs.webkit.org/show_bug.cgi?id=191817
<rdar://problem/46159222>

Reviewed by Ryosuke Niwa.

Source/WebCore:

When dragging an image element, if the image element has:

(1) box-sizing: border-box;
(2) a border-image
(3) a border-top-width that is at least as large as the height of the element and/or a border-left-width that is

at least as large as the width of the element

...then upon drag, we will fail to create a suitable drag image using the bounding box of the image element
since the size is empty, thereby causing a crash. To fix this, we bail out of this bounding-rect-dependent
codepath for generating a drag image in the case where the bounding rect is empty, and instead fall back to an
icon representation for the drag image.

Test: fast/events/drag-image-with-border-image.html

  • page/DragController.cpp:

(WebCore::DragController::doImageDrag):

LayoutTests:

Verifies that an image that meets the pathological criteria described in Source/WebCore/ChangeLog can still be
dragged and dropped into an editable area.

  • fast/events/drag-image-with-border-image.html: Added.
  • platform/gtk/TestExpectations:
  • platform/ios/TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • platform/wpe/TestExpectations:

Enable this test only in WebKit1.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238365 r238375  
     12018-11-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Dragging image with a border-image larger than the image element crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=191817
     5        <rdar://problem/46159222>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Verifies that an image that meets the pathological criteria described in Source/WebCore/ChangeLog can still be
     10        dragged and dropped into an editable area.
     11
     12        * fast/events/drag-image-with-border-image.html: Added.
     13        * platform/gtk/TestExpectations:
     14        * platform/ios/TestExpectations:
     15        * platform/mac-wk2/TestExpectations:
     16        * platform/wpe/TestExpectations:
     17
     18        Enable this test only in WebKit1.
     19
    1202018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    221
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r238350 r238375  
    25022502webkit.org/b/42194 fast/events/drag-and-drop-link.html [ Failure ]
    25032503webkit.org/b/157179 fast/events/drag-and-drop-link-into-focused-contenteditable.html [ Failure ]
     2504webkit.org/b/157179 fast/events/drag-image-with-border-image.html [ Failure ]
    25042505webkit.org/b/157179 fast/events/draggable-div-customdata.html [ Failure ]
    25052506webkit.org/b/157179 fast/events/draggable-div-nodata.html [ Failure ]
  • trunk/LayoutTests/platform/ios/TestExpectations

    r238279 r238375  
    282282fast/events/drag-file-crash.html [ Skip ]
    283283fast/events/drag-image-filename.html [ Skip ]
     284fast/events/drag-image-with-border-image.html [ Skip ]
    284285fast/events/drag-in-frames.html [ Skip ]
    285286fast/events/drag-and-drop-link.html [ Skip ]
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r238299 r238375  
    130130fast/events/drag-and-drop-link-fast-multiple-times-does-not-crash.html
    131131fast/events/drag-and-drop-link-containing-block.html
     132fast/events/drag-image-with-border-image.html
    132133fast/events/drag-in-frames.html
    133134fast/events/drag-parent-node.html
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r238350 r238375  
    159159fast/events/drag-display-none-element.html [ Skip ]
    160160fast/events/drag-image-filename.html [ Skip ]
     161fast/events/drag-image-with-border-image.html [ Skip ]
    161162fast/events/drag-in-frames.html [ Skip ]
    162163fast/events/drag-outside-window.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r238363 r238375  
     12018-11-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Dragging image with a border-image larger than the image element crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=191817
     5        <rdar://problem/46159222>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        When dragging an image element, if the image element has:
     10
     11        (1) box-sizing: border-box;
     12        (2) a border-image
     13        (3) a border-top-width that is at least as large as the height of the element and/or a border-left-width that is
     14            at least as large as the width of the element
     15
     16        ...then upon drag, we will fail to create a suitable drag image using the bounding box of the image element
     17        since the size is empty, thereby causing a crash. To fix this, we bail out of this bounding-rect-dependent
     18        codepath for generating a drag image in the case where the bounding rect is empty, and instead fall back to an
     19        icon representation for the drag image.
     20
     21        Test: fast/events/drag-image-with-border-image.html
     22
     23        * page/DragController.cpp:
     24        (WebCore::DragController::doImageDrag):
     25
    1262018-11-18  Zan Dobersek  <zdobersek@igalia.com>
    227
  • trunk/Source/WebCore/page/DragController.cpp

    r237986 r238375  
    12051205
    12061206    Image* image = getImage(element);
    1207     if (image && shouldUseCachedImageForDragImage(*image) && (dragImage = DragImage { createDragImageFromImage(image, element.renderer() ? orientationDescription : ImageOrientationDescription()) })) {
     1207    if (image && !layoutRect.isEmpty() && shouldUseCachedImageForDragImage(*image) && (dragImage = DragImage { createDragImageFromImage(image, element.renderer() ? orientationDescription : ImageOrientationDescription()) })) {
    12081208        dragImage = DragImage { fitDragImageToMaxSize(dragImage.get(), layoutRect.size(), maxDragImageSize()) };
    12091209        IntSize fittedSize = dragImageSize(dragImage.get());
Note: See TracChangeset for help on using the changeset viewer.