Bug 1352238 Part 1 - Make box construction and layout for radio/checkbox elements work the same on Android as on other platforms. r=mats

MozReview-Commit-ID: NmWepjKDVj

--HG--
extra : rebase_source : b8e1c2684672c3426708099225342ebae152b3f4
This commit is contained in:
Louis Chang 2017-09-05 22:44:24 +08:00
Родитель f7ab109d5e
Коммит 057601eaa6
2 изменённых файлов: 1 добавлений и 20 удалений

Просмотреть файл

@ -3836,10 +3836,6 @@ nsCSSFrameConstructor::FindInputData(Element* aElement,
auto controlType = control->ControlType();
// Note that Android widgets don't have theming support and thus
// appearance:none is the same as any other appearance value.
// So this chunk doesn't apply there:
#if !defined(MOZ_WIDGET_ANDROID)
// radio and checkbox inputs with appearance:none should be constructed
// by display type. (Note that we're not checking that appearance is
// not (respectively) NS_THEME_RADIO and NS_THEME_CHECKBOX.)
@ -3848,7 +3844,6 @@ nsCSSFrameConstructor::FindInputData(Element* aElement,
aStyleContext->StyleDisplay()->mAppearance == NS_THEME_NONE) {
return nullptr;
}
#endif
return FindDataByInt(controlType, aElement, aStyleContext,
sInputData, ArrayLength(sInputData));

Просмотреть файл

@ -44,11 +44,7 @@ nsFormControlFrame::GetMinISize(gfxContext *aRenderingContext)
{
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
#if !defined(MOZ_WIDGET_ANDROID)
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
#else
result = DefaultSize();
#endif
return result;
}
@ -57,11 +53,7 @@ nsFormControlFrame::GetPrefISize(gfxContext *aRenderingContext)
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
#if !defined(MOZ_WIDGET_ANDROID)
result = StyleDisplay()->mAppearance == NS_THEME_NONE ? 0 : DefaultSize();
#else
result = DefaultSize();
#endif
return result;
}
@ -77,11 +69,10 @@ nsFormControlFrame::ComputeAutoSize(gfxContext* aRC,
ComputeSizeFlags aFlags)
{
LogicalSize size(aWM, 0, 0);
#if !defined(MOZ_WIDGET_ANDROID)
if (StyleDisplay()->mAppearance == NS_THEME_NONE) {
return size;
}
#endif
// Note: this call always set the BSize to NS_UNCONSTRAINEDSIZE.
size = nsAtomicContainerFrame::ComputeAutoSize(aRC, aWM, aCBSize,
aAvailableISize, aMargin,
@ -96,16 +87,11 @@ nsFormControlFrame::GetLogicalBaseline(WritingMode aWritingMode) const
NS_ASSERTION(!NS_SUBTREE_DIRTY(this),
"frame must not be dirty");
// NOTE: on Android we use appearance:none by default for checkbox/radio,
// so the different layout for appearance:none we have on other platforms
// doesn't work there. *shrug*
#if !defined(MOZ_WIDGET_ANDROID)
// For appearance:none we use a standard CSS baseline, i.e. synthesized from
// our margin-box.
if (StyleDisplay()->mAppearance == NS_THEME_NONE) {
return nsAtomicContainerFrame::GetLogicalBaseline(aWritingMode);
}
#endif
// This is for compatibility with Chrome, Safari and Edge (Dec 2016).
// Treat radio buttons and checkboxes as having an intrinsic baseline