Changeset 259595 in webkit


Ignore:
Timestamp:
Apr 6, 2020 2:44:11 PM (4 years ago)
Author:
Jack Lee
Message:

Nullptr crash in CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary with draggable text
https://bugs.webkit.org/show_bug.cgi?id=209999
<rdar://problem/58978340>

Reviewed by Ryosuke Niwa.

Source/WebCore:

VisibleParagraphStart/End may return empty VisiblePosition if no proper element or node
can be used as position candidate. Add null check for the returned VisiblePositions.

Test: fast/css/style-change-draggable-text.html

  • editing/CompositeEditCommand.cpp:

(WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):

LayoutTests:

Added a regression test for the crash.

  • fast/css/style-change-draggable-text-expected.txt: Added.
  • fast/css/style-change-draggable-text.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259593 r259595  
     12020-04-06  Jack Lee  <shihchieh_lee@apple.com>
     2
     3        Nullptr crash in CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary with draggable text
     4        https://bugs.webkit.org/show_bug.cgi?id=209999
     5        <rdar://problem/58978340>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Added a regression test for the crash.
     10
     11        * fast/css/style-change-draggable-text-expected.txt: Added.
     12        * fast/css/style-change-draggable-text.html: Added.
     13
    1142020-04-06  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r259594 r259595  
     12020-04-06  Jack Lee  <shihchieh_lee@apple.com>
     2
     3        Nullptr crash in CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary with draggable text
     4        https://bugs.webkit.org/show_bug.cgi?id=209999
     5        <rdar://problem/58978340>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        VisibleParagraphStart/End may return empty VisiblePosition if no proper element or node
     10        can be used as position candidate. Add null check for the returned VisiblePositions.
     11
     12        Test: fast/css/style-change-draggable-text.html
     13
     14        * editing/CompositeEditCommand.cpp:
     15        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
     16
    1172020-04-06  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebCore/editing/CompositeEditCommand.cpp

    r259575 r259595  
    11601160    VisiblePosition visibleParagraphStart(startOfParagraph(visiblePos));
    11611161    VisiblePosition visibleParagraphEnd = endOfParagraph(visiblePos);
     1162    if (visibleParagraphStart.isNull() || visibleParagraphEnd.isNull())
     1163        return nullptr;
     1164
    11621165    VisiblePosition next = visibleParagraphEnd.next();
    11631166    VisiblePosition visibleEnd = next.isNotNull() ? next : visibleParagraphEnd;
Note: See TracChangeset for help on using the changeset viewer.