haikuwebkit/LayoutTests/editing/style
commit-queue@webkit.org 76f3f97c6e Nullptr deref in WebCore::ApplyStyleCommand::applyRelativeFontStyleChange
https://bugs.webkit.org/show_bug.cgi?id=223364

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

Source/WebCore:

When the editing code creates a span to apply font style change, it may not have editable
style if the document sets extra style (e.g. user-select: all). This is causing a debug
ASSERT in AppendNodeCommand::AppendNodeCommand when the span is inserted and a nullptr
dereference later in release mode. This patch ensures that we skip the font style change
when that happens.

Test: editing/style/apply-font-style-change-crash.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Skip the font style change if
the span insertion failed.
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): After inserting the new element,
ensure that the conditions from the ASSERT of AppendNodeCommand::AppendNodeCommand hold and
return failure if they don't.
* editing/ApplyStyleCommand.h: Return a boolean indicating success.

LayoutTests:

Add regression test.

* editing/style/apply-font-style-change-crash-expected.txt: Added.
* editing/style/apply-font-style-change-crash.html: Added.

Canonical link: https://commits.webkit.org/235647@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-23 13:55:33 +00:00
..
4230923-expected.txt
4230923.html
4916887.html
5017613-1.html
5017613-2.html
5046875-1.html
5046875-2.html
5065910.html
5084241.html
5091898.html
5228141.html
5279521.html
apple-style-editable-mix.html
apply-font-size-to-multiple-nodes-expected.txt Make dump-as-markup.js dump newlines within text as "\n" 2020-12-04 19:43:08 +00:00
apply-font-size-to-multiple-nodes.html
apply-font-style-change-crash-expected.txt Nullptr deref in WebCore::ApplyStyleCommand::applyRelativeFontStyleChange 2021-03-23 13:55:33 +00:00
apply-font-style-change-crash.html Nullptr deref in WebCore::ApplyStyleCommand::applyRelativeFontStyleChange 2021-03-23 13:55:33 +00:00
apply-style-atomic-expected.txt
apply-style-atomic.html
apply-style-crash-expected.txt
apply-style-crash.html
apply-style-crash2-expected.txt
apply-style-crash2.html
apply-style-crash3-expected.txt
apply-style-crash3.html
apply-style-iframe-crash-expected.txt
apply-style-iframe-crash.html
apply-style-join-child-text-nodes-crash-expected.txt
apply-style-join-child-text-nodes-crash.html
apply-through-end-of-document-expected.txt
apply-through-end-of-document.html
background-color-retained-expected.txt
background-color-retained.html
block-style-001.html
block-style-002.html
block-style-003.html
block-style-004-expected.txt
block-style-004.html
block-style-005-expected.txt
block-style-005.html
block-style-006-expected.txt
block-style-006.html
block-style-progress-crash-expected.txt
block-style-progress-crash.html
block-styles-007.html
bold-with-dom-changes-expected.txt
bold-with-dom-changes.html
change-text-direction-crash-expected.txt
change-text-direction-crash.html
create-block-for-style-001.html
create-block-for-style-002.html
create-block-for-style-003.html
create-block-for-style-004.html
create-block-for-style-005.html
create-block-for-style-006.html
create-block-for-style-007.html
create-block-for-style-008.html
create-block-for-style-009.html
create-block-for-style-010.html
create-block-for-style-011.html
create-block-for-style-012.html
create-block-for-style-013.html
designmode.html
fix-range-from-root-editable-crash-expected.txt
fix-range-from-root-editable-crash.html
font-face-unquote-expected.txt
font-face-unquote.html
font-family-with-space.html
fontsize-1-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
fontsize-1.html
fore-color-by-name-expected.txt
fore-color-by-name.html
heading-text-after-hr-expected.txt
heading-text-after-hr.html
highlight-insert-paragraph-expected.txt
highlight-insert-paragraph.html
highlight.html
iframe-onload-crash-mac-expected.txt
iframe-onload-crash-mac.html
iframe-onload-crash-unix-expected.txt
iframe-onload-crash-unix.html
iframe-onload-crash-win-expected.txt
iframe-onload-crash-win.html Source/WebCore: 2020-11-17 01:34:46 +00:00
inline-style-container-expected.txt
inline-style-container.html
inline-style-extend-run-expected.txt
inline-style-extend-run.html
invalid-font-size-expected.txt
invalid-font-size.html
inverse-color-filter-expected.txt
inverse-color-filter.html [Testing] Rename test header commands to match names in WebPreferences*.yaml 2020-10-13 17:16:15 +00:00
justify-without-enclosing-block-expected.txt
justify-without-enclosing-block.xhtml
make-text-writing-direction-inline-mac-expected.txt
make-text-writing-direction-inline-mac.html
make-text-writing-direction-inline-win-expected.txt
make-text-writing-direction-inline-win.html Source/WebCore: 2020-11-17 01:34:46 +00:00
non-inheritable-styles-expected.txt
non-inheritable-styles.html
preserve-selection-direction-expected.txt
preserve-selection-direction.html
push-down-font-styles-mac-expected.txt
push-down-font-styles-mac.html
push-down-font-styles-win-expected.txt
push-down-font-styles-win.html Source/WebCore: 2020-11-17 01:34:46 +00:00
push-down-implicit-styles-around-list-mac-expected.txt
push-down-implicit-styles-around-list-mac.html
push-down-implicit-styles-around-list-win-expected.txt
push-down-implicit-styles-around-list-win.html Source/WebCore: 2020-11-17 01:34:46 +00:00
push-down-implicit-styles-mac-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
push-down-implicit-styles-mac.html
push-down-inline-styles-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
push-down-inline-styles.html
query-typing-style-expected.txt
query-typing-style.html
redundant-background-color-expected.txt
redundant-background-color.html
relative-font-size-change-001.html
relative-font-size-change-002.html
relative-font-size-change-003.html
relative-font-size-change-004.html
remove-format-without-enclosing-block-expected.txt
remove-format-without-enclosing-block.html
remove-nested-inline-styles-expected.txt
remove-nested-inline-styles.html
remove-styled-element-with-style-span-expected.txt
remove-styled-element-with-style-span.html
remove-underline-across-paragraph-expected.txt
remove-underline-across-paragraph-in-bold-expected.txt
remove-underline-across-paragraph-in-bold.html
remove-underline-across-paragraph.html
remove-underline-after-paragraph-expected.txt
remove-underline-after-paragraph-in-bold-expected.txt
remove-underline-after-paragraph-in-bold.html
remove-underline-after-paragraph.html
remove-underline-expected.txt
remove-underline-from-stylesheet-expected.txt
remove-underline-from-stylesheet.html
remove-underline-in-bold-expected.txt
remove-underline-in-bold.html
remove-underline.html
set-backColor-with-color-filter-expected.txt
set-backColor-with-color-filter.html [Testing] Rename test header commands to match names in WebPreferences*.yaml 2020-10-13 17:16:15 +00:00
set-foreColor-with-color-filter-expected.txt
set-foreColor-with-color-filter.html [Testing] Rename test header commands to match names in WebPreferences*.yaml 2020-10-13 17:16:15 +00:00
smoosh-styles-001.html
smoosh-styles-003-expected.txt
smoosh-styles-003.html
style-3681552-fix-001-expected.txt
style-3681552-fix-001.html
style-3681552-fix-002.html
style-3690704-fix-expected.txt
style-3690704-fix.html
style-3998892-fix.html
style-boundary-001.html
style-boundary-002-expected.txt
style-boundary-002.html
style-boundary-003-expected.txt
style-boundary-003.html
style-boundary-004.html
style-boundary-005.html
style-text-node-without-editable-parent-expected.txt
style-text-node-without-editable-parent.html
stylewithcss-without-selection-expected.txt
stylewithcss-without-selection.html
table-selection.html
temporary-span-crash-expected.txt
temporary-span-crash.html
text-decoration-state-change-expected.txt
text-decoration-state-change.html
text-decoration-state-expected.txt
text-decoration-state.html
text-indent-expected.txt
text-indent.html
textdecoration-outside-of-rooteditable-expected.txt
textdecoration-outside-of-rooteditable.html
textdecoration-outside-of-unsplittable-element-expected.txt
textdecoration-outside-of-unsplittable-element.html
toggle-style-bold-italic-expected.txt Source/WebCore: 2020-11-17 01:34:46 +00:00
toggle-style-bold-italic-mixed-editability-expected.txt Source/WebCore: 2020-11-17 01:34:46 +00:00
toggle-style-bold-italic-mixed-editability.html Source/WebCore: 2020-11-17 01:34:46 +00:00
toggle-style-bold-italic.html Source/WebCore: 2020-11-17 01:34:46 +00:00
typing-style-001-expected.txt
typing-style-001.html
typing-style-002-expected.txt
typing-style-002.html
typing-style-003-expected.txt
typing-style-003.html
unbold-in-bold.html
underline-by-user-expected.txt
underline-by-user.html
underline-expected.txt
underline.html