gecko-dev/layout
Olli Pettay abf54817b9 Bug 1428246 - The attributeChangedCallback is fired twice for the *first* style attribute change, r=peterv
The idea with this patch is that style code will first call
InlineStyleDeclarationWillChange before style declaration has changed, and SetInlineStyleDeclaration once it has changed.

In order to be able to report old attribute value, InlineStyleDeclarationWillChange reads the value and also calls AttributeWillChange (so that DOMMutationObserser can grab the old value). Later SetInlineStyleDeclaration passes the old value to
SetAttrAndNotify so that mutation events and attributeChanged callbacks are handled correctly.

Because of performance, declaration can't be cloned for reading the old value. And that is why the recently-added callback is used to detect when declaration is about to change (bug 1466963 and followup bug 1468665).

To keep the expected existing behavior, even if declaration isn't changed, but just a new declaration was created (since there wasn't any), we need to still run all these
willchange/set calls. That is when the code has 'if (created)' checks.

Since there are several declaration implementation and only nsDOMCSSAttributeDeclaration needs the about-to-change callback, GetPropertyChangeClosure is the one to initialize the callback closure, and the struct which is then passes as data to the closure.

Apparently we lost mutation event testing on style attribute when the pref was added, so test_style_attr_listener.html is modified to test both pref values.

--HG--
extra : rebase_source : 9e605d43f22e650ac3912fbfb41abb8d5a2a0c8f
2018-06-26 12:54:00 +03:00
..
base Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-26 12:24:32 +03:00
build Bug 1268889 - Implement Clear-Site-Data header - part 1, r=mayhemer 2018-06-20 11:57:49 -04:00
doc Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt on a CLOSED TREE 2018-03-22 20:06:24 +01:00
forms Bug 1468663 part 1: Fill in missing mozilla:: namespaces in layout headers that are referenced by files in layout/generic. r=emilio 2018-06-15 16:14:29 +00:00
generic Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-26 12:24:32 +03:00
inspector Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj 2018-06-17 22:43:11 -07:00
ipc Bug 1467867 - Ensure we populate the event regions overrides properly. r=botond 2018-06-08 21:16:43 +00:00
mathml Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj 2018-06-17 22:43:11 -07:00
media
painting Bug 1469472 - Add crashtest. 2018-06-22 12:20:37 -04:00
printing Bug 1468133: Remove the optimization to lazily load non-SVG styles since it's not relevant anymore. r=heycam 2018-06-22 03:42:46 +02:00
reftests Merge inbound to mozilla-central. a=merge 2018-06-25 22:02:08 +03:00
style Bug 1428246 - The attributeChangedCallback is fired twice for the *first* style attribute change, r=peterv 2018-06-26 12:54:00 +03:00
svg Merge inbound to mozilla-central. a=merge 2018-06-25 22:02:08 +03:00
tables Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj 2018-06-17 22:43:11 -07:00
tools Bug 1468677 - [reftest] remove dummy reftest.manifests entry used for global filter, r=ahal 2018-06-13 21:28:26 -07:00
xul Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-06-26 12:24:32 +03:00
moz.build