Bug 1322698 - Synthesize an 'appearance:none' checkbox/radio baseline from its margin-box by default (in an inline context). r=dholbert
--- a/layout/forms/nsFormControlFrame.cpp
+++ b/layout/forms/nsFormControlFrame.cpp
@@ -96,16 +96,29 @@ nsFormControlFrame::GetIntrinsicBSize()
return nsPresContext::CSSPixelsToAppUnits(13 - 2 * 2);
}
nscoord
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
// at the block-end of the control (use the block-end content edge rather
// than the margin edge).
// For "inverted" lines (typically in writing-mode:vertical-lr), use the
// block-start end instead.
return aWritingMode.IsLineInverted()
? GetLogicalUsedBorderAndPadding(aWritingMode).BStart(aWritingMode)
: BSize(aWritingMode) -