Bug 898913 - Look for the floating first-letter frame to remove on the kPushedFloatsList too. r=dholbert

This commit is contained in:
Mats Palmgren 2013-08-10 23:00:46 +00:00
Родитель d4fa38741b
Коммит 5aaa7da647
3 изменённых файлов: 45 добавлений и 11 удалений

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

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div { page-break-inside: avoid; }
div:first-letter { float: right; }
</style>
<script>
function boom()
{
var d = document.getElementById('d');
d.removeChild(d.firstChild);
}
</script>
</head>
<body onload="boom();">
<div id="d">&#x202B;</div>
</body>
</html>

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

@ -414,3 +414,4 @@ pref(layers.force-active,true) load 859526-1.html
pref(layers.force-active,true) load 859630-1.html
load 866588.html
load 897852.html
asserts(4-6) load 898913.html # bug 847368

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

@ -9792,6 +9792,18 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
}
}
static nsIFrame*
FindFirstLetterFrame(nsIFrame* aFrame, nsIFrame::ChildListID aListID)
{
nsFrameList list = aFrame->GetChildList(aListID);
for (nsFrameList::Enumerator e(list); !e.AtEnd(); e.Next()) {
if (nsGkAtoms::letterFrame == e.get()->GetType()) {
return e.get();
}
}
return nullptr;
}
nsresult
nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsPresContext* aPresContext,
@ -9799,18 +9811,15 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsIFrame* aBlockFrame,
bool* aStopLooking)
{
// First look for the float frame that is a letter frame
nsIFrame* floatFrame = aBlockFrame->GetFirstChild(nsIFrame::kFloatList);
while (floatFrame) {
// See if we found a floating letter frame
if (nsGkAtoms::letterFrame == floatFrame->GetType()) {
break;
}
floatFrame = floatFrame->GetNextSibling();
}
// Look for the first letter frame on the kFloatList, then kPushedFloatsList.
nsIFrame* floatFrame =
::FindFirstLetterFrame(aBlockFrame, nsIFrame::kFloatList);
if (!floatFrame) {
// No such frame
return NS_OK;
floatFrame =
::FindFirstLetterFrame(aBlockFrame, nsIFrame::kPushedFloatsList);
if (!floatFrame) {
return NS_OK;
}
}
// Take the text frame away from the letter frame (so it isn't