Bug 707734 - Disable 'click and drag' text selection in nsFrame.cpp for touch enable devices r=roc

This commit is contained in:
Vivien Nicolas 2011-12-19 10:11:16 +01:00
Родитель 6562304b10
Коммит d51296165e
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -52,6 +52,9 @@ pref("browser.viewport.scaleRatio", -1);
/* allow scrollbars to float above chrome ui */ /* allow scrollbars to float above chrome ui */
pref("ui.scrollbarsCanOverlapContent", 1); pref("ui.scrollbarsCanOverlapContent", 1);
/* disable text selection */
pref("browser.ignoreNativeFrameTextSelection", true);
/* cache prefs */ /* cache prefs */
pref("browser.cache.disk.enable", false); pref("browser.cache.disk.enable", false);
pref("browser.cache.disk.capacity", 0); // kilobytes pref("browser.cache.disk.capacity", 0); // kilobytes

Просмотреть файл

@ -2444,14 +2444,14 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (me->isControl) if (me->isControl)
return NS_OK;//short ciruit. hard coded for mac due to time restraints. return NS_OK;//short circuit. hard coded for mac due to time restraints.
bool control = me->isMeta; bool control = me->isMeta;
#else #else
bool control = me->isControl; bool control = me->isControl;
#endif #endif
nsRefPtr<nsFrameSelection> fc = const_cast<nsFrameSelection*>(frameselection); nsRefPtr<nsFrameSelection> fc = const_cast<nsFrameSelection*>(frameselection);
if (me->clickCount >1 ) if (me->clickCount > 1)
{ {
// These methods aren't const but can't actually delete anything, // These methods aren't const but can't actually delete anything,
// so no need for nsWeakFrame. // so no need for nsWeakFrame.
@ -2466,6 +2466,14 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
if (!offsets.content) if (!offsets.content)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// On touchables devices, touch the screen is usually a pan action,
// so let reposition the caret if needed but do not select text
if (Preferences::GetBool("browser.ignoreNativeFrameTextSelection", false)) {
return fc->HandleClick(offsets.content, offsets.StartOffset(),
offsets.EndOffset(), false, false,
offsets.associateWithNext);
}
// Let Ctrl/Cmd+mouse down do table selection instead of drag initiation // Let Ctrl/Cmd+mouse down do table selection instead of drag initiation
nsCOMPtr<nsIContent>parentContent; nsCOMPtr<nsIContent>parentContent;
PRInt32 contentOffset; PRInt32 contentOffset;