Bug 1305844 - Make most align/justify nsStylePosition members public, and remove trivial accessors. r=dholbert

--HG--
extra : rebase_source : a38fdd5d608370e3408a698fd887cc15f5c01537
This commit is contained in:
Brad Werth 2016-10-03 13:05:35 -07:00
Родитель c52dc70005
Коммит 25da11fb5e
5 изменённых файлов: 15 добавлений и 28 удалений

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

@ -2743,7 +2743,7 @@ CrossAxisPositionTracker::
aAxisTracker.IsCrossAxisReversed()),
mPackingSpaceRemaining(0),
mNumPackingSpacesRemaining(0),
mAlignContent(aReflowInput.mStylePosition->ComputedAlignContent())
mAlignContent(aReflowInput.mStylePosition->mAlignContent)
{
MOZ_ASSERT(aFirstLine, "null first line pointer");
@ -4067,7 +4067,7 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
const auto justifyContent = IsLegacyBox(aReflowInput.mStyleDisplay,
mStyleContext) ?
ConvertLegacyStyleToJustifyContent(StyleXUL()) :
aReflowInput.mStylePosition->ComputedJustifyContent();
aReflowInput.mStylePosition->mJustifyContent;
for (FlexLine* line = lines.getFirst(); line; line = line->getNext()) {
// Main-Axis Alignment - Flexbox spec section 9.5

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

@ -4073,7 +4073,7 @@ nsGridContainerFrame::Tracks::InitializeItemBaselines(
// For this purpose, the 'start', 'end', 'flex-start', and 'flex-end'
// values of 'align-self' are treated as either 'self-start' or
// 'self-end', whichever they end up equivalent to.
auto alignContent = child->StylePosition()->ComputedAlignContent();
auto alignContent = child->StylePosition()->mAlignContent;
alignContent &= ~NS_STYLE_ALIGN_FLAG_BITS;
if (alignContent == NS_STYLE_ALIGN_BASELINE ||
alignContent == NS_STYLE_ALIGN_LAST_BASELINE) {
@ -4675,8 +4675,8 @@ nsGridContainerFrame::Tracks::AlignJustifyContent(
}
const bool isAlign = mAxis == eLogicalAxisBlock;
auto valueAndFallback = isAlign ? aStyle->ComputedAlignContent() :
aStyle->ComputedJustifyContent();
auto valueAndFallback = isAlign ? aStyle->mAlignContent :
aStyle->mJustifyContent;
bool overflowSafe;
auto alignment = ::GetAlignJustifyValue(valueAndFallback, aWM, isAlign,
&overflowSafe);

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

@ -4400,7 +4400,7 @@ nsComputedDOMStyle::DoGetAlignContent()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString str;
auto align = StylePosition()->ComputedAlignContent();
auto align = StylePosition()->mAlignContent;
nsCSSValue::AppendAlignJustifyValueToString(align & NS_STYLE_ALIGN_ALL_BITS, str);
auto fallback = align >> NS_STYLE_ALIGN_ALL_SHIFT;
if (fallback) {
@ -4416,7 +4416,7 @@ nsComputedDOMStyle::DoGetAlignItems()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString str;
auto align = StylePosition()->ComputedAlignItems();
auto align = StylePosition()->mAlignItems;
nsCSSValue::AppendAlignJustifyValueToString(align, str);
val->SetString(str);
return val.forget();
@ -4438,7 +4438,7 @@ nsComputedDOMStyle::DoGetJustifyContent()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString str;
auto justify = StylePosition()->ComputedJustifyContent();
auto justify = StylePosition()->mJustifyContent;
nsCSSValue::AppendAlignJustifyValueToString(justify & NS_STYLE_JUSTIFY_ALL_BITS, str);
auto fallback = justify >> NS_STYLE_JUSTIFY_ALL_SHIFT;
if (fallback) {

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

@ -1692,7 +1692,7 @@ nsStylePosition::UsedAlignSelf(nsStyleContext* aParent) const
return mAlignSelf;
}
if (MOZ_LIKELY(aParent)) {
auto parentAlignItems = aParent->StylePosition()->ComputedAlignItems();
auto parentAlignItems = aParent->StylePosition()->mAlignItems;
MOZ_ASSERT(!(parentAlignItems & NS_STYLE_ALIGN_LEGACY),
"align-items can't have 'legacy'");
return parentAlignItems;

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

@ -1707,27 +1707,12 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
return nsChangeHint(0);
}
/**
* Return the computed value for 'align-content'.
*/
uint16_t ComputedAlignContent() const { return mAlignContent; }
/**
* Return the computed value for 'align-items'.
*/
uint8_t ComputedAlignItems() const { return mAlignItems; }
/**
* Return the used value for 'align-self' given our parent StyleContext
* aParent (or null for the root).
*/
uint8_t UsedAlignSelf(nsStyleContext* aParent) const;
/**
* Return the computed value for 'justify-content'.
*/
uint16_t ComputedJustifyContent() const { return mJustifyContent; }
/**
* Return the computed value for 'justify-items' given our parent StyleContext
* aParent (or null for the root).
@ -1755,15 +1740,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
nsStyleCoord mGridAutoRowsMax; // [reset] coord, percent, enum, calc, flex
uint8_t mGridAutoFlow; // [reset] enumerated. See nsStyleConsts.h
mozilla::StyleBoxSizing mBoxSizing; // [reset] see nsStyleConsts.h
private:
friend class nsRuleNode;
uint16_t mAlignContent; // [reset] fallback value in the high byte
uint8_t mAlignItems; // [reset] see nsStyleConsts.h
public:
uint8_t mAlignSelf; // [reset] see nsStyleConsts.h
private:
uint16_t mJustifyContent; // [reset] fallback value in the high byte
private:
friend class nsRuleNode;
// mJustifyItems should only be read via ComputedJustifyItems(), which
// lazily resolves its "auto" value. nsRuleNode needs direct access so
// it can set mJustifyItems' value when populating this struct.
uint8_t mJustifyItems; // [reset] see nsStyleConsts.h
public:
uint8_t mJustifySelf; // [reset] see nsStyleConsts.h