Bug 605985 part 1 - Remove most default styling for checkbox and radio buttons and make the instrinsic size be zero for -moz-appearance:none checkbox/radios. r=dholbert

This commit is contained in:
Mats Palmgren
2017-02-09 21:22:40 +01:00
parent 4a98f17712
commit 69fd5767bc
3 changed files with 73 additions and 54 deletions

View File

@@ -49,7 +49,7 @@ nsFormControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
result = GetIntrinsicISize();
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
return result;
}
@@ -58,13 +58,13 @@ nsFormControlFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
result = GetIntrinsicISize();
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
return result;
}
/* virtual */
LogicalSize
nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext,
nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRC,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
@@ -73,27 +73,16 @@ nsFormControlFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags)
{
const WritingMode wm = GetWritingMode();
LogicalSize result(wm, GetIntrinsicISize(), GetIntrinsicBSize());
return result.ConvertTo(aWM, wm);
}
nscoord
nsFormControlFrame::GetIntrinsicISize()
{
// Provide a reasonable default for sites that use an "auto" height.
// Note that if you change this, you should change the values in forms.css
// as well. This is the 13px default width minus the 2px default border.
return nsPresContext::CSSPixelsToAppUnits(13 - 2 * 2);
}
nscoord
nsFormControlFrame::GetIntrinsicBSize()
{
// Provide a reasonable default for sites that use an "auto" height.
// Note that if you change this, you should change the values in forms.css
// as well. This is the 13px default width minus the 2px default border.
return nsPresContext::CSSPixelsToAppUnits(13 - 2 * 2);
LogicalSize size(aWM, 0, 0);
if (StyleDisplay()->mAppearance == NS_THEME_NONE) {
return size;
}
// Note: this call always set the BSize to NS_UNCONSTRAINEDSIZE.
size = nsAtomicContainerFrame::ComputeAutoSize(aRC, aWM, aCBSize,
aAvailableISize, aMargin,
aBorder, aPadding, aFlags);
size.BSize(aWM) = DefaultSize();
return size;
}
nscoord