Backed out changeset f1d90a17ebcc (bug 1216234) for dt6 test failures

This commit is contained in:
Carsten "Tomcat" Book 2015-11-10 14:30:39 +01:00
parent 061ea7e810
commit bb40cde64b
9 changed files with 63 additions and 111 deletions

View File

@ -13,7 +13,8 @@ const {setTimeout, clearTimeout} =
const {CssLogic} = require("devtools/shared/styleinspector/css-logic");
const {InplaceEditor, editableField, editableItem} =
require("devtools/client/shared/inplace-editor");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const {ELEMENT_STYLE, PSEUDO_ELEMENTS} =
require("devtools/server/actors/styles");
const {OutputParser} = require("devtools/shared/output-parser");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/client/styleeditor/utils");
const {
@ -4058,7 +4059,3 @@ XPCOMUtils.defineLazyGetter(this, "domUtils", function() {
loader.lazyGetter(this, "AutocompletePopup", function() {
return require("devtools/client/shared/autocomplete-popup").AutocompletePopup;
});
loader.lazyGetter(this, "PSEUDO_ELEMENTS", () => {
return domUtils.getCSSPseudoElementNames();
});

View File

@ -160,14 +160,6 @@ function* compareAppliedStylesWithUI(inspector, view, filter) {
filter: filter
});
// We may see multiple entries that map to a given rule; filter the
// duplicates here to match what the UI does.
let entryMap = new Map();
for (let entry of entries) {
entryMap.set(entry.rule, entry);
}
entries = [...entryMap.values()];
let elementStyle = view._elementStyle;
is(elementStyle.rules.length, entries.length,
"Should have correct number of rules (" + entries.length + ")");

View File

@ -12,6 +12,7 @@ const {Arg, Option, method, RetVal, types} = protocol;
const events = require("sdk/event/core");
const {Class} = require("sdk/core/heritage");
const {LongStringActor} = require("devtools/server/actors/string");
const {PSEUDO_ELEMENT_SET} = require("devtools/shared/styleinspector/css-logic");
// This will also add the "stylesheet" actor type for protocol.js to recognize
const {UPDATE_PRESERVING_RULES, UPDATE_GENERAL} =
@ -34,12 +35,24 @@ loader.lazyGetter(this, "RuleRewriter", () => {
const ELEMENT_STYLE = 100;
exports.ELEMENT_STYLE = ELEMENT_STYLE;
// Not included since these are uneditable by the user.
// See https://hg.mozilla.org/mozilla-central/file/696a4ad5d011/layout/style/nsCSSPseudoElementList.h#l74
PSEUDO_ELEMENT_SET.delete(":-moz-meter-bar");
PSEUDO_ELEMENT_SET.delete(":-moz-list-bullet");
PSEUDO_ELEMENT_SET.delete(":-moz-list-number");
PSEUDO_ELEMENT_SET.delete(":-moz-focus-inner");
PSEUDO_ELEMENT_SET.delete(":-moz-focus-outer");
PSEUDO_ELEMENT_SET.delete(":-moz-math-anonymous");
PSEUDO_ELEMENT_SET.delete(":-moz-math-stretchy");
const PSEUDO_ELEMENTS = Array.from(PSEUDO_ELEMENT_SET);
exports.PSEUDO_ELEMENTS = PSEUDO_ELEMENTS;
// When gathering rules to read for pseudo elements, we will skip
// :before and :after, which are handled as a special case.
loader.lazyGetter(this, "PSEUDO_ELEMENTS_TO_READ", () => {
return DOMUtils.getCSSPseudoElementNames().filter(pseudo => {
return pseudo !== ":before" && pseudo !== ":after";
});
const PSEUDO_ELEMENTS_TO_READ = PSEUDO_ELEMENTS.filter(pseudo => {
return pseudo !== ":before" && pseudo !== ":after";
});
const XHTML_NS = "http://www.w3.org/1999/xhtml";

View File

@ -85,7 +85,7 @@ addTest(function inheritedSystemStyles() {
ok(!applied[1].rule.parentStyleSheet.system, "Entry 1 should be a system style");
is(applied[1].rule.type, 1, "Entry 1 should be a rule style");
is(applied.length, 11, "Should have 11 rules.");
is(applied.length, 8, "Should have 8 rules.");
}).then(runNextTest));
});

View File

@ -43,6 +43,36 @@ const Services = require("Services");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { getRootBindingParent } = require("devtools/shared/layout/utils");
var pseudos = new Set([
":after",
":before",
":first-letter",
":first-line",
":selection",
":-moz-color-swatch",
":-moz-focus-inner",
":-moz-focus-outer",
":-moz-list-bullet",
":-moz-list-number",
":-moz-math-anonymous",
":-moz-math-stretchy",
":-moz-meter-bar",
":-moz-number-spin-box",
":-moz-number-spin-down",
":-moz-number-spin-up",
":-moz-number-text",
":-moz-number-wrapper",
":-moz-placeholder",
":-moz-progress-bar",
":-moz-range-progress",
":-moz-range-thumb",
":-moz-range-track",
":-moz-selection"
]);
const PSEUDO_ELEMENT_SET = pseudos;
exports.PSEUDO_ELEMENT_SET = PSEUDO_ELEMENT_SET;
// This should be ok because none of the functions that use this should be used
// on the worker thread, where Cu is not available.
if (Cu) {
@ -1648,6 +1678,18 @@ CssSelector.prototype = {
return this.cssRule.line;
},
/**
* Retrieve the pseudo-elements that we support. This list should match the
* elements specified in layout/style/nsCSSPseudoElementList.h
*/
get pseudoElements()
{
if (!CssSelector._pseudoElements) {
CssSelector._pseudoElements = PSEUDO_ELEMENT_SET;
}
return CssSelector._pseudoElements;
},
/**
* Retrieve specificity information for the current selector.
*

View File

@ -1191,29 +1191,6 @@ GetStatesForPseudoClass(const nsAString& aStatePseudo)
return sPseudoClassStates[nsCSSPseudoClasses::GetPseudoType(atom)];
}
NS_IMETHODIMP
inDOMUtils::GetCSSPseudoElementNames(uint32_t* aLength, char16_t*** aNames)
{
nsTArray<nsIAtom*> array;
for (int i = 0; i < nsCSSPseudoElements::ePseudo_PseudoElementCount; ++i) {
nsCSSPseudoElements::Type type = static_cast<nsCSSPseudoElements::Type>(i);
if (!nsCSSPseudoElements::PseudoElementIsUASheetOnly(type)) {
nsIAtom* atom = nsCSSPseudoElements::GetPseudoAtom(type);
array.AppendElement(atom);
}
}
*aLength = array.Length();
char16_t** ret =
static_cast<char16_t**>(moz_xmalloc(*aLength * sizeof(char16_t*)));
for (uint32_t i = 0; i < *aLength; ++i) {
ret[i] = ToNewUnicode(nsDependentAtomString(array[i]));
}
*aNames = ret;
return NS_OK;
}
NS_IMETHODIMP
inDOMUtils::AddPseudoClassLock(nsIDOMElement *aElement,
const nsAString &aPseudoClass)

View File

@ -17,7 +17,7 @@ interface nsIDOMFontFaceList;
interface nsIDOMRange;
interface nsIDOMCSSStyleSheet;
[scriptable, uuid(ec3dc3d5-41d1-4d08-ace5-7e944de6614d)]
[scriptable, uuid(d67c0463-592e-4d7c-b67e-923ee3f6c643)]
interface inIDOMUtils : nsISupports
{
// CSS utilities
@ -162,17 +162,6 @@ interface inIDOMUtils : nsISupports
nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
/**
* Get the names of all the supported pseudo-elements.
* Pseudo-elements which are only accepted in UA style sheets are
* not included.
*
* @param {unsigned long} aCount the number of items returned
* @param {wstring[]} aNames the names
*/
void getCSSPseudoElementNames([optional] out unsigned long aCount,
[retval, array, size_is(aCount)] out wstring aNames);
// pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class
// selector string, e.g. ":hover". ":-moz-any-link" and non-event-state
// pseudo-classes are ignored.

View File

@ -19,7 +19,6 @@ support-files =
[test_color_to_rgba.html]
[test_css_property_is_shorthand.html]
[test_css_property_is_valid.html]
[test_getCSSPseudoElementNames.html]
[test_getRelativeRuleLine.html]
[test_get_all_style_sheets.html]
[test_is_valid_css_color.html]

View File

@ -1,57 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test inDOMUtils::getCSSPseudoElementNames</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript;version=1.8">
let utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
.getService(SpecialPowers.Ci.inIDOMUtils);
let expected = new Set([
":after",
":before",
":first-letter",
":first-line",
":-moz-color-swatch",
":-moz-focus-inner",
":-moz-focus-outer",
":-moz-list-bullet",
":-moz-list-number",
":-moz-math-anonymous",
":-moz-meter-bar",
":-moz-placeholder",
":-moz-progress-bar",
":-moz-range-progress",
":-moz-range-thumb",
":-moz-range-track",
":-moz-selection",
]);
let names = utils.getCSSPseudoElementNames();
for (let name of names) {
ok(expected.has(name), name + " is included");
expected.delete(name);
}
if (expected.size > 0) {
todo_is(expected.size, 0,
"ideally all pseudo-element names would be listed in this test");
for (let extra of expected) {
info("extra element: " + extra);
}
}
</script>
</head>
<body>
<h1>Test inDOMUtils::getCSSPseudoElementNames</h1>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>