mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 405577. Allow available width to go negative for inlines/text, so we can tell whether zero-width content fits or not. Also allow textframes to honour a forced break at the end of the text. r+sr=dbaron
This commit is contained in:
parent
e90527d8c5
commit
96732f1829
@ -430,7 +430,6 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
||||
availableWidth -= leftEdge;
|
||||
availableWidth -= ltr ? aReflowState.mComputedBorderPadding.right
|
||||
: aReflowState.mComputedBorderPadding.left;
|
||||
availableWidth = PR_MAX(0, availableWidth);
|
||||
}
|
||||
lineLayout->BeginSpan(this, &aReflowState, leftEdge, leftEdge + availableWidth);
|
||||
|
||||
|
@ -5326,7 +5326,9 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
PRInt32 limitLength = length;
|
||||
PRInt32 forceBreak = lineLayout.GetForcedBreakPosition(mContent);
|
||||
PRBool forceBreakAfter = PR_FALSE;
|
||||
if (forceBreak >= offset + length) {
|
||||
forceBreakAfter = forceBreak == offset + length;
|
||||
// The break is not within the text considered for this textframe.
|
||||
forceBreak = -1;
|
||||
}
|
||||
@ -5480,9 +5482,14 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
lineLayout.NotifyOptionalBreakPosition(mContent, offset + length,
|
||||
textMetrics.mAdvanceWidth + provider.GetHyphenWidth() <= availWidth);
|
||||
}
|
||||
PRBool breakAfter = PR_FALSE;
|
||||
if ((charsFit == length && transformedOffset + transformedLength == mTextRun->GetLength() &&
|
||||
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
|
||||
PRBool breakAfter = forceBreakAfter;
|
||||
if (!breakAfter && charsFit == length &&
|
||||
transformedOffset + transformedLength == mTextRun->GetLength() &&
|
||||
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK)) {
|
||||
// We placed all the text in the textrun and we have a break opportunity at
|
||||
// the end of the textrun. We need to record it because the following
|
||||
// content may not care about nsLineBreaker.
|
||||
|
||||
// Note that because we didn't break, we can be sure that (thanks to the
|
||||
// code up above) textMetrics.mAdvanceWidth includes the width of any
|
||||
// trailing whitespace. So we need to subtract trimmableWidth here
|
||||
|
28
layout/reftests/bugs/405577-1-ref.html
Normal file
28
layout/reftests/bugs/405577-1-ref.html
Normal file
@ -0,0 +1,28 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
b { white-space:nowrap; }
|
||||
div { border:1px solid black; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width:100px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
<div style="width:200px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
<div style="width:400px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><br>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
28
layout/reftests/bugs/405577-1.html
Normal file
28
layout/reftests/bugs/405577-1.html
Normal file
@ -0,0 +1,28 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
b { white-space:nowrap; }
|
||||
div { border:1px solid black; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width:100px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
<div style="width:200px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
<div style="width:400px">
|
||||
<b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b><span>
|
||||
</span><b><img src="mozilla-banner.gif" width="100">This is text</b>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -505,6 +505,7 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
|
||||
== 404666-2.html 404666-2-ref.html
|
||||
== 405186-1.xhtml about:blank
|
||||
== 405305-1.html 405305-1-ref.html
|
||||
== 405577-1.html 405577-1-ref.html
|
||||
== 405584-1.html 405584-1-ref.html
|
||||
== 406484-1.html 406484-1-ref.html
|
||||
== 406568-1.html 406568-1-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user