Open Bug 592528 Opened 15 years ago Updated 3 years ago

XUL textbox newline handling broken if binding is constructed before editor is initialized

Categories

(Toolkit :: UI Widgets, defect)

defect

Tracking

()

People

(Reporter: Gavin, Unassigned)

References

Details

See testcase in bug 570192. That bug has a wallpaper that avoids throwing an exception, but we need to figure out a better solution that will make sure that the newline handling stays correct.
Component: Editor → XUL Widgets
Product: Core → Toolkit
QA Contact: editor → xul.widgets
I disabled browser_bug321000.js because of this. http://hg.mozilla.org/integration/mozilla-inbound/rev/1a4ef8ec3f5a
For whatever reason, this is permanently broken on my main profile on Windows. Calling _setNewlineHandling manually fixes it. I think toggling tabs on top breaks it, too. Basically, the idea that _setNewlineHandling should be called from the textbox constructor seems completely bogus. Can the textbox binding get some kind of notification when the editor is initialized or should this code live somewhere else entirely? Could the editor handle all of this on its own?
(In reply to Dão Gottwald [:dao] from comment #3) > I disabled browser_bug321000.js because of this. > http://hg.mozilla.org/integration/mozilla-inbound/rev/1a4ef8ec3f5a https://hg.mozilla.org/mozilla-central/rev/1a4ef8ec3f5a
(In reply to Dão Gottwald [:dao] from comment #4) > For whatever reason, this is permanently broken on my main profile on > Windows. Calling _setNewlineHandling manually fixes it. I think toggling > tabs on top breaks it, too. > > Basically, the idea that _setNewlineHandling should be called from the > textbox constructor seems completely bogus. Can the textbox binding get some > kind of notification when the editor is initialized or should this code live > somewhere else entirely? Could the editor handle all of this on its own? The problem here is that as far as the editor is concerned, it is dealing with an <input type=text> which gets its editor lazily initialized. The editor uses the default newline handling pref to initialize correctly when it's initialized, but HTML input doesn't have a newlines attribute, so it doesn't make a lot of sense to add a special case to look for a parent xul:textbox etc. I don't like the idea of adding a notification of some sort, since I spent a lot of effort to avoid needing that, and this seems to be the only missing case that we know of. Now, there are multiple ways in which we just choose to initialize the editor eagerly <http://mxr.mozilla.org/mozilla-central/source/layout/forms/nsTextControlFrame.cpp#437>. We _could_ add another heuristic there to make sure that xul:textbox inputs are always initialized eagerly. One simple heuristic that comes to my mind is looking for the xbl:inherits attribute. I'm curious to know what others think about this.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.