mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1209710 - Use convenience methods to simplify CSSAlignUtils::AlignJustifySelf(). r=layout-reviewers,jfkthame
We already have convenience methods added over the years :) Differential Revision: https://phabricator.services.mozilla.com/D95823
This commit is contained in:
parent
bece5cbd4e
commit
13893d56db
@ -52,30 +52,14 @@ nscoord CSSAlignUtils::AlignJustifySelf(const StyleAlignFlags& aAlignment,
|
||||
alignment = StyleAlignFlags::END;
|
||||
}
|
||||
|
||||
// XXX try to condense this code a bit by adding the necessary convenience
|
||||
// methods? (bug 1209710)
|
||||
|
||||
// Get the item's margin corresponding to the container's start/end side.
|
||||
WritingMode wm = aRI.GetWritingMode();
|
||||
const LogicalMargin margin = aRI.ComputedLogicalMargin(wm);
|
||||
nscoord marginStart, marginEnd;
|
||||
if (aAxis == eLogicalAxisBlock) {
|
||||
if (MOZ_LIKELY(isSameSide)) {
|
||||
marginStart = margin.BStart(wm);
|
||||
marginEnd = margin.BEnd(wm);
|
||||
} else {
|
||||
marginStart = margin.BEnd(wm);
|
||||
marginEnd = margin.BStart(wm);
|
||||
}
|
||||
} else {
|
||||
if (MOZ_LIKELY(isSameSide)) {
|
||||
marginStart = margin.IStart(wm);
|
||||
marginEnd = margin.IEnd(wm);
|
||||
} else {
|
||||
marginStart = margin.IEnd(wm);
|
||||
marginEnd = margin.IStart(wm);
|
||||
}
|
||||
}
|
||||
const auto startSide = MakeLogicalSide(
|
||||
aAxis, MOZ_LIKELY(isSameSide) ? eLogicalEdgeStart : eLogicalEdgeEnd);
|
||||
const nscoord marginStart = margin.Side(startSide, wm);
|
||||
const auto endSide = GetOppositeSide(startSide);
|
||||
const nscoord marginEnd = margin.Side(endSide, wm);
|
||||
|
||||
const auto& styleMargin = aRI.mStyleMargin->mMargin;
|
||||
bool hasAutoMarginStart;
|
||||
|
Loading…
Reference in New Issue
Block a user