mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 12:07:52 +00:00
Bug 941356 - Fix start offset of transformed drag images. r=botond
I'm not sure whether we should deal with ancestor scales and such. There seemed to be a discussion about that in D77436 but dealing with partially-3d-transformed content sounds like a massive pain. For now this fixes the start point, which is a progression. Differential Revision: https://phabricator.services.mozilla.com/D106896
This commit is contained in:
parent
2ae8ccfc52
commit
dc59483894
@ -636,10 +636,7 @@ void DOMIntersectionObserver::Update(Document* aDocument,
|
||||
|
||||
// 2.3. Let targetRect be a DOMRectReadOnly obtained by running the
|
||||
// getBoundingClientRect() algorithm on target.
|
||||
targetRect = nsLayoutUtils::GetAllInFlowRectsUnion(
|
||||
targetFrame,
|
||||
nsLayoutUtils::GetContainingBlockForClientRect(targetFrame),
|
||||
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
|
||||
targetRect = targetFrame->GetBoundingClientRect();
|
||||
|
||||
// 2.4. Let intersectionRect be the result of running the compute the
|
||||
// intersection algorithm on target.
|
||||
|
@ -1014,10 +1014,7 @@ already_AddRefed<DOMRect> Element::GetBoundingClientRect() {
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(
|
||||
frame, nsLayoutUtils::GetContainingBlockForClientRect(frame),
|
||||
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
|
||||
rect->SetLayoutRect(r);
|
||||
rect->SetLayoutRect(frame->GetBoundingClientRect());
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
|
@ -4844,6 +4844,8 @@ UniquePtr<RangePaintInfo> PresShell::CreateRangePaintInfo(
|
||||
// appropriate nsDisplayAsyncZoom display items. This code handles the general
|
||||
// case with nested async zooms (even though that never actually happens),
|
||||
// because it fell out of the implementation for free.
|
||||
//
|
||||
// TODO: Do we need to do the same for ancestor transforms?
|
||||
for (nsPresContext* ctx = GetPresContext(); ctx;
|
||||
ctx = ctx->GetParentPresContext()) {
|
||||
PresShell* shell = ctx->PresShell();
|
||||
@ -4884,7 +4886,7 @@ UniquePtr<RangePaintInfo> PresShell::CreateRangePaintInfo(
|
||||
// determine the offset of the reference frame for the display list
|
||||
// to the root frame. This will allow the coordinates used when painting
|
||||
// to all be offset from the same point
|
||||
info->mRootOffset = ancestorFrame->GetOffsetTo(rootFrame);
|
||||
info->mRootOffset = ancestorFrame->GetBoundingClientRect().TopLeft();
|
||||
rangeRect.MoveBy(info->mRootOffset);
|
||||
aSurfaceRect.UnionRect(aSurfaceRect, rangeRect);
|
||||
|
||||
|
@ -7403,6 +7403,12 @@ nsRect nsIFrame::GetNormalRect() const {
|
||||
return GetRect();
|
||||
}
|
||||
|
||||
nsRect nsIFrame::GetBoundingClientRect() {
|
||||
return nsLayoutUtils::GetAllInFlowRectsUnion(
|
||||
this, nsLayoutUtils::GetContainingBlockForClientRect(this),
|
||||
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
|
||||
}
|
||||
|
||||
nsPoint nsIFrame::GetPositionIgnoringScrolling() const {
|
||||
return GetParent() ? GetParent()->GetPositionOfChildIgnoringScrolling(this)
|
||||
: GetPosition();
|
||||
|
@ -1284,6 +1284,11 @@ class nsIFrame : public nsQueryFrame {
|
||||
*/
|
||||
nsRect GetNormalRect() const;
|
||||
|
||||
/**
|
||||
* Returns frame's rect as required by the GetBoundingClientRect() DOM API.
|
||||
*/
|
||||
nsRect GetBoundingClientRect();
|
||||
|
||||
/**
|
||||
* Return frame's position without relative positioning.
|
||||
* If aHasProperty is provided, returns whether the normal position
|
||||
|
@ -724,9 +724,8 @@ nsresult nsBaseDragService::DrawDrag(nsINode* aDOMNode,
|
||||
// otherwise, there was no region so just set the rectangle to
|
||||
// the size of the primary frame of the content.
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(dragNode);
|
||||
nsIFrame* frame = content->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
presLayoutRect = frame->GetRect();
|
||||
if (nsIFrame* frame = content->GetPrimaryFrame()) {
|
||||
presLayoutRect = frame->GetBoundingClientRect();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user