diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 91b9bb0962e..3fd94db5021 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -1794,12 +1794,13 @@ mRect.height); fprintf(out, " [content=%p]", mContent); // output the img src url - nsCOMPtr uri; - mLoads[0].mRequest->GetURI(getter_AddRefs(uri)); - nsCAutoString uristr; - uri->GetAsciiSpec(uristr); - fprintf(out, " [src=%s]", uristr.get()); - + if (mLoads[0].mRequest) { + nsCOMPtr uri; + mLoads[0].mRequest->GetURI(getter_AddRefs(uri)); + nsCAutoString uristr; + uri->GetAsciiSpec(uristr); + fprintf(out, " [src=%s]", uristr.get()); + } fputs("\n", out); return NS_OK; } diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index b7d784e528e..ae015af6d57 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -1420,6 +1420,19 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd, // XXXwaterson probably not the right way to get this; e.g., embeddings, etc. PRBool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection); + PRBool reducedBothMargins = PR_FALSE; + // An HR needs to reduce the avail width by both margins, because it effectively fits + // on one line. If it gets continued then only the continuation has any width. XXX - Are + // there other elements with these characterstics and if so, is there a bit indicating that? + if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) { + nsCOMPtr frameType; + pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); + if (nsLayoutAtoms::hrFrame == frameType.get()) { + aReflowState.availableWidth -= pfd->mMargin.left + pfd->mMargin.right; + reducedBothMargins = PR_TRUE; + } + } + // Only apply start-margin on the first-in flow for inline frames nsIFrame *prevInFlow; pfd->mFrame->GetPrevInFlow(&prevInFlow); @@ -1432,7 +1445,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd, pfd->mMargin.right = 0; } - if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) { + if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) && !reducedBothMargins){ // Adjust available width to account for the left margin. The // right margin will be accounted for when we finish flowing the // frame. diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 91b9bb0962e..3fd94db5021 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -1794,12 +1794,13 @@ mRect.height); fprintf(out, " [content=%p]", mContent); // output the img src url - nsCOMPtr uri; - mLoads[0].mRequest->GetURI(getter_AddRefs(uri)); - nsCAutoString uristr; - uri->GetAsciiSpec(uristr); - fprintf(out, " [src=%s]", uristr.get()); - + if (mLoads[0].mRequest) { + nsCOMPtr uri; + mLoads[0].mRequest->GetURI(getter_AddRefs(uri)); + nsCAutoString uristr; + uri->GetAsciiSpec(uristr); + fprintf(out, " [src=%s]", uristr.get()); + } fputs("\n", out); return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index b7d784e528e..ae015af6d57 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -1420,6 +1420,19 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd, // XXXwaterson probably not the right way to get this; e.g., embeddings, etc. PRBool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection); + PRBool reducedBothMargins = PR_FALSE; + // An HR needs to reduce the avail width by both margins, because it effectively fits + // on one line. If it gets continued then only the continuation has any width. XXX - Are + // there other elements with these characterstics and if so, is there a bit indicating that? + if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) { + nsCOMPtr frameType; + pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); + if (nsLayoutAtoms::hrFrame == frameType.get()) { + aReflowState.availableWidth -= pfd->mMargin.left + pfd->mMargin.right; + reducedBothMargins = PR_TRUE; + } + } + // Only apply start-margin on the first-in flow for inline frames nsIFrame *prevInFlow; pfd->mFrame->GetPrevInFlow(&prevInFlow); @@ -1432,7 +1445,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd, pfd->mMargin.right = 0; } - if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) { + if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) && !reducedBothMargins){ // Adjust available width to account for the left margin. The // right margin will be accounted for when we finish flowing the // frame.