mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 452787, change to ignore selection when inside a draggable html element, r=smaug,sr=roc
This commit is contained in:
parent
90fdd3385a
commit
39ab9e9583
@ -665,9 +665,7 @@ public:
|
||||
* @param aContent The content node to test.
|
||||
* @return whether it's draggable
|
||||
*/
|
||||
static PRBool ContentIsDraggable(nsIContent* aContent) {
|
||||
return IsDraggableImage(aContent) || IsDraggableLink(aContent);
|
||||
}
|
||||
static PRBool ContentIsDraggable(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Method that decides whether a content node is a draggable image
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMNSHTMLElement.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -2453,6 +2454,26 @@ nsContentUtils::GetImageFromContent(nsIImageLoadingContent* aContent,
|
||||
return image;
|
||||
}
|
||||
|
||||
// static
|
||||
PRBool
|
||||
nsContentUtils::ContentIsDraggable(nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> htmlElement = do_QueryInterface(aContent);
|
||||
if (htmlElement) {
|
||||
PRBool draggable = PR_FALSE;
|
||||
htmlElement->GetDraggable(&draggable);
|
||||
if (draggable)
|
||||
return PR_TRUE;
|
||||
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
||||
nsGkAtoms::_false, eIgnoreCase)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// special handling for content area image and link dragging
|
||||
return IsDraggableImage(aContent) || IsDraggableLink(aContent);
|
||||
}
|
||||
|
||||
// static
|
||||
PRBool
|
||||
nsContentUtils::IsDraggableImage(nsIContent* aContent)
|
||||
|
@ -2143,14 +2143,9 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// if no node in the hierarchy was found to drag, but the GetDragData method
|
||||
// returned a node, use that returned node. Otherwise, just use the original
|
||||
// node that was clicked.
|
||||
if (!dragContent) {
|
||||
if (dragDataNode)
|
||||
dragContent = originalDragContent;
|
||||
else
|
||||
dragContent = mGestureDownContent;
|
||||
}
|
||||
// returned a node, use that returned node. Otherwise, nothing is draggable.
|
||||
if (!dragContent && dragDataNode)
|
||||
dragContent = dragDataNode;
|
||||
|
||||
if (dragContent) {
|
||||
// if an ancestor node was used instead, clear the drag data
|
||||
|
@ -82,6 +82,10 @@ function afterDragTests()
|
||||
sendMouseEventsForDrag("dragfalse");
|
||||
gDragInfo = { target: $("spanfalse").firstChild, testid: "draggable false child" };
|
||||
sendMouseEventsForDrag("spanfalse");
|
||||
|
||||
synthesizeMouse(draggable, 12, 12, { type: "mouseup" });
|
||||
if (gExtraDragTests == 4)
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function sendMouseEventsForDrag(nodeid)
|
||||
@ -462,8 +466,6 @@ function onDragStartDraggable(event)
|
||||
ok(dt.mozItemCount == 0 && dt.types.length == 0 && event.originalTarget == gDragInfo.target, gDragInfo.testid);
|
||||
|
||||
gExtraDragTests++;
|
||||
if (gExtraDragTests == 6)
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function checkOneDataItem(dt, expectedtypes, expecteddata, index, testid)
|
||||
@ -528,7 +530,7 @@ function expectError(fn, eid, testid)
|
||||
|
||||
<input id="input" value="Text in a box" ondragstart="doDragStartInput(event)">
|
||||
|
||||
<div style="-moz-user-select: none;" ondragstart="onDragStartDraggable(event)">
|
||||
<div ondragstart="onDragStartDraggable(event)">
|
||||
<div id="dragtrue" draggable="true">
|
||||
This is a <span id="spantrue">draggable</span> area.
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user