Closed Bug 237228 Opened 21 years ago Closed 20 years ago

pref "layout.word_select.eat_space_to_next_word" can't be set by user in the profile's prefs.js

Categories

(Core :: DOM: Selection, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: vdvo, Assigned: ginnchen+exoracle)

References

Details

Attachments

(4 files, 5 obsolete files)

The boolean preference layout.word_select.eat_space_to_next_word isn't settable in the user's profile (prefs.js or user.js) because of a bug very similar to bug 232321. (Also, for the same reason the pref can't be changed in about:config.) Patch coming up, hopefully.
Comment on attachment 143686 [details] [diff] [review] patch, adapted from bug 232321's attachment 141174 [details] [diff] [review] Warning: patch by clueless newbie. OTOH, it's all stolen from bug 232321, so it could be right. BTW, cute bug of Buzilla in previous comment. :-)
Attachment #143686 - Flags: superreview?(bzbarsky)
Attachment #143686 - Flags: review?(bzbarsky)
I'll try to take a look Saturday morning.
Comment on attachment 143686 [details] [diff] [review] patch, adapted from bug 232321's attachment 141174 [details] [diff] [review] >Index: layout/html/base/src/nsTextFrame.cpp >+nsTextFrame::WordSelectListener::Observe(nsISupports *aSubject, >+ const char *aTopic, >+ const PRUnichar *aData) Fix the indent there. > nsTextFrame::~nsTextFrame() > { >+ NS_IF_RELEASE(sWordSelectListener); Er, no. That's no good at all. That will wipe out the listener any time a text frame is destroyed. We don't want that. If you need to add a Shutdown() method of some sort that will get called at app shutdown, go ahead and do so.
Attachment #143686 - Flags: superreview?(bzbarsky)
Attachment #143686 - Flags: superreview-
Attachment #143686 - Flags: review?(bzbarsky)
Attachment #143686 - Flags: review-
Attached patch patch, version 2 (obsolete) — Splinter Review
There must be a less invasive way to do this...?? I moved the definition of class nsTextFrame from the .cpp to the .h, and just enough #include's to make it compile. I added a Shutdown() method to the class. The warning applies more than before.
Attachment #143686 - Attachment is obsolete: true
Attachment #143916 - Flags: superreview?(bzbarsky)
Attachment #143916 - Flags: review?(dbaron)
I won't be able to get to this for at least two weeks....
Comment on attachment 143916 [details] [diff] [review] patch, version 2 OK, thanks anyway. Let's try roc then?
Attachment #143916 - Flags: superreview?(bzbarsky) → superreview?(roc)
Moving nsTextFrame into nsTextFrame.h is unfortunate but I guess it's the right thing to do. However, nsAutoIndexBuffer doesn't need to be in nsTextFrame.h. nsTextFrame.h just needs "struct nsAutoIndexBuffer;" and the actual definition can stay where it is. Ditto for TextStyle. The declaration of TextStyle in nsTextFrame.cpp will be "struct nsTextFrame::TextStyle { ..." Ditto for TextReflowData.
+#include "nsTextTransformer.h" +#include "nsIRenderingContext.h" +#include "nsIFontMetrics.h" +#include "nsILookAndFeel.h" +#include "nsITextContent.h" Plus, I think these includes can be left out of nsTextFrame.h and replaced where necessary by class nsIRenderingContext; etc
+#define TEXT_BUF_SIZE 100 This can stay in nsTextFrame.cpp once nsAutoIndexBuffer is back in nsTextFrame.cpp ... you get the idea.
This should do it. As long as I was meddling with this file, I also took the liberty of correcting some whitespace inconsistencies and tab abuse. It appears that at various times, the file was edited by people using tabs 8, 2, and even 4 spaces wide. I'll attach a diff -uw version that should be more readable.
Attachment #143916 - Attachment is obsolete: true
Attachment #144000 - Flags: superreview?(roc)
Attachment #144000 - Flags: review?(dbaron)
Attachment #143916 - Flags: superreview?(roc)
Attachment #143916 - Flags: review?(dbaron)
+class nsFrame; You need to #include "nsFrame.h" here because it's used as a superclass. Did this compile?
Oops. It compiled only because the only files that include nsTextFrame.h also include nsFrame.h. Thanks, Robert.
Attachment #144000 - Attachment is obsolete: true
Attachment #144001 - Attachment is obsolete: true
Attachment #144000 - Flags: superreview?(roc)
Attachment #144000 - Flags: review?(dbaron)
Attachment #144045 - Flags: superreview?(roc)
Attachment #144045 - Flags: review?(dbaron)
Comment on attachment 144045 [details] [diff] [review] patch v4, addressing roc's comment looks ok to me!
Attachment #144045 - Flags: superreview?(roc) → superreview+
Robert, could you perhaps recommend a better choice for a reviewer? Thanks.
dbaron is the right choice for reviewer.
Comment on attachment 144045 [details] [diff] [review] patch v4, addressing roc's comment I haven't seen any good justification for why we want this to be fixed, and it doesn't seem like it's worth this much code. However, it could probably be done in much less code with the prefs stuff jst landed a few days ago (with one big pref observer for all of content/layout). Perhaps with that it would be little enough code that the tiny benefit of allowing users to set this (rather than just following platform conventions, which is what it's for now) offsets the amount of code increase.
Attachment #144045 - Flags: review?(dbaron) → review-
Attached patch smaller patch (obsolete) — Splinter Review
smaller patch, just copy from bug 232321
Comment on attachment 158300 [details] [diff] [review] smaller patch oops, it's just duplicate of patch version 1. I'm sorry.
What about move it into nsEventStateManager? add, PRBool nsEventStateManager::GetWordSelectEatSpaceAfter() void nsEventStateManager::ResetWordSelectEatSpaceAfter() So we don't need add nsTextFrame.h. And I think nsFrame::GetFrameFromDirection need this setting. I have a patch for bug 256252, which has this requirement. I just workaround it, change aPos->mEatingWS to PR_FALSE and change it back after calling nsFrame::GetFrameFromDirection. It's a little ugly.
David, it is important for blind people to have this setting on linux. For blind people, they need ctrl+right to go to beginning of the next word. Because, if cursor goes to end of the word, the screen reader may not work correctly. We must get it fixed to make Mozilla accessible on linux.
Comment on attachment 158300 [details] [diff] [review] smaller patch you definitely don't want to destroy this observer every time a text frame is destroyed
Attachment #158300 - Flags: review-
add GetWordSelectEatSpaceAfter, GetWordSelectStopAtPunctuation to nsTextTransformer
Attachment #158360 - Flags: review?(dbaron)
Comment on attachment 158360 [details] [diff] [review] patch, use nsTextTransformer's PrefCallback >+PRBool nsTextTransformer::sWordSelectEatSpaceAfter = PR_FALSE; This should default to true for consistency with the current code. Also, nsTextTransformer::Shutdown should remove both pref callbacks.
(In reply to comment #26) > (From update of attachment 158360 [details] [diff] [review]) > >+PRBool nsTextTransformer::sWordSelectEatSpaceAfter = PR_FALSE; > This should default to true for consistency with the current code. On unix, the default values for these two settings are PR_FALSE; On windows, they're PR_TRUE; I tested on windows, it works well. I think we don't want to set default value of sWordSelectEatSpaceAfter to PR_TRU, but set sWordSelectStopAtPunctuation to PR_FALSE. > Also, nsTextTransformer::Shutdown should remove both pref callbacks. In bug 240543. Hiding some nsIPref* API bloatyness in nsContentUtils. "NS_IF_RELEASE(sWordSelectListener);" was removed from ShutDown(); Do we still need it?
Assignee: vdvo → ginn.chen
Status: NEW → ASSIGNED
Attachment #158389 - Flags: review?(dbaron)
Attachment #158300 - Attachment is obsolete: true
Comment on attachment 158389 [details] [diff] [review] patch, add UnregisterPrefCallback I was suggesting leaving the default value in case something somewhere relied on what happened when some platform-specific part of all.js didn't set the pref.
Attachment #158389 - Flags: review?(dbaron) → review+
Attachment #158389 - Flags: superreview?(roc)
Attachment #158389 - Flags: superreview?(roc) → superreview+
fixed.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Blocks: caretnav
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: