Closed Bug 560665 Opened 14 years ago Closed 14 years ago

When having caret browsing turned on, don't pretend that there is a space in the text box if it's empty

Categories

(Core :: DOM: Selection, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

(Blocks 1 open bug)

Details

Attachments

(3 obsolete files)

With my patch in bug 560270, we're using a newline character when the text box is empty, for line-height calculation purposes.  Currently, in caret navigation, that appears as a white-space inside empty textboxes before the editor is initialized.

We need to fix that.
No longer blocks: 560270
Blocks: 559710
Blocks: 561293
Attached patch Patch (v1) (obsolete) — Splinter Review
This patch solves a more general problem.  We need to initialize the editor if some random code uses the document's selection object on an uninitialized text box.  This patch implements this behavior.  One such caller is the caret browsing code, there might be others as well inside the tree.

This approach might also be helpful in fixing bug 561293, as well as bug 560670.

This patch is easy to test, but my need to sleep is more than this patch's need for a test!  :-)  I'll write a test and attach it to the bug tomorrow.
Attachment #440957 - Flags: review?(roc)
Blocks: 560670
Attached patch Patch (v1.1) (obsolete) — Splinter Review
A proof of my need to sleep!  I attached the patch without qrefreshing!
Attachment #440957 - Attachment is obsolete: true
Attachment #440959 - Flags: review?(roc)
Attachment #440957 - Flags: review?(roc)
Attached patch Patch (v1.2) (obsolete) — Splinter Review
Hmm, nsISelection2.h is not needed.
Attachment #440959 - Attachment is obsolete: true
Attachment #440960 - Flags: review?(roc)
Attachment #440959 - Flags: review?(roc)
+nsEditorInitializerOnSelection::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* aSel, PRInt16 aReason)

80 columns

How do we ensure that mFrame in the listener isn't a dangling pointer? Can we null out mFrame in nsEditorInitializerOnSelection::Destroy and call nsEditorInitializerOnSelection::Destroy from nsTextControlFrame::Destroy?

+  // Make sure that the editor will be initialized when the selection
+  // inside the anonymous content changes.

But you're actually listening on the presShell's selection, right?

It seems like whenever the presshell selection changes, we're going to initialize the editors on all nsTextControlFrames? I must be confused.
I removed the non-breaking space character that was causing this problem in bug 559710 comment 28, so this is no longer an issue.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Attachment #440960 - Attachment is obsolete: true
Attachment #440960 - Flags: review?(roc)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: