mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 842142 - Prevent odd text wrapping in SVG text. r=roc
This commit is contained in:
parent
10166ad978
commit
35661a5229
@ -5277,7 +5277,7 @@ ShouldInflateFontsForContainer(const nsIFrame *aFrame)
|
||||
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT) &&
|
||||
// We also want to disable font inflation for containers that have
|
||||
// preformatted text.
|
||||
styleText->WhiteSpaceCanWrap();
|
||||
styleText->WhiteSpaceCanWrap(aFrame);
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -3719,8 +3719,9 @@ nsFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlineMinWidthData *aData)
|
||||
{
|
||||
NS_ASSERTION(GetParent(), "Must have a parent if we get here!");
|
||||
nsIFrame* parent = GetParent();
|
||||
bool canBreak = !CanContinueTextRun() &&
|
||||
GetParent()->StyleText()->WhiteSpaceCanWrap();
|
||||
parent->StyleText()->WhiteSpaceCanWrap(parent);
|
||||
|
||||
if (canBreak)
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
|
@ -2027,9 +2027,10 @@ nsImageFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
||||
|
||||
NS_ASSERTION(GetParent(), "Must have a parent if we get here!");
|
||||
|
||||
nsIFrame* parent = GetParent();
|
||||
bool canBreak =
|
||||
!CanContinueTextRun() &&
|
||||
GetParent()->StyleText()->WhiteSpaceCanWrap() &&
|
||||
parent->StyleText()->WhiteSpaceCanWrap(parent) &&
|
||||
!IsInAutoWidthTableCellForQuirk(this);
|
||||
|
||||
if (canBreak)
|
||||
|
@ -205,7 +205,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
||||
|
||||
mTopEdge = aY;
|
||||
|
||||
psd->mNoWrap = !mStyleText->WhiteSpaceCanWrap();
|
||||
psd->mNoWrap = !mStyleText->WhiteSpaceCanWrap(GetLineContainerFrame());
|
||||
psd->mDirection = aDirection;
|
||||
psd->mChangedFrameDirection = false;
|
||||
|
||||
@ -407,7 +407,8 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame,
|
||||
psd->mRightEdge = aRightEdge;
|
||||
psd->mBaseline = aBaseline;
|
||||
|
||||
psd->mNoWrap = !aSpanReflowState->frame->StyleText()->WhiteSpaceCanWrap();
|
||||
nsIFrame* frame = aSpanReflowState->frame;
|
||||
psd->mNoWrap = !frame->StyleText()->WhiteSpaceCanWrap(frame);
|
||||
psd->mDirection = aSpanReflowState->mStyleVisibility->mDirection;
|
||||
psd->mChangedFrameDirection = false;
|
||||
|
||||
|
@ -2272,12 +2272,13 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
||||
if (!initialBreakController) {
|
||||
initialBreakController = mLineContainer;
|
||||
}
|
||||
if (!initialBreakController->StyleText()->WhiteSpaceCanWrap()) {
|
||||
if (!initialBreakController->StyleText()->
|
||||
WhiteSpaceCanWrap(initialBreakController)) {
|
||||
flags |= nsLineBreaker::BREAK_SUPPRESS_INITIAL;
|
||||
}
|
||||
nsTextFrame* startFrame = mappedFlow->mStartFrame;
|
||||
const nsStyleText* textStyle = startFrame->StyleText();
|
||||
if (!textStyle->WhiteSpaceCanWrap()) {
|
||||
if (!textStyle->WhiteSpaceCanWrap(startFrame)) {
|
||||
flags |= nsLineBreaker::BREAK_SUPPRESS_INSIDE;
|
||||
}
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_NO_BREAKS) {
|
||||
@ -3108,7 +3109,7 @@ PropertyProvider::GetHyphenationBreaks(uint32_t aStart, uint32_t aLength,
|
||||
NS_PRECONDITION(IsInBounds(mStart, mLength, aStart, aLength), "Range out of bounds");
|
||||
NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
|
||||
|
||||
if (!mTextStyle->WhiteSpaceCanWrap() ||
|
||||
if (!mTextStyle->WhiteSpaceCanWrap(mFrame) ||
|
||||
mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE)
|
||||
{
|
||||
memset(aBreakBefore, false, aLength*sizeof(bool));
|
||||
@ -7929,7 +7930,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
canTrimTrailingWhitespace ? &trimmedWidth : nullptr,
|
||||
&textMetrics, boundingBoxType, ctx,
|
||||
&usedHyphenation, &transformedLastBreak,
|
||||
textStyle->WordCanWrap(), &breakPriority);
|
||||
textStyle->WordCanWrap(this), &breakPriority);
|
||||
if (!length && !textMetrics.mAscent && !textMetrics.mDescent) {
|
||||
// If we're measuring a zero-length piece of text, update
|
||||
// the height manually.
|
||||
|
@ -1336,19 +1336,22 @@ struct nsStyleText {
|
||||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_DISCARD_NEWLINES;
|
||||
}
|
||||
|
||||
bool WhiteSpaceCanWrap() const {
|
||||
bool WhiteSpaceCanWrapStyle() const {
|
||||
return mWhiteSpace == NS_STYLE_WHITESPACE_NORMAL ||
|
||||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP ||
|
||||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_LINE;
|
||||
}
|
||||
|
||||
bool WordCanWrap() const {
|
||||
return WhiteSpaceCanWrap() && mWordWrap == NS_STYLE_WORDWRAP_BREAK_WORD;
|
||||
bool WordCanWrapStyle() const {
|
||||
return WhiteSpaceCanWrapStyle() &&
|
||||
mWordWrap == NS_STYLE_WORDWRAP_BREAK_WORD;
|
||||
}
|
||||
|
||||
// These are defined in nsStyleStructInlines.h.
|
||||
inline bool HasTextShadow(const nsIFrame* aFrame) const;
|
||||
inline nsCSSShadowArray* GetTextShadow(const nsIFrame* aFrame) const;
|
||||
inline bool WhiteSpaceCanWrap(const nsIFrame* aFrame) const;
|
||||
inline bool WordCanWrap(const nsIFrame* aFrame) const;
|
||||
};
|
||||
|
||||
struct nsStyleVisibility {
|
||||
|
@ -70,6 +70,18 @@ nsStyleText::GetTextShadow(const nsIFrame* aFrame) const
|
||||
return mTextShadow;
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleText::WhiteSpaceCanWrap(const nsIFrame* aFrame) const
|
||||
{
|
||||
return WhiteSpaceCanWrapStyle() && !aFrame->IsSVGText();
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleText::WordCanWrap(const nsIFrame* aFrame) const
|
||||
{
|
||||
return WordCanWrapStyle() && !aFrame->IsSVGText();
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyleDisplay::IsBlockInside(const nsIFrame* aFrame) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user