mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 03:05:34 +00:00
Bug 1049130 - UITour: Fixing highlight placed in the wrong place at first time. r=Gijs
MozReview-Commit-ID: LVTbjeaizRD --HG-- extra : rebase_source : 535286c1de72d42c24432b2e2073ab13dc808b87
This commit is contained in:
parent
8145881eb8
commit
14a7e31cc1
@ -1140,16 +1140,11 @@ this.UITour = {
|
|||||||
/* The "overlap" position anchors from the top-left but we want to centre highlights at their
|
/* The "overlap" position anchors from the top-left but we want to centre highlights at their
|
||||||
minimum size. */
|
minimum size. */
|
||||||
let highlightWindow = aChromeWindow;
|
let highlightWindow = aChromeWindow;
|
||||||
let containerStyle = highlightWindow.getComputedStyle(highlighter.parentElement);
|
|
||||||
let paddingTopPx = 0 - parseFloat(containerStyle.paddingTop);
|
|
||||||
let paddingLeftPx = 0 - parseFloat(containerStyle.paddingLeft);
|
|
||||||
let highlightStyle = highlightWindow.getComputedStyle(highlighter);
|
let highlightStyle = highlightWindow.getComputedStyle(highlighter);
|
||||||
let highlightHeightWithMin = Math.max(highlightHeight, parseFloat(highlightStyle.minHeight));
|
let highlightHeightWithMin = Math.max(highlightHeight, parseFloat(highlightStyle.minHeight));
|
||||||
let highlightWidthWithMin = Math.max(highlightWidth, parseFloat(highlightStyle.minWidth));
|
let highlightWidthWithMin = Math.max(highlightWidth, parseFloat(highlightStyle.minWidth));
|
||||||
let offsetX = paddingTopPx
|
let offsetX = -(Math.max(0, highlightWidthWithMin - targetRect.width) / 2);
|
||||||
- (Math.max(0, highlightWidthWithMin - targetRect.width) / 2);
|
let offsetY = -(Math.max(0, highlightHeightWithMin - targetRect.height) / 2);
|
||||||
let offsetY = paddingLeftPx
|
|
||||||
- (Math.max(0, highlightHeightWithMin - targetRect.height) / 2);
|
|
||||||
this._addAnnotationPanelMutationObserver(highlighter.parentElement);
|
this._addAnnotationPanelMutationObserver(highlighter.parentElement);
|
||||||
highlighter.parentElement.openPopup(highlightAnchor, "overlap", offsetX, offsetY);
|
highlighter.parentElement.openPopup(highlightAnchor, "overlap", offsetX, offsetY);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
/* This is a buffer to compensate for the movement in the "wobble" effect,
|
/* This is a buffer to compensate for the movement in the "wobble" effect,
|
||||||
and for the box-shadow of #UITourHighlight. */
|
and for the box-shadow of #UITourHighlight. */
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
/* Compensate the displacement caused by padding. */
|
||||||
|
margin: -4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#UITourHighlight {
|
#UITourHighlight {
|
||||||
|
Loading…
Reference in New Issue
Block a user