Bug 1268342 part 2 - Store writing mode of frame in PerFrameData. r=jfkthame
authorXidorn Quan <me@upsuper.org>
Mon, 30 May 2016 09:24:18 +1000
changeset 338464 77af17d7575646053e3ffad7c2f8c19e675e866e
parent 338463 d36ad40cf9910c695a20eff674aa18dc89d3b269
child 338465 7beb1565767200b49de2450912af5624ab7f4725
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1268342
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 1268342 part 2 - Store writing mode of frame in PerFrameData. r=jfkthame MozReview-Commit-ID: 66ZWj3EdCdh
layout/generic/nsLineLayout.cpp
layout/generic/nsLineLayout.h
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -241,17 +241,17 @@ nsLineLayout::BeginLineReflow(nscoord aI
   if (frame->GetType() == nsGkAtoms::rubyTextContainerFrame) {
     // Ruby text container won't be reflowed via ReflowFrame, hence the
     // relative positioning information should be recorded here.
     MOZ_ASSERT(mBaseLineLayout != this);
     pfd->mRelativePos =
       mBlockReflowState->mStyleDisplay->IsRelativelyPositionedStyle();
     if (pfd->mRelativePos) {
       MOZ_ASSERT(
-        mBlockReflowState->GetWritingMode() == frame->GetWritingMode(),
+        mBlockReflowState->GetWritingMode() == pfd->mWritingMode,
         "mBlockReflowState->frame == frame, "
         "hence they should have identical writing mode");
       pfd->mOffsets = mBlockReflowState->ComputedLogicalOffsets();
     }
   }
 }
 
 void
@@ -680,23 +680,23 @@ nsLineLayout::NewPerFrameData(nsIFrame* 
   pfd->mIsNonWhitespaceTextFrame = false;
   pfd->mIsLetterFrame = false;
   pfd->mRecomputeOverflow = false;
   pfd->mIsBullet = false;
   pfd->mSkipWhenTrimmingWhitespace = false;
   pfd->mIsEmpty = false;
   pfd->mIsLinkedToBase = false;
 
-  WritingMode frameWM = aFrame->GetWritingMode();
+  pfd->mWritingMode = aFrame->GetWritingMode();
   WritingMode lineWM = mRootSpan->mWritingMode;
   pfd->mBounds = LogicalRect(lineWM);
   pfd->mOverflowAreas.Clear();
   pfd->mMargin = LogicalMargin(lineWM);
   pfd->mBorderPadding = LogicalMargin(lineWM);
-  pfd->mOffsets = LogicalMargin(frameWM);
+  pfd->mOffsets = LogicalMargin(pfd->mWritingMode);
 
   pfd->mJustificationInfo = JustificationInfo();
   pfd->mJustificationAssignment = JustificationAssignment();
 
 #ifdef DEBUG
   pfd->mBlockDirAlign = 0xFF;
   outerLineLayout->mFramesAllocated++;
 #endif
@@ -831,17 +831,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
     NS_ASSERTION(!hasLineOffset, "LineBaselineOffset was set but was not expected");
 #endif
   }
 
   mJustificationInfo = JustificationInfo();
 
   // Stash copies of some of the computed state away for later
   // (block-direction alignment, for example)
-  WritingMode frameWM = aFrame->GetWritingMode();
+  WritingMode frameWM = pfd->mWritingMode;
   WritingMode lineWM = mRootSpan->mWritingMode;
 
   // NOTE: While the inline direction coordinate remains relative to the
   // parent span, the block direction coordinate is fixed at the top
   // edge for the line. During VerticalAlignFrames we will repair this
   // so that the block direction coordinate is properly set and relative
   // to the appropriate span.
   pfd->mBounds.IStart(lineWM) = psd->mICoord;
@@ -1432,17 +1432,17 @@ nsLineLayout::CanPlaceFrame(PerFrameData
 void
 nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics)
 {
   WritingMode lineWM = mRootSpan->mWritingMode;
 
   // If the frame's block direction does not match the line's, we can't use
   // its ascent; instead, treat it as a block with baseline at the block-end
   // edge (or block-begin in the case of an "inverted" line).
-  if (pfd->mFrame->GetWritingMode().GetBlockDir() != lineWM.GetBlockDir()) {
+  if (pfd->mWritingMode.GetBlockDir() != lineWM.GetBlockDir()) {
     pfd->mAscent = lineWM.IsLineInverted() ? 0 : aMetrics.BSize(lineWM);
   } else {
     if (aMetrics.BlockStartAscent() == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
       pfd->mAscent = pfd->mFrame->GetLogicalBaseline(lineWM);
     } else {
       pfd->mAscent = aMetrics.BlockStartAscent();
     }
   }
@@ -1792,17 +1792,17 @@ nsLineLayout::VerticalAlignFrames(PerSpa
   nsFrame::ListTag(stdout, spanFrame);
   printf(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s",
          preMode ? "yes" : "no",
          mPresContext->CompatibilityMode() != eCompatibility_NavQuirks ? "yes" : "no",
          spanFramePFD->mBounds.ISize(lineWM),
          spanFramePFD->mBounds.BSize(lineWM),
          emptyContinuation ? "yes" : "no");
   if (psd != mRootSpan) {
-    WritingMode frameWM = spanFramePFD->mFrame->GetWritingMode();
+    WritingMode frameWM = spanFramePFD->mWritingMode;
     printf(" bp=%d,%d,%d,%d margin=%d,%d,%d,%d",
            spanFramePFD->mBorderPadding.Top(lineWM),
            spanFramePFD->mBorderPadding.Right(lineWM),
            spanFramePFD->mBorderPadding.Bottom(lineWM),
            spanFramePFD->mBorderPadding.Left(lineWM),
            spanFramePFD->mMargin.Top(lineWM),
            spanFramePFD->mMargin.Right(lineWM),
            spanFramePFD->mMargin.Bottom(lineWM),
@@ -3254,17 +3254,17 @@ nsLineLayout::TextAlignLine(nsLineBox* a
 void
 nsLineLayout::ApplyRelativePositioning(PerFrameData* aPFD)
 {
   if (!aPFD->mRelativePos) {
     return;
   }
 
   nsIFrame* frame = aPFD->mFrame;
-  WritingMode frameWM = frame->GetWritingMode();
+  WritingMode frameWM = aPFD->mWritingMode;
   LogicalPoint origin = frame->GetLogicalPosition(ContainerSize());
   // right and bottom are handled by
   // nsHTMLReflowState::ComputeRelativeOffsets
   nsHTMLReflowState::ApplyRelativePositioning(frame, frameWM,
                                               aPFD->mOffsets, &origin,
                                               ContainerSize());
   frame->SetPosition(frameWM, origin, ContainerSize());
 }
--- a/layout/generic/nsLineLayout.h
+++ b/layout/generic/nsLineLayout.h
@@ -470,16 +470,17 @@ protected:
     bool mRecomputeOverflow : 1;
     bool mIsBullet : 1;
     bool mSkipWhenTrimmingWhitespace : 1;
     bool mIsEmpty : 1;
     bool mIsLinkedToBase : 1;
 
     // Other state we use
     uint8_t mBlockDirAlign;
+    mozilla::WritingMode mWritingMode;
 
     PerFrameData* Last() {
       PerFrameData* pfd = this;
       while (pfd->mNext) {
         pfd = pfd->mNext;
       }
       return pfd;
     }