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

Changeset 280381 in webkit


Ignore:
Timestamp:
Jul 28, 2021, 7:01:53 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Crash in ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=226926

Patch by Frédéric Wang <fwang@igalia.com> on 2021-07-28
Reviewed by Ryosuke Niwa.

Source/WebCore:

In r179944 and r180050, special handling was added for display: grid/flex nodes in
Position::isCandidate in order to make them editable but the same logic was not added in
PositionIterator::isCandidate. This patch fixes that inconsistency as well as the
corresponding debug ASSERT and release nullptr dereference.

Tests: fast/editing/apply-relative-font-style-change-crash-001.html

fast/editing/apply-relative-font-style-change-crash-002.html

  • dom/PositionIterator.cpp:

(WebCore::PositionIterator::isCandidate const): Handle flexbox and grid.

LayoutTests:

Add regression tests.

  • fast/editing/apply-relative-font-style-change-crash-001-expected.txt: Added.
  • fast/editing/apply-relative-font-style-change-crash-001-expected.txt: Added.
  • fast/editing/apply-relative-font-style-change-crash-002.html: Added.
  • fast/editing/apply-relative-font-style-change-crash-002.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280378 r280381  
     12021-07-28  Frédéric Wang  <fwang@igalia.com>
     2
     3        Crash in ApplyStyleCommand::applyRelativeFontStyleChange
     4        https://bugs.webkit.org/show_bug.cgi?id=226926
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add regression tests.
     9
     10        * fast/editing/apply-relative-font-style-change-crash-001-expected.txt: Added.
     11        * fast/editing/apply-relative-font-style-change-crash-001-expected.txt: Added.
     12        * fast/editing/apply-relative-font-style-change-crash-002.html: Added.
     13        * fast/editing/apply-relative-font-style-change-crash-002.html: Added.
     14
    1152021-07-28  Fujii Hironori  <Hironori.Fujii@sony.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r280376 r280381  
     12021-07-28  Frédéric Wang  <fwang@igalia.com>
     2
     3        Crash in ApplyStyleCommand::applyRelativeFontStyleChange
     4        https://bugs.webkit.org/show_bug.cgi?id=226926
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        In r179944 and r180050, special handling was added for display: grid/flex nodes in
     9        Position::isCandidate in order to make them editable but the same logic was not added in
     10        PositionIterator::isCandidate. This patch fixes that inconsistency as well as the
     11        corresponding debug ASSERT and release nullptr dereference.
     12
     13        Tests: fast/editing/apply-relative-font-style-change-crash-001.html
     14               fast/editing/apply-relative-font-style-change-crash-002.html
     15
     16        * dom/PositionIterator.cpp:
     17        (WebCore::PositionIterator::isCandidate const): Handle flexbox and grid.
     18
    1192021-07-27  Joonghun Park  <jh718.park@samsung.com>
    220
  • trunk/Source/WebCore/dom/PositionIterator.cpp

    r271635 r280381  
    3333#include "HTMLNames.h"
    3434#include "RenderBlockFlow.h"
     35#include "RenderFlexibleBox.h"
     36#include "RenderGrid.h"
    3537#include "RenderText.h"
    3638
     
    165167        return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parentNode());
    166168
    167     if (!is<HTMLHtmlElement>(*m_anchorNode) && is<RenderBlockFlow>(*renderer)) {
    168         RenderBlockFlow& block = downcast<RenderBlockFlow>(*renderer);
     169    if (!is<HTMLHtmlElement>(*m_anchorNode) && (is<RenderBlockFlow>(*renderer) || is<RenderGrid>(*renderer) || is<RenderFlexibleBox>(*renderer))) {
     170        auto& block = downcast<RenderBlock>(*renderer);
    169171        if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode)) {
    170172            if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
Note: See TracChangeset for help on using the changeset viewer.