[webkit-changes] [WebKit/WebKit] 43e2b4: Splitting text can leave 'start' and 'end' Positio...

Ahmad Saleem noreply at github.com
Thu Dec 29 15:06:27 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 43e2b46ed602ea589134da0e5e6172fe5edd3159
      https://github.com/WebKit/WebKit/commit/43e2b46ed602ea589134da0e5e6172fe5edd3159
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2022-12-29 (Thu, 29 Dec 2022)

  Changed paths:
    A LayoutTests/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash-expected.txt
    A LayoutTests/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash.html
    A LayoutTests/platform/mac-wk1/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash-expected.txt
    M Source/WebCore/editing/ApplyStyleCommand.cpp

  Log Message:
  -----------
  Splitting text can leave 'start' and 'end' Positions without renderers

Splitting text can leave 'start' and 'end' Positions without renderers
https://bugs.webkit.org/show_bug.cgi?id=249898

Reviewed by Ryosuke Niwa.

Merge - https://chromium.googlesource.com/chromium/blink/+/d538920cd38e1a59c914f81f63757642466c4f46

When establishing new start and end positions in ApplyStyleCommand::applyInlineStyle()
be sure to return early if either of them end up null, just as we do if either of
them are null initially.

In this test case execCommand('CreateLink') adds an anchor HTML element in an SVG
namespace so the text underneath validly does not receive a renderer. Without a renderer
the text won't get a visible position value for the command so there's nothing to do but
bail.

* Source/WebCore/editing/ApplyStyleCommand.cpp:
(ApplyStyleCommand::applyInlineStyle): Add early return if 'start' or 'end' positions are null
(ApplyStyleCommand::shouldSplitTextElement): Add ASSERT for position to be not null
* LayoutTests/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash.html: Add Test Case
* LayoutTests/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash-expected.txt: Add Test Case Expectation
* LayoutTests/platform/mac-wk1/editing/execCommand/apply-inline-style-to-element-with-no-renderer-crash-expected.txt

Canonical link: https://commits.webkit.org/258358@main




More information about the webkit-changes mailing list