mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046498 - Constrain frame to anchor subtree when dragging selection caret. r=roc
This commit is contained in:
parent
6bb8d86e9f
commit
7d8540531d
@ -609,11 +609,25 @@ SelectionCarets::DragSelection(const nsPoint &movePoint)
|
||||
// Find out which content we point to
|
||||
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(canvasFrame, movePoint,
|
||||
nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | nsLayoutUtils::IGNORE_CROSS_DOC);
|
||||
NS_ENSURE_TRUE(ptFrame, nsEventStatus_eConsumeNoDefault);
|
||||
if (!ptFrame) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsIFrame* caretFocusFrame = GetCaretFocusFrame();
|
||||
nsRefPtr<nsFrameSelection> fs = caretFocusFrame->GetFrameSelection();
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *newFrame = nullptr;
|
||||
nsPoint newPoint;
|
||||
nsPoint ptInFrame = movePoint;
|
||||
nsLayoutUtils::TransformPoint(canvasFrame, ptFrame, ptInFrame);
|
||||
result = fs->ConstrainFrameAndPointToAnchorSubtree(ptFrame, ptInFrame, &newFrame, newPoint);
|
||||
if (NS_FAILED(result) || !newFrame) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
nsFrame::ContentOffsets offsets =
|
||||
ptFrame->GetContentOffsetsFromPoint(ptInFrame);
|
||||
newFrame->GetContentOffsetsFromPoint(newPoint);
|
||||
NS_ENSURE_TRUE(offsets.content, nsEventStatus_eConsumeNoDefault);
|
||||
|
||||
nsISelection* caretSelection = GetSelection();
|
||||
@ -623,8 +637,6 @@ SelectionCarets::DragSelection(const nsPoint &movePoint)
|
||||
}
|
||||
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(0);
|
||||
nsIFrame* caretFocusFrame = GetCaretFocusFrame();
|
||||
nsRefPtr<nsFrameSelection> fs = caretFocusFrame->GetFrameSelection();
|
||||
if (!CompareRangeWithContentOffset(range, fs, offsets, mDragMode)) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -580,6 +580,11 @@ public:
|
||||
*/
|
||||
nsresult MaintainSelection(nsSelectionAmount aAmount = eSelectNoAmount);
|
||||
|
||||
nsresult ConstrainFrameAndPointToAnchorSubtree(nsIFrame *aFrame,
|
||||
nsPoint& aPoint,
|
||||
nsIFrame **aRetFrame,
|
||||
nsPoint& aRetPoint);
|
||||
|
||||
nsFrameSelection();
|
||||
|
||||
void StartBatchChanges();
|
||||
@ -643,8 +648,6 @@ private:
|
||||
void InvalidateDesiredX(); //do not listen to mDesiredX you must get another.
|
||||
void SetDesiredX(nscoord aX); //set the mDesiredX
|
||||
|
||||
nsresult ConstrainFrameAndPointToAnchorSubtree(nsIFrame *aFrame, nsPoint& aPoint, nsIFrame **aRetFrame, nsPoint& aRetPoint);
|
||||
|
||||
uint32_t GetBatching() const {return mBatching; }
|
||||
bool GetNotifyFrames() const { return mNotifyFrames; }
|
||||
void SetDirty(bool aDirty=true){if (mBatching) mChangesDuringBatching = aDirty;}
|
||||
|
Loading…
Reference in New Issue
Block a user