88#include " core/executing_context.h"
99#include " core/html/parser/html_parser.h"
1010#include " css_property_list.h"
11+ #include " core/dom/mutation_observer_interest_group.h"
12+ #include " html_names.h"
13+ #include " element_namespace_uris.h"
1114
1215namespace webf {
1316
@@ -153,6 +156,8 @@ void InlineCssStyleDeclaration::setCssText(const std::string& css_text, webf::Ex
153156 InternalSetProperty (css_key, AtomicString (ctx (), css_value));
154157 }
155158 }
159+
160+ InlineStyleChanged ();
156161}
157162
158163void InlineCssStyleDeclaration::Trace (GCVisitor* visitor) const {
@@ -173,6 +178,18 @@ std::string InlineCssStyleDeclaration::ToString() const {
173178 return s;
174179}
175180
181+ void InlineCssStyleDeclaration::InlineStyleChanged () {
182+ assert (owner_element_->IsStyledElement ());
183+
184+ if (std::shared_ptr<MutationObserverInterestGroup> recipients =
185+ MutationObserverInterestGroup::CreateForAttributesMutation (
186+ *owner_element_, html_names::kStyleAttr )) {
187+ AtomicString old_value;
188+ recipients->EnqueueMutationRecord (MutationRecord::CreateAttributes (
189+ owner_element_, html_names::kStyleAttr , element_namespace_uris::khtml, old_value));
190+ }
191+ }
192+
176193bool InlineCssStyleDeclaration::NamedPropertyQuery (const AtomicString& key, ExceptionState&) {
177194 return cssPropertyList.count (key.ToStdString (ctx ())) > 0 ;
178195}
@@ -199,8 +216,12 @@ bool InlineCssStyleDeclaration::InternalSetProperty(std::string& name, const Ato
199216 return true ;
200217 }
201218
219+ AtomicString old_value = properties_[name];
220+
202221 properties_[name] = value;
203222
223+ InlineStyleChanged ();
224+
204225 std::unique_ptr<SharedNativeString> args_01 = stringToNativeString (name);
205226 GetExecutingContext ()->uiCommandBuffer ()->addCommand (
206227 UICommand::kSetStyle , std::move (args_01), owner_element_->bindingObject (), value.ToNativeString (ctx ()).release ());
@@ -218,6 +239,8 @@ AtomicString InlineCssStyleDeclaration::InternalRemoveProperty(std::string& name
218239 AtomicString return_value = properties_[name];
219240 properties_.erase (name);
220241
242+ InlineStyleChanged ();
243+
221244 std::unique_ptr<SharedNativeString> args_01 = stringToNativeString (name);
222245 GetExecutingContext ()->uiCommandBuffer ()->addCommand (UICommand::kSetStyle , std::move (args_01),
223246 owner_element_->bindingObject (), nullptr );
0 commit comments