Hacky fix to make HR's ALIGN attribute work again. b=158197 r=mjudge sr=bzbarsky

This commit is contained in:
dbaron%fas.harvard.edu 2002-08-06 12:59:48 +00:00
Родитель 5034fc364c
Коммит 259a56c337
2 изменённых файлов: 42 добавлений и 4 удалений

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

@ -3052,9 +3052,28 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
content->GetTag(*getter_AddRefs(tag));
if (tag == nsHTMLAtoms::hr) {
// get the alignment from the HR frame
// hack to get the HRFrame due to the wrapper frame for the
// quirks mode anonymous content
nsIFrame *hrFrame = psd->mFirstFrame->mFrame;
nsCOMPtr<nsIAtom> frameType;
hrFrame->GetFrameType(getter_AddRefs(frameType));
if (frameType != nsLayoutAtoms::hrFrame) {
// |hrFrame| is a wrapper frame, so the real frame is one
// of its children.
nsIFrame *child;
for (hrFrame->FirstChild(mPresContext, nsnull, &child);
child; child->GetNextSibling(&child)) {
child->GetFrameType(getter_AddRefs(frameType));
if (frameType == nsLayoutAtoms::hrFrame) {
hrFrame = child;
break;
}
}
}
const nsStyleMargin* margin;
psd->mFirstFrame->mFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&)margin);
::GetStyleData(hrFrame, &margin);
textAlign = NS_STYLE_TEXT_ALIGN_CENTER;
nsStyleCoord zero(nscoord(0));
nsStyleCoord temp;

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

@ -3052,9 +3052,28 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
content->GetTag(*getter_AddRefs(tag));
if (tag == nsHTMLAtoms::hr) {
// get the alignment from the HR frame
// hack to get the HRFrame due to the wrapper frame for the
// quirks mode anonymous content
nsIFrame *hrFrame = psd->mFirstFrame->mFrame;
nsCOMPtr<nsIAtom> frameType;
hrFrame->GetFrameType(getter_AddRefs(frameType));
if (frameType != nsLayoutAtoms::hrFrame) {
// |hrFrame| is a wrapper frame, so the real frame is one
// of its children.
nsIFrame *child;
for (hrFrame->FirstChild(mPresContext, nsnull, &child);
child; child->GetNextSibling(&child)) {
child->GetFrameType(getter_AddRefs(frameType));
if (frameType == nsLayoutAtoms::hrFrame) {
hrFrame = child;
break;
}
}
}
const nsStyleMargin* margin;
psd->mFirstFrame->mFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&)margin);
::GetStyleData(hrFrame, &margin);
textAlign = NS_STYLE_TEXT_ALIGN_CENTER;
nsStyleCoord zero(nscoord(0));
nsStyleCoord temp;