зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0fa44cb3f4b6 (bug 1506751) for xpcshell failures on reflow.js
--HG-- extra : rebase_source : 77d529bcc65ad571092dc6a47e45c8e1a5ccdb44
This commit is contained in:
Родитель
a45897eb14
Коммит
195847fe14
|
@ -208,7 +208,6 @@ skip-if = (os == "win" && debug) # bug 963492: win.
|
||||||
[browser_rules_mark_overridden_06.js]
|
[browser_rules_mark_overridden_06.js]
|
||||||
[browser_rules_mark_overridden_07.js]
|
[browser_rules_mark_overridden_07.js]
|
||||||
[browser_rules_mathml-element.js]
|
[browser_rules_mathml-element.js]
|
||||||
[browser_rules_media-queries_reload.js]
|
|
||||||
[browser_rules_media-queries.js]
|
[browser_rules_media-queries.js]
|
||||||
[browser_rules_multiple-properties-duplicates.js]
|
[browser_rules_multiple-properties-duplicates.js]
|
||||||
[browser_rules_multiple-properties-priority.js]
|
[browser_rules_multiple-properties-priority.js]
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test that applicable media queries are updated in the Rule view after reloading
|
|
||||||
// the page and resizing the window.
|
|
||||||
|
|
||||||
const TEST_URI = `
|
|
||||||
<style type='text/css'>
|
|
||||||
@media all and (max-width: 500px) {
|
|
||||||
div {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media all and (min-width: 500px) {
|
|
||||||
div {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div></div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
add_task(async function() {
|
|
||||||
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
|
|
||||||
const { inspector, view: ruleView, testActor, toolbox } = await openRuleView();
|
|
||||||
const hostWindow = toolbox.win.parent;
|
|
||||||
|
|
||||||
const originalWidth = hostWindow.outerWidth;
|
|
||||||
const originalHeight = hostWindow.outerHeight;
|
|
||||||
|
|
||||||
await selectNode("div", inspector);
|
|
||||||
|
|
||||||
info("Resize window so the media query for small viewports applies");
|
|
||||||
let onRuleViewRefreshed = ruleView.once("ruleview-refreshed");
|
|
||||||
let onResize = once(hostWindow, "resize");
|
|
||||||
hostWindow.resizeTo(400, 400);
|
|
||||||
await onResize;
|
|
||||||
await testActor.reflow();
|
|
||||||
await onRuleViewRefreshed;
|
|
||||||
let rule = getRuleViewRuleEditor(ruleView, 1).rule;
|
|
||||||
is(rule.textProps[0].value, "red", "Small viewport media query inspected");
|
|
||||||
|
|
||||||
info("Reload the current page");
|
|
||||||
await reloadPage(inspector, testActor);
|
|
||||||
await selectNode("div", inspector);
|
|
||||||
|
|
||||||
info("Resize window so the media query for large viewports applies");
|
|
||||||
onRuleViewRefreshed = ruleView.once("ruleview-refreshed");
|
|
||||||
onResize = once(hostWindow, "resize");
|
|
||||||
hostWindow.resizeTo(800, 800);
|
|
||||||
await onResize;
|
|
||||||
await testActor.reflow();
|
|
||||||
await onRuleViewRefreshed;
|
|
||||||
info("Reselect the rule after page reload.");
|
|
||||||
rule = getRuleViewRuleEditor(ruleView, 1).rule;
|
|
||||||
is(rule.textProps[0].value, "green", "Large viewport media query inspected");
|
|
||||||
|
|
||||||
info("Resize window to original dimentions");
|
|
||||||
onResize = once(hostWindow, "resize");
|
|
||||||
hostWindow.resizeTo(originalWidth, originalHeight);
|
|
||||||
await onResize;
|
|
||||||
});
|
|
|
@ -466,11 +466,7 @@ ReflowObserver.prototype.QueryInterface = ChromeUtils
|
||||||
class WindowResizeObserver extends Observable {
|
class WindowResizeObserver extends Observable {
|
||||||
constructor(targetActor, callback) {
|
constructor(targetActor, callback) {
|
||||||
super(targetActor, callback);
|
super(targetActor, callback);
|
||||||
|
|
||||||
this.onNavigate = this.onNavigate.bind(this);
|
|
||||||
this.onResize = this.onResize.bind(this);
|
this.onResize = this.onResize.bind(this);
|
||||||
|
|
||||||
this.targetActor.on("navigate", this.onNavigate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_startListeners() {
|
_startListeners() {
|
||||||
|
@ -481,22 +477,10 @@ class WindowResizeObserver extends Observable {
|
||||||
this.listenerTarget.removeEventListener("resize", this.onResize);
|
this.listenerTarget.removeEventListener("resize", this.onResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNavigate() {
|
|
||||||
if (this.isObserving) {
|
|
||||||
this._stopListeners();
|
|
||||||
this._startListeners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onResize() {
|
onResize() {
|
||||||
this.notifyCallback();
|
this.notifyCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
|
||||||
this.targetActor.off("navigate", this.onNavigate);
|
|
||||||
super.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
get listenerTarget() {
|
get listenerTarget() {
|
||||||
// For the rootActor, return its window.
|
// For the rootActor, return its window.
|
||||||
if (this.targetActor.isRootActor) {
|
if (this.targetActor.isRootActor) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче