Bug 1322698 - Synthesize an 'appearance:none' checkbox/radio baseline from its margin-box by default (in an inline context). r=dholbert
authorMats Palmgren <mats@mozilla.com>
Fri, 23 Dec 2016 19:11:03 +0100
changeset 453571 c718681647c73a4999035b0cef1a4f90f553c869
parent 453570 8e6a515461cb2f8f8e8f567739ea9794533f0ba9
child 453572 326d947d6bb6b10fc3b985a1093d3862f561f6a0
push id39711
push userdmitchell@mozilla.com
push dateFri, 23 Dec 2016 21:59:47 +0000
reviewersdholbert
bugs1322698
milestone53.0a1
Bug 1322698 - Synthesize an 'appearance:none' checkbox/radio baseline from its margin-box by default (in an inline context). r=dholbert
layout/forms/nsFormControlFrame.cpp
--- 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) -