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
parent 4688078712
commit b7fb6ad80f
2 changed files with 13 additions and 2 deletions

View File

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

View File

@ -2444,14 +2444,14 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
#ifdef XP_MACOSX
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;
#else
bool control = me->isControl;
#endif
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,
// so no need for nsWeakFrame.
@ -2466,6 +2466,14 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
if (!offsets.content)
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
nsCOMPtr<nsIContent>parentContent;
PRInt32 contentOffset;