зеркало из https://github.com/mozilla/gecko-dev.git
Bug 988143 - Enable Gecko Touch in Fennec, Android specific nsCaret mods, r=ehsan
This commit is contained in:
Родитель
b470913851
Коммит
27ef7c7715
|
@ -46,6 +46,9 @@ using namespace mozilla::gfx;
|
|||
// an insignificant dot
|
||||
static const int32_t kMinBidiIndicatorPixels = 2;
|
||||
|
||||
/*static*/ bool nsCaret::sSelectionCaretEnabled = false;
|
||||
/*static*/ bool nsCaret::sSelectionCaretsAffectCaret = false;
|
||||
|
||||
/**
|
||||
* Find the first frame in an in-order traversal of the frame subtree rooted
|
||||
* at aFrame which is either a text frame logically at the end of a line,
|
||||
|
@ -144,6 +147,15 @@ nsresult nsCaret::Init(nsIPresShell *inPresShell)
|
|||
LookAndFeel::GetInt(LookAndFeel::eIntID_ShowCaretDuringSelection,
|
||||
mShowDuringSelection ? 1 : 0) != 0;
|
||||
|
||||
static bool addedCaretPref = false;
|
||||
if (!addedCaretPref) {
|
||||
Preferences::AddBoolVarCache(&sSelectionCaretEnabled,
|
||||
"selectioncaret.enabled");
|
||||
Preferences::AddBoolVarCache(&sSelectionCaretsAffectCaret,
|
||||
"selectioncaret.visibility.affectscaret");
|
||||
addedCaretPref = true;
|
||||
}
|
||||
|
||||
// get the selection from the pres shell, and set ourselves up as a selection
|
||||
// listener
|
||||
|
||||
|
@ -253,7 +265,8 @@ bool nsCaret::IsVisible()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!mShowDuringSelection) {
|
||||
if (!mShowDuringSelection &&
|
||||
!(sSelectionCaretEnabled && sSelectionCaretsAffectCaret)) {
|
||||
Selection* selection = GetSelectionInternal();
|
||||
if (!selection) {
|
||||
return false;
|
||||
|
@ -264,6 +277,20 @@ bool nsCaret::IsVisible()
|
|||
}
|
||||
}
|
||||
|
||||
// The Android IME can have a visible caret when there is a composition
|
||||
// selection, due to auto-suggest/auto-correct styling (underlining),
|
||||
// but never when the SelectionCarets are visible.
|
||||
if (sSelectionCaretEnabled && sSelectionCaretsAffectCaret) {
|
||||
nsCOMPtr<nsISelectionController> selCon = do_QueryReferent(mPresShell);
|
||||
if (selCon) {
|
||||
bool visible = false;
|
||||
selCon->GetSelectionCaretsVisibility(&visible);
|
||||
if (visible) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsMenuPopupHidingCaret()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -230,6 +230,10 @@ protected:
|
|||
* it's in non-user-modifiable content.
|
||||
*/
|
||||
bool mIgnoreUserModify;
|
||||
|
||||
// Preference
|
||||
static bool sSelectionCaretEnabled;
|
||||
static bool sSelectionCaretsAffectCaret;
|
||||
};
|
||||
|
||||
#endif //nsCaret_h__
|
||||
|
|
|
@ -879,3 +879,6 @@ pref("toolkit.telemetry.unified", false);
|
|||
|
||||
// Selection carets never fall-back to internal LongTap detector.
|
||||
pref("selectioncaret.detects.longtap", false);
|
||||
|
||||
// Selection carets override caret visibility.
|
||||
pref("selectioncaret.visibility.affectscaret", true);
|
||||
|
|
|
@ -4560,6 +4560,9 @@ pref("selectioncaret.inflatesize.threshold", 40);
|
|||
// Selection carets will fall-back to internal LongTap detector.
|
||||
pref("selectioncaret.detects.longtap", true);
|
||||
|
||||
// Selection carets do not affect caret visibility.
|
||||
pref("selectioncaret.visibility.affectscaret", false);
|
||||
|
||||
// New implementation to unify touch-caret and selection-carets.
|
||||
pref("layout.accessiblecaret.enabled", false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче