mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1055658 part 4 - Revert RubyReflowState. r=dbaron
--HG-- extra : source : 4ee892ec7dde8957aa733401bfd7746a97ebcf7e
This commit is contained in:
parent
a36d378995
commit
cd8f0da1f4
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* states and methods used while laying out a ruby segment */
|
||||
|
||||
#include "RubyReflowState.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
RubyReflowState::RubyReflowState(
|
||||
WritingMode aLineWM,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers)
|
||||
: mCurrentContainerIndex(kBaseContainerIndex)
|
||||
{
|
||||
uint32_t rtcCount = aTextContainers.Length();
|
||||
mTextContainers.SetCapacity(rtcCount);
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
mTextContainers.AppendElement(
|
||||
TextContainerInfo(aLineWM, aTextContainers[i]));
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* states and methods used while laying out a ruby segment */
|
||||
|
||||
#ifndef mozilla_RubyReflowState_h_
|
||||
#define mozilla_RubyReflowState_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "WritingModes.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#define RTC_ARRAY_SIZE 1
|
||||
|
||||
class nsRubyTextContainerFrame;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MOZ_STACK_CLASS RubyReflowState MOZ_FINAL
|
||||
{
|
||||
public:
|
||||
explicit RubyReflowState(
|
||||
WritingMode aLineWM,
|
||||
const nsTArray<nsRubyTextContainerFrame*>& aTextContainers);
|
||||
|
||||
struct TextContainerInfo
|
||||
{
|
||||
nsRubyTextContainerFrame* mFrame;
|
||||
LogicalSize mLineSize;
|
||||
|
||||
TextContainerInfo(WritingMode aLineWM, nsRubyTextContainerFrame* aFrame)
|
||||
: mFrame(aFrame)
|
||||
, mLineSize(aLineWM) { }
|
||||
};
|
||||
|
||||
void AdvanceCurrentContainerIndex() { mCurrentContainerIndex++; }
|
||||
|
||||
void SetTextContainerInfo(int32_t aIndex,
|
||||
nsRubyTextContainerFrame* aContainer,
|
||||
const LogicalSize& aLineSize)
|
||||
{
|
||||
MOZ_ASSERT(mTextContainers[aIndex].mFrame == aContainer);
|
||||
mTextContainers[aIndex].mLineSize = aLineSize;
|
||||
}
|
||||
|
||||
const TextContainerInfo&
|
||||
GetCurrentTextContainerInfo(nsRubyTextContainerFrame* aFrame) const
|
||||
{
|
||||
MOZ_ASSERT(mTextContainers[mCurrentContainerIndex].mFrame == aFrame);
|
||||
return mTextContainers[mCurrentContainerIndex];
|
||||
}
|
||||
|
||||
private:
|
||||
static MOZ_CONSTEXPR_VAR int32_t kBaseContainerIndex = -1;
|
||||
// The index of the current reflowing container. When it equals to
|
||||
// kBaseContainerIndex, we are reflowing ruby base. Otherwise, it
|
||||
// stands for the index of text containers in the ruby segment.
|
||||
int32_t mCurrentContainerIndex;
|
||||
|
||||
nsAutoTArray<TextContainerInfo, RTC_ARRAY_SIZE> mTextContainers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // mozilla_RubyReflowState_h_
|
@ -95,7 +95,6 @@ UNIFIED_SOURCES += [
|
||||
'nsTextRunTransformations.cpp',
|
||||
'nsVideoFrame.cpp',
|
||||
'nsViewportFrame.cpp',
|
||||
'RubyReflowState.cpp',
|
||||
'RubyUtils.cpp',
|
||||
'ScrollbarActivity.cpp',
|
||||
'StickyScrollContainer.cpp',
|
||||
|
@ -72,7 +72,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
||||
mFloatManager = nullptr;
|
||||
mLineLayout = nullptr;
|
||||
mRubyReflowState = nullptr;
|
||||
memset(&mFlags, 0, sizeof(mFlags));
|
||||
mDiscoveredClearance = nullptr;
|
||||
mPercentHeightObserver = nullptr;
|
||||
@ -208,7 +207,6 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
mLineLayout = aParentReflowState.mLineLayout;
|
||||
else
|
||||
mLineLayout = nullptr;
|
||||
mRubyReflowState = nullptr;
|
||||
|
||||
// Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
|
||||
// this constructor's init list, so the only flags that we need to explicitly
|
||||
|
@ -21,10 +21,6 @@ class nsLineLayout;
|
||||
class nsIPercentHeightObserver;
|
||||
struct nsHypotheticalBox;
|
||||
|
||||
namespace mozilla {
|
||||
class RubyReflowState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return aValue clamped to [aMinValue, aMaxValue].
|
||||
*
|
||||
@ -262,9 +258,6 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
|
||||
// LineLayout object (only for inline reflow; set to nullptr otherwise)
|
||||
nsLineLayout* mLineLayout;
|
||||
|
||||
// RubyReflowState object (only for ruby reflow; set to nullptr otherwise)
|
||||
mozilla::RubyReflowState* mRubyReflowState;
|
||||
|
||||
// The appropriate reflow state for the containing block (for
|
||||
// percentage widths, etc.) of this reflow state's frame.
|
||||
const nsHTMLReflowState *mCBReflowState;
|
||||
|
@ -67,7 +67,6 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
||||
mForceBreakFrameOffset(-1),
|
||||
mMinLineBSize(0),
|
||||
mTextIndent(0),
|
||||
mRubyReflowState(nullptr),
|
||||
mFirstLetterStyleOK(false),
|
||||
mIsTopOfPage(false),
|
||||
mImpactedByFloats(false),
|
||||
@ -886,10 +885,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
aFrame, availSize);
|
||||
nsHTMLReflowState& reflowState = *reflowStateHolder;
|
||||
reflowState.mLineLayout = this;
|
||||
if (mRubyReflowState) {
|
||||
reflowState.mRubyReflowState = mRubyReflowState;
|
||||
mRubyReflowState = nullptr;
|
||||
}
|
||||
reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
|
||||
if (reflowState.ComputedISize() == NS_UNCONSTRAINEDSIZE) {
|
||||
reflowState.AvailableISize() = availableSpaceOnLine;
|
||||
|
@ -27,10 +27,6 @@
|
||||
class nsFloatManager;
|
||||
struct nsStyleText;
|
||||
|
||||
namespace mozilla {
|
||||
class RubyReflowState;
|
||||
}
|
||||
|
||||
class nsLineLayout {
|
||||
public:
|
||||
/**
|
||||
@ -102,13 +98,6 @@ public:
|
||||
|
||||
bool IsZeroBSize();
|
||||
|
||||
// The ruby layout will be passed to the next frame to be reflowed
|
||||
// via the HTML reflow state.
|
||||
void SetRubyReflowState(mozilla::RubyReflowState* aRubyReflowState)
|
||||
{
|
||||
mRubyReflowState = aRubyReflowState;
|
||||
}
|
||||
|
||||
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
||||
// if the frame is pushed to the next line because it doesn't fit.
|
||||
void ReflowFrame(nsIFrame* aFrame,
|
||||
@ -565,10 +554,6 @@ protected:
|
||||
int32_t mLineNumber;
|
||||
mozilla::JustificationInfo mJustificationInfo;
|
||||
|
||||
// The ruby layout for the next frame to be reflowed.
|
||||
// It is reset every time it is used.
|
||||
mozilla::RubyReflowState* mRubyReflowState;
|
||||
|
||||
int32_t mTotalPlacedFrames;
|
||||
|
||||
nscoord mBStartEdge;
|
||||
|
@ -341,7 +341,6 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
"No line layout provided to RubyBaseContainerFrame reflow method.");
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||
|
||||
AutoTextContainerArray textContainers;
|
||||
GetTextContainers(textContainers);
|
||||
@ -494,7 +493,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
lineLayout->VerticalAlignLine();
|
||||
LogicalSize lineSize(lineWM, rtcISize, lineLayout->GetFinalLineBSize());
|
||||
aReflowState.mRubyReflowState->SetTextContainerInfo(i, textContainer, lineSize);
|
||||
textContainer->SetLineSize(lineSize);
|
||||
lineLayout->EndLineReflow();
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
#include "nsRubyBaseFrame.h"
|
||||
#include "nsRubyTextFrame.h"
|
||||
#include "RubyReflowState.h"
|
||||
|
||||
#define RTC_ARRAY_SIZE 1
|
||||
|
||||
/**
|
||||
* Factory function.
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsStyleContext.h"
|
||||
#include "WritingModes.h"
|
||||
#include "RubyUtils.h"
|
||||
#include "RubyReflowState.h"
|
||||
#include "nsRubyBaseContainerFrame.h"
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
|
||||
@ -241,11 +240,9 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
||||
textContainers.AppendElement(iter.GetTextContainer());
|
||||
}
|
||||
const uint32_t rtcCount = textContainers.Length();
|
||||
RubyReflowState rubyReflowState(lineWM, textContainers);
|
||||
|
||||
nsHTMLReflowMetrics baseMetrics(aReflowState);
|
||||
bool pushedFrame;
|
||||
aReflowState.mLineLayout->SetRubyReflowState(&rubyReflowState);
|
||||
aReflowState.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
|
||||
&baseMetrics, pushedFrame);
|
||||
|
||||
@ -330,13 +327,10 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
|
||||
nsRect offsetRect = baseRect;
|
||||
for (uint32_t i = 0; i < rtcCount; i++) {
|
||||
nsRubyTextContainerFrame* textContainer = textContainers[i];
|
||||
rubyReflowState.AdvanceCurrentContainerIndex();
|
||||
|
||||
nsReflowStatus textReflowStatus;
|
||||
nsHTMLReflowMetrics textMetrics(aReflowState);
|
||||
nsHTMLReflowState textReflowState(aPresContext, aReflowState,
|
||||
textContainer, availSize);
|
||||
textReflowState.mRubyReflowState = &rubyReflowState;
|
||||
// FIXME We probably shouldn't be using the same nsLineLayout for
|
||||
// the text containers. But it should be fine now as we are
|
||||
// not actually using this line layout to reflow something,
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "WritingModes.h"
|
||||
#include "RubyReflowState.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -125,8 +124,6 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
MOZ_ASSERT(aReflowState.mRubyReflowState, "No ruby reflow state provided");
|
||||
|
||||
// All rt children have already been reflowed. All we need to do is
|
||||
// to report complete and return the desired size provided by the
|
||||
// ruby base container.
|
||||
@ -137,7 +134,5 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// will take care of our continuations.
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
||||
const RubyReflowState::TextContainerInfo& info =
|
||||
aReflowState.mRubyReflowState->GetCurrentTextContainerInfo(this);
|
||||
aDesiredSize.SetSize(lineWM, info.mLineSize);
|
||||
aDesiredSize.SetSize(lineWM, mLineSize);
|
||||
}
|
||||
|
@ -62,12 +62,18 @@ protected:
|
||||
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
explicit nsRubyTextContainerFrame(nsStyleContext* aContext)
|
||||
: nsRubyTextContainerFrameSuper(aContext) {}
|
||||
: nsRubyTextContainerFrameSuper(aContext)
|
||||
, mLineSize(mozilla::WritingMode(aContext)) {}
|
||||
|
||||
void UpdateSpanFlag();
|
||||
|
||||
// For MoveOverflowToChildList
|
||||
friend class nsRubyBaseContainerFrame;
|
||||
void SetLineSize(const mozilla::LogicalSize& aSize) { mLineSize = aSize; }
|
||||
|
||||
// The intended dimensions of the ruby text container. It is set by
|
||||
// the corresponding ruby base container when the segment is reflowed,
|
||||
// and used when the ruby text container is reflowed by its parent.
|
||||
mozilla::LogicalSize mLineSize;
|
||||
};
|
||||
|
||||
#endif /* nsRubyTextContainerFrame_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user