Commit cb71b59e authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Adam Roben.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15942
          REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange())

        Test: editing/selection/cleared-by-relayout.html

        * editing/Selection.cpp:
        (WebCore::Selection::toRange): Check if the selection has been cleared
        by updating layout.

LayoutTests:

        Reviewed by Adam Roben.

        - test for http://bugs.webkit.org/show_bug.cgi?id=15942
          REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange())

        * editing/selection/cleared-by-relayout-expected.txt: Added.
        * editing/selection/cleared-by-relayout.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4dfc68a2
2007-11-11 Dan Bernstein <mitz@apple.com>
Reviewed by Adam Roben.
- test for http://bugs.webkit.org/show_bug.cgi?id=15942
REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange())
* editing/selection/cleared-by-relayout-expected.txt: Added.
* editing/selection/cleared-by-relayout.html: Added.
2007-11-11 Antti Koivisto <antti@apple.com> 2007-11-11 Antti Koivisto <antti@apple.com>
Reviewed by Darin. Reviewed by Darin.
......
Test for http://bugs.webkit.org/show_bug.cgi?id=15942 REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange()).
<p>
Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=15942">http://bugs.webkit.org/show_bug.cgi?id=15942</a>
REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange())</i>.
</p>
<p>
<iframe onload="prepare()" id="target" src="data:text/html,&lt;body contenteditable&gt;"></iframe>
</p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var target = document.getElementById('target');
function prepare()
{
var doc = target.contentDocument;
target.contentWindow.getSelection().setPosition(doc.body, 0);
target.focus();
test();
}
function test()
{
target.style.display = 'none';
target.contentDocument.body.innerHTML;
}
</script>
2007-11-11 Dan Bernstein <mitz@apple.com>
Reviewed by Adam Roben.
- fix http://bugs.webkit.org/show_bug.cgi?id=15942
REGRESSION: Selecting "Edit Html" tab in Blogger causes crash (Assertion failed: isRange())
Test: editing/selection/cleared-by-relayout.html
* editing/Selection.cpp:
(WebCore::Selection::toRange): Check if the selection has been cleared
by updating layout.
2007-11-11 Darin Adler <darin@apple.com> 2007-11-11 Darin Adler <darin@apple.com>
Reviewed by Mark Rowe. Reviewed by Mark Rowe.
......
...@@ -129,6 +129,10 @@ PassRefPtr<Range> Selection::toRange() const ...@@ -129,6 +129,10 @@ PassRefPtr<Range> Selection::toRange() const
// incorrect results. // incorrect results.
m_start.node()->document()->updateLayout(); m_start.node()->document()->updateLayout();
// Check again, because updating layout can clear the selection.
if (isNone())
return 0;
Position s, e; Position s, e;
if (isCaret()) { if (isCaret()) {
// If the selection is a caret, move the range start upstream. This helps us match // If the selection is a caret, move the range start upstream. This helps us match
......
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