Bug 959380 - 1/5 - Make gfxBreakPriority a typed enum - r=jrmuizel
This commit is contained in:
@@ -6293,7 +6293,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
bool hyphenation = haveHyphenation && hyphenBuffer[i - bufferStart];
|
||||
bool wordWrapping =
|
||||
aCanWordWrap && mCharacterGlyphs[i].IsClusterStart() &&
|
||||
*aBreakPriority <= eWordWrapBreak;
|
||||
*aBreakPriority <= gfxBreakPriority::eWordWrapBreak;
|
||||
|
||||
if (lineBreakHere || hyphenation || wordWrapping) {
|
||||
gfxFloat hyphenatedAdvance = advance;
|
||||
@@ -6308,7 +6308,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
lastBreakTrimmableAdvance = trimmableAdvance;
|
||||
lastBreakUsedHyphenation = !lineBreakHere && !wordWrapping;
|
||||
*aBreakPriority = hyphenation || lineBreakHere ?
|
||||
eNormalBreak : eWordWrapBreak;
|
||||
gfxBreakPriority::eNormalBreak : gfxBreakPriority::eWordWrapBreak;
|
||||
}
|
||||
|
||||
width += advance;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#ifndef GFX_TYPES_H
|
||||
#define GFX_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
typedef struct _cairo_surface cairo_surface_t;
|
||||
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
||||
|
||||
@@ -36,11 +39,11 @@ typedef double gfxFloat;
|
||||
* @see gfxTextRun::BreakAndMeasureText
|
||||
* @see nsLineLayout::NotifyOptionalBreakPosition
|
||||
*/
|
||||
enum gfxBreakPriority {
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxBreakPriority)
|
||||
eNoBreak = 0,
|
||||
eWordWrapBreak,
|
||||
eNormalBreak
|
||||
};
|
||||
MOZ_END_ENUM_CLASS(gfxBreakPriority)
|
||||
|
||||
/**
|
||||
* The format for an image surface. For all formats with alpha data, 0
|
||||
|
||||
@@ -3346,7 +3346,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState,
|
||||
bool allowPullUp = true;
|
||||
nsIContent* forceBreakInContent = nullptr;
|
||||
int32_t forceBreakOffset = -1;
|
||||
gfxBreakPriority forceBreakPriority = eNoBreak;
|
||||
gfxBreakPriority forceBreakPriority = gfxBreakPriority::eNoBreak;
|
||||
do {
|
||||
nsFloatManager::SavedState floatManagerState;
|
||||
aState.mReflowState.mFloatManager->PushState(&floatManagerState);
|
||||
@@ -3498,7 +3498,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
|
||||
if (aFloatAvailableSpace.mHasFloats) {
|
||||
// There is a soft break opportunity at the start of the line, because
|
||||
// we can always move this line down below float(s).
|
||||
if (aLineLayout.NotifyOptionalBreakPosition(frame->GetContent(), 0, true, eNormalBreak)) {
|
||||
if (aLineLayout.NotifyOptionalBreakPosition(frame->GetContent(), 0, true, gfxBreakPriority::eNormalBreak)) {
|
||||
lineReflowStatus = LINE_REFLOW_REDO_NEXT_BAND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
||||
mLastOptionalBreakContent(nullptr),
|
||||
mForceBreakContent(nullptr),
|
||||
mBlockRS(nullptr),/* XXX temporary */
|
||||
mLastOptionalBreakPriority(eNoBreak),
|
||||
mLastOptionalBreakPriority(gfxBreakPriority::eNoBreak),
|
||||
mLastOptionalBreakContentOffset(-1),
|
||||
mForceBreakContentOffset(-1),
|
||||
mMinLineHeight(0),
|
||||
@@ -1025,7 +1025,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
// record soft break opportunity after this content that can't be
|
||||
// part of a text run. This is not a text frame so we know
|
||||
// that offset INT32_MAX means "after the content".
|
||||
if (NotifyOptionalBreakPosition(aFrame->GetContent(), INT32_MAX, optionalBreakAfterFits, eNormalBreak)) {
|
||||
if (NotifyOptionalBreakPosition(aFrame->GetContent(), INT32_MAX, optionalBreakAfterFits, gfxBreakPriority::eNormalBreak)) {
|
||||
// If this returns true then we are being told to actually break here.
|
||||
aReflowStatus = NS_INLINE_LINE_BREAK_AFTER(aReflowStatus);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
mNeedBackup = false;
|
||||
mLastOptionalBreakContent = nullptr;
|
||||
mLastOptionalBreakContentOffset = -1;
|
||||
mLastOptionalBreakPriority = eNoBreak;
|
||||
mLastOptionalBreakPriority = gfxBreakPriority::eNoBreak;
|
||||
}
|
||||
// Retrieve last set optional break position. When this returns null, no
|
||||
// optional break has been recorded (which means that the line can't break yet).
|
||||
|
||||
@@ -8092,7 +8092,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
// Record a potential break after final soft hyphen
|
||||
aLineLayout.NotifyOptionalBreakPosition(mContent, offset + length,
|
||||
textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth,
|
||||
eNormalBreak);
|
||||
gfxBreakPriority::eNormalBreak);
|
||||
}
|
||||
bool breakAfter = forceBreakAfter;
|
||||
// length == 0 means either the text is empty or it's all collapsed away
|
||||
@@ -8112,7 +8112,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
breakAfter = true;
|
||||
} else {
|
||||
aLineLayout.NotifyOptionalBreakPosition(mContent, offset + length,
|
||||
true, eNormalBreak);
|
||||
true, gfxBreakPriority::eNormalBreak);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user