/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Maybe<nscoord> nsCheckboxRadioFrame::GetNaturalBaselineBOffset(
WritingMode aWM, BaselineSharingGroup aBaselineGroup,
BaselineExportContext) const {
NS_ASSERTION(!IsSubtreeDirty(), "frame must not be dirty");
if (aBaselineGroup == BaselineSharingGroup::Last) { return Nothing{};
}
if (StyleDisplay()->IsBlockOutsideStyle()) { return Nothing{};
}
// For appearance:none we use a standard CSS baseline, i.e. synthesized from // our margin-box. if (!StyleDisplay()->HasAppearance()) { return Nothing{};
}
if (aWM.IsCentralBaseline()) { return Some(BSize(aWM) / 2);
}
// 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. // See kCheckboxRadioBorderWidth in Theme.cpp
CSSCoord border = PresContext()->Theme()->GetCheckboxRadioBorderWidth(); auto bp = CSSPixel::ToAppUnits(Style()->EffectiveZoom().Zoom(border)); return Some(aWM.IsLineInverted() ? std::min(bp, BSize(aWM))
: std::max(0, BSize(aWM) - bp));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.