Bug 1215702 patch 2 - Remove the mechanism of backend-only CSS properties. r=heycam

This is a mechanism that should not exist; any use of it means
nonconformance with http://www.w3.org/TR/CSS/#partial .
This commit is contained in:
L. David Baron 2015-10-19 22:22:34 -07:00
parent 4838d0e5be
commit f873297860
12 changed files with 35 additions and 102 deletions

View File

@ -61,13 +61,12 @@
CSS_PROP_*] gives the name of the style struct. Can be used to make
nsStyle##stylestruct_ and eStyleStruct_##stylestruct_
-. 'stylestructoffset_' [not used for CSS_PROP_BACKENDONLY] gives the
result of offsetof(nsStyle*, member). Ignored (and generally
CSS_PROP_NO_OFFSET, or -1) for properties whose animtype_ is
eStyleAnimType_None.
-. 'stylestructoffset_' gives the result of offsetof(nsStyle*,
member). Ignored (and generally CSS_PROP_NO_OFFSET, or -1) for
properties whose animtype_ is eStyleAnimType_None.
-. 'animtype_' [not used for CSS_PROP_BACKENDONLY] gives the
animation type (see nsStyleAnimType) of this property.
-. 'animtype_' gives the animation type (see nsStyleAnimType) of this
property.
CSS_PROP_SHORTHAND only takes 1-5.
@ -159,14 +158,6 @@
#define CSS_PROP_SVGRESET(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, SVGReset, stylestructoffset_, animtype_)
#define CSS_PROP_VARIABLES(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, stylestructoffset_, animtype_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, Variables, stylestructoffset_, animtype_)
// For properties that are stored in the CSS backend but are not
// computed. An includer may define this in addition to CSS_PROP, but
// otherwise we treat it as the same.
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_) CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, BackendOnly, CSS_PROP_NO_OFFSET, eStyleAnimType_None)
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
// And similarly for logical properties. An includer can define
// CSS_PROP_LOGICAL to capture all logical properties, but otherwise they
// are included in CSS_PROP (as long as CSS_PROP_LIST_INCLUDE_LOGICAL is
@ -294,10 +285,6 @@
#define DEFINED_CSS_PROP_VARIABLES
#endif
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_) /* nothing */
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#ifndef CSS_PROP_LOGICAL
#define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, group_, struct_, stylestructoffset_, animtype_) /* nothing */
#define DEFINED_CSS_PROP_LOGICAL
@ -4240,10 +4227,6 @@ CSS_PROP_FONT(
#undef CSS_PROP_SVG
#undef CSS_PROP_SVGRESET
#undef CSS_PROP_VARIABLES
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(USED_CSS_PROP) */
@ -4343,10 +4326,6 @@ CSS_PROP_FONT(
#undef CSS_PROP_VARIABLES
#undef DEFINED_CSS_PROP_VARIABLES
#endif
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(USED_CSS_PROP) */

View File

@ -2278,9 +2278,6 @@ bool nsCSSProps::GetColorName(int32_t aPropValue, nsCString &aStr)
}
const nsStyleStructID nsCSSProps::kSIDTable[eCSSProperty_COUNT_no_shorthands] = {
// Note that this uses the special BackendOnly style struct ID
// (which does need to be valid for storing in the
// nsCSSCompressedDataBlock::mStyleBits bitfield).
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
eStyleStruct_##stylestruct_,
@ -2971,9 +2968,6 @@ nsCSSProps::gPropertyCountInStruct[nsStyleStructID_Length] = {
/* static */ const size_t
nsCSSProps::gPropertyIndexInStruct[eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, pref_, \
parsevariant_, kwtable_) \
size_t(-1),
#define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, \
kwtable_, group_, stylestruct_, \
stylestructoffset_, animtype_) \
@ -2984,7 +2978,6 @@ nsCSSProps::gPropertyIndexInStruct[eCSSProperty_COUNT_no_shorthands] = {
#include "nsCSSPropList.h"
#undef CSS_PROP
#undef CSS_PROP_LOGICAL
#undef CSS_PROP_BACKENDONLY
};

View File

@ -77,8 +77,8 @@ struct nsRuleData
// include that here since it includes us.
MOZ_ASSERT(mSIDs & (1 << sid),
"calling nsRuleData::ValueFor on property not in mSIDs");
MOZ_ASSERT(sid != eStyleStruct_BackendOnly && indexInStruct != size_t(-1),
"backend-only or logical property");
MOZ_ASSERT(indexInStruct != size_t(-1),
"logical property");
return mValueStorage + mValueOffsets[sid] + indexInStruct;
}
@ -106,23 +106,18 @@ struct nsRuleData
nsStyleStructID sid = eStyleStruct_##stylestruct_; \
size_t indexInStruct = \
nsCSSProps::PropertyIndexInStruct(eCSSProperty_##id_); \
MOZ_ASSERT(sid != eStyleStruct_BackendOnly && \
indexInStruct != size_t(-1), \
"backend-only property"); \
MOZ_ASSERT(indexInStruct != size_t(-1), \
"logical property"); \
return mValueStorage + mValueOffsets[sid] + indexInStruct; \
} \
const nsCSSValue* ValueFor##method_() const { \
return const_cast<nsRuleData*>(this)->ValueFor##method_(); \
}
#define CSS_PROP_BACKENDONLY(name_, id_, method_, flags_, pref_, \
parsevariant_, kwtable_) \
/* empty; backend-only structs are not in nsRuleData */
#define CSS_PROP_LIST_EXCLUDE_LOGICAL
#include "nsCSSPropList.h"
#undef CSS_PROP_LIST_EXCLUDE_LOGICAL
#undef CSS_PROP
#undef CSS_PROP_PUBLIC_OR_PRIVATE
#undef CSS_PROP_BACKENDONLY
private:
inline size_t GetPoisonOffset();

View File

@ -54,12 +54,6 @@ nsStyleStructID_Inherited_Count =
nsStyleStructID_Reset_Count =
nsStyleStructID_Length - nsStyleStructID_Reset_Start,
// An ID used for properties that are not in style structs. This is
// used only in some users of nsStyleStructID, such as
// nsCSSProps::kSIDTable, including some that store SIDs in a bitfield,
// such as nsCSSCompressedDataBlock::mStyleBits.
eStyleStruct_BackendOnly = nsStyleStructID_Length
};
// A bit corresponding to each struct ID

View File

@ -92,10 +92,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
for (let propertyName in gCSSProperties) {
let prop = gCSSProperties[propertyName];
if (prop.backend_only) {
// These aren't interesting to us.
continue;
}
for (let iter in testValues) {
let testValue = testValues[iter];

View File

@ -28,9 +28,6 @@ var cs = getComputedStyle(content, "");
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if (info.backend_only) {
continue;
}
function test_val(v) {
content.style.setProperty(prop, v, "");
isnot(get_computed_value(cs, prop), "",

View File

@ -66,7 +66,7 @@ function round(lower_set, higher_set, roundnum) {
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if (info.backend_only || info.subproperties || info.get_computed)
if (info.subproperties || info.get_computed)
continue;
gRule1.style.setProperty(prop, info[lower_set][0], "");
gRule2.style.setProperty(prop, info[higher_set][0], "");
@ -74,7 +74,7 @@ function round(lower_set, higher_set, roundnum) {
for (var prop in gCSSProperties) {
var info = gCSSProperties[prop];
if (info.backend_only || info.subproperties || info.get_computed)
if (info.subproperties || info.get_computed)
continue;
if ("prerequisites" in info) {

View File

@ -47,8 +47,6 @@ function get_computed_value_node(node, property)
function test_property(property)
{
var info = gCSSProperties[property];
if (info.backend_only)
return;
var keywords = ["inherit"];
if (info.inherited && gTestUnset)

View File

@ -73,8 +73,6 @@ function setup_initial_values(id, ivalprop, prereqprop) {
function test_property(property)
{
var info = gCSSProperties[property];
if (info.backend_only)
return;
var keywords = ["initial"];
if (!info.inherited && gTestUnset)

View File

@ -128,16 +128,11 @@ function iframe_loaded(event)
}
start_ser.push(cur_ser);
var cur_compute;
if (!("backend_only" in info)) {
cur_compute = get_computed_value(cur_cs, current_item.prop);
if (cur_compute == "") {
isnot(cur_compute, "",
"computed value should be nonempty for " +
current_item.prop + ": " + current_item.value);
}
} else {
cur_compute = undefined;
var cur_compute = get_computed_value(cur_cs, current_item.prop);
if (cur_compute == "") {
isnot(cur_compute, "",
"computed value should be nonempty for " +
current_item.prop + ": " + current_item.value);
}
start_compute.push(cur_compute);
}
@ -164,19 +159,17 @@ function iframe_loaded(event)
"serialization should match when cloning " +
current_item.prop + ": " + current_item.value);
if (!("backend_only" in info)) {
var end_compute = get_computed_value(test_cs[idx], current_item.prop);
// Output computed values only when the test failed.
// Computed values may be very long.
if (end_compute == start_compute[idx]) {
ok(true,
"computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
} else {
is(end_compute, start_compute[idx],
"computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
}
var end_compute = get_computed_value(test_cs[idx], current_item.prop);
// Output computed values only when the test failed.
// Computed values may be very long.
if (end_compute == start_compute[idx]) {
ok(true,
"computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
} else {
is(end_compute, start_compute[idx],
"computed values should match when cloning " +
current_item.prop + ": " + current_item.value);
}
}

View File

@ -148,8 +148,6 @@ function setup_initial_values(id, ivalprop, prereqprop) {
function test_value(property, val, is_initial)
{
var info = gCSSProperties[property];
if (info.backend_only)
return;
if ("prerequisites" in info) {
var prereqs = info.prerequisites;

View File

@ -111,8 +111,6 @@ function test_property(property)
{
var info = gCSSProperties[property];
var test_computed = !("backend_only" in info);
// can all properties be removed from the style?
function test_remove_all_properties(property, value) {
var i, p = [];
@ -151,9 +149,9 @@ function test_property(property)
step1vals.push(gDeclaration.getPropertyValue(info.subproperties[idx]));
var step1comp;
var step1comps = [];
if (test_computed && info.type != CSS_TYPE_TRUE_SHORTHAND)
if (info.type != CSS_TYPE_TRUE_SHORTHAND)
step1comp = gComputedStyle.getPropertyValue(property);
if (test_computed && "subproperties" in info)
if ("subproperties" in info)
for (idx in info.subproperties)
step1comps.push(gComputedStyle.getPropertyValue(info.subproperties[idx]));
@ -191,7 +189,7 @@ function test_property(property)
is(gDeclaration.getPropertyValue(property), step1val,
"parse+serialize should be idempotent for '" +
property + ": " + value + "'");
if (test_computed && info.type != CSS_TYPE_TRUE_SHORTHAND) {
if (info.type != CSS_TYPE_TRUE_SHORTHAND) {
is(gComputedStyle.getPropertyValue(property), step1comp,
"serialize+parse should be identity transform for '" +
property + ": " + value + "'");
@ -215,18 +213,16 @@ function test_property(property)
// the computed values of other parts.
for (idx in info.subproperties) {
var subprop = info.subproperties[idx];
if (test_computed && !("backend_only" in gCSSProperties[subprop])) {
is(gComputedStyle.getPropertyValue(subprop), step1comps[idx],
"serialize(" + subprop + ")+parse should be the identity " +
"transform for '" + property + ": " + value + "'");
}
is(gComputedStyle.getPropertyValue(subprop), step1comps[idx],
"serialize(" + subprop + ")+parse should be the identity " +
"transform for '" + property + ": " + value + "'");
}
is(gDeclaration.getPropertyValue(property), step1val,
"parse+split+serialize should be idempotent for '" +
property + ": " + value + "'");
}
if (test_computed && info.type != CSS_TYPE_TRUE_SHORTHAND) {
if (info.type != CSS_TYPE_TRUE_SHORTHAND) {
gDeclaration.removeProperty(property);
gDeclaration.setProperty(property, step1comp, "");
var func = xfail_compute(property, value) ? todo_is : is;
@ -234,12 +230,10 @@ function test_property(property)
"parse+compute+serialize should be idempotent for '" +
property + ": " + value + "'");
}
if (test_computed && "subproperties" in info) {
if ("subproperties" in info) {
gDeclaration.removeProperty(property);
for (idx in info.subproperties) {
var subprop = info.subproperties[idx];
if ("backend_only" in gCSSProperties[subprop])
continue;
gDeclaration.setProperty(subprop, step1comps[idx], "");
}
@ -248,8 +242,6 @@ function test_property(property)
// the computed values of other parts.
for (idx in info.subproperties) {
var subprop = info.subproperties[idx];
if ("backend_only" in gCSSProperties[subprop])
continue;
is(gComputedStyle.getPropertyValue(subprop), step1comps[idx],
"parse+compute+serialize(" + subprop + ") should be idempotent for '" +
property + ": " + value + "'");