Bug 1055667 part 5 - Make nsRubyFrame inherit nsInlineFrame. r=dbaron

--HG--
extra : source : 2ebca66c36f692cf29cbeb1eb64c6760bb75847c
This commit is contained in:
Xidorn Quan 2015-01-15 20:02:11 +11:00
parent f371f07432
commit e2198398db
2 changed files with 13 additions and 49 deletions

View File

@ -23,7 +23,7 @@ using namespace mozilla;
NS_QUERYFRAME_HEAD(nsRubyFrame)
NS_QUERYFRAME_ENTRY(nsRubyFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsRubyFrameSuper)
NS_IMPL_FRAMEARENA_HELPERS(nsRubyFrame)
@ -48,8 +48,10 @@ nsRubyFrame::GetType() const
/* virtual */ bool
nsRubyFrame::IsFrameOfType(uint32_t aFlags) const
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eLineParticipant));
if (aFlags & eBidiInlineContainer) {
return false;
}
return nsRubyFrameSuper::IsFrameOfType(aFlags);
}
#ifdef DEBUG_FRAME_DUMP
@ -121,32 +123,6 @@ nsRubyFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
aData->currentLine += sum;
}
/* virtual */ LogicalSize
nsRubyFrame::ComputeSize(nsRenderingContext *aRenderingContext,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags)
{
// Ruby frame is inline, hence don't compute size before reflow.
return LogicalSize(aWM, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
}
/* virtual */ nscoord
nsRubyFrame::GetLogicalBaseline(WritingMode aWritingMode) const
{
return mBaseline;
}
/* virtual */ bool
nsRubyFrame::CanContinueTextRun() const
{
return true;
}
/* virtual */ void
nsRubyFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

View File

@ -9,11 +9,13 @@
#ifndef nsRubyFrame_h___
#define nsRubyFrame_h___
#include "nsContainerFrame.h"
#include "nsInlineFrame.h"
class nsRubyBaseContainerFrame;
class nsRubyTextContainerFrame;
typedef nsInlineFrame nsRubyFrameSuper;
/**
* Factory function.
* @return a newly allocated nsRubyFrame (infallible)
@ -21,7 +23,7 @@ class nsRubyTextContainerFrame;
nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
class nsRubyFrame MOZ_FINAL : public nsContainerFrame
class nsRubyFrame MOZ_FINAL : public nsRubyFrameSuper
{
public:
NS_DECL_FRAMEARENA_HELPERS
@ -35,22 +37,10 @@ public:
InlineMinISizeData *aData) MOZ_OVERRIDE;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) MOZ_OVERRIDE;
virtual mozilla::LogicalSize
ComputeSize(nsRenderingContext *aRenderingContext,
mozilla::WritingMode aWritingMode,
const mozilla::LogicalSize& aCBSize,
nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode)
const MOZ_OVERRIDE;
virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
@ -65,7 +55,8 @@ public:
protected:
friend nsContainerFrame* NS_NewRubyFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
explicit nsRubyFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
explicit nsRubyFrame(nsStyleContext* aContext)
: nsRubyFrameSuper(aContext) {}
void ReflowSegment(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
@ -74,11 +65,8 @@ protected:
nsRubyBaseContainerFrame* PullOneSegment(ContinuationTraversingState& aState);
// The three members below are not initialized until the first reflow.
nscoord mBaseline;
// The leadings required to put the annotations.
// The leading required to put the annotations.
// They are not initialized until the first reflow.
nscoord mBStartLeading;
nscoord mBEndLeading;
};