Open Bug 144468 Opened 24 years ago Updated 1 year ago

Inserting a large Table causes Composer to freeze

Categories

(Core :: DOM: Editor, defect, P5)

defect

Tracking

()

Future

People

(Reporter: TucsonTester1, Unassigned)

Details

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) BuildID: 20020510 Inserting a large table is very slow and often causes composer to freeze. Reproducible: Always Steps to Reproduce: 1. Open new Composer page 2. Insert a large table (Larger than 200 x 50/50 x 200 will cause freezing) 3. Composer freezes Actual Results: Table Size Pixels Result 200 x 200 4 Froze 200 x 200 1 Froze 200 x 100 1 Froze 200 x 80 1 Froze 200 x 60 1 Froze 200 x 40 1 Froze 200 x 20 1 OK 200 x 30 1 OK 200 x 35 1 OK 200 x 38 1 OK 200 x 39 1 OK 200 x 40 1 OK 200 x 40 2 OK 200 x 40 4 Worked, but last Column is smaller than the rest. 250 x 40 1 Froze 200 x 40 1 Froze, screen greyed out, - - then rendered the table, but last Column is smaller than the rest. 250 x 200 1 Froze 200 x 50 1 Froze, screen greyed out, - - then rendered the table, but last Column is smaller than the rest. 200 x 60 1 Froze, screen greyed out, - - then rendered the table, but last 4 Columns are smaller than the rest. 200 x 60 4 Froze, screen greyed out, - - then rendered the table, but last 4 Columns are smaller than the rest. 200 x 100 1 Froze 80 x 200 1 Froze 50 x 200 1 Froze 40 x 200 1 OK 45 x 200 1 Froze 60 x 180 1 Froze 50 x 170 1 Froze 40 x 170 1 Froze, screen greyed out, then rendered the table. Very SLow 40 x 175 1 OK, very slow 42 x 175 1 Froze, screen greyed out, then rendered the table. Very SLow Expected Results: I expected composer to render the table without freezing. I also expected Composer to reneder the tables faster.
--> cmanske
Assignee: syd → cmanske
Pasting is an editor core issue.
Assignee: cmanske → kin
Component: Editor: Composer → Editor: Core
I inserted a table with 60 rows and 250 columns. I put dumps in the JS to test if it creates the DOM table correctly and it did. We then proceed into nsHTMLEditor::InsertElementAtSelection(). That is where it appears to lock up. Here's the stack after breaking at that point: nsTraceRefcnt::LogDtor(void * 0x00129568, const char * 0x1010a4b0 `string', unsigned int 12) line 2036 + 2 bytes nsStr::~nsStr() line 266 + 16 bytes nsStrPrivate::Realloc(nsStr & {...}, unsigned int 4) line 1125 + 14 bytes nsStrPrivate::EnsureCapacity(nsStr & {...}, unsigned int 4) line 120 + 13 bytes nsStrPrivate::GrowCapacity(nsStr & {...}, unsigned int 4) line 148 + 13 bytes nsString::SetCapacity(unsigned int 4) line 192 + 37 bytes nsString::SetLength(unsigned int 4) line 176 nsAString::do_AssignFromReadable(const nsAString & {...}) line 274 nsAString::AssignFromReadable(const nsAString & {...}) line 219 nsAString::Assign(const nsAString & {...}) line 243 + 19 bytes nsString::operator=(const nsAString & {...}) line 276 + 19 bytes ChangeAttributeTxn::Init(ChangeAttributeTxn * const 0x05aacfc8, nsIEditor * 0x0353d370, nsIDOMElement * 0x05aacdf4, const nsAString & {...}, const nsAString & {...}, int 0) line 64 nsEditor::CreateTxnForSetAttribute(nsEditor * const 0x0353d370, nsIDOMElement * 0x05aacdf4, const nsAString & {...}, const nsAString & {...}, ChangeAttributeTxn * * 0x001296bc) line 4523 + 34 bytes nsEditor::SetAttribute(nsEditor * const 0x0353d370, nsIDOMElement * 0x05aacdf4, const nsAString & {...}, const nsAString & {...}) line 1016 + 31 bytes nsTextEditRules::CreateMozBR(nsIDOMNode * 0x04506794, int 0, nsCOMPtr<nsIDOMNode> * 0x00129768) line 1399 + 64 bytes nsHTMLEditRules::AdjustSpecialBreaks(int 0) line 6690 + 37 bytes nsHTMLEditRules::AfterEditInner(int 3008, short 1) line 391 + 10 bytes nsHTMLEditRules::AfterEdit(nsHTMLEditRules * const 0x03636074, int 3008, short 1) line 333 + 20 bytes nsHTMLEditor::EndOperation(nsHTMLEditor * const 0x0353d370) line 3882 + 62 bytes nsAutoRules::~nsAutoRules() line 125 nsHTMLEditor::InsertElementAtSelection(nsHTMLEditor * const 0x0353d444, nsIDOMElement * 0x035d6f08, int 1) line 1844 + 33 bytes nsHTMLEditorLog::InsertElementAtSelection(nsHTMLEditorLog * const 0x0353d444, nsIDOMElement * 0x035d6f08, int 1) line 739 + 17 bytes nsEditorShell::InsertElementAtSelection(nsEditorShell * const 0x035e0b40, nsIDOMElement * 0x035d6f08, int 1) line 3037 + 34 bytes
Composer is not freezing as the summary suggests, it's just taking an incredibly long time to create, insert and reflow tables with a large number of columns. For testing purposes I used the 40 rows by 170 columns example with 1 pixel border. Using my stopwatch, I found that the time was divided as follows: EdInsertTable.js takes roughly 28 seconds to create and assemble a table. The call to editorShell.InsertElementAtSelection() takes roughly 1:25 seconds, of which 1:04 of it is spent in AdjustSpecialBreaks(), which adds the br nodes to each cell. Joe and I know this takes a long time. Note that in this particular case it's iterating over 6800 nodes. Reflowing the table during the editorShell.EndBatchChanges() takes about 30 seconds. Joe would it speed things up from the editor:core perspective if cmanske inserted these <br>s for us ... maybe not since JS is soooo slow.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Target Milestone: --- → mozilla1.0.1
Oh My Gawd
Target Milestone: mozilla1.0.1 → Future
QA Contact: sujay → editor
Assignee: kinmoz → nobody
Status: ASSIGNED → NEW

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: major → S4
Priority: P3 → P5

Well, pasting a big table indeed causes freeze a couple of minutes (Profile with Nightly with pasting 1,100 x 1,100 table). However, according to the profile, most time spends on the laying out the table. That's triggered by ContentEventHandler for making a content cache for IME, but it's anyway performed after a tick to show the table. I guess we can do nothing because table layout cannot be fast due to the complicated layout rules.

Might be the layout team has some ideas though.

OS: Windows 98 → All
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.