Bug 1106755 - Make more overflow area computation code apply only to floating ::first-letter. r=jfkthame

In inline layout there's no need to do anything with overflow areas
since RelativePositionFrames handles it.  Apparently doing some of the
work messes things up somehow, so the easy fix is to make the inline
::first-letter codepath behave more like nsInlineFrame and not do any
messing with overflow areas.  So this moves the rest of the overflow
code in nsFirstLetterFrame::Reflow into the float-only codepath.  There
don't appear to be any ordering issues with the movement, since the code
that the FinishAndStoreOverflow call is moved across deals with creating
and destroying continuations of the child.

All the added tests pass with the patch, but without the patch
overflow-inline-nooverflow.html fails.
This commit is contained in:
L. David Baron 2015-01-31 11:00:44 -08:00
Родитель c64f6910f8
Коммит 958c00e0fe
11 изменённых файлов: 145 добавлений и 8 удалений

Просмотреть файл

@ -226,6 +226,15 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
aMetrics.SetSize(wm, convertedSize);
aMetrics.SetBlockStartAscent(kidMetrics.BlockStartAscent() +
bp.BStart(wm));
// Ensure that the overflow rect contains the child textframe's
// overflow rect.
// Note that if this is floating, the overline/underline drawable
// area is in the overflow rect of the child textframe.
aMetrics.UnionOverflowAreasWithDesiredBounds();
ConsiderChildOverflow(aMetrics.mOverflowAreas, kid);
FinishAndStoreOverflow(&aMetrics);
}
else {
// Pretend we are a span and reflow the child frame
@ -247,12 +256,6 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
nsLayoutUtils::SetBSizeFromFontMetrics(this, aMetrics, bp, lineWM, wm);
}
// Ensure that the overflow rect contains the child textframe's overflow rect.
// Note that if this is floating, the overline/underline drawable area is in
// the overflow rect of the child textframe.
aMetrics.UnionOverflowAreasWithDesiredBounds();
ConsiderChildOverflow(aMetrics.mOverflowAreas, kid);
if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) {
// Create a continuation or remove existing continuations based on
// the reflow completion status.
@ -287,8 +290,6 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
}
}
FinishAndStoreOverflow(&aMetrics);
NS_FRAME_SET_TRUNCATION(aReflowStatus, aReflowState, aMetrics);
}

Просмотреть файл

@ -0,0 +1,14 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 8em; width: 5em;
padding: 3px;
background: yellow; color: black;
line-height: 1.0;
}
div::first-letter { font-size: 1.2em; float: left; }
</style>
<div>Hello world, testing, testing, testing, testing</div>

Просмотреть файл

@ -0,0 +1,15 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 8em; width: 5em;
padding: 3px;
background: yellow; color: black;
overflow: auto;
line-height: 1.0;
}
div::first-letter { font-size: 1.2em; float: left; }
</style>
<div>Hello world, testing, testing, testing, testing</div>

Просмотреть файл

@ -0,0 +1,14 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 3em; width: 8em;
padding: 3px;
background: yellow; color: black;
line-height: 1.0;
}
div::first-letter { font-size: 4em; float: left; }
</style>
<div>Hello</div>

Просмотреть файл

@ -0,0 +1,15 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 3em; width: 8em;
padding: 3px;
background: yellow; color: black;
overflow: auto;
line-height: 1.0;
}
div::first-letter { font-size: 4em; float: left; }
</style>
<div>Hello</div>

Просмотреть файл

@ -0,0 +1,14 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 8em; width: 5em;
padding: 3px;
background: yellow; color: black;
line-height: 1.0;
}
div::first-letter { font-size: 1.2em }
</style>
<div>Hello world, testing, testing, testing, testing</div>

Просмотреть файл

@ -0,0 +1,15 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 8em; width: 5em;
padding: 3px;
background: yellow; color: black;
overflow: auto;
line-height: 1.0;
}
div::first-letter { font-size: 1.2em }
</style>
<div>Hello world, testing, testing, testing, testing</div>

Просмотреть файл

@ -0,0 +1,14 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 3em; width: 8em;
padding: 3px;
background: yellow; color: black;
line-height: 1.0;
}
div::first-letter { font-size: 4em }
</style>
<div>Hello</div>

Просмотреть файл

@ -0,0 +1,15 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 3em; width: 8em;
padding: 3px;
background: yellow; color: black;
overflow: auto;
line-height: 1.0;
}
span { font-size: 4em }
</style>
<div><span>H</span>ello</div>

Просмотреть файл

@ -0,0 +1,15 @@
<title>::first-letter and overflow</title>
<style>
div {
height: 3em; width: 8em;
padding: 3px;
background: yellow; color: black;
overflow: auto;
line-height: 1.0;
}
div::first-letter { font-size: 4em }
</style>
<div>Hello</div>

Просмотреть файл

@ -67,3 +67,8 @@ fails-if(winWidget||cocoaWidget) == 617869-1.html 617869-1-ref.html
fails-if(gtk2Widget) random-if(winWidget&&!d2d) == font-text-styles-floater.html font-text-styles-floater-ref.html # bug 992846
== inline-height-empty.html inline-height-empty-ref.html
HTTP(..) == indic-clusters-1.html indic-clusters-1-ref.html
== overflow-float-nooverflow.html overflow-float-nooverflow-ref.html
== overflow-float-overflow.html overflow-float-overflow-notref.html
== overflow-inline-nooverflow.html overflow-inline-nooverflow-ref.html
!= overflow-inline-overflow.html overflow-inline-overflow-notref.html
== overflow-inline-overflow.html overflow-inline-overflow-ref.html