diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 28e43d4b574..c89c89596d9 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -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 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; diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 28e43d4b574..c89c89596d9 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -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 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;