Bug 1304012 -- Part 1: Don't bother resolving align-self/justify-self 'auto' value for getComputedStyle & inheritance. r=dholbert

MozReview-Commit-ID: 8LMn8oQhUz8
This commit is contained in:
Brad Werth 2016-09-27 14:45:51 -07:00
Родитель 6266ebefa2
Коммит b9a57c7d02
3 изменённых файлов: 15 добавлений и 42 удалений

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

@ -4426,8 +4426,8 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetAlignSelf()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
auto align = StylePosition()->ComputedAlignSelf(mStyleContext->GetParent());
nsAutoString str;
auto align = StylePosition()->mAlignSelf;
nsCSSValue::AppendAlignJustifyValueToString(align, str);
val->SetString(str);
return val.forget();
@ -4469,8 +4469,7 @@ nsComputedDOMStyle::DoGetJustifySelf()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString str;
auto justify =
StylePosition()->ComputedJustifySelf(mStyleContext->GetParent());
auto justify = StylePosition()->mJustifySelf;
nsCSSValue::AppendAlignJustifyValueToString(justify, str);
val->SetString(str);
return val.forget();

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

@ -8461,25 +8461,11 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
NS_STYLE_ALIGN_NORMAL);
// align-self: enum, inherit, initial
const auto& alignSelfValue = *aRuleData->ValueForAlignSelf();
if (MOZ_UNLIKELY(alignSelfValue.GetUnit() == eCSSUnit_Inherit)) {
if (MOZ_LIKELY(parentContext)) {
nsStyleContext* grandparentContext = parentContext->GetParent();
if (MOZ_LIKELY(grandparentContext)) {
parentContext->AddStyleBit(NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE);
}
pos->mAlignSelf = parentPos->ComputedAlignSelf(grandparentContext);
} else {
pos->mAlignSelf = NS_STYLE_ALIGN_NORMAL;
}
conditions.SetUncacheable();
} else {
SetValue(alignSelfValue,
pos->mAlignSelf, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentPos->mAlignSelf, // unused, we handle 'inherit' above
NS_STYLE_ALIGN_AUTO);
}
SetValue(*aRuleData->ValueForAlignSelf(),
pos->mAlignSelf, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentPos->mAlignSelf,
NS_STYLE_ALIGN_AUTO);
// justify-content: enum, inherit, initial
SetValue(*aRuleData->ValueForJustifyContent(),
@ -8507,25 +8493,11 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
}
// justify-self: enum, inherit, initial
const auto& justifySelfValue = *aRuleData->ValueForJustifySelf();
if (MOZ_UNLIKELY(justifySelfValue.GetUnit() == eCSSUnit_Inherit)) {
if (MOZ_LIKELY(parentContext)) {
nsStyleContext* grandparentContext = parentContext->GetParent();
if (MOZ_LIKELY(grandparentContext)) {
parentContext->AddStyleBit(NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE);
}
pos->mJustifySelf = parentPos->ComputedJustifySelf(grandparentContext);
} else {
pos->mJustifySelf = NS_STYLE_JUSTIFY_NORMAL;
}
conditions.SetUncacheable();
} else {
SetValue(justifySelfValue,
pos->mJustifySelf, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentPos->mJustifySelf, // not used, we handle 'inherit' above
NS_STYLE_JUSTIFY_AUTO);
}
SetValue(*aRuleData->ValueForJustifySelf(),
pos->mJustifySelf, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentPos->mJustifySelf,
NS_STYLE_JUSTIFY_AUTO);
// flex-basis: auto, length, percent, enum, calc, inherit, initial
// (Note: The flags here should match those used for 'width' property above.)

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

@ -1760,11 +1760,13 @@ private:
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
uint8_t mJustifyItems; // [reset] see nsStyleConsts.h
uint8_t mJustifySelf; // [reset] see nsStyleConsts.h
public:
uint8_t mJustifySelf; // [reset] see nsStyleConsts.h
uint8_t mFlexDirection; // [reset] see nsStyleConsts.h
uint8_t mFlexWrap; // [reset] see nsStyleConsts.h
uint8_t mObjectFit; // [reset] see nsStyleConsts.h