Closed Bug 333038 Opened 18 years ago Closed 18 years ago

Support for inline spellchecking for designMode

Categories

(Firefox :: General, defect)

2.0 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 2 beta1

People

(Reporter: robert.strong.bugs, Assigned: enndeakin)

References

Details

(Keywords: fixed1.8.1, qawanted, Whiteboard: 181b1+)

Attachments

(2 files)

We should support inline spellchecking for designMode / midas for Firefox 2.0
Blocks: 329668
Flags: blocking-firefox2?
I'm swapping the dependencies between this bug and the land spellchecking bug to reflect what will actually happen (I'm treating that other bug as migration of the current stuff from trunk). If this goes in to 2.0 it will happen long after the "regular" spellchecking is on branch.
No longer blocks: 329668
Depends on: 329668
Who's going to own this?  cc-ing Blake in case he knows what type of rabbit hole we'll be going down here.

Nice to have, but I'd ship without it.
One way to get the editor in JavaScript after finding a document with designMode="on"

var docshell = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                  .getInterface(Components.interfaces.nsIWebNavigation)
                  .QueryInterface(Components.interfaces.nsIDocShell);

if (docshell instanceof Components.interfaces.nsIEditorDocShell)
  var editor = docshell.editor;


Not sure what it will take to add the context menu items for inline spellchecking of a designMode document.
Flags: blocking-firefox2? → blocking-firefox2+
Assignee: nobody → michael.wu
Whiteboard: [SWAG: 3d (no idea, actually)]
Target Milestone: --- → Firefox 2 beta1
Inline spellchecking seems rather unhelpful without the corresponding context menu items, and adding proper context menu items for designMode is covered by bug 312930.
Depends on: 312930
-> Enn, unless mwu has something in the way of a patch
Assignee: michael.wu → enndeakin
The context menu is easy to make work. You just need to make to context menu code in browser.js know when it's in a designmode document and set the flag accordingly. There may need to be some other tweaks to the code if it assumes anything about textfields.
Does this mean having spellchecking by default, or just an option on the context menu to enable it? The latter is already covered by bug 312930.
*** Bug 338470 has been marked as a duplicate of this bug. ***
Fixed by bug 312930.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
No, this isn't fixed. mconnor says that spellchecking for design mode should be on by default. I already have patch bing worked on.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Correct, it should follow the same preference as textareas.
Attachment #226652 - Flags: superreview?(bzbarsky)
Attachment #226652 - Flags: review?(bzbarsky)
I probably won't get to this until next week...
Attachment #226652 - Flags: approval1.8.1?
Comment on attachment 226652 [details] [diff] [review]
Enable spellchecking for design mode documents

(clearing approval1.8.1?)

Can we get someone other than bz to review this patch, please? Once that's done, check it in on trunk, mark it fixed and then resubmit the approval request?
Attachment #226652 - Flags: approval1.8.1?
Attachment #226652 - Flags: review?(bzbarsky) → review+
Attachment #226652 - Flags: approval1.8.1?
Whiteboard: [SWAG: 3d (no idea, actually)] → needs sr and a=
Whiteboard: needs sr and a= → needs sr and a= 181b1+
Comment on attachment 226652 [details] [diff] [review]
Enable spellchecking for design mode documents

>Index: content/html/document/src/nsHTMLDocument.cpp

>+nsHTMLDocument::SetEnableRealTimeSpell(nsPIDOMWindow* window,

>+  nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(window);

No need; nsPIDOMWindow inherits from nsIDOMWindow, so you can just pass |window| through.

Oh, and call them aWindow and aEditSession.

>Index: content/html/document/src/nsHTMLDocument.h

>+  void SetEnableRealTimeSpell(nsPIDOMWindow* window,
>+                              nsIEditingSession* editSession);

Toss in some comments explaining what this does?

sr=bzbarsky
Attachment #226652 - Flags: superreview?(bzbarsky) → superreview+
Checked in on trunk
Neil, with a fresh profile on Windows, I'm seeing textareas with design mode not having spell check on by default. Have you seen this before?
So, using July 27th nightly of Minefield, I can confirm that both:

  http://www.gmail.com and 
  http://www.mozilla.org/editor/midasdemo/ 

have spell checking turned off by default in Windows using a clean profile. Oddly, the fields have spell checking turned on by default in OS X.

Adding qawanted.
Keywords: qawanted
Whiteboard: needs sr and a= 181b1+ → 181b1+
Comment on attachment 226652 [details] [diff] [review]
Enable spellchecking for design mode documents

Please renominate this for blocking once we're sure that there are no regressions or problems with the functionality.
Attachment #226652 - Flags: approval1.8.1?
Status: REOPENED → ASSIGNED
Whiteboard: 181b1+ → 181b1+ [trunk patch landed, regressions?]
Works fine for me on Windows with a new profile using a July 4 build.
Comment on attachment 226652 [details] [diff] [review]
Enable spellchecking for design mode documents

Please go ahead and land this on the branch.
Attachment #226652 - Flags: approval1.8.1+
Whiteboard: 181b1+ [trunk patch landed, regressions?] → 181b1+ [checkin needed]
Status: ASSIGNED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Whiteboard: 181b1+ [checkin needed] → 181b1+ [checkin needed (1.8 branch)]
Whiteboard: 181b1+ [checkin needed (1.8 branch)] → 181b1+ [checkin needed]
Whiteboard: 181b1+ [checkin needed] → 181b1+ [checkin needed (1.8 branch)]
A different patch is needed for the branch here, the spellchecker interfaces called are different.
Brettw and Bz are both out - so maybe PKasting can take a look?
Comment on attachment 228346 [details] [diff] [review]
Branch version of patch - does it need review?

I assumed the trunk patch was OK and just reviewed the differences to the branch patch.  Everything spellcheck-related looks good to me.  The only question I had was as follows:

In nsHTMLDocument::RealTimeSpellCallback(), the trunk patch looks like:
 +    nsPIDOMWindow *window = doc->GetWindow();
+    if (window) {
+      nsIDocShell *docshell = window->GetDocShell();
+      if (docshell) {
+        nsCOMPtr<nsIEditingSession> editSession = do_GetInterface(docshell);

While the branch patch looks like:
+    nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(doc->GetScriptGlobalObject()));
+    if (window) {
+      nsCOMPtr<nsISupports> container = doc->GetContainer();
+      nsCOMPtr<nsIEditingSession> editSession = do_GetInterface(container);

I don't know enough about how the editing session is hooked up to know whether the branch change to get a container off the document is the right way to go; I'll assume so.  But it does make me wonder whether we still need to be checking if we can get a window here, since we don't get anything from it like we do on trunk.

Other than that, things look good to me.
Attachment #228346 - Flags: review+
Comment on attachment 228346 [details] [diff] [review]
Branch version of patch - does it need review?

Approving for drivers...
Attachment #228346 - Flags: approval1.8.1+
Landed on the 1.8 branch.
Keywords: fixed1.8.1
Whiteboard: 181b1+ [checkin needed (1.8 branch)] → 181b1+
Depends on: 347200
The solution to turn off spell checking when not needed for form elements has been introduced with the fix in Bug 339127. And how do we turn it off when we don't need it in designMode? 

perhaps something similar to execCommand("spellCheck",false,"false");??
(In reply to comment #28)
> The solution to turn off spell checking when not needed for form elements has
> been introduced with the fix in Bug 339127. And how do we turn it off when we
> don't need it in designMode? 

You should be able to set the spellcheck attribute to false on the BODY of the document that's in designmode (or going to be in designmode).  Designmode is treated like contenteditable is set on the BODY, so you need to adjust the value of spellcheck there as well.

I'm not sure if I have any testcases lying around which demonstrate this.  If you run into problems with this approach, please post a new bug and attach your testcase.
comment 29 works perfectly, but could it be possible to somehow improve the user experience in designMode fields?
I'm thinking about letting the document know if the current right clicked word is misspelled and the possible suggestions, so instead of showing the full context menu just show the suggestions, or if the page is using a custom context menu then also show the suggestions (or just the suggestions)

taking privacy considerations aside for a moment, does anybody think that this is worth filing as a RFE?
Alfonso, that's definitely outside the scope of this bug. Please file a separate bug if you can't find any duplicates.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: