diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index d341f1a94ac9..84be42da7a11 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -891,11 +891,13 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState, // frame and not always sticking them in block frames. // First, find the reflow state for the outermost frame for this - // content. + // content, except for fieldsets where the inner anonymous frame has + // the correct padding area with the legend taken into account. const nsHTMLReflowState* aLastRS = &aReflowState; const nsHTMLReflowState* lastButOneRS = &aReflowState; while (aLastRS->parentReflowState && - aLastRS->parentReflowState->frame->GetContent() == frame->GetContent()) { + aLastRS->parentReflowState->frame->GetContent() == frame->GetContent() && + aLastRS->parentReflowState->frame->GetType() != nsGkAtoms::fieldSetFrame) { lastButOneRS = aLastRS; aLastRS = aLastRS->parentReflowState; } diff --git a/layout/reftests/forms/fieldset/abs-pos-child-sizing-ref.html b/layout/reftests/forms/fieldset/abs-pos-child-sizing-ref.html new file mode 100644 index 000000000000..405cfaf0a9d9 --- /dev/null +++ b/layout/reftests/forms/fieldset/abs-pos-child-sizing-ref.html @@ -0,0 +1,79 @@ + +
+ +