Bug 376238, add a pref to disable drag images, r=sr=roc

This commit is contained in:
enndeakin@sympatico.ca 2007-05-16 11:05:23 -07:00
parent 8b8fb2dc58
commit f53073946d
2 changed files with 13 additions and 1 deletions

View File

@ -197,6 +197,9 @@ pref("view_source.wrap_long_lines", false);
// dispatch left clicks only to content in browser (still allows clicks to chrome/xul)
pref("nglayout.events.dispatchLeftClickOnly", true);
// whether or not to draw images while dragging
pref("nglayout.enable_drag_images", true);
// whether or not to use xbl form controls
pref("nglayout.debug.enable_xbl_forms", false);

View File

@ -69,6 +69,7 @@
#include "nsIViewObserver.h"
#include "nsRegion.h"
#include "nsGUIEvent.h"
#include "nsIPrefService.h"
#ifdef MOZ_CAIRO_GFX
#include "gfxContext.h"
@ -76,6 +77,8 @@
#endif
#define DRAGIMAGES_PREF "nglayout.enable_drag_images"
NS_IMPL_ADDREF(nsBaseDragService)
NS_IMPL_RELEASE(nsBaseDragService)
NS_IMPL_QUERY_INTERFACE2(nsBaseDragService, nsIDragService, nsIDragSession)
@ -412,8 +415,14 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
if (!presShell)
return NS_ERROR_FAILURE;
// check if drag images are disabled
PRBool enableDragImages = PR_TRUE;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs)
prefs->GetBoolPref(DRAGIMAGES_PREF, &enableDragImages);
// didn't want an image, so just set the screen rectangle to the frame size
if (!mHasImage) {
if (!enableDragImages || !mHasImage) {
// if a region was specified, set the screen rectangle to the area that
// the region occupies
if (aRegion) {