зеркало из https://github.com/mozilla/gecko-dev.git
Bug 504622 part 2. Allow fieldsets to shrink below their intrinsic min-width and below the width of their legend if their min-width is explicitly overridden. r=dbaron
This commit is contained in:
Родитель
6b2f992350
Коммит
6f55f6fce6
|
@ -341,42 +341,6 @@ nsFieldSetFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
|
|||
}
|
||||
|
||||
/* virtual */
|
||||
LogicalSize
|
||||
nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
WritingMode aWM,
|
||||
const LogicalSize& aCBSize,
|
||||
nscoord aAvailableISize,
|
||||
const LogicalSize& aMargin,
|
||||
const LogicalSize& aBorder,
|
||||
const LogicalSize& aPadding,
|
||||
ComputeSizeFlags aFlags)
|
||||
{
|
||||
LogicalSize result =
|
||||
nsContainerFrame::ComputeSize(aRenderingContext, aWM,
|
||||
aCBSize, aAvailableISize,
|
||||
aMargin, aBorder, aPadding, aFlags);
|
||||
|
||||
// XXX The code below doesn't make sense if the caller's writing mode
|
||||
// is orthogonal to this frame's. Not sure yet what should happen then;
|
||||
// for now, just bail out.
|
||||
if (aWM.IsVertical() != GetWritingMode().IsVertical()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Fieldsets never shrink below their min width.
|
||||
|
||||
// If we're a container for font size inflation, then shrink
|
||||
// wrapping inside of us should not apply font size inflation.
|
||||
AutoMaybeDisableFontInflation an(this);
|
||||
|
||||
nscoord minISize = GetMinISize(aRenderingContext);
|
||||
if (minISize > result.ISize(aWM)) {
|
||||
result.ISize(aWM) = minISize;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aDesiredSize,
|
||||
|
@ -424,18 +388,6 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
LogicalSize legendAvailSize = aReflowInput.ComputedSizeWithPadding(legendWM);
|
||||
innerAvailSize.BSize(innerWM) = legendAvailSize.BSize(legendWM) =
|
||||
NS_UNCONSTRAINEDSIZE;
|
||||
NS_ASSERTION(!inner ||
|
||||
nsLayoutUtils::IntrinsicForContainer(aReflowInput.mRenderingContext,
|
||||
inner,
|
||||
nsLayoutUtils::MIN_ISIZE) <=
|
||||
innerAvailSize.ISize(innerWM),
|
||||
"Bogus availSize.ISize; should be bigger");
|
||||
NS_ASSERTION(!legend ||
|
||||
nsLayoutUtils::IntrinsicForContainer(aReflowInput.mRenderingContext,
|
||||
legend,
|
||||
nsLayoutUtils::MIN_ISIZE) <=
|
||||
legendAvailSize.ISize(legendWM),
|
||||
"Bogus availSize.ISize; should be bigger");
|
||||
|
||||
// get our border and padding
|
||||
LogicalMargin border = aReflowInput.ComputedLogicalBorderPadding() -
|
||||
|
@ -599,11 +551,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT_UNREACHABLE("unexpected GetLogicalAlign value");
|
||||
}
|
||||
} else {
|
||||
// otherwise make place for the legend
|
||||
// otherwise just start-align it.
|
||||
mLegendRect.IStart(wm) = innerContentRect.IStart(wm);
|
||||
innerContentRect.ISize(wm) = mLegendRect.ISize(wm);
|
||||
contentRect.ISize(wm) = mLegendRect.ISize(wm) +
|
||||
aReflowInput.ComputedLogicalPadding().IStartEnd(wm);
|
||||
}
|
||||
|
||||
// place the legend
|
||||
|
|
|
@ -24,15 +24,6 @@ public:
|
|||
nsLayoutUtils::IntrinsicISizeType);
|
||||
virtual nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
|
||||
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
|
||||
virtual mozilla::LogicalSize
|
||||
ComputeSize(nsRenderingContext *aRenderingContext,
|
||||
mozilla::WritingMode aWritingMode,
|
||||
const mozilla::LogicalSize& aCBSize,
|
||||
nscoord aAvailableISize,
|
||||
const mozilla::LogicalSize& aMargin,
|
||||
const mozilla::LogicalSize& aBorder,
|
||||
const mozilla::LogicalSize& aPadding,
|
||||
ComputeSizeFlags aFlags) override;
|
||||
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,10 @@ fieldset { border-right:7px solid blue; font-size: 16px; }
|
|||
|
||||
#test5 { position:fixed; top:12em; width:200px; }
|
||||
#test5 fieldset { background:lime;}
|
||||
#test5 .legend { margin-left: 193px; background:pink; }
|
||||
/* Percentage margins don't get counted in intrinsic width, so make sure that
|
||||
our fixed-size margins sum to 0, so they also do not affect intrinsic width
|
||||
either. */
|
||||
#test5 .legend { margin-left: 193px; background:pink; margin-right: -193px; }
|
||||
|
||||
#test6 { position:fixed; left:20px; top:15em; width:400px; }
|
||||
#test6 fieldset { width:300px; }
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<fieldset style="width: -moz-fit-content">
|
||||
Longwordgoeshere
|
||||
</fieldset>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<fieldset style="width: 0">
|
||||
Longwordgoeshere
|
||||
</fieldset>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<body style="width: 0">
|
||||
<fieldset style="width: 0">
|
||||
Longwordgoeshere
|
||||
</fieldset>
|
||||
</body>
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<fieldset style="width: -moz-fit-content">‌<!-- To give us the right height --></fieldset>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<fieldset style="width: 0; min-width: 0">
|
||||
<div style="visibility: hidden">Longwordgoeshere</div>
|
||||
</fieldset>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<body style="width: 0">
|
||||
<fieldset style="min-width: 0">
|
||||
<div style="visibility: hidden">Longwordgoeshere</div>
|
||||
</fieldset>
|
||||
</body>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
width: 0;
|
||||
}
|
||||
legend {
|
||||
width: 100px;
|
||||
height: 20px;
|
||||
background: white;
|
||||
}
|
||||
</style>
|
||||
<fieldset>
|
||||
<legend></legend>
|
||||
</fieldset>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
width: 0;
|
||||
}
|
||||
legend {
|
||||
width: 100px;
|
||||
height: 20px;
|
||||
}
|
||||
</style>
|
||||
<fieldset>
|
||||
<legend></legend>
|
||||
</fieldset>
|
|
@ -16,6 +16,11 @@ fuzzy-if(skiaContent,1,40768) == abs-pos-child-sizing.html abs-pos-child-sizing-
|
|||
== legend-rtl.html legend-rtl-ref.html
|
||||
== fieldset-grid-001.html fieldset-grid-001-ref.html
|
||||
== fieldset-flexbox-001.html fieldset-flexbox-001-ref.html
|
||||
== fieldset-min-width-1a.html fieldset-min-width-1-ref.html
|
||||
== fieldset-min-width-1b.html fieldset-min-width-1-ref.html
|
||||
== fieldset-min-width-2a.html fieldset-min-width-2-ref.html
|
||||
== fieldset-min-width-2b.html fieldset-min-width-2-ref.html
|
||||
== legend-overlapping-right-border-1.html legend-overlapping-right-border-1-ref.html
|
||||
== fieldset-border-image-1a.html fieldset-border-image-1-ref.html
|
||||
== fieldset-border-image-1b.html fieldset-border-image-1-ref.html
|
||||
== fieldset-border-image-2a.html fieldset-border-image-2-ref.html
|
||||
|
|
|
@ -71,6 +71,7 @@ fieldset {
|
|||
padding-inline-start: 0.625em;
|
||||
padding-inline-end: 0.625em;
|
||||
border: 2px groove ThreeDLightShadow;
|
||||
min-width: -moz-min-content;
|
||||
}
|
||||
|
||||
label {
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[min-width-not-important.html]
|
||||
type: reftest
|
||||
expected: FAIL
|
Загрузка…
Ссылка в новой задаче