diff --git a/modules/libpref/init/StaticPrefList.h b/modules/libpref/init/StaticPrefList.h index 876eaffbb3ba..66ef938a5ad6 100644 --- a/modules/libpref/init/StaticPrefList.h +++ b/modules/libpref/init/StaticPrefList.h @@ -333,24 +333,6 @@ VARCACHE_PREF( ) #undef PREF_VALUE -// When the pref is true, CSSStyleDeclaration.setProperty always appends -// new declarations (and discards old ones if they exist), otherwise, it -// will update in-place when given property exists in the block, and -// avoid updating at all when the existing property declaration is -// identical to the new one. -// See bug 1415330, bug 1460295, and bug 1461285 for some background. -#ifdef RELEASE_OR_BETA -# define PREF_VALUE false -#else -# define PREF_VALUE true -#endif -VARCACHE_PREF( - "layout.css.property-append-only", - layout_css_property_append_only, - bool, PREF_VALUE -) -#undef PREF_VALUE - // Should the :visited selector ever match (otherwise :link matches instead)? VARCACHE_PREF( "layout.css.visited_links_enabled", diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 3933e17dbf27..c78532d7b50e 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -3584,31 +3584,18 @@ fn set_property( } let importance = if is_important { Importance::Important } else { Importance::Normal }; - let append_only = unsafe { - structs::StaticPrefs_sVarCache_layout_css_property_append_only - }; - let mode = if append_only { - DeclarationPushMode::Append - } else { - let will_change = read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { - decls.will_change_in_update_mode(&source_declarations, importance) - }); - if !will_change { - return false; - } - DeclarationPushMode::Update - }; + let mut updates = Default::default(); + let will_change = read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { + decls.prepare_for_update(&source_declarations, importance, &mut updates) + }); + if !will_change { + return false; + } before_change_closure.invoke(); - - let result = write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| { - decls.extend( - source_declarations.drain(), - importance, - mode, - ) + write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| { + decls.update(source_declarations.drain(), importance, &mut updates) }); - debug_assert!(result); true } diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 845aa0ba1f12..4d2b58f8c6aa 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -327173,9 +327173,15 @@ {} ] ], - "css/cssom/cssstyledeclaration-setter-order.html": [ + "css/cssom/cssstyledeclaration-setter-declarations.html": [ [ - "/css/cssom/cssstyledeclaration-setter-order.html", + "/css/cssom/cssstyledeclaration-setter-declarations.html", + {} + ] + ], + "css/cssom/cssstyledeclaration-setter-logical.html": [ + [ + "/css/cssom/cssstyledeclaration-setter-logical.html", {} ] ], @@ -553875,7 +553881,7 @@ "testharness" ], "css/cssom/cssstyledeclaration-mutationrecord-001.html": [ - "5d455757e4c80b4781ea4263fa78bced1d6b8632", + "0ed8cb2c41f371fdb509731f2ad1cf11e047d46f", "testharness" ], "css/cssom/cssstyledeclaration-mutationrecord-002.html": [ @@ -553890,8 +553896,12 @@ "958b71b8f1c58a809590459e6f085f3e1217e9c7", "testharness" ], - "css/cssom/cssstyledeclaration-setter-order.html": [ - "3e0e768c466011bb3d91b3f0eff55e029a2aec0f", + "css/cssom/cssstyledeclaration-setter-declarations.html": [ + "e530f6b573bfb9774dd732f7289156117fc4bd94", + "testharness" + ], + "css/cssom/cssstyledeclaration-setter-logical.html": [ + "c454a34b964e2aa05790831cc2de20e169162dd5", "testharness" ], "css/cssom/escape.html": [ diff --git a/testing/web-platform/meta/css/cssom/cssstyledeclaration-mutationrecord-001.html.ini b/testing/web-platform/meta/css/cssom/cssstyledeclaration-mutationrecord-001.html.ini deleted file mode 100644 index 524316b29aad..000000000000 --- a/testing/web-platform/meta/css/cssom/cssstyledeclaration-mutationrecord-001.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[cssstyledeclaration-mutationrecord-001.html] - prefs: [layout.css.property-append-only:true] diff --git a/testing/web-platform/meta/css/cssom/cssstyledeclaration-setter-order.html.ini b/testing/web-platform/meta/css/cssom/cssstyledeclaration-setter-order.html.ini deleted file mode 100644 index 1ab043bcb4f4..000000000000 --- a/testing/web-platform/meta/css/cssom/cssstyledeclaration-setter-order.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[cssstyledeclaration-setter-order.html] - prefs: [layout.css.property-append-only:true] diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-mutationrecord-001.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-mutationrecord-001.html index 5bd8456ed703..ba4d926b15ce 100644 --- a/testing/web-platform/tests/css/cssom/cssstyledeclaration-mutationrecord-001.html +++ b/testing/web-platform/tests/css/cssom/cssstyledeclaration-mutationrecord-001.html @@ -1,6 +1,6 @@ -CSSOM: CSSStyleDeclaration.setPropertyValue queues a mutation record when not actually mutated +CSSOM: CSSStyleDeclaration.setPropertyValue queues a mutation record when changed @@ -9,12 +9,12 @@ diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-declarations.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-declarations.html new file mode 100644 index 000000000000..e66466e7a11b --- /dev/null +++ b/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-declarations.html @@ -0,0 +1,160 @@ + +CSSOM test: declaration block after setting via CSSOM + + + +
+ diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-logical.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-logical.html new file mode 100644 index 000000000000..13d68e9a7022 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-logical.html @@ -0,0 +1,73 @@ + +CSSOM test: declaration block after setting via CSSOM + + + +
+
+ diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-order.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-order.html deleted file mode 100644 index 702b38fef061..000000000000 --- a/testing/web-platform/tests/css/cssom/cssstyledeclaration-setter-order.html +++ /dev/null @@ -1,108 +0,0 @@ - -CSSOM test: order of declarations after setting via CSSOM - - - -
-