зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1358713, when a popup's anchor does not have a frame originally, don't have the popup update its position to follow it, r=tn
This commit is contained in:
Родитель
5d0885869a
Коммит
38846a0f8f
|
@ -2510,11 +2510,13 @@ nsMenuPopupFrame::ShouldFollowAnchor(nsRect& aRect)
|
|||
}
|
||||
|
||||
nsIFrame* anchorFrame = mAnchorContent->GetPrimaryFrame();
|
||||
if (anchorFrame) {
|
||||
nsPresContext* rootPresContext = PresContext()->GetRootPresContext();
|
||||
if (rootPresContext) {
|
||||
aRect = ComputeAnchorRect(rootPresContext, anchorFrame);
|
||||
}
|
||||
if (!anchorFrame) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsPresContext* rootPresContext = PresContext()->GetRootPresContext();
|
||||
if (rootPresContext) {
|
||||
aRect = ComputeAnchorRect(rootPresContext, anchorFrame);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
<menuitem label="Three"/>
|
||||
</menupopup>
|
||||
|
||||
<button id="anchorhidden" label="HiddenAnchor" hidden="true"/>
|
||||
<button id="anchorextra" label="ExtraAnchor"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
Components.utils.import("resource://gre/modules/Task.jsm");
|
||||
|
@ -140,6 +143,27 @@ function runTests() {
|
|||
yield popuphidden;
|
||||
yield menupopuphidden;
|
||||
|
||||
// A popup with a hidden anchor should not update
|
||||
let anchorhidden = document.getElementById("anchorhidden");
|
||||
popupshown = waitForPanel(panel, "popupshown");
|
||||
panel.openPopup(anchorhidden, "after_start");
|
||||
yield popupshown;
|
||||
|
||||
let oldtop = panel.getBoundingClientRect().top;
|
||||
|
||||
// Show and adjust anchors. The panel should not update or hide due to this.
|
||||
anchorhidden.hidden = false;
|
||||
document.getElementById("anchorextra").hidden = true;
|
||||
yield new Promise(r => { SimpleTest.executeSoon(r); });
|
||||
|
||||
let newtop = panel.getBoundingClientRect().top;
|
||||
is(panel.state, "open", "panel is still open after showing anchor");
|
||||
is(oldtop, newtop, "panel top did not change after showing anchor");
|
||||
|
||||
popuphidden = waitForPanel(panel, "popuphidden");
|
||||
panel.hidePopup();
|
||||
yield popuphidden;
|
||||
|
||||
// The panel should no longer follow anchors.
|
||||
panel.setAttribute("followanchor", "false");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче