Bug 1591297 - Remove -moz-binding, nsStyleDisplay::mBinding and similar. r=hiro

Differential Revision: https://phabricator.services.mozilla.com/D50556

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-26 11:37:33 +00:00
parent 576949a095
commit 4825f0f201
21 changed files with 7 additions and 153 deletions

View File

@ -138,15 +138,6 @@ const TEST_DATA = [
is(fragment.textContent, 'url("images/arrow.gif")!important');
},
},
{
name: "-moz-binding",
value: "url(http://somesite.com/path/to/binding.xml#someid)",
test: fragment => {
is(countAll(fragment), 1);
is(countUrls(fragment), 1);
is(getUrl(fragment), "http://somesite.com/path/to/binding.xml#someid");
},
},
{
name: "background",
value:

View File

@ -182,7 +182,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"animation-name",
"animation-play-state",
"animation-timing-function",
"-moz-binding",
"block-size",
"border-block-end-color",
"border-block-end-style",

View File

@ -3119,7 +3119,6 @@ exports.CSS_PROPERTIES = {
"transform-origin",
"contain",
"-moz-appearance",
"-moz-binding",
"-moz-orient",
"will-change",
"shape-image-threshold",
@ -11003,10 +11002,6 @@ exports.PREFERENCES = [
"text-underline-offset",
"layout.css.text-underline-offset.enabled"
],
[
"-moz-binding",
"layout.css.moz-binding.content.enabled"
],
[
"offset-distance",
"layout.css.motion-path.enabled"

View File

@ -1062,10 +1062,6 @@ bool nsTreeSanitizer::MustPrune(int32_t aNamespace, nsAtom* aLocal,
return false;
}
bool nsTreeSanitizer::SanitizeStyleDeclaration(DeclarationBlock* aDeclaration) {
return aDeclaration->RemovePropertyByID(eCSSProperty__moz_binding);
}
bool nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
nsAString& aSanitized,
Document* aDocument,
@ -1111,27 +1107,15 @@ bool nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
didSanitize = true;
// Ignore these rule types.
break;
case CSSRule_Binding::STYLE_RULE:
case CSSRule_Binding::NAMESPACE_RULE:
case CSSRule_Binding::FONT_FACE_RULE: {
// Append @namespace and @font-face rules verbatim.
// Append style, @namespace and @font-face rules verbatim.
nsAutoString cssText;
rule->GetCssText(cssText);
aSanitized.Append(cssText);
break;
}
case CSSRule_Binding::STYLE_RULE: {
// For style rules, we will just look for and remove the
// -moz-binding properties.
auto styleRule = static_cast<BindingStyleRule*>(rule);
DeclarationBlock* styleDecl = styleRule->GetDeclarationBlock();
MOZ_ASSERT(styleDecl);
if (SanitizeStyleDeclaration(styleDecl)) {
didSanitize = true;
}
nsAutoString decl;
styleRule->GetCssText(decl);
aSanitized.Append(decl);
}
}
}
if (didSanitize && mLogRemovals) {
@ -1169,26 +1153,6 @@ void nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
if (kNameSpaceID_None == attrNs) {
if (aAllowed.mStyle && nsGkAtoms::style == attrLocal) {
nsAutoString value;
aElement->GetAttr(attrNs, attrLocal, value);
Document* document = aElement->OwnerDoc();
RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
RefPtr<DeclarationBlock> decl = DeclarationBlock::FromCssText(
value, urlExtra, document->GetCompatibilityMode(),
document->CSSLoader());
if (decl) {
if (SanitizeStyleDeclaration(decl)) {
nsAutoString cleanValue;
decl->ToString(cleanValue);
aElement->SetAttr(kNameSpaceID_None, nsGkAtoms::style, cleanValue,
false);
if (mLogRemovals) {
LogMessage(
"Removed -moz-binding styling from element style attribute.",
aElement->OwnerDoc(), aElement);
}
}
}
continue;
}
if (aAllowed.mDangerousSrc && nsGkAtoms::src == attrLocal) {

View File

@ -36,10 +36,6 @@
#include "nsMediaFeatures.h"
#include "nsPrintfCString.h"
#include "gfxUserFontSet.h"
#ifdef MOZ_XBL
# include "nsXBLPrototypeBinding.h"
# include "nsBindingManager.h"
#endif
#include "nsWindowSizes.h"
#include "GeckoProfiler.h"

View File

@ -1,3 +0,0 @@
<frameset>
<frameset onload="document.getElementById('y').appendChild(document.createElement('span'))" style="-moz-binding: url(#x)">
<frame id="y">

View File

@ -298,7 +298,6 @@ load 1490012.html
load 1502893.html
load 1509989.html
load 1514086.html
pref(layout.css.moz-binding.content.enabled,false) skip-if(!xbl) load 1517319.html
load 1533783.html
load 1533891.html
pref(gfx.omta.background-color,true) load 1533968.html

View File

@ -2648,8 +2648,7 @@ bool StyleAnimation::operator==(const StyleAnimation& aOther) const {
// nsStyleDisplay
//
nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
: mBinding(StyleUrlOrNone::None()),
mTransitions(
: mTransitions(
nsStyleAutoArray<StyleTransition>::WITH_SINGLE_INITIAL_ELEMENT),
mTransitionTimingFunctionCount(1),
mTransitionDurationCount(1),
@ -2717,8 +2716,7 @@ nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
}
nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
: mBinding(aSource.mBinding),
mTransitions(aSource.mTransitions),
: mTransitions(aSource.mTransitions),
mTransitionTimingFunctionCount(aSource.mTransitionTimingFunctionCount),
mTransitionDurationCount(aSource.mTransitionDurationCount),
mTransitionDelayCount(aSource.mTransitionDelayCount),
@ -2848,8 +2846,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(
const nsStyleDisplay& aNewData, const nsStylePosition& aOldPosition) const {
nsChangeHint hint = nsChangeHint(0);
if (mBinding != aNewData.mBinding || mPosition != aNewData.mPosition ||
mDisplay != aNewData.mDisplay || mContain != aNewData.mContain ||
if (mPosition != aNewData.mPosition || mDisplay != aNewData.mDisplay ||
mContain != aNewData.mContain ||
(mFloat == StyleFloat::None) != (aNewData.mFloat == StyleFloat::None) ||
mScrollBehavior != aNewData.mScrollBehavior ||
mScrollSnapType != aNewData.mScrollSnapType ||

View File

@ -1470,7 +1470,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
nsChangeHint CalcDifference(const nsStyleDisplay& aNewData,
const nsStylePosition& aOldPosition) const;
mozilla::StyleUrlOrNone mBinding;
nsStyleAutoArray<mozilla::StyleTransition> mTransitions;
// The number of elements in mTransitions that are not from repeating
// a list due to another property being longer.

View File

@ -1478,14 +1478,6 @@ var gCSSProperties = {
other_values: ["radio", "menulist"],
invalid_values: [],
},
"-moz-binding": {
domProp: "MozBinding",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: ["none"],
other_values: ["url(foo.xml)"],
invalid_values: [],
},
"border-inline": {
domProp: "borderInline",
inherited: false,

View File

@ -140,14 +140,6 @@ function test_property(property)
gElementN.parentNode.style.removeProperty(property);
gElementF.parentNode.style.removeProperty(property);
}
// FIXME -moz-binding value makes gElementF and its parent loses
// their frame. Force it to get recreated after each property.
// See bug 1331903.
gDisplayTree.style.display = "none";
get_computed_value(getComputedStyle(gElementF, ""), "width");
gDisplayTree.style.display = "";
get_computed_value(getComputedStyle(gElementF, ""), "width");
});
}

View File

@ -1210,8 +1210,6 @@ for (prop in gCSSProperties) {
info.type != CSS_TYPE_LEGACY_SHORTHAND &&
!("alias_for" in info) &&
!prop.match(/^transition-/) &&
// FIXME (Bug 119078): THIS SHOULD REALLY NOT BE NEEDED!
prop != "-moz-binding" &&
prop != "mask") {
if ("prerequisites" in info) {

View File

@ -18,12 +18,6 @@ const { AppConstants } = SpecialPowers.Cu.import(
{}
);
if (!AppConstants.MOZ_XBL) {
// This property still exists when XBL is disabled, but we don't want to
// test it, since it will crash. Will be removed in bug 1566221.
delete gCSSProperties["-moz-binding"]
}
/** Test for cloning of CSS property values (including 'inherit', 'initial' and 'unset') **/
var test_queue = [];
var iframe = document.getElementById("iframe");

View File

@ -196,14 +196,6 @@ function test_value(property, val, is_initial)
gElementN.parentNode.style.removeProperty(property);
gElementF.parentNode.style.removeProperty(property);
}
// FIXME -moz-binding value makes gElementF and its parent loses
// their frame. Force it to get recreated after each property.
// See bug 1331903.
gDisplayTree.style.display = "none";
get_computed_value(getComputedStyle(gElementF, ""), "width");
gDisplayTree.style.display = "";
get_computed_value(getComputedStyle(gElementF, ""), "width");
}
function test_property(prop) {

View File

@ -4832,12 +4832,6 @@
value: @IS_NOT_RELEASE_OR_BETA@
mirror: always
# Is support for -moz-binding enabled?
- name: layout.css.moz-binding.content.enabled
type: bool
value: false
mirror: always
# Expose the media query -moz-touch-enabled to web content.
- name: layout.css.moz-touch-enabled.enabled
type: RelaxedAtomicBool

View File

@ -276,11 +276,6 @@ impl ComputedValuesInner {
pub fn get_raw_visited_style(&self) -> &Option<RawOffsetArc<ComputedValues>> {
&self.visited_style
}
#[allow(non_snake_case)]
pub fn has_moz_binding(&self) -> bool {
!self.get_box().gecko.mBinding.is_none()
}
}
<%def name="declare_style_struct(style_struct)">

View File

@ -631,18 +631,6 @@ ${helpers.predefined_type(
gecko_ffi_name="mAppearance",
)}
${helpers.predefined_type(
"-moz-binding",
"url::UrlOrNone",
"computed::url::UrlOrNone::none()",
engines="gecko",
animation_value_type="none",
gecko_ffi_name="mBinding",
gecko_pref="layout.css.moz-binding.content.enabled",
enabled_in="chrome",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding)",
)}
${helpers.single_keyword(
"-moz-orient",
"inline block horizontal vertical",

View File

@ -3074,10 +3074,6 @@ impl ComputedValuesInner {
self.rules.as_ref().unwrap()
}
/// Whether this style has a -moz-binding value. This is always false for
/// Servo for obvious reasons.
pub fn has_moz_binding(&self) -> bool { false }
#[inline]
/// Returns whether the "content" property for the given style is completely
/// ineffective, and would yield an empty `::before` or `::after`

View File

@ -260,7 +260,6 @@ pub trait DomTraversal<E: TElement>: Sync {
context: &mut StyleContext<E>,
parent: E,
parent_data: &ElementData,
is_initial_style: bool,
) -> bool {
debug_assert!(
parent.has_current_styles_for_traversal(parent_data, context.shared.traversal_flags)
@ -272,21 +271,6 @@ pub trait DomTraversal<E: TElement>: Sync {
return true;
}
// Gecko-only XBL handling.
//
// When we apply the XBL binding during frame construction, we restyle
// the whole subtree again if the binding is valid, so assuming it's
// likely to load valid bindings, we avoid wasted work here, which may
// be a very big perf hit when elements with bindings are nested
// heavily.
if cfg!(feature = "gecko") &&
is_initial_style &&
parent_data.styles.primary().has_moz_binding()
{
debug!("Parent {:?} has XBL binding, deferring traversal", parent);
return true;
}
return false;
}
@ -514,7 +498,7 @@ pub fn recalc_style_at<E, D, F>(
is_servo_nonincremental_layout();
traverse_children = traverse_children &&
!traversal.should_cull_subtree(context, element, &data, is_initial_style);
!traversal.should_cull_subtree(context, element, &data);
// Examine our children, and enqueue the appropriate ones for traversal.
if traverse_children {

View File

@ -65,4 +65,3 @@ user_pref("media.allowed-to-play.enabled", true);
// Ensure media can always play without delay
user_pref("media.block-autoplay-until-in-foreground", false);
user_pref("toolkit.telemetry.coverage.endpoint.base", "http://localhost");
user_pref("layout.css.moz-binding.content.enabled", true); // Le sad

View File

@ -457,10 +457,6 @@ search-textbox {
/* SeaMonkey uses its own autocomplete and the toolkit's autocomplete widget */
%ifndef MOZ_SUITE
panel[type="autocomplete-richlistbox"] {
-moz-binding: none;
}
.autocomplete-richlistbox {
-moz-user-focus: ignore;
overflow-x: hidden !important;
@ -625,7 +621,3 @@ tabmodalprompt {
[ordinal="9"] { -moz-box-ordinal-group: 9; }
[ordinal="1000"] { -moz-box-ordinal-group: 1000; }
}
%ifndef MOZ_XBL
* { -moz-binding: none !important }
%endif