Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merge inbound to central, a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 62e9XDudUlc
  • Loading branch information
KWierso committed Mar 9, 2017
2 parents 2214d48 + 0c5bcaa commit 909afae
Show file tree
Hide file tree
Showing 3,424 changed files with 41,719 additions and 54,109 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions accessible/tests/mochitest/jsat/test_content_text.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@
new ExpectedEditState({
editing: true,
multiline: true,
atStart: false,
atEnd: true
atStart: true,
atEnd: false
}),
new ExpectedCursorChange(
['Please refrain from Mayoneggs during this salmonella scare.',
{string: 'textarea'}]),
new ExpectedTextSelectionChanged(59, 59)
new ExpectedTextSelectionChanged(0, 0)
],
[ContentMessages.activateCurrent(10),
new ExpectedTextCaretChanged(10, 59),
new ExpectedTextCaretChanged(0, 10),
new ExpectedEditState({ editing: true,
multiline: true,
atStart: false,
Expand Down
1 change: 1 addition & 0 deletions accessible/tests/mochitest/states/test_inputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
// (per spec, min/maxlength validity is affected by interactive edits)
var mininp = document.getElementById("minlength");
mininp.focus();
mininp.setSelectionRange(mininp.value.length, mininp.value.length);
synthesizeKey("VK_BACK_SPACE", {});
ok(!mininp.validity.valid,
"input should be invalid after interactive edits");
Expand Down
32 changes: 0 additions & 32 deletions b2g/chrome/content/devtools/adb.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,38 +89,6 @@ var AdbController = {

updateState: function() {
this.umsActive = false;
this.storages = navigator.getDeviceStorages('sdcard');
this.updateStorageState(0);
},

updateStorageState: function(storageIndex) {
if (storageIndex >= this.storages.length) {
// We've iterated through all of the storage objects, now we can
// really do updateStateInternal.
this.updateStateInternal();
return;
}
let storage = this.storages[storageIndex];
DEBUG && debug("Checking availability of storage: '" + storage.storageName + "'");

let req = storage.available();
req.onsuccess = function(e) {
DEBUG && debug("Storage: '" + storage.storageName + "' is '" + e.target.result + "'");
if (e.target.result == 'shared') {
// We've found a storage area that's being shared with the PC.
// We can stop looking now.
this.umsActive = true;
this.updateStateInternal();
return;
}
this.updateStorageState(storageIndex + 1);
}.bind(this);
req.onerror = function(e) {

Cu.reportError("AdbController: error querying storage availability for '" +
this.storages[storageIndex].storageName + "' (ignoring)\n");
this.updateStorageState(storageIndex + 1);
}.bind(this);
},

updateStateInternal: function() {
Expand Down
6 changes: 4 additions & 2 deletions devtools/client/inspector/inspector.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@
<div id="ruleview-command-toolbar">
<button id="ruleview-add-rule-button" data-localization="title=inspector.addRule.tooltip" class="devtools-button"></button>
<button id="pseudo-class-panel-toggle" data-localization="title=inspector.togglePseudo.tooltip" class="devtools-button"></button>
<button id="class-panel-toggle" data-localization="title=inspector.classPanel.toggleClass.tooltip" class="devtools-button"></button>
</div>
</div>
<div id="pseudo-class-panel" hidden="true">
<div id="pseudo-class-panel" class="ruleview-reveal-panel" hidden="true">
<label><input id="pseudo-hover-toggle" type="checkbox" value=":hover" tabindex="-1" />:hover</label>
<label><input id="pseudo-active-toggle" type="checkbox" value=":active" tabindex="-1" />:active</label>
<label><input id="pseudo-focus-toggle" type="checkbox" value=":focus" tabindex="-1" />:focus</label>
</div>
</div>
<div id="ruleview-class-panel" class="ruleview-reveal-panel" hidden="true"></div>
</div>

<div id="ruleview-container" class="ruleview">
Expand Down
73 changes: 60 additions & 13 deletions devtools/client/inspector/rules/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {PrefObserver} = require("devtools/client/shared/prefs");
const ElementStyle = require("devtools/client/inspector/rules/models/element-style");
const Rule = require("devtools/client/inspector/rules/models/rule");
const RuleEditor = require("devtools/client/inspector/rules/views/rule-editor");
const ClassListPreviewer = require("devtools/client/inspector/rules/views/class-list-previewer");
const {gDevTools} = require("devtools/client/framework/devtools");
const {getCssProperties} = require("devtools/shared/fronts/css-properties");
const {
Expand Down Expand Up @@ -120,6 +121,7 @@ function CssRuleView(inspector, document, store, pageStyle) {
this._onClearSearch = this._onClearSearch.bind(this);
this._onTogglePseudoClassPanel = this._onTogglePseudoClassPanel.bind(this);
this._onTogglePseudoClass = this._onTogglePseudoClass.bind(this);
this._onToggleClassPanel = this._onToggleClassPanel.bind(this);

let doc = this.styleDocument;
this.element = doc.getElementById("ruleview-container-focusable");
Expand All @@ -128,6 +130,8 @@ function CssRuleView(inspector, document, store, pageStyle) {
this.searchClearButton = doc.getElementById("ruleview-searchinput-clear");
this.pseudoClassPanel = doc.getElementById("pseudo-class-panel");
this.pseudoClassToggle = doc.getElementById("pseudo-class-panel-toggle");
this.classPanel = doc.getElementById("ruleview-class-panel");
this.classToggle = doc.getElementById("class-panel-toggle");
this.hoverCheckbox = doc.getElementById("pseudo-hover-toggle");
this.activeCheckbox = doc.getElementById("pseudo-active-toggle");
this.focusCheckbox = doc.getElementById("pseudo-focus-toggle");
Expand All @@ -146,8 +150,8 @@ function CssRuleView(inspector, document, store, pageStyle) {
this.searchField.addEventListener("input", this._onFilterStyles);
this.searchField.addEventListener("contextmenu", this.inspector.onTextBoxContextMenu);
this.searchClearButton.addEventListener("click", this._onClearSearch);
this.pseudoClassToggle.addEventListener("click",
this._onTogglePseudoClassPanel);
this.pseudoClassToggle.addEventListener("click", this._onTogglePseudoClassPanel);
this.classToggle.addEventListener("click", this._onToggleClassPanel);
this.hoverCheckbox.addEventListener("click", this._onTogglePseudoClass);
this.activeCheckbox.addEventListener("click", this._onTogglePseudoClass);
this.focusCheckbox.addEventListener("click", this._onTogglePseudoClass);
Expand Down Expand Up @@ -181,6 +185,8 @@ function CssRuleView(inspector, document, store, pageStyle) {

this.highlighters.addToView(this);

this.classListPreviewer = new ClassListPreviewer(this.inspector, this.classPanel);

EventEmitter.decorate(this);
}

Expand Down Expand Up @@ -673,6 +679,7 @@ CssRuleView.prototype = {

this.tooltips.destroy();
this.highlighters.removeFromView(this);
this.classListPreviewer.destroy();

// Remove bound listeners
this.shortcuts.destroy();
Expand All @@ -683,8 +690,8 @@ CssRuleView.prototype = {
this.searchField.removeEventListener("contextmenu",
this.inspector.onTextBoxContextMenu);
this.searchClearButton.removeEventListener("click", this._onClearSearch);
this.pseudoClassToggle.removeEventListener("click",
this._onTogglePseudoClassPanel);
this.pseudoClassToggle.removeEventListener("click", this._onTogglePseudoClassPanel);
this.classToggle.removeEventListener("click", this._onToggleClassPanel);
this.hoverCheckbox.removeEventListener("click", this._onTogglePseudoClass);
this.activeCheckbox.removeEventListener("click", this._onTogglePseudoClass);
this.focusCheckbox.removeEventListener("click", this._onTogglePseudoClass);
Expand All @@ -693,6 +700,8 @@ CssRuleView.prototype = {
this.searchClearButton = null;
this.pseudoClassPanel = null;
this.pseudoClassToggle = null;
this.classPanel = null;
this.classToggle = null;
this.hoverCheckbox = null;
this.activeCheckbox = null;
this.focusCheckbox = null;
Expand Down Expand Up @@ -1372,18 +1381,30 @@ CssRuleView.prototype = {
*/
_onTogglePseudoClassPanel: function () {
if (this.pseudoClassPanel.hidden) {
this.pseudoClassToggle.classList.add("checked");
this.hoverCheckbox.setAttribute("tabindex", "0");
this.activeCheckbox.setAttribute("tabindex", "0");
this.focusCheckbox.setAttribute("tabindex", "0");
this.showPseudoClassPanel();
} else {
this.pseudoClassToggle.classList.remove("checked");
this.hoverCheckbox.setAttribute("tabindex", "-1");
this.activeCheckbox.setAttribute("tabindex", "-1");
this.focusCheckbox.setAttribute("tabindex", "-1");
this.hidePseudoClassPanel();
}
},

showPseudoClassPanel: function () {
this.hideClassPanel();

this.pseudoClassToggle.classList.add("checked");
this.hoverCheckbox.setAttribute("tabindex", "0");
this.activeCheckbox.setAttribute("tabindex", "0");
this.focusCheckbox.setAttribute("tabindex", "0");

this.pseudoClassPanel.hidden = false;
},

hidePseudoClassPanel: function () {
this.pseudoClassToggle.classList.remove("checked");
this.hoverCheckbox.setAttribute("tabindex", "-1");
this.activeCheckbox.setAttribute("tabindex", "-1");
this.focusCheckbox.setAttribute("tabindex", "-1");

this.pseudoClassPanel.hidden = !this.pseudoClassPanel.hidden;
this.pseudoClassPanel.hidden = true;
},

/**
Expand All @@ -1395,6 +1416,32 @@ CssRuleView.prototype = {
this.inspector.togglePseudoClass(target.value);
},

/**
* Called when the class panel button is clicked and toggles the display of the class
* panel.
*/
_onToggleClassPanel: function () {
if (this.classPanel.hidden) {
this.showClassPanel();
} else {
this.hideClassPanel();
}
},

showClassPanel: function () {
this.hidePseudoClassPanel();

this.classToggle.classList.add("checked");
this.classPanel.hidden = false;

this.classListPreviewer.focusAddClassField();
},

hideClassPanel: function () {
this.classToggle.classList.remove("checked");
this.classPanel.hidden = true;
},

/**
* Handle the keypress event in the rule view.
*/
Expand Down
7 changes: 7 additions & 0 deletions devtools/client/inspector/rules/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ support-files =
[browser_rules_authored_color.js]
[browser_rules_authored_override.js]
[browser_rules_blob_stylesheet.js]
[browser_rules_class_panel_add.js]
[browser_rules_class_panel_content.js]
[browser_rules_class_panel_edit.js]
[browser_rules_class_panel_invalid_nodes.js]
[browser_rules_class_panel_mutation.js]
[browser_rules_class_panel_state_preserved.js]
[browser_rules_class_panel_toggle.js]
[browser_rules_colorpicker-and-image-tooltip_01.js]
[browser_rules_colorpicker-and-image-tooltip_02.js]
[browser_rules_colorpicker-appears-on-swatch-click.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* 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 classes can be added in the class panel

// This array contains the list of test cases. Each test case contains these properties:
// - {String} textEntered The text to be entered in the field
// - {Boolean} expectNoMutation Set to true if we shouldn't wait for a DOM mutation
// - {Array} expectedClasses The expected list of classes to be applied to the DOM and to
// be found in the class panel
const TEST_ARRAY = [{
textEntered: "",
expectNoMutation: true,
expectedClasses: []
}, {
textEntered: "class",
expectedClasses: ["class"]
}, {
textEntered: "class",
expectNoMutation: true,
expectedClasses: ["class"]
}, {
textEntered: "a a a a a a a a a a",
expectedClasses: ["class", "a"]
}, {
textEntered: "class2 class3",
expectedClasses: ["class", "a", "class2", "class3"]
}, {
textEntered: " ",
expectNoMutation: true,
expectedClasses: ["class", "a", "class2", "class3"]
}, {
textEntered: " class4",
expectedClasses: ["class", "a", "class2", "class3", "class4"]
}, {
textEntered: " \t class5 \t \t\t ",
expectedClasses: ["class", "a", "class2", "class3", "class4", "class5"]
}];

add_task(function* () {
yield addTab("data:text/html;charset=utf-8,");
let {testActor, inspector, view} = yield openRuleView();

info("Open the class panel");
view.showClassPanel();

const textField = inspector.panelDoc.querySelector("#ruleview-class-panel .add-class");
ok(textField, "The input field exists in the class panel");

textField.focus();

let onMutation;
for (let {textEntered, expectNoMutation, expectedClasses} of TEST_ARRAY) {
if (!expectNoMutation) {
onMutation = inspector.once("markupmutation");
}

info(`Enter the test string in the field: ${textEntered}`);
for (let key of textEntered.split("")) {
EventUtils.synthesizeKey(key, {}, view.styleWindow);
}

info("Submit the change and wait for the textfield to become empty");
let onEmpty = waitForFieldToBeEmpty(textField);
EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow);

if (!expectNoMutation) {
info("Wait for the DOM to change");
yield onMutation;
}

yield onEmpty;

info("Check the state of the DOM node");
let className = yield testActor.getAttribute("body", "class");
let expectedClassName = expectedClasses.length ? expectedClasses.join(" ") : null;
is(className, expectedClassName, "The DOM node has the right className");

info("Check the content of the class panel");
checkClassPanelContent(view, expectedClasses.map(name => {
return {name, state: true};
}));
}
});

function waitForFieldToBeEmpty(textField) {
return waitForSuccess(() => !textField.value);
}
Loading

0 comments on commit 909afae

Please sign in to comment.