⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269136 in webkit


Ignore:
Timestamp:
Oct 28, 2020, 8:53:02 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

REGRESSION(r267329): Crash in VisibleSelection::toNormalizedRange()
https://bugs.webkit.org/show_bug.cgi?id=218276

Reviewed by Wenson Hsieh.

Source/WebCore:

The crash was a symptom of the issue that m_extent or m_base could be null but not the other
when canonicalizing a non-null Position with VisiblePosition will make it null.

Fixed the bug by making sure base and extent's nullness match.

Test: editing/selection/delete-selection-with-disconnected-extent.html

  • editing/VisibleSelection.cpp:

(WebCore::VisibleSelection::setBaseAndExtentToDeepEquivalents):

LayoutTests:

Added a regression test and rebaselined the test now that we got the pre-r267329 behavior back.

  • editing/execCommand/insert-list-nested-with-orphaned-expected.txt: Reverted the rebaseline in r267329.
  • editing/selection/delete-selection-with-disconnected-extent-expected.txt: Added.
  • editing/selection/delete-selection-with-disconnected-extent.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269135 r269136  
     12020-10-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r267329): Crash in VisibleSelection::toNormalizedRange()
     4        https://bugs.webkit.org/show_bug.cgi?id=218276
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Added a regression test and rebaselined the test now that we got the pre-r267329 behavior back.
     9
     10        * editing/execCommand/insert-list-nested-with-orphaned-expected.txt: Reverted the rebaseline in r267329.
     11        * editing/selection/delete-selection-with-disconnected-extent-expected.txt: Added.
     12        * editing/selection/delete-selection-with-disconnected-extent.html: Added.
     13
    1142020-10-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    215
  • trunk/LayoutTests/editing/execCommand/insert-list-nested-with-orphaned-expected.txt

    r267329 r269136  
    1818|     <ol>
    1919|       <li>
    20 |         "because of you"
     20|         "<#selection-caret>because of you"
    2121|   "
    2222    "
  • trunk/Source/WebCore/ChangeLog

    r269134 r269136  
     12020-10-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r267329): Crash in VisibleSelection::toNormalizedRange()
     4        https://bugs.webkit.org/show_bug.cgi?id=218276
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        The crash was a symptom of the issue that m_extent or m_base could be null but not the other
     9        when canonicalizing a non-null Position with VisiblePosition will make it null.
     10
     11        Fixed the bug by making sure base and extent's nullness match.
     12
     13        Test: editing/selection/delete-selection-with-disconnected-extent.html
     14
     15        * editing/VisibleSelection.cpp:
     16        (WebCore::VisibleSelection::setBaseAndExtentToDeepEquivalents):
     17
    1182020-10-28  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebCore/editing/VisibleSelection.cpp

    r268847 r269136  
    233233    else
    234234        m_extent = VisiblePosition(m_focus, m_affinity).deepEquivalent();
     235    if (m_base.isNull() != m_extent.isNull()) {
     236        if (m_base.isNull())
     237            m_base = m_extent;
     238        else
     239            m_extent = m_base;
     240    }
    235241}
    236242
Note: See TracChangeset for help on using the changeset viewer.