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 @@ + + + + Testcase for bug 971653 + + + + + +
+ legend +
+
+ +
+ legend +
+
+ +
+
+
+ +
+
+
+ + + + diff --git a/layout/reftests/forms/fieldset/abs-pos-child-sizing.html b/layout/reftests/forms/fieldset/abs-pos-child-sizing.html new file mode 100644 index 000000000000..72d47deac9bd --- /dev/null +++ b/layout/reftests/forms/fieldset/abs-pos-child-sizing.html @@ -0,0 +1,64 @@ + + + + Testcase for bug 971653 + + + + + +
+ legend +
+
+ +
+ legend +
+
+ +
+
+
+ +
+
+
+ + + + diff --git a/layout/reftests/forms/fieldset/reftest.list b/layout/reftests/forms/fieldset/reftest.list index da8e4f81c0e5..bd5e86e66bde 100644 --- a/layout/reftests/forms/fieldset/reftest.list +++ b/layout/reftests/forms/fieldset/reftest.list @@ -9,3 +9,4 @@ random-if(B2G) == fieldset-overflow-auto-1.html fieldset-overflow-auto-1-ref.htm == relpos-legend-1.html relpos-legend-1-ref.html == relpos-legend-2.html relpos-legend-2-ref.html test-pref(layout.css.sticky.enabled,true) == sticky-legend-1.html sticky-legend-1-ref.html +== abs-pos-child-sizing.html abs-pos-child-sizing-ref.html