From 4825f0f20194c8ebe1b6ef171e846927beb60772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 26 Oct 2019 11:37:33 +0000 Subject: [PATCH] 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 --- .../browser_styleinspector_output-parser.js | 9 ----- .../server/actors/animation-type-longhand.js | 1 - .../shared/css/generated/properties-db.js | 5 --- dom/base/nsTreeSanitizer.cpp | 40 +------------------ layout/style/ServoStyleSet.cpp | 4 -- layout/style/crashtests/1517319.html | 3 -- layout/style/crashtests/crashtests.list | 1 - layout/style/nsStyleStruct.cpp | 10 ++--- layout/style/nsStyleStruct.h | 1 - layout/style/test/property_database.js | 8 ---- .../style/test/test_initial_computation.html | 8 ---- .../test/test_transitions_per_property.html | 2 - layout/style/test/test_value_cloning.html | 6 --- layout/style/test/test_value_computation.html | 8 ---- modules/libpref/init/StaticPrefList.yaml | 6 --- .../components/style/properties/gecko.mako.rs | 5 --- .../style/properties/longhands/box.mako.rs | 12 ------ .../style/properties/properties.mako.rs | 4 -- servo/components/style/traversal.rs | 18 +-------- testing/profiles/common/user.js | 1 - toolkit/content/xul.css | 8 ---- 21 files changed, 7 insertions(+), 153 deletions(-) delete mode 100644 layout/style/crashtests/1517319.html diff --git a/devtools/client/inspector/shared/test/browser_styleinspector_output-parser.js b/devtools/client/inspector/shared/test/browser_styleinspector_output-parser.js index d99dc80f9fbb..cd2d3a4ec81d 100644 --- a/devtools/client/inspector/shared/test/browser_styleinspector_output-parser.js +++ b/devtools/client/inspector/shared/test/browser_styleinspector_output-parser.js @@ -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: diff --git a/devtools/server/actors/animation-type-longhand.js b/devtools/server/actors/animation-type-longhand.js index ed95e4af2185..2a09f21e67db 100644 --- a/devtools/server/actors/animation-type-longhand.js +++ b/devtools/server/actors/animation-type-longhand.js @@ -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", diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index 67da3350ba98..3f79dd103cba 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -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" diff --git a/dom/base/nsTreeSanitizer.cpp b/dom/base/nsTreeSanitizer.cpp index 3b307a3f2328..bbe675837867 100644 --- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -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(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 urlExtra(aElement->GetURLDataForStyleAttr()); - RefPtr 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) { diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 060150605057..1fd6a3527fb2 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -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" diff --git a/layout/style/crashtests/1517319.html b/layout/style/crashtests/1517319.html deleted file mode 100644 index 09437d8779b6..000000000000 --- a/layout/style/crashtests/1517319.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index 73af9729e10c..04a68ea03bce 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -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 diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 5da5579f28a5..ecab1ba0873c 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2648,8 +2648,7 @@ bool StyleAnimation::operator==(const StyleAnimation& aOther) const { // nsStyleDisplay // nsStyleDisplay::nsStyleDisplay(const Document& aDocument) - : mBinding(StyleUrlOrNone::None()), - mTransitions( + : mTransitions( nsStyleAutoArray::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 || diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 09b6220ac41a..548376f34fc9 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1470,7 +1470,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { nsChangeHint CalcDifference(const nsStyleDisplay& aNewData, const nsStylePosition& aOldPosition) const; - mozilla::StyleUrlOrNone mBinding; nsStyleAutoArray mTransitions; // The number of elements in mTransitions that are not from repeating // a list due to another property being longer. diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 4d53936801ae..0d364831e32c 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -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, diff --git a/layout/style/test/test_initial_computation.html b/layout/style/test/test_initial_computation.html index 167ee561ea09..c8a36af22763 100644 --- a/layout/style/test/test_initial_computation.html +++ b/layout/style/test/test_initial_computation.html @@ -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"); }); } diff --git a/layout/style/test/test_transitions_per_property.html b/layout/style/test/test_transitions_per_property.html index b30dbad584df..c1aede6c96ea 100644 --- a/layout/style/test/test_transitions_per_property.html +++ b/layout/style/test/test_transitions_per_property.html @@ -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) { diff --git a/layout/style/test/test_value_cloning.html b/layout/style/test/test_value_cloning.html index 8e5d76016f10..b35c4e74eb64 100644 --- a/layout/style/test/test_value_cloning.html +++ b/layout/style/test/test_value_cloning.html @@ -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"); diff --git a/layout/style/test/test_value_computation.html b/layout/style/test/test_value_computation.html index a615daac7c73..a6e253bcc3f1 100644 --- a/layout/style/test/test_value_computation.html +++ b/layout/style/test/test_value_computation.html @@ -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) { diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index c84869b48c88..d9306b0c1191 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -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 diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs index 97321fcbd381..7783c7eebd3a 100644 --- a/servo/components/style/properties/gecko.mako.rs +++ b/servo/components/style/properties/gecko.mako.rs @@ -276,11 +276,6 @@ impl ComputedValuesInner { pub fn get_raw_visited_style(&self) -> &Option> { &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)"> diff --git a/servo/components/style/properties/longhands/box.mako.rs b/servo/components/style/properties/longhands/box.mako.rs index 852b5eee427c..22c779a52caa 100644 --- a/servo/components/style/properties/longhands/box.mako.rs +++ b/servo/components/style/properties/longhands/box.mako.rs @@ -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", diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index a7af2844caef..424a9cf17c4e 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -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` diff --git a/servo/components/style/traversal.rs b/servo/components/style/traversal.rs index 69d0e4631506..d88c25004ff2 100644 --- a/servo/components/style/traversal.rs +++ b/servo/components/style/traversal.rs @@ -260,7 +260,6 @@ pub trait DomTraversal: Sync { context: &mut StyleContext, 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: 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( 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 { diff --git a/testing/profiles/common/user.js b/testing/profiles/common/user.js index e954b74d07a6..9907fe23e440 100644 --- a/testing/profiles/common/user.js +++ b/testing/profiles/common/user.js @@ -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 diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index a685176509d4..071366237e8a 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -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