mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 04:58:00 +00:00
Make text-indent contribute to intrinsic widths, and handle negative text-indent and negative margin properly by distinguishing forced and optional breaks when accumulating minimum widths. b=368155 r+sr=roc
This commit is contained in:
parent
3cd4d2979c
commit
3897543ff9
@ -1910,7 +1910,7 @@ nsLayoutUtils::MinWidthFromInline(nsIFrame* aFrame,
|
||||
nsIFrame::InlineMinWidthData data;
|
||||
DISPLAY_MIN_WIDTH(aFrame, data.prevLines);
|
||||
aFrame->AddInlineMinWidth(aRenderingContext, &data);
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
return data.prevLines;
|
||||
}
|
||||
|
||||
@ -1921,7 +1921,7 @@ nsLayoutUtils::PrefWidthFromInline(nsIFrame* aFrame,
|
||||
nsIFrame::InlinePrefWidthData data;
|
||||
DISPLAY_PREF_WIDTH(aFrame, data.prevLines);
|
||||
aFrame->AddInlinePrefWidth(aRenderingContext, &data);
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
return data.prevLines;
|
||||
}
|
||||
|
||||
|
@ -193,14 +193,14 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
||||
BRFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlineMinWidthData *aData)
|
||||
{
|
||||
aData->Break(aRenderingContext);
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
BRFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlinePrefWidthData *aData)
|
||||
{
|
||||
aData->Break(aRenderingContext);
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
|
@ -641,26 +641,31 @@ nsBlockFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
||||
ResolveBidi();
|
||||
#endif // IBMBIDI
|
||||
|
||||
PRInt32 lineNumber = 0;
|
||||
InlineMinWidthData data;
|
||||
for (line_iterator line = begin_lines(), line_end = end_lines();
|
||||
line != line_end; ++line, ++lineNumber)
|
||||
line != line_end; ++line)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisyIntrinsic) {
|
||||
IndentBy(stdout, gNoiseIndent);
|
||||
printf("line %d (%s%s)\n", lineNumber,
|
||||
printf("line (%s%s)\n",
|
||||
line->IsBlock() ? "block" : "inline",
|
||||
line->IsEmpty() ? ",empty" : "");
|
||||
line->IsEmpty() ? ", empty" : "");
|
||||
}
|
||||
AutoNoisyIndenter lineindent(gNoisyIntrinsic);
|
||||
#endif
|
||||
if (line->IsBlock()) {
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
data.currentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
line->mFirstChild, nsLayoutUtils::MIN_WIDTH);
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
} else {
|
||||
if (line == begin_lines() && !GetPrevContinuation()) {
|
||||
const nsStyleCoord &indent = GetStyleText()->mTextIndent;
|
||||
if (indent.GetUnit() == eStyleUnit_Coord)
|
||||
data.currentLine += indent.GetCoordValue();
|
||||
}
|
||||
// XXX Bug NNNNNN Should probably handle percentage text-indent.
|
||||
|
||||
nsIFrame *kid = line->mFirstChild;
|
||||
for (PRInt32 i = 0, i_end = line->GetChildCount(); i != i_end;
|
||||
@ -676,7 +681,7 @@ nsBlockFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
|
||||
mMinWidth = data.prevLines;
|
||||
return mMinWidth;
|
||||
@ -702,26 +707,31 @@ nsBlockFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
||||
ResolveBidi();
|
||||
#endif // IBMBIDI
|
||||
|
||||
PRInt32 lineNumber = 0;
|
||||
InlinePrefWidthData data;
|
||||
for (line_iterator line = begin_lines(), line_end = end_lines();
|
||||
line != line_end; ++line, ++lineNumber)
|
||||
line != line_end; ++line)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisyIntrinsic) {
|
||||
IndentBy(stdout, gNoiseIndent);
|
||||
printf("line %d (%s%s)\n", lineNumber,
|
||||
printf("line (%s%s)\n",
|
||||
line->IsBlock() ? "block" : "inline",
|
||||
line->IsEmpty() ? ",empty" : "");
|
||||
line->IsEmpty() ? ", empty" : "");
|
||||
}
|
||||
AutoNoisyIndenter lineindent(gNoisyIntrinsic);
|
||||
#endif
|
||||
if (line->IsBlock()) {
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
data.currentLine = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
line->mFirstChild, nsLayoutUtils::PREF_WIDTH);
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
} else {
|
||||
if (line == begin_lines() && !GetPrevContinuation()) {
|
||||
const nsStyleCoord &indent = GetStyleText()->mTextIndent;
|
||||
if (indent.GetUnit() == eStyleUnit_Coord)
|
||||
data.currentLine += indent.GetCoordValue();
|
||||
}
|
||||
// XXX Bug NNNNNN Should probably handle percentage text-indent.
|
||||
|
||||
nsIFrame *kid = line->mFirstChild;
|
||||
for (PRInt32 i = 0, i_end = line->GetChildCount(); i != i_end;
|
||||
@ -737,7 +747,7 @@ nsBlockFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
data.Break(aRenderingContext);
|
||||
data.ForceBreak(aRenderingContext);
|
||||
|
||||
mPrefWidth = data.prevLines;
|
||||
return mPrefWidth;
|
||||
|
@ -2945,14 +2945,15 @@ nsFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
GetParent()->GetStyleText()->WhiteSpaceCanWrap();
|
||||
|
||||
if (canBreak)
|
||||
aData->Break(aRenderingContext);
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
aData->trailingWhitespace = 0;
|
||||
aData->skipWhitespace = PR_FALSE;
|
||||
aData->trailingTextFrame = nsnull;
|
||||
aData->currentLine += nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
this, nsLayoutUtils::MIN_WIDTH);
|
||||
aData->atStartOfLine = PR_FALSE;
|
||||
if (canBreak)
|
||||
aData->Break(aRenderingContext);
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
@ -2966,7 +2967,7 @@ nsFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::InlineMinWidthData::Break(nsIRenderingContext *aRenderingContext)
|
||||
nsIFrame::InlineMinWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
currentLine -= trailingWhitespace;
|
||||
prevLines = PR_MAX(prevLines, currentLine);
|
||||
@ -2985,7 +2986,22 @@ nsIFrame::InlineMinWidthData::Break(nsIRenderingContext *aRenderingContext)
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::InlinePrefWidthData::Break(nsIRenderingContext *aRenderingContext)
|
||||
nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
trailingTextFrame = nsnull;
|
||||
|
||||
// If we can fit more content into a smaller width by staying on this
|
||||
// line (because we're still at a negative offset due to negative
|
||||
// text-indent or negative margin), don't break. Otherwise, do the
|
||||
// same as ForceBreak. it doesn't really matter when we accumulate
|
||||
// floats.
|
||||
if (currentLine < 0 || atStartOfLine)
|
||||
return;
|
||||
ForceBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::InlinePrefWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
|
||||
{
|
||||
if (floats.Count() != 0) {
|
||||
// preferred widths accumulated for floats that have already
|
||||
|
@ -1122,18 +1122,29 @@ public:
|
||||
struct InlineMinWidthData : public InlineIntrinsicWidthData {
|
||||
InlineMinWidthData()
|
||||
: trailingTextFrame(nsnull)
|
||||
, atStartOfLine(PR_TRUE)
|
||||
{}
|
||||
|
||||
void Break(nsIRenderingContext *aRenderingContext);
|
||||
// We need to distinguish forced and optional breaks for cases where the
|
||||
// current line total is negative. When it is, we need to ignore
|
||||
// optional breaks to prevent min-width from ending up bigger than
|
||||
// pref-width.
|
||||
void ForceBreak(nsIRenderingContext *aRenderingContext);
|
||||
void OptionallyBreak(nsIRenderingContext *aRenderingContext);
|
||||
|
||||
// The last text frame processed so far in the current line, when
|
||||
// the last characters in that text frame are relevant for line
|
||||
// break opportunities.
|
||||
nsIFrame *trailingTextFrame;
|
||||
|
||||
// Whether we're currently at the start of the line. If we are, we
|
||||
// can't break (for example, between the text-indent and the first
|
||||
// word).
|
||||
PRBool atStartOfLine;
|
||||
};
|
||||
|
||||
struct InlinePrefWidthData : public InlineIntrinsicWidthData {
|
||||
void Break(nsIRenderingContext *aRenderingContext);
|
||||
void ForceBreak(nsIRenderingContext *aRenderingContext);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -5727,7 +5727,7 @@ nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
aData->skipWhitespace, // XXX ???
|
||||
nsnull)) // XXX Better to pass real frame
|
||||
{
|
||||
aData->Break(aRenderingContext);
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@ -5753,7 +5753,7 @@ nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
firstChar = *bp2;
|
||||
}
|
||||
if ('\n' == firstChar) {
|
||||
aData->Break(aRenderingContext);
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
aData->skipWhitespace = PR_TRUE;
|
||||
aData->trailingWhitespace = 0;
|
||||
} else if (!aData->skipWhitespace || wsSignificant) {
|
||||
@ -5771,6 +5771,7 @@ nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
wordLen*(ts.mWordSpacing + ts.mLetterSpacing + ts.mSpaceWidth);// XXX simplistic
|
||||
}
|
||||
aData->currentLine += width;
|
||||
aData->atStartOfLine = PR_FALSE;
|
||||
if (wsSignificant) {
|
||||
aData->trailingWhitespace = 0;
|
||||
aData->skipWhitespace = PR_FALSE;
|
||||
@ -5780,12 +5781,12 @@ nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
}
|
||||
|
||||
if (wrapping) {
|
||||
aData->Break(aRenderingContext);
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!atStart && wrapping) {
|
||||
aData->Break(aRenderingContext);
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
}
|
||||
|
||||
atStart = PR_FALSE;
|
||||
@ -5818,6 +5819,7 @@ nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
}
|
||||
|
||||
aData->currentLine += width;
|
||||
aData->atStartOfLine = PR_FALSE;
|
||||
aData->skipWhitespace = PR_FALSE;
|
||||
aData->trailingWhitespace = 0;
|
||||
}
|
||||
@ -5878,7 +5880,7 @@ nsTextFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
|
||||
firstChar = *bp2;
|
||||
}
|
||||
if ('\n' == firstChar) {
|
||||
aData->Break(aRenderingContext);
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
} else if (!aData->skipWhitespace) {
|
||||
nscoord width;
|
||||
if ('\t' == firstChar) {
|
||||
|
@ -4896,42 +4896,48 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
|
||||
if (start >= flowEndInTextRun)
|
||||
return;
|
||||
|
||||
if (mTextRun->CanBreakLineBefore(start)) {
|
||||
aData->Break(aRenderingContext);
|
||||
}
|
||||
|
||||
PRUint32 i;
|
||||
PRUint32 wordStart = start;
|
||||
// XXX Should we consider hyphenation here?
|
||||
for (i = start + 1; i <= flowEndInTextRun; ++i) {
|
||||
if (i < flowEndInTextRun && !mTextRun->CanBreakLineBefore(i)) {
|
||||
PRBool preformattedNewline = !collapseWhitespace &&
|
||||
for (PRUint32 i = start, wordStart = start; i <= flowEndInTextRun; ++i) {
|
||||
PRBool preformattedNewline = PR_FALSE;
|
||||
if (i < flowEndInTextRun) {
|
||||
// XXXldb Shouldn't we be including the newline as part of the
|
||||
// segment that it ends rather than part of the segment that it
|
||||
// starts?
|
||||
preformattedNewline = !collapseWhitespace &&
|
||||
frag->CharAt(iter.ConvertSkippedToOriginal(i)) == '\n';
|
||||
if (!preformattedNewline) {
|
||||
// we can't break here
|
||||
if (!mTextRun->CanBreakLineBefore(i) && !preformattedNewline) {
|
||||
// we can't break here (and it's not the end of the flow)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nscoord width =
|
||||
NSToCoordCeil(mTextRun->GetAdvanceWidth(wordStart, i - wordStart, &provider));
|
||||
aData->currentLine += width;
|
||||
if (i > wordStart) {
|
||||
nscoord width =
|
||||
NSToCoordCeil(mTextRun->GetAdvanceWidth(wordStart, i - wordStart, &provider));
|
||||
aData->currentLine += width;
|
||||
aData->atStartOfLine = PR_FALSE;
|
||||
|
||||
if (collapseWhitespace) {
|
||||
nscoord trailingWhitespaceWidth;
|
||||
PRUint32 trimStart = GetEndOfTrimmedText(frag, wordStart, i, &iter);
|
||||
if (trimStart == start) {
|
||||
trailingWhitespaceWidth = width;
|
||||
if (collapseWhitespace) {
|
||||
nscoord trailingWhitespaceWidth;
|
||||
PRUint32 trimStart = GetEndOfTrimmedText(frag, wordStart, i, &iter);
|
||||
if (trimStart == start) {
|
||||
trailingWhitespaceWidth = width;
|
||||
} else {
|
||||
trailingWhitespaceWidth =
|
||||
NSToCoordCeil(mTextRun->GetAdvanceWidth(trimStart, i - trimStart, &provider));
|
||||
}
|
||||
aData->trailingWhitespace += trailingWhitespaceWidth;
|
||||
} else {
|
||||
trailingWhitespaceWidth =
|
||||
NSToCoordCeil(mTextRun->GetAdvanceWidth(trimStart, i - trimStart, &provider));
|
||||
aData->trailingWhitespace = 0;
|
||||
}
|
||||
aData->trailingWhitespace += trailingWhitespaceWidth;
|
||||
} else {
|
||||
aData->trailingWhitespace = 0;
|
||||
}
|
||||
|
||||
if (i < flowEndInTextRun) {
|
||||
aData->Break(aRenderingContext);
|
||||
if (preformattedNewline) {
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
} else {
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
}
|
||||
wordStart = i;
|
||||
}
|
||||
}
|
||||
@ -5016,7 +5022,7 @@ nsTextFrame::AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext,
|
||||
PRUint32 endRun = iter.GetSkippedOffset();
|
||||
aData->currentLine +=
|
||||
NSToCoordCeil(mTextRun->GetAdvanceWidth(startRun, endRun - startRun, &provider));
|
||||
aData->Break(aRenderingContext);
|
||||
aData->ForceBreak(aRenderingContext);
|
||||
startRun = endRun;
|
||||
}
|
||||
iter.AdvanceOriginal(1);
|
||||
|
44
layout/reftests/bugs/368155-negative-margins-1-ref.html
Normal file
44
layout/reftests/bugs/368155-negative-margins-1-ref.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Minimum intrinsic widths combined with negative margins</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { height: 2.5em; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<div style="width: 2em"></div>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<div style="width: 3em"></div>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<div style="width: 3em"></div>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<div style="width: 0.5em"></div>
|
||||
</td></tr></table>
|
||||
|
||||
</body>
|
||||
</html>
|
56
layout/reftests/bugs/368155-negative-margins-1.html
Normal file
56
layout/reftests/bugs/368155-negative-margins-1.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Minimum intrinsic widths combined with negative margins</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { height: 2.5em; }
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 0.5em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin-right: -1em"></span>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin-left: -1em"></span>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin: 0 -0.5em"></span>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin-right: -2em"></span>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin-left: -2em"></span>
|
||||
</td></tr></table>
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin: 0 -1em"></span>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<span style="margin-right: -2em"></span>​<span style="width: 3em"></span>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<span style="width: 3em"></span>​<span style="margin-right: -2em"></span>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td>
|
||||
<span style="width: 3em;"></span>​<span style="margin-left: -2em"></span>
|
||||
</td></tr></table>
|
||||
|
||||
<table border width="1"><tr><td style="text-indent: -.75em">
|
||||
<span style="margin-right: -.75em"></span>​<span></span>
|
||||
</td></tr></table>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -209,6 +209,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 368020-2.html 368020-2-ref.html # bug 3
|
||||
fails == 368020-3.html 368020-3-ref.html # bug 368085
|
||||
fails == 368020-4.html 368020-4-ref.html # bug 368085
|
||||
== 368020-5.html 368020-5-ref.html
|
||||
== 368155-negative-margins-1.html 368155-negative-margins-1-ref.html
|
||||
# we can't test this because there's antialiasing involved, and our comparison
|
||||
# is too exact
|
||||
# == 368247-1.html 368247-1-ref.html
|
||||
|
@ -12,3 +12,7 @@
|
||||
== text-indent-multiple-line.html text-indent-multiple-line-ref-inline-margin.html
|
||||
== text-indent-multiple-line.html text-indent-multiple-line-ref-float.html
|
||||
!= text-indent-multiple-line.html text-indent-multiple-line-notref-block-margin.html
|
||||
== text-indent-intrinsic-pref.html text-indent-intrinsic-pref-ref.html
|
||||
== text-indent-intrinsic-min.html text-indent-intrinsic-min-ref.html
|
||||
== text-indent-negative-intrinsic-pref.html text-indent-negative-intrinsic-pref-ref.html
|
||||
== text-indent-negative-intrinsic-min.html text-indent-negative-intrinsic-min-ref.html
|
||||
|
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- test against inline margin -->
|
||||
<div><span style="margin-left: 3em">X</span></div>
|
||||
|
||||
<!-- test against block padding -->
|
||||
<div style="padding-left: 3em;">X</div>
|
||||
|
||||
<!-- test against block width -->
|
||||
<div style="width: 4em;"></div>
|
||||
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
44
layout/reftests/text-indent/text-indent-intrinsic-min.html
Normal file
44
layout/reftests/text-indent/text-indent-intrinsic-min.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; width: 1px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- test against inline margin -->
|
||||
<div style="text-indent: 3em;">X</div>
|
||||
|
||||
<!-- test against block padding -->
|
||||
<div style="text-indent: 3em;">X</div>
|
||||
|
||||
<!-- test against block width -->
|
||||
<div style="text-indent: 3em;"><span></span></div>
|
||||
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span>​<span style="width: 2em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span>​<span style="width: 6em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span><br><span style="width: 2em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span><br><span style="width: 6em"></span></div>
|
||||
<pre style="text-indent: 3em"><span style="width: 1em"></span>
|
||||
<span style="width: 2em"></span></pre>
|
||||
<pre style="text-indent: 3em"><span style="width: 1em"></span>
|
||||
<span style="width: 6em"></span></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- test against inline margin -->
|
||||
<div><span style="margin-left: 3em">X</span></div>
|
||||
|
||||
<!-- test against block padding -->
|
||||
<div style="padding-left: 3em;">X</div>
|
||||
|
||||
<!-- test against block width -->
|
||||
<div style="width: 4em;"></div>
|
||||
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
<div style="width: 10em;"></div>
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
<div style="width: 4em;"></div>
|
||||
<div style="width: 6em;"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
44
layout/reftests/text-indent/text-indent-intrinsic-pref.html
Normal file
44
layout/reftests/text-indent/text-indent-intrinsic-pref.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- test against inline margin -->
|
||||
<div style="text-indent: 3em;">X</div>
|
||||
|
||||
<!-- test against block padding -->
|
||||
<div style="text-indent: 3em;">X</div>
|
||||
|
||||
<!-- test against block width -->
|
||||
<div style="text-indent: 3em;"><span></span></div>
|
||||
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span>​<span style="width: 2em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span>​<span style="width: 6em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span><br><span style="width: 2em"></span></div>
|
||||
<div style="text-indent: 3em"><span style="width: 1em"></span><br><span style="width: 6em"></span></div>
|
||||
<pre style="text-indent: 3em"><span style="width: 1em"></span>
|
||||
<span style="width: 2em"></span></pre>
|
||||
<pre style="text-indent: 3em"><span style="width: 1em"></span>
|
||||
<span style="width: 6em"></span></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div style="width: 0"></div>
|
||||
<div style="width: 2em"></div>
|
||||
<div style="width: 0"></div>
|
||||
<div style="width: 1em"></div>
|
||||
<div style="width: 3em"></div>
|
||||
<div style="width: 3em"></div>
|
||||
<div style="width: 1em"></div>
|
||||
<div style="width: 2em"></div>
|
||||
<div style="width: 5em"></div>
|
||||
<div style="width: 2em"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and negative text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="width: 1px">
|
||||
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 5em"></span></div>
|
||||
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 3em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 4em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span><br><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 5em"></span><br><span style="width: 1em"></span></div>
|
||||
<pre style="text-indent: -3em"><span style="width: 1em"></span>
|
||||
<span style="width: 5em"></span></pre>
|
||||
<pre style="text-indent: -3em"><span style="width: 5em"></span>
|
||||
<span style="width: 1em"></span></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div style="width: 0"></div>
|
||||
<div style="width: 2em"></div>
|
||||
<div style="width: 0"></div>
|
||||
<div style="width: 1em"></div>
|
||||
<div style="width: 4em"></div>
|
||||
<div style="width: 4em"></div>
|
||||
<div style="width: 1em"></div>
|
||||
<div style="width: 2em"></div>
|
||||
<div style="width: 5em"></div>
|
||||
<div style="width: 2em"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for intrinsic widths and negative text-indent</title>
|
||||
<style type="text/css">
|
||||
|
||||
body { font-size: 12px; }
|
||||
|
||||
body > div, body > pre {
|
||||
float: left; clear: left; margin: 1px; height: 2em;
|
||||
border: medium solid;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 5em"></span></div>
|
||||
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span>​<span style="width: 3em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 4em"></span>​<span style="width: 3em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 1em"></span><br><span style="width: 1em"></span></div>
|
||||
<div style="text-indent: -3em;"><span style="width: 5em"></span><br><span style="width: 1em"></span></div>
|
||||
<pre style="text-indent: -3em"><span style="width: 1em"></span>
|
||||
<span style="width: 5em"></span></pre>
|
||||
<pre style="text-indent: -3em"><span style="width: 5em"></span>
|
||||
<span style="width: 1em"></span></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user