浏览代码

LibWeb: Make Element::recompute_style() really compare properties

It's not enough to compare StyleProperties pointers to see if something
changed, we have to do a deep compare.
Andreas Kling 3 年之前
父节点
当前提交
201afb50c7
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      Userland/Libraries/LibWeb/DOM/Element.cpp

+ 2 - 3
Userland/Libraries/LibWeb/DOM/Element.cpp

@@ -271,13 +271,12 @@ void Element::recompute_style()
 {
 {
     set_needs_style_update(false);
     set_needs_style_update(false);
     VERIFY(parent());
     VERIFY(parent());
-    auto old_specified_css_values = m_specified_css_values;
     auto new_specified_css_values = document().style_computer().compute_style(*this);
     auto new_specified_css_values = document().style_computer().compute_style(*this);
 
 
-    if (old_specified_css_values == new_specified_css_values)
+    if (m_specified_css_values && *m_specified_css_values == *new_specified_css_values)
         return;
         return;
 
 
-    m_specified_css_values = new_specified_css_values;
+    m_specified_css_values = move(new_specified_css_values);
 
 
     document().invalidate_layout();
     document().invalidate_layout();
 }
 }