Crash in WebCore::InlineBox::deleteLine
https://bugs.webkit.org/show_bug.cgi?id=93448
Patch by Douglas Stockwell <dstockwell@chromium.org> on 2013-01-02
Reviewed by Eric Seidel.
Source/WebCore:
When we ran off the end of the line while looking for line breaks in an
inline with white-space:nowrap nested in a block with white-space:pre
it was possible for the line break to be set at or before the current
position -- this could result in duplications in the render tree or
infinite looping.
This patch changes the "fixup" logic that runs after we have finished
iterating through elements and text and have potentially found a break
point. In the case of a block setting white-space:pre we would back up
a character in some cases. Not doing so could leave whitespace that
should have been collapsed at the end of an inline.
For example in '<span style="white-space:nowrap">x_</span>_y' if a
break was inserted before 'y' the space after 'x' would still be
rendered (rather than be collapsed with the break).
To avoid this problem we will not take the opportunity to break until
we have finished collapsing whitespace.
Tests: fast/text/whitespace/inline-whitespace-wrapping-1.html
fast/text/whitespace/inline-whitespace-wrapping-2.html
fast/text/whitespace/inline-whitespace-wrapping-3.html
fast/text/whitespace/inline-whitespace-wrapping-4.html
fast/text/whitespace/nowrap-white-space-collapse.html
fast/text/whitespace/pre-block-normal-inline-crash-1.html
fast/text/whitespace/pre-block-normal-inline-crash-2.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Collapse
whitespace before breaking. Avoid setting the break before the current
position.
LayoutTests:
* editing/deleting/delete-block-table-expected.txt:
* editing/execCommand/selectAll-expected.txt: Renamed from LayoutTests/platform/chromium/editing/execCommand/selectAll-expected.txt.
* fast/text/whitespace/inline-whitespace-wrapping-1-expected.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-1.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-2-expected.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-2.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-3-expected.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-3.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-4-expected.html: Added.
* fast/text/whitespace/inline-whitespace-wrapping-4.html: Added.
* fast/text/whitespace/nowrap-white-space-collapse-expected.html: Added.
* fast/text/whitespace/nowrap-white-space-collapse.html: Added.
* fast/text/whitespace/pre-block-normal-inline-crash-1-expected.txt: Added.
* fast/text/whitespace/pre-block-normal-inline-crash-1.html: Added.
* fast/text/whitespace/pre-block-normal-inline-crash-2-expected.txt: Added.
* fast/text/whitespace/pre-block-normal-inline-crash-2.html: Added.
* platform/chromium-win/editing/deleting/delete-to-select-table-expected.txt:
* platform/chromium-win/editing/execCommand/print-expected.txt:
* platform/chromium-win/editing/execCommand/selectAll-expected.txt:
* platform/chromium-win/editing/inserting/editable-html-element-expected.txt:
* platform/efl/editing/execCommand/selectAll-expected.txt: Removed.
* platform/gtk/editing/execCommand/selectAll-expected.txt: Removed.
* platform/mac/editing/execCommand/selectAll-expected.txt: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed