Crashes in WebCore::ApplyStyleCommand.doApply()

https://bugs.webkit.org/show_bug.cgi?id=67765

Patch by Shinya Kawanaka <shinyak@google.com> on 2011-09-09
Reviewed by Ryosuke Niwa.

WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.

Source/WebCore:

Test: editing/style/remove-format-without-enclosing-block.html

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle): Added null check.

LayoutTests:

* editing/style/remove-format-without-enclosing-block-expected.txt: Added.
* editing/style/remove-format-without-enclosing-block.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a82a94c1
2011-09-09 Shinya Kawanaka <shinyak@google.com>
Crashes in WebCore::ApplyStyleCommand.doApply()
https://bugs.webkit.org/show_bug.cgi?id=67765
Reviewed by Ryosuke Niwa.
WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.
* editing/style/remove-format-without-enclosing-block-expected.txt: Added.
* editing/style/remove-format-without-enclosing-block.html: Added.
2011-09-09 Ilya Tikhonovsky <loislo@chromium.org>
Unreviewed. Update test expectations for hyphenate-limit-lines.html.
AexecCommand("RemoveFormat") was crashing when there is no enclosing block.
The test has passed if it does not crash.
PASS
<card id="edit" contentEditable="true">A<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
edit.focus();
document.execCommand("SelectAll");
document.execCommand("RemoveFormat");
document.writeln('execCommand("RemoveFormat") was crashing when there is no enclosing block.<br>');
document.writeln('The test has passed if it does not crash.<br><br>')
document.writeln('PASS');
</script>
2011-09-09 Shinya Kawanaka <shinyak@google.com>
Crashes in WebCore::ApplyStyleCommand.doApply()
https://bugs.webkit.org/show_bug.cgi?id=67765
Reviewed by Ryosuke Niwa.
WebCore::enclosingBlock may return null, but ApplyStyleCommand::applyBlockStyle did not check it. This patch make it to be checked.
Test: editing/style/remove-format-without-enclosing-block.html
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle): Added null check.
2011-09-09 James Simonsen <simonjam@chromium.org>
[Chromium] Fix leak of Skia stream with custom CSS fonts
......@@ -281,8 +281,8 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
if (newBlock)
block = newBlock;
}
ASSERT(block->isHTMLElement());
if (block->isHTMLElement()) {
ASSERT(!block || block->isHTMLElement());
if (block && block->isHTMLElement()) {
removeCSSStyle(style, toHTMLElement(block.get()));
if (!m_removeOnly)
addBlockStyle(styleChange, toHTMLElement(block.get()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment