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

Changeset 278002 in webkit


Ignore:
Timestamp:
May 25, 2021, 1:32:20 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=225267

Patch by Frederic Wang <fwang@igalia.com> on 2021-05-25
Reviewed by Ryosuke Niwa.

Source/WebCore:

WebCore::Position::upstream behaves specially for table renderer, which may confuse the
execution of WebCore::InsertParagraphSeparatorCommand::doApply() when the visible position
is within a table, leading to a debug assertion failure and a nullptr dereference in release
build. In r273375, this was fixed for DOM elements with the table tag, but this does not work
for display: table. This patch instead directly calls isRenderedTable, for consistency with
WebCore::Position::upstream.

Test: fast/editing/paste-and-match-style-with-table-2-crash.html

  • editing/markup.cpp:

(WebCore::createFragmentFromText): Use isRenderedTable instead of checking the tag name.

LayoutTests:

Add regression test.

  • fast/editing/paste-and-match-style-with-table-2-crash-expected.txt: Added.
  • fast/editing/paste-and-match-style-with-table-2-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r278001 r278002  
     12021-05-25  Frederic Wang  <fwang@igalia.com>
     2
     3        Crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
     4        https://bugs.webkit.org/show_bug.cgi?id=225267
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add regression test.
     9
     10        * fast/editing/paste-and-match-style-with-table-2-crash-expected.txt: Added.
     11        * fast/editing/paste-and-match-style-with-table-2-crash.html: Added.
     12
    1132021-05-25  Fujii Hironori  <Hironori.Fujii@sony.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r278000 r278002  
     12021-05-25  Frederic Wang  <fwang@igalia.com>
     2
     3        Crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply
     4        https://bugs.webkit.org/show_bug.cgi?id=225267
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        WebCore::Position::upstream behaves specially for table renderer, which may confuse the
     9        execution of WebCore::InsertParagraphSeparatorCommand::doApply() when the visible position
     10        is within a table, leading to a debug assertion failure and a nullptr dereference in release
     11        build. In r273375, this was fixed for DOM elements with the table tag, but this does not work
     12        for display: table. This patch instead directly calls isRenderedTable, for consistency with
     13        WebCore::Position::upstream.
     14
     15        Test: fast/editing/paste-and-match-style-with-table-2-crash.html
     16
     17        * editing/markup.cpp:
     18        (WebCore::createFragmentFromText): Use isRenderedTable instead of checking the tag name.
     19
    1202021-05-25  Ian Gilbert  <iang@apple.com>
    221
  • trunk/Source/WebCore/editing/markup.cpp

    r277967 r278002  
    12041204        && !block->hasTagName(htmlTag)
    12051205        // Avoid using table as paragraphs due to its special treatment in Position::upstream/downstream.
    1206         && !block->hasTagName(tableTag)
     1206        && !isRenderedTable(block)
    12071207        && block != editableRootForPosition(start);
    12081208    bool useLineBreak = enclosingTextFormControl(start);
Note: See TracChangeset for help on using the changeset viewer.