Bug 1358548 - Move functionality of BidiParagraphData::Init() into a constructor instead of a separate method. r=dholbert
authorJonathan Kew <jkew@mozilla.com>
Wed, 26 Apr 2017 23:25:49 +0100
changeset 403216 dba6cd25106665ebfa440b6af8ab81c8c22126c7
parent 403215 033145d323135c10d4eb2780e18ffd7bbb17335b
child 403217 2318d492b17f539d7e9ba8b2417f6b46c3664493
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1358548
milestone55.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 1358548 - Move functionality of BidiParagraphData::Init() into a constructor instead of a separate method. r=dholbert
layout/base/nsBidiPresUtils.cpp
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -140,31 +140,30 @@ struct MOZ_STACK_CLASS BidiParagraphData
   nsBidiLevel         mParaLevel;
   nsIContent*         mPrevContent;
   nsIFrame*           mPrevFrame;
 #ifdef DEBUG
   // Only used for NOISY debug output.
   nsBlockFrame*       mCurrentBlock;
 #endif
 
-  void Init(nsBlockFrame* aBlockFrame)
-  {
-    mRequiresBidi = false;
-    mPrevContent = nullptr;
+  explicit BidiParagraphData(nsBlockFrame* aBlockFrame)
+    : mPresContext(aBlockFrame->PresContext())
+    , mIsVisual(mPresContext->IsVisualMode())
+    , mRequiresBidi(false)
+    , mParaLevel(nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->StyleContext()))
+    , mPrevContent(nullptr)
 #ifdef DEBUG
-    mCurrentBlock = aBlockFrame;
+    , mCurrentBlock(aBlockFrame)
 #endif
-
-    mParaLevel = nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->StyleContext());
+  {
     if (mParaLevel > 0) {
       mRequiresBidi = true;
     }
 
-    mPresContext = aBlockFrame->PresContext();
-    mIsVisual = mPresContext->IsVisualMode();
     if (mIsVisual) {
       /**
        * Drill up in content to detect whether this is an element that needs to
        * be rendered with logical order even on visual pages.
        *
        * We always use logical order on form controls, firstly so that text
        * entry will be in logical order, but also because visual pages were
        * written with the assumption that even if the browser had no support
@@ -698,18 +697,17 @@ CreateContinuation(nsIFrame*  aFrame,
  *  The rendering layer requires each text frame to contain text in only one
  *  direction, so we may need to call EnsureBidiContinuation() to split frames.
  *  We may also need to call RemoveBidiContinuation() to convert frames created
  *  by EnsureBidiContinuation() in previous reflows into fluid continuations.
  */
 nsresult
 nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
 {
-  BidiParagraphData bpd;
-  bpd.Init(aBlockFrame);
+  BidiParagraphData bpd(aBlockFrame);
 
   // Handle bidi-override being set on the block itself before calling
   // TraverseFrames.
   // No need to call GetBidiControl as well, because isolate and embed
   // values of unicode-bidi property are redundant on block elements.
   // unicode-bidi:plaintext on a block element is handled by block frame
   // via using nsIFrame::GetWritingMode(nsIFrame*).
   char16_t ch = GetBidiOverride(aBlockFrame->StyleContext());