Skip to content

Commit

Permalink
Merge fx-team to central, a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
KWierso committed Sep 9, 2015
2 parents f15dff0 + 01ffbc5 commit 4259e6d
Show file tree
Hide file tree
Showing 41 changed files with 811 additions and 149 deletions.
8 changes: 4 additions & 4 deletions browser/components/controlcenter/content/panel.inc.xul
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@
<description class="identity-popup-warning-yellow"
when-ciphers="weak">&identity.description.weakCipher2;</description>

<!-- More Security Information -->
<button label="&identity.moreInfoLinkText2;"
oncommand="gIdentityHandler.handleMoreInfoClick(event);"/>

<!-- Active Mixed Content Blocked -->
<description class="identity-popup-warning-gray"
when-mixedcontent="active-blocked">&identity.description.activeBlocked; <label observes="identity-popup-mcb-learn-more"/></description>
Expand Down Expand Up @@ -159,6 +155,10 @@
label="&identity.enableMixedContentBlocking.label;"
accesskey="&identity.enableMixedContentBlocking.accesskey;"
oncommand="gIdentityHandler.enableMixedContentProtection()"/>

<!-- More Security Information -->
<button label="&identity.moreInfoLinkText2;"
oncommand="gIdentityHandler.handleMoreInfoClick(event);"/>
</vbox>

</panelview>
Expand Down
2 changes: 1 addition & 1 deletion browser/devtools/animationinspector/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ AnimationsTimeline.prototype = {
createNode({
parent: iterations,
attributes: {
"class": "delay",
"class": "delay" + (delay < 0 ? " negative" : ""),
"style": `left:-${x}px;
width:${w}px;`
}
Expand Down
3 changes: 3 additions & 0 deletions browser/devtools/animationinspector/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ support-files =
doc_body_animation.html
doc_frame_script.js
doc_modify_playbackRate.html
doc_negative_animation.html
doc_simple_animation.html
head.js

[browser_animation_controller_exposes_document_currentTime.js]
[browser_animation_empty_on_invalid_nodes.js]
[browser_animation_iterationCount_hidden_by_default.js]
[browser_animation_mutations_with_same_names.js]
[browser_animation_panel_exists.js]
[browser_animation_participate_in_inspector_update.js]
[browser_animation_play_pause_button.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* vim: set 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 the controller provides the document.timeline currentTime (at least
// the last known version since new animations were added).

add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel, controller} = yield openAnimationInspectorNewUI();

ok(controller.documentCurrentTime, "The documentCurrentTime getter exists");
checkDocumentTimeIsCorrect(controller);
let time1 = controller.documentCurrentTime;

yield startNewAnimation(controller, panel);
checkDocumentTimeIsCorrect(controller);
let time2 = controller.documentCurrentTime;
ok(time2 > time1, "The new documentCurrentTime is higher than the old one");
});

function checkDocumentTimeIsCorrect(controller) {
let time = 0;
for (let {state} of controller.animationPlayers) {
time = Math.max(time, state.documentCurrentTime);
}
is(controller.documentCurrentTime, time,
"The documentCurrentTime is correct");
}

function* startNewAnimation(controller, panel) {
info("Add a new animation to the page and check the time again");
let onPlayerAdded = controller.once(controller.PLAYERS_UPDATED_EVENT);
yield executeInContent("devtools:test:setAttribute", {
selector: ".still",
attributeName: "class",
attributeValue: "ball still short"
});
yield onPlayerAdded;
yield waitForAllAnimationTargets(panel);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Check that when animations are added later (through animation mutations) and
// if these animations have the same names, then all of them are still being
// displayed (which should be true as long as these animations apply to
// different nodes).

add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_negative_animation.html");
let {controller, panel} = yield openAnimationInspectorNewUI();

info("Wait until all animations have been added " +
"(they're added with setTimeout)");
while (controller.animationPlayers.length < 3) {
yield controller.once(controller.PLAYERS_UPDATED_EVENT);
}
yield waitForAllAnimationTargets(panel);

is(panel.animationsTimelineComponent.animations.length, 3,
"The timeline shows 3 animations too");

// Reduce the known nodeFronts to a set to make them unique.
let nodeFronts = new Set(panel.animationsTimelineComponent
.targetNodes.map(n => n.nodeFront));
is(nodeFronts.size, 3,
"The animations are applied to 3 different node fronts");
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ add_task(function*() {

ok(!timeline.hasAttribute("disabled"), "The timeline input[range] is enabled");
ok(widget.setCurrentTime, "The widget has the setCurrentTime method");
ok(widget.player.setCurrentTime, "The associated player front has the setCurrentTime method");
ok(widget.player.setCurrentTime,
"The associated player front has the setCurrentTime method");

info("Faking an older server version by setting " +
"AnimationsController.traits.hasSetCurrentTime to false");
"AnimationsController.traits.hasSetCurrentTime to false");

yield selectNode("body", inspector);
controller.traits.hasSetCurrentTime = false;
Expand All @@ -35,7 +36,4 @@ add_task(function*() {
timeline = widget.currentTimeEl;

ok(timeline.hasAttribute("disabled"), "The timeline input[range] is disabled");

yield selectNode("body", inspector);
controller.traits.hasSetCurrentTime = true;
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function* testRefreshOnRemove(inspector, panel) {
attributeValue: "ball short test-node"
});
yield onPanelUpdated;
yield waitForAllAnimationTargets(panel);

assertAnimationsDisplayed(panel, 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel} = yield openAnimationInspectorNewUI();
yield waitForAllAnimationTargets(panel);

let timeline = panel.animationsTimelineComponent;
let scrubberEl = timeline.scrubberEl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");

let {panel} = yield openAnimationInspectorNewUI();
yield waitForAllAnimationTargets(panel);

let timeline = panel.animationsTimelineComponent;
let win = timeline.win;
Expand All @@ -20,17 +19,17 @@ add_task(function*() {

info("Mousedown in the header to move the scrubber");
EventUtils.synthesizeMouse(timeHeaderEl, 50, 1, {type: "mousedown"}, win);
let newPos = parseInt(scrubberEl.style.left);
let newPos = parseInt(scrubberEl.style.left, 10);
is(newPos, 50, "The scrubber moved on mousedown");

info("Continue moving the mouse and verify that the scrubber tracks it");
EventUtils.synthesizeMouse(timeHeaderEl, 100, 1, {type: "mousemove"}, win);
newPos = parseInt(scrubberEl.style.left);
newPos = parseInt(scrubberEl.style.left, 10);
is(newPos, 100, "The scrubber followed the mouse");

info("Release the mouse and move again and verify that the scrubber stays");
EventUtils.synthesizeMouse(timeHeaderEl, 100, 1, {type: "mouseup"}, win);
EventUtils.synthesizeMouse(timeHeaderEl, 200, 1, {type: "mousemove"}, win);
newPos = parseInt(scrubberEl.style.left);
newPos = parseInt(scrubberEl.style.left, 10);
is(newPos, 100, "The scrubber stopped following the mouse");
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@

add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");

let {panel} = yield openAnimationInspectorNewUI();
yield waitForAllAnimationTargets(panel);

let timeline = panel.animationsTimelineComponent;
let win = timeline.win;
let timeHeaderEl = timeline.timeHeaderEl;
let scrubberEl = timeline.scrubberEl;

let startPos = scrubberEl.getBoundingClientRect().left;

info("Wait for some time to check that the scrubber moves");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,47 @@

// Check that animation delay is visualized in the timeline-based UI when the
// animation is delayed.
// Also check that negative delays do not overflow the UI, and are shown like
// positive delays.

add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspectorNewUI();

info("Selecting a delayed animated node");
yield selectNode(".delayed", inspector);

info("Getting the animation and delay elements from the panel");
let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;
let delay = timelineEl.querySelector(".delay");

ok(delay, "The animation timeline contains the delay element");
checkDelayAndName(timelineEl, true);

info("Selecting a no-delay animated node");
yield selectNode(".animated", inspector);
checkDelayAndName(timelineEl, false);

info("Getting the animation and delay elements from the panel again");
delay = timelineEl.querySelector(".delay");

ok(!delay, "The animation timeline contains no delay element");
info("Selecting a negative-delay animated node");
yield selectNode(".negative-delay", inspector);
checkDelayAndName(timelineEl, true);
});

function checkDelayAndName(timelineEl, hasDelay) {
let delay = timelineEl.querySelector(".delay");

is(!!delay, hasDelay, "The timeline " +
(hasDelay ? "contains" : "does not contain") +
" a delay element, as expected");

if (hasDelay) {
let name = timelineEl.querySelector(".name");
let targetNode = timelineEl.querySelector(".target");

// Check that the delay element does not cause the timeline to overflow.
let delayRect = delay.getBoundingClientRect();
let sidebarWidth = targetNode.getBoundingClientRect().width;
ok(delayRect.x >= sidebarWidth,
"The delay element isn't displayed over the sidebar");

// Check that the delay is not displayed on top of the name.
let nameLeft = name.getBoundingClientRect().left;
ok(delayRect.right <= nameLeft,
"The delay element does not span over the name element");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {panel} = yield openAnimationInspectorNewUI();
yield waitForAllAnimationTargets(panel);

info("Getting the animation element from the panel");
let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;
Expand All @@ -22,8 +21,8 @@ add_task(function*() {
ok(el.hasAttribute("title"), "The tooltip is defined");

let title = el.getAttribute("title");
ok(title.match(/Delay: [\d.]+s/), "The tooltip shows the delay");
ok(title.match(/Duration: [\d.]+s/), "The tooltip shows the delay");
ok(title.match(/Delay: [\d.-]+s/), "The tooltip shows the delay");
ok(title.match(/Duration: [\d.]+s/), "The tooltip shows the duration");
ok(title.match(/Repeats: /), "The tooltip shows the iterations");
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_modify_playbackRate.html");

let {panel} = yield openAnimationInspectorNewUI();
yield waitForAllAnimationTargets(panel);

let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function* testDataUpdates({panel, controller, inspector}, isNewUI=false) {
yield selectNode(".animated", inspector);

let animation = controller.animationPlayers[0];
yield setStyle(animation, "animationDuration", "5.5s", isNewUI);
yield setStyle(animation, "animationIterationCount", "300", isNewUI);
yield setStyle(animation, "animationDelay", "45s", isNewUI);
yield setStyle(animation, panel, "animationDuration", "5.5s", isNewUI);
yield setStyle(animation, panel, "animationIterationCount", "300", isNewUI);
yield setStyle(animation, panel, "animationDelay", "45s", isNewUI);

if (isNewUI) {
let animationsEl = panel.animationsTimelineComponent.animationsEl;
Expand All @@ -52,7 +52,7 @@ function* testDataUpdates({panel, controller, inspector}, isNewUI=false) {
}
}

function* setStyle(animation, name, value, isNewUI=false) {
function* setStyle(animation, panel, name, value, isNewUI=false) {
info("Change the animation style via the content DOM. Setting " +
name + " to " + value);

Expand All @@ -64,6 +64,10 @@ function* setStyle(animation, name, value, isNewUI=false) {
});
yield onAnimationChanged;

// Also wait for the target node previews to be loaded if the panel got
// refreshed as a result of this animation mutation.
yield waitForAllAnimationTargets(panel);

// If this is the playerWidget-based UI, wait for the auto-refresh event too
// to make sure the UI has updated.
if (!isNewUI) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
html, body {
margin: 0;
height: 100%;
overflow: hidden;
}

div {
position: absolute;
top: 0;
left: -500px;
height: 20px;
width: 500px;
color: red;
background: linear-gradient(to left, currentColor, currentColor 2px, transparent);
}

.zero {
color: blue;
top: 20px;
}

.positive {
color: green;
top: 40px;
}

.negative.move { animation: 5s -1s move linear forwards; }
.zero.move { animation: 5s 0s move linear forwards; }
.positive.move { animation: 5s 1s move linear forwards; }

@keyframes move {
to {
transform: translateX(500px);
}
}
</style>
</head>
<body>
<div class="negative"></div>
<div class="zero"></div>
<div class="positive"></div>
<script>
var negative = document.querySelector(".negative");
var zero = document.querySelector(".zero");
var positive = document.querySelector(".positive");

// The non-delayed animation starts now.
zero.classList.add("move");
// The negative-delayed animation starts in 1 second.
setTimeout(function() {
negative.classList.add("move");
}, 1000);
// The positive-delayed animation starts in 200 ms.
setTimeout(function() {
positive.classList.add("move");
}, 200);
</script>
</body>
</html>
Loading

0 comments on commit 4259e6d

Please sign in to comment.