forked from mirrors/gecko-dev
Bug 1473029, convert drag services to internally use CSSIntRegion instead ns nsIScriptableRegion, r=mstange
This commit is contained in:
parent
03caccfe9e
commit
a399d3073b
13 changed files with 53 additions and 53 deletions
|
|
@ -4976,7 +4976,7 @@ PresShell::CreateRangePaintInfo(nsRange* aRange,
|
||||||
already_AddRefed<SourceSurface>
|
already_AddRefed<SourceSurface>
|
||||||
PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
|
PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
|
||||||
Selection* aSelection,
|
Selection* aSelection,
|
||||||
nsIntRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
nsRect aArea,
|
nsRect aArea,
|
||||||
const LayoutDeviceIntPoint aPoint,
|
const LayoutDeviceIntPoint aPoint,
|
||||||
LayoutDeviceIntRect* aScreenRect,
|
LayoutDeviceIntRect* aScreenRect,
|
||||||
|
|
@ -5076,7 +5076,7 @@ PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems
|
||||||
aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel())
|
aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel())
|
||||||
.ToOutsidePixels(pc->AppUnitsPerDevPixel());
|
.ToOutsidePixels(pc->AppUnitsPerDevPixel());
|
||||||
for (auto iter = region.RectIter(); !iter.Done(); iter.Next()) {
|
for (auto iter = region.RectIter(); !iter.Done(); iter.Next()) {
|
||||||
const nsIntRect& rect = iter.Get();
|
const IntRect& rect = iter.Get();
|
||||||
|
|
||||||
builder->MoveTo(rect.TopLeft());
|
builder->MoveTo(rect.TopLeft());
|
||||||
builder->LineTo(rect.TopRight());
|
builder->LineTo(rect.TopRight());
|
||||||
|
|
@ -5136,7 +5136,7 @@ PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems
|
||||||
|
|
||||||
already_AddRefed<SourceSurface>
|
already_AddRefed<SourceSurface>
|
||||||
PresShell::RenderNode(nsINode* aNode,
|
PresShell::RenderNode(nsINode* aNode,
|
||||||
nsIntRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
const LayoutDeviceIntPoint aPoint,
|
const LayoutDeviceIntPoint aPoint,
|
||||||
LayoutDeviceIntRect* aScreenRect,
|
LayoutDeviceIntRect* aScreenRect,
|
||||||
uint32_t aFlags)
|
uint32_t aFlags)
|
||||||
|
|
@ -5163,9 +5163,10 @@ PresShell::RenderNode(nsINode* aNode,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRegion) {
|
Maybe<CSSIntRegion> region = aRegion;
|
||||||
|
if (region) {
|
||||||
// combine the area with the supplied region
|
// combine the area with the supplied region
|
||||||
nsIntRect rrectPixels = aRegion->GetBounds();
|
CSSIntRect rrectPixels = region->GetBounds();
|
||||||
|
|
||||||
nsRect rrect = ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel());
|
nsRect rrect = ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel());
|
||||||
area.IntersectRect(area, rrect);
|
area.IntersectRect(area, rrect);
|
||||||
|
|
@ -5175,11 +5176,11 @@ PresShell::RenderNode(nsINode* aNode,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// move the region so that it is offset from the topleft corner of the surface
|
// move the region so that it is offset from the topleft corner of the surface
|
||||||
aRegion->MoveBy(-nsPresContext::AppUnitsToIntCSSPixels(area.x),
|
region->MoveBy(-nsPresContext::AppUnitsToIntCSSPixels(area.x),
|
||||||
-nsPresContext::AppUnitsToIntCSSPixels(area.y));
|
-nsPresContext::AppUnitsToIntCSSPixels(area.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
return PaintRangePaintInfo(rangeItems, nullptr, aRegion, area, aPoint,
|
return PaintRangePaintInfo(rangeItems, nullptr, region, area, aPoint,
|
||||||
aScreenRect, aFlags);
|
aScreenRect, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5210,7 +5211,7 @@ PresShell::RenderSelection(Selection* aSelection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PaintRangePaintInfo(rangeItems, aSelection, nullptr, area, aPoint,
|
return PaintRangePaintInfo(rangeItems, aSelection, Nothing(), area, aPoint,
|
||||||
aScreenRect, aFlags);
|
aScreenRect, aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public:
|
||||||
|
|
||||||
already_AddRefed<SourceSurface>
|
already_AddRefed<SourceSurface>
|
||||||
RenderNode(nsINode* aNode,
|
RenderNode(nsINode* aNode,
|
||||||
nsIntRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
const LayoutDeviceIntPoint aPoint,
|
const LayoutDeviceIntPoint aPoint,
|
||||||
LayoutDeviceIntRect* aScreenRect,
|
LayoutDeviceIntRect* aScreenRect,
|
||||||
uint32_t aFlags) override;
|
uint32_t aFlags) override;
|
||||||
|
|
@ -543,7 +543,7 @@ private:
|
||||||
already_AddRefed<SourceSurface>
|
already_AddRefed<SourceSurface>
|
||||||
PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
|
PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
|
||||||
dom::Selection* aSelection,
|
dom::Selection* aSelection,
|
||||||
nsIntRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
nsRect aArea,
|
nsRect aArea,
|
||||||
const LayoutDeviceIntPoint aPoint,
|
const LayoutDeviceIntPoint aPoint,
|
||||||
LayoutDeviceIntRect* aScreenRect,
|
LayoutDeviceIntRect* aScreenRect,
|
||||||
|
|
|
||||||
|
|
@ -1162,7 +1162,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual already_AddRefed<mozilla::gfx::SourceSurface>
|
virtual already_AddRefed<mozilla::gfx::SourceSurface>
|
||||||
RenderNode(nsINode* aNode,
|
RenderNode(nsINode* aNode,
|
||||||
nsIntRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
const mozilla::LayoutDeviceIntPoint aPoint,
|
const mozilla::LayoutDeviceIntPoint aPoint,
|
||||||
mozilla::LayoutDeviceIntRect* aScreenRect,
|
mozilla::LayoutDeviceIntRect* aScreenRect,
|
||||||
uint32_t aFlags) = 0;
|
uint32_t aFlags) = 0;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
|
|
||||||
// nsBaseDragService
|
// nsBaseDragService
|
||||||
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType) override;
|
uint32_t aActionType) override;
|
||||||
// nsIDragService
|
// nsIDragService
|
||||||
NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
NS_IMETHOD EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers) override;
|
||||||
|
|
@ -46,14 +46,14 @@ private:
|
||||||
// Creates and returns the drag image for a drag. aImagePoint will be set to
|
// Creates and returns the drag image for a drag. aImagePoint will be set to
|
||||||
// the origin of the drag relative to mNativeDragView.
|
// the origin of the drag relative to mNativeDragView.
|
||||||
NSImage* ConstructDragImage(nsINode* aDOMNode,
|
NSImage* ConstructDragImage(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
NSPoint* aImagePoint);
|
NSPoint* aImagePoint);
|
||||||
|
|
||||||
// Creates and returns the drag image for a drag. aPoint should be the origin
|
// Creates and returns the drag image for a drag. aPoint should be the origin
|
||||||
// of the drag, for example the mouse coordinate of the mousedown event.
|
// of the drag, for example the mouse coordinate of the mousedown event.
|
||||||
// aDragRect will be set the area of the drag relative to this.
|
// aDragRect will be set the area of the drag relative to this.
|
||||||
NSImage* ConstructDragImage(nsINode* aDOMNode,
|
NSImage* ConstructDragImage(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
mozilla::CSSIntPoint aPoint,
|
mozilla::CSSIntPoint aPoint,
|
||||||
mozilla::LayoutDeviceIntRect* aDragRect);
|
mozilla::LayoutDeviceIntRect* aDragRect);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ nsDragService::~nsDragService()
|
||||||
|
|
||||||
NSImage*
|
NSImage*
|
||||||
nsDragService::ConstructDragImage(nsINode* aDOMNode,
|
nsDragService::ConstructDragImage(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
NSPoint* aDragPoint)
|
NSPoint* aDragPoint)
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||||
|
|
@ -108,7 +108,7 @@ nsDragService::ConstructDragImage(nsINode* aDOMNode,
|
||||||
|
|
||||||
NSImage*
|
NSImage*
|
||||||
nsDragService::ConstructDragImage(nsINode* aDOMNode,
|
nsDragService::ConstructDragImage(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
CSSIntPoint aPoint,
|
CSSIntPoint aPoint,
|
||||||
LayoutDeviceIntRect* aDragRect)
|
LayoutDeviceIntRect* aDragRect)
|
||||||
{
|
{
|
||||||
|
|
@ -284,7 +284,7 @@ nsDragService::GetFilePath(NSPasteboardItem* item)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDragService::InvokeDragSessionImpl(nsIArray* aTransferableArray,
|
nsDragService::InvokeDragSessionImpl(nsIArray* aTransferableArray,
|
||||||
nsIScriptableRegion* aDragRgn,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType)
|
uint32_t aActionType)
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
@ -344,7 +344,7 @@ nsDragService::InvokeDragSessionImpl(nsIArray* aTransferableArray,
|
||||||
[pbItem setDataProvider:mNativeDragView forTypes:types];
|
[pbItem setDataProvider:mNativeDragView forTypes:types];
|
||||||
|
|
||||||
NSPoint draggingPoint;
|
NSPoint draggingPoint;
|
||||||
NSImage* image = ConstructDragImage(mSourceNode, aDragRgn, &draggingPoint);
|
NSImage* image = ConstructDragImage(mSourceNode, aRegion, &draggingPoint);
|
||||||
|
|
||||||
NSRect localDragRect = image.alignmentRect;
|
NSRect localDragRect = image.alignmentRect;
|
||||||
localDragRect.origin.x = draggingPoint.x;
|
localDragRect.origin.x = draggingPoint.x;
|
||||||
|
|
@ -712,7 +712,7 @@ nsDragService::DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint)
|
||||||
|
|
||||||
// Create a new image; if one isn't returned don't change the current one.
|
// Create a new image; if one isn't returned don't change the current one.
|
||||||
LayoutDeviceIntRect newRect;
|
LayoutDeviceIntRect newRect;
|
||||||
NSImage* image = ConstructDragImage(mSourceNode, nullptr, screenPoint, &newRect);
|
NSImage* image = ConstructDragImage(mSourceNode, Nothing(), screenPoint, &newRect);
|
||||||
if (image) {
|
if (image) {
|
||||||
NSRect draggingRect = nsCocoaUtils::GeckoRectToCocoaRectDevPix(newRect, scaleFactor);
|
NSRect draggingRect = nsCocoaUtils::GeckoRectToCocoaRectDevPix(newRect, scaleFactor);
|
||||||
[draggingItem setDraggingFrame:draggingRect contents:image];
|
[draggingItem setDraggingFrame:draggingRect contents:image];
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ nsDragService::InvokeDragSession(nsINode *aDOMNode,
|
||||||
// nsBaseDragService
|
// nsBaseDragService
|
||||||
nsresult
|
nsresult
|
||||||
nsDragService::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
|
nsDragService::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType)
|
uint32_t aActionType)
|
||||||
{
|
{
|
||||||
// make sure that we have an array of transferables to use
|
// make sure that we have an array of transferables to use
|
||||||
|
|
@ -1717,8 +1717,8 @@ void nsDragService::SetDragIcon(GdkDragContext* aContext)
|
||||||
LayoutDeviceIntRect dragRect;
|
LayoutDeviceIntRect dragRect;
|
||||||
nsPresContext* pc;
|
nsPresContext* pc;
|
||||||
RefPtr<SourceSurface> surface;
|
RefPtr<SourceSurface> surface;
|
||||||
DrawDrag(mSourceNode, mRegion, mScreenPosition,
|
DrawDrag(mSourceNode, mRegion,
|
||||||
&dragRect, &surface, &pc);
|
mScreenPosition, &dragRect, &surface, &pc);
|
||||||
if (!pc)
|
if (!pc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
// nsBaseDragService
|
// nsBaseDragService
|
||||||
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType) override;
|
uint32_t aActionType) override;
|
||||||
// nsIDragService
|
// nsIDragService
|
||||||
NS_IMETHOD InvokeDragSession (nsINode *aDOMNode,
|
NS_IMETHOD InvokeDragSession (nsINode *aDOMNode,
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,7 @@ nsBaseDragService::nsBaseDragService()
|
||||||
mDragAction(DRAGDROP_ACTION_NONE),
|
mDragAction(DRAGDROP_ACTION_NONE),
|
||||||
mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0),
|
mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0),
|
||||||
mContentPolicyType(nsIContentPolicy::TYPE_OTHER),
|
mContentPolicyType(nsIContentPolicy::TYPE_OTHER),
|
||||||
mSuppressLevel(0), mInputSource(MouseEvent_Binding::MOZ_SOURCE_MOUSE),
|
mSuppressLevel(0), mInputSource(MouseEvent_Binding::MOZ_SOURCE_MOUSE)
|
||||||
mRegion(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,7 +301,7 @@ nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
|
||||||
// to be set to the area encompassing the selected rows of the
|
// to be set to the area encompassing the selected rows of the
|
||||||
// tree to ensure that the drag feedback gets clipped to those
|
// tree to ensure that the drag feedback gets clipped to those
|
||||||
// rows. For other content, region should be null.
|
// rows. For other content, region should be null.
|
||||||
mRegion = nullptr;
|
mRegion = Nothing();
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
if (aDOMNode && aDOMNode->IsContent() && !aImage) {
|
if (aDOMNode && aDOMNode->IsContent() && !aImage) {
|
||||||
if (aDOMNode->NodeInfo()->Equals(nsGkAtoms::treechildren,
|
if (aDOMNode->NodeInfo()->Equals(nsGkAtoms::treechildren,
|
||||||
|
|
@ -310,7 +309,13 @@ nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
|
||||||
nsTreeBodyFrame* treeBody =
|
nsTreeBodyFrame* treeBody =
|
||||||
do_QueryFrame(aDOMNode->AsContent()->GetPrimaryFrame());
|
do_QueryFrame(aDOMNode->AsContent()->GetPrimaryFrame());
|
||||||
if (treeBody) {
|
if (treeBody) {
|
||||||
treeBody->GetSelectionRegion(getter_AddRefs(mRegion));
|
nsCOMPtr<nsIScriptableRegion> region;
|
||||||
|
treeBody->GetSelectionRegion(getter_AddRefs(region));
|
||||||
|
if (region) {
|
||||||
|
nsIntRegion intRegion;
|
||||||
|
region->GetRegion(&intRegion);
|
||||||
|
mRegion.emplace(CSSIntRegion::FromUnknownRegion(intRegion));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,7 +325,7 @@ nsBaseDragService::InvokeDragSessionWithImage(nsINode* aDOMNode,
|
||||||
aTransferableArray,
|
aTransferableArray,
|
||||||
aActionType,
|
aActionType,
|
||||||
nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
nsIContentPolicy::TYPE_INTERNAL_IMAGE);
|
||||||
mRegion = nullptr;
|
mRegion = Nothing();
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,7 +347,7 @@ nsBaseDragService::InvokeDragSessionWithSelection(Selection* aSelection,
|
||||||
mDragPopup = nullptr;
|
mDragPopup = nullptr;
|
||||||
mImage = nullptr;
|
mImage = nullptr;
|
||||||
mImageOffset = CSSIntPoint();
|
mImageOffset = CSSIntPoint();
|
||||||
mRegion = nullptr;
|
mRegion = Nothing();
|
||||||
|
|
||||||
mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
|
mScreenPosition.x = aDragEvent->ScreenX(CallerType::System);
|
||||||
mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
|
mScreenPosition.y = aDragEvent->ScreenY(CallerType::System);
|
||||||
|
|
@ -473,7 +478,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers)
|
||||||
mScreenPosition = CSSIntPoint();
|
mScreenPosition = CSSIntPoint();
|
||||||
mEndDragPoint = LayoutDeviceIntPoint(0, 0);
|
mEndDragPoint = LayoutDeviceIntPoint(0, 0);
|
||||||
mInputSource = MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
mInputSource = MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
||||||
mRegion = nullptr;
|
mRegion = Nothing();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -573,7 +578,7 @@ GetPresShellForContent(nsINode* aDOMNode)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
CSSIntPoint aScreenPosition,
|
CSSIntPoint aScreenPosition,
|
||||||
LayoutDeviceIntRect* aScreenDragRect,
|
LayoutDeviceIntRect* aScreenDragRect,
|
||||||
RefPtr<SourceSurface>* aSurface,
|
RefPtr<SourceSurface>* aSurface,
|
||||||
|
|
@ -633,9 +638,7 @@ nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
||||||
CSSIntRect dragRect;
|
CSSIntRect dragRect;
|
||||||
if (aRegion) {
|
if (aRegion) {
|
||||||
// the region's coordinates are relative to the root frame
|
// the region's coordinates are relative to the root frame
|
||||||
int32_t dragRectX, dragRectY, dragRectW, dragRectH;
|
dragRect = aRegion->GetBounds();
|
||||||
aRegion->GetBoundingBox(&dragRectX, &dragRectY, &dragRectW, &dragRectH);
|
|
||||||
dragRect.SetRect(dragRectX, dragRectY, dragRectW, dragRectH);
|
|
||||||
|
|
||||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||||
CSSIntRect screenRect = rootFrame->GetScreenRect();
|
CSSIntRect screenRect = rootFrame->GetScreenRect();
|
||||||
|
|
@ -695,12 +698,7 @@ nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
||||||
|
|
||||||
if (!mDragPopup) {
|
if (!mDragPopup) {
|
||||||
// otherwise, just draw the node
|
// otherwise, just draw the node
|
||||||
nsIntRegion clipRegion;
|
|
||||||
uint32_t renderFlags = mImage ? 0 : nsIPresShell::RENDER_AUTO_SCALE;
|
uint32_t renderFlags = mImage ? 0 : nsIPresShell::RENDER_AUTO_SCALE;
|
||||||
if (aRegion) {
|
|
||||||
aRegion->GetRegion(&clipRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (renderFlags) {
|
if (renderFlags) {
|
||||||
nsCOMPtr<nsINode> dragINode = do_QueryInterface(dragNode);
|
nsCOMPtr<nsINode> dragINode = do_QueryInterface(dragNode);
|
||||||
// check if the dragged node itself is an img element
|
// check if the dragged node itself is an img element
|
||||||
|
|
@ -721,7 +719,7 @@ nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LayoutDeviceIntPoint pnt(aScreenDragRect->TopLeft());
|
LayoutDeviceIntPoint pnt(aScreenDragRect->TopLeft());
|
||||||
*aSurface = presShell->RenderNode(dragNode, aRegion ? &clipRegion : nullptr,
|
*aSurface = presShell->RenderNode(dragNode, aRegion,
|
||||||
pnt, aScreenDragRect,
|
pnt, aScreenDragRect,
|
||||||
renderFlags);
|
renderFlags);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
#include "nsRegion.h"
|
||||||
#include "Units.h"
|
#include "Units.h"
|
||||||
|
|
||||||
// translucency level for drag images
|
// translucency level for drag images
|
||||||
|
|
@ -82,7 +83,7 @@ protected:
|
||||||
* EndDragSession() get called if the platform drag is successfully invoked.
|
* EndDragSession() get called if the platform drag is successfully invoked.
|
||||||
*/
|
*/
|
||||||
virtual nsresult InvokeDragSessionImpl(nsIArray* aTransferableArray,
|
virtual nsresult InvokeDragSessionImpl(nsIArray* aTransferableArray,
|
||||||
nsIScriptableRegion* aDragRgn,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType) = 0;
|
uint32_t aActionType) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,7 +109,7 @@ protected:
|
||||||
* whichever of mImage or aDOMNode is used.
|
* whichever of mImage or aDOMNode is used.
|
||||||
*/
|
*/
|
||||||
nsresult DrawDrag(nsINode* aDOMNode,
|
nsresult DrawDrag(nsINode* aDOMNode,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
mozilla::CSSIntPoint aScreenPosition,
|
mozilla::CSSIntPoint aScreenPosition,
|
||||||
mozilla::LayoutDeviceIntRect* aScreenDragRect,
|
mozilla::LayoutDeviceIntRect* aScreenDragRect,
|
||||||
RefPtr<SourceSurface>* aSurface,
|
RefPtr<SourceSurface>* aSurface,
|
||||||
|
|
@ -199,7 +200,7 @@ protected:
|
||||||
nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses;
|
nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses;
|
||||||
|
|
||||||
// Sub-region for tree-selections.
|
// Sub-region for tree-selections.
|
||||||
nsCOMPtr<nsIScriptableRegion> mRegion;
|
mozilla::Maybe<mozilla::CSSIntRegion> mRegion;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsBaseDragService_h__
|
#endif // nsBaseDragService_h__
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ GetPrincipalURIFromNode(nsCOMPtr<nsINode>& sourceNode,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDragServiceProxy::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
|
nsDragServiceProxy::InvokeDragSessionImpl(nsIArray* aArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType)
|
uint32_t aActionType)
|
||||||
{
|
{
|
||||||
NS_ENSURE_STATE(mSourceDocument->GetDocShell());
|
NS_ENSURE_STATE(mSourceDocument->GetDocShell());
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public:
|
||||||
|
|
||||||
// nsBaseDragService
|
// nsBaseDragService
|
||||||
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType) override;
|
uint32_t aActionType) override;
|
||||||
private:
|
private:
|
||||||
virtual ~nsDragServiceProxy();
|
virtual ~nsDragServiceProxy();
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ nsDragService::~nsDragService()
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsDragService::CreateDragImage(nsINode *aDOMNode,
|
nsDragService::CreateDragImage(nsINode *aDOMNode,
|
||||||
nsIScriptableRegion *aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
SHDRAGIMAGE *psdi)
|
SHDRAGIMAGE *psdi)
|
||||||
{
|
{
|
||||||
if (!psdi)
|
if (!psdi)
|
||||||
|
|
@ -165,7 +165,7 @@ nsDragService::CreateDragImage(nsINode *aDOMNode,
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
nsresult
|
nsresult
|
||||||
nsDragService::InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
nsDragService::InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const Maybe<CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType)
|
uint32_t aActionType)
|
||||||
{
|
{
|
||||||
// Try and get source URI of the items that are being dragged
|
// Try and get source URI of the items that are being dragged
|
||||||
|
|
@ -654,7 +654,7 @@ nsDragService::UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
IID_IDragSourceHelper, (void**)&pdsh))) {
|
IID_IDragSourceHelper, (void**)&pdsh))) {
|
||||||
SHDRAGIMAGE sdi;
|
SHDRAGIMAGE sdi;
|
||||||
if (CreateDragImage(mSourceNode, nullptr, &sdi)) {
|
if (CreateDragImage(mSourceNode, Nothing(), &sdi)) {
|
||||||
nsNativeDragTarget::DragImageChanged();
|
nsNativeDragTarget::DragImageChanged();
|
||||||
if (FAILED(pdsh->InitializeFromBitmap(&sdi, mDataObject)))
|
if (FAILED(pdsh->InitializeFromBitmap(&sdi, mDataObject)))
|
||||||
DeleteObject(sdi.hbmpDragImage);
|
DeleteObject(sdi.hbmpDragImage);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
|
|
||||||
// nsBaseDragService
|
// nsBaseDragService
|
||||||
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
|
||||||
nsIScriptableRegion* aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
uint32_t aActionType);
|
uint32_t aActionType);
|
||||||
|
|
||||||
// nsIDragSession
|
// nsIDragSession
|
||||||
|
|
@ -54,7 +54,7 @@ protected:
|
||||||
|
|
||||||
// Create a bitmap for drag operations
|
// Create a bitmap for drag operations
|
||||||
bool CreateDragImage(nsINode *aDOMNode,
|
bool CreateDragImage(nsINode *aDOMNode,
|
||||||
nsIScriptableRegion *aRegion,
|
const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
|
||||||
SHDRAGIMAGE *psdi);
|
SHDRAGIMAGE *psdi);
|
||||||
|
|
||||||
IDataObject * mDataObject;
|
IDataObject * mDataObject;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue