Bug 1275452 - Part 2: Eagerly restyle native anonymous content in stylo. r=bholley
authorCameron McCormack <cam@mcc.id.au>
Wed, 25 May 2016 16:55:49 +1000
changeset 298907 ce7e41b72c76ca3cbb248115f66ce3fad3cef664
parent 298906 a51e41ec23e20c9dfdc00a221d5025f9bea795a1
child 298908 5e15a686b21e21ccd2866ff4e08732acebc256f4
push id30285
push usercbook@mozilla.com
push dateWed, 25 May 2016 13:06:07 +0000
treeherdermozilla-central@d6d4e8417d2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1275452
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275452 - Part 2: Eagerly restyle native anonymous content in stylo. r=bholley
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -4236,16 +4236,23 @@ nsCSSFrameConstructor::GetAnonymousConte
       SetFlagsOnSubtree(content, NODE_IS_EDITABLE);
     }
     if (NS_FAILED(rv)) {
       content->UnbindFromTree();
       return rv;
     }
   }
 
+  if (ServoStyleSet* styleSet = mPresShell->StyleSet()->GetAsServo()) {
+    // Eagerly compute styles for the anonymous content tree.
+    for (auto& info : aContent) {
+      styleSet->RestyleSubtree(info.mContent);
+    }
+  }
+
   return NS_OK;
 }
 
 static
 bool IsXULDisplayType(const nsStyleDisplay* aDisplay)
 {
   return (aDisplay->mDisplay == NS_STYLE_DISPLAY_INLINE_BOX ||
 #ifdef MOZ_XUL