Bug 1289701 - Add a note about the possibility of reentrant call of nsStyleSet::GetContext(). r=dbaron
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Thu, 15 Dec 2016 06:49:02 +0900
changeset 325898 756b4447cae3fa1877d1252526384988d9e570f2
parent 325897 65d60084b5ebe1bafe686a883d76b87759e9db93
child 325899 0e00689493b6e712340f902ccd5480b99815ccf9
push id84827
push userhiikezoe@mozilla-japan.org
push dateWed, 14 Dec 2016 21:49:35 +0000
treeherdermozilla-inbound@756b4447cae3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1289701
milestone53.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 1289701 - Add a note about the possibility of reentrant call of nsStyleSet::GetContext(). r=dbaron MozReview-Commit-ID: DQVQMERvTkk
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -549,16 +549,19 @@ static nscoord CalcLengthWith(const nsCS
         // nsRuleNode::SetFont makes the same assumption!), so we should
         // use StyleFont on this context to get the root element's
         // font size.
         rootFontSize = styleFont->mFont.size;
       } else {
         // This is not the root element or we are calculating something other
         // than font size, so rem is relative to the root element's font size.
         // Find the root style context by walking up the style context tree.
+        // NOTE: We should not call ResolveStyleFor() against the root element
+        // to obtain the root style here because it may lead to reentrant call
+        // of nsStyleSet::GetContext().
         nsStyleContext* rootStyle = aStyleContext;
         while (rootStyle->GetParent()) {
           rootStyle = rootStyle->GetParent();
         }
         const nsStyleFont *rootStyleFont = rootStyle->StyleFont();
         rootFontSize = rootStyleFont->mFont.size;
       }