Bug 19735

Summary: WebKit hangs when bulleting lists in google presentations
Product: WebKit Reporter: Ojan Vafai <ovafai>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: joyannefoster, jparent, justin.garcia, ovafai, rniwa, robbyw, sullivan
Priority: P1 Keywords: GoogleBug
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://docs.google.com
Attachments:
Description Flags
sample from the hang on my mac none

Description Ojan Vafai 2008-06-23 17:48:50 PDT
Go to docs.google.com
Create a presentation
Click in one of the text fields
Type a <enter> b <enter> c
Select all
Click unordered list button

I see http://trac.webkit.org/changeset/34354 attempts to fix a similar sounding issue. But I still get a hang in a nightly at r34367 with the above steps. I tried a few quick things to see if I could figure out the solution. 

The problem is that in the while loop on line 86 of InsertListCommand.cpp, startOfCurrentParagraph.deepEquivalent().node() is NULL. I tried checking startOfCurrentParagraph.isNotNull() in the while's conditional check. That successfully avoids the hang, but also skips over the div containing the "b".
Comment 1 Julie Parent 2008-06-25 18:32:46 PDT
FYI - We've got a workaround in our js for this issue (we just insert a dummy div as the first node inside the contentEditable div and the problem goes away) that we will be pushing into production soon, so this easy to repro test case will be disappearing on you.
Comment 2 Eric Seidel (no email) 2008-06-26 07:26:08 PDT
This is a reproducible full browser hang (thus crash) in Safari and should be a P1.
Comment 3 Eric Seidel (no email) 2008-06-26 07:27:30 PDT
Created attachment 21947 [details]
sample from the hang on my mac
Comment 4 Eric Seidel (no email) 2008-06-27 09:12:35 PDT
This might be the same root cause as bug 19071.
Comment 5 Eric Seidel (no email) 2008-06-27 09:15:28 PDT
Without a test case, this bug is going to soon be useless to us, since the docs.google.com reproduction is going away. :(  Perhaps something like this will work?

a<br>
b<br>
c
<script>
document.designMode = "on";
document.execCommand("selectall");
document.execCommand("insertUnorderedList");
</script>

Comment 6 Eric Seidel (no email) 2008-06-27 09:16:36 PDT
(In reply to comment #5)
> Without a test case, this bug is going to soon be useless to us, since the
> docs.google.com reproduction is going away. :(  Perhaps something like this
> will work?

To confirm, the above (very simple) proposed test does not repro the hang.
Comment 7 Robby Walker 2008-06-27 10:29:36 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Without a test case, this bug is going to soon be useless to us, since the
> > docs.google.com reproduction is going away. :(  Perhaps something like this
> > will work?
> 
> To confirm, the above (very simple) proposed test does not repro the hang.
> 

The Docs test case seemed to have something to do with other elements in the document (but not in the editable area) being set unselectable (el.style.WebKitUserSelect = 'none').  In our case, it is the toolbar on the page that is unselectable (as are all its children).  In fact, setting an empty div to unselectable did not repro the bug but having at least one level of nested divs each of which were unselectable did repro the bug.

I'll try to create a small test case.
Comment 8 Justin Garcia 2008-06-27 10:47:10 PDT
i'll try and get to this today
Comment 9 Annie Sullivan 2008-11-04 12:03:26 PST
Minimal test case in Midas demo:

<ol>
<li>a<br>b<br>c</li>
</ol>

(select b and c, insert unordered list)
Comment 10 Eric Seidel (no email) 2009-03-17 18:32:19 PDT
(In reply to comment #9)
> Minimal test case in Midas demo:
> 
> <ol>
> <li>a<br>b<br>c</li>
> </ol>
> 
> (select b and c, insert unordered list)


I just tried that at http://www.mozilla.org/editor/midasdemo/ and it did not hang a Debug r41792 but did not repro the hang.  Annie, was I trying correctly?  Or is this just fixed?

However WebKit's behavior here disagree's with firefox's.  I like FF's better (they make b,c into a new sublist).
Comment 11 joyannefoster 2010-07-08 14:08:35 PDT
I have reproduced this with Safari 5 (on windows but this was based on the a complaint from a mac user).  I have narrowed it down to simple test html - below.  Just select the text at the top and hover over the 2nd text below, then the 3rd and it hangs

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
   <title>Test hang page</title>
</head><body>
<img src="/tg/include/images/transpix.gif">
<div contenteditable="true" style="position: absolute; top: 5px; left: 15px; width: 200px; height: 200px; ">Highlight this and hover above text below<br>Replace this sample text with some text of your own.</div>
<div style="position:relative;top:200px;" onmouseover="document.execCommand('InsertOrderedList',false,null)">highlight above text and hover over this first</div>
<div style="position:relative;top:300px;" onmouseover="document.execCommand('InsertUnorderedList',false,null)">then hover over this</div>

</body></html>