mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 812824: Use a clean struct for inheritance on root nodes. r=dbaron,Waldo
This commit is contained in:
parent
a47c16de3a
commit
83feb11ffb
3
layout/reftests/bugs/812824-1-ref.html
Normal file
3
layout/reftests/bugs/812824-1-ref.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!DOCTYPE HTML>
|
||||
<style> html { background-color: inherit } </style>
|
||||
<p>This document should NOT have a red background.</p>
|
5
layout/reftests/bugs/812824-1.html
Normal file
5
layout/reftests/bugs/812824-1.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE HTML>
|
||||
<style> html { tab-size: 0 } </style>
|
||||
<script> getComputedStyle(document.documentElement, ""); </script>
|
||||
<style> html { tab-size: inherit } </style>
|
||||
<p>This document should NOT have a red background.</p>
|
@ -1731,3 +1731,4 @@ fuzzy(40,800) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) te
|
||||
== 801994-1.html 801994-1-ref.html
|
||||
== 804323-1.html 804323-1-ref.html
|
||||
== 811301-1.html 811301-1-ref.html
|
||||
== 812824-1.html 812824-1-ref.html
|
||||
|
1
layout/style/crashtests/812824.html
Normal file
1
layout/style/crashtests/812824.html
Normal file
@ -0,0 +1 @@
|
||||
<html style="border: inherit;"><div></div><style>html, div { border-image-source: url('border.png'); }</style></html>
|
@ -81,3 +81,4 @@ skip-if(Android||browserIsRemote) load 786108-1.html # Bug 795534
|
||||
skip-if(browserIsRemote) load 786108-2.html # Bug 795534
|
||||
load 788836.html
|
||||
load 806310-1.html
|
||||
load 812824.html
|
||||
|
@ -2315,17 +2315,24 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
\
|
||||
nsStyleContext* parentContext = aContext->GetParent(); \
|
||||
\
|
||||
nsStyle##type_* data_ = nullptr; \
|
||||
const nsStyle##type_* parentdata_ = nullptr; \
|
||||
bool canStoreInRuleTree = aCanStoreInRuleTree; \
|
||||
nsStyle##type_* data_ = nullptr; \
|
||||
mozilla::Maybe<nsStyle##type_> maybeFakeParentData; \
|
||||
const nsStyle##type_* parentdata_ = nullptr; \
|
||||
bool canStoreInRuleTree = aCanStoreInRuleTree; \
|
||||
\
|
||||
/* If |canStoreInRuleTree| might be true by the time we're done, we */ \
|
||||
/* can't call parentContext->GetStyle##type_() since it could recur into */ \
|
||||
/* setting the same struct on the same rule node, causing a leak. */ \
|
||||
if (parentContext && aRuleDetail != eRuleFullReset && \
|
||||
if (aRuleDetail != eRuleFullReset && \
|
||||
(!aStartStruct || (aRuleDetail != eRulePartialReset && \
|
||||
aRuleDetail != eRuleNone))) \
|
||||
parentdata_ = parentContext->GetStyle##type_(); \
|
||||
aRuleDetail != eRuleNone))) { \
|
||||
if (parentContext) { \
|
||||
parentdata_ = parentContext->GetStyle##type_(); \
|
||||
} else { \
|
||||
maybeFakeParentData.construct ctorargs_; \
|
||||
parentdata_ = maybeFakeParentData.addr(); \
|
||||
} \
|
||||
} \
|
||||
if (aStartStruct) \
|
||||
/* We only need to compute the delta between this computed data and */ \
|
||||
/* our computed data. */ \
|
||||
@ -2382,12 +2389,18 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
|
||||
/* If |canStoreInRuleTree| might be true by the time we're done, we */ \
|
||||
/* can't call parentContext->GetStyle##type_() since it could recur into */ \
|
||||
/* setting the same struct on the same rule node, causing a leak. */ \
|
||||
mozilla::Maybe<nsStyle##type_> maybeFakeParentData; \
|
||||
const nsStyle##type_* parentdata_ = data_; \
|
||||
if (parentContext && \
|
||||
aRuleDetail != eRuleFullReset && \
|
||||
if (aRuleDetail != eRuleFullReset && \
|
||||
aRuleDetail != eRulePartialReset && \
|
||||
aRuleDetail != eRuleNone) \
|
||||
parentdata_ = parentContext->GetStyle##type_(); \
|
||||
aRuleDetail != eRuleNone) { \
|
||||
if (parentContext) { \
|
||||
parentdata_ = parentContext->GetStyle##type_(); \
|
||||
} else { \
|
||||
maybeFakeParentData.construct ctorargs_; \
|
||||
parentdata_ = maybeFakeParentData.addr(); \
|
||||
} \
|
||||
} \
|
||||
bool canStoreInRuleTree = aCanStoreInRuleTree;
|
||||
|
||||
/**
|
||||
@ -6506,18 +6519,14 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
|
||||
// and inherit that resolved value.
|
||||
uint8_t inheritedAlignSelf = parentPos->mAlignSelf;
|
||||
if (inheritedAlignSelf == NS_STYLE_ALIGN_SELF_AUTO) {
|
||||
if (parentPos == pos) {
|
||||
// We're the root node. (If we weren't, COMPUTE_START_RESET would've
|
||||
// given us a distinct parentPos, since we've got an 'inherit' value.)
|
||||
// Nothing to inherit from --> just use default value.
|
||||
if (!parentContext) {
|
||||
// We're the root node. Nothing to inherit from --> just use default
|
||||
// value.
|
||||
inheritedAlignSelf = NS_STYLE_ALIGN_ITEMS_INITIAL_VALUE;
|
||||
} else {
|
||||
// Our parent's "auto" value should resolve to our grandparent's value
|
||||
// for "align-items". So, that's what we're supposed to inherit.
|
||||
NS_ABORT_IF_FALSE(aContext->GetParent(),
|
||||
"we've got a distinct parent style-struct already, "
|
||||
"so we should have a parent style-context");
|
||||
nsStyleContext* grandparentContext = aContext->GetParent()->GetParent();
|
||||
nsStyleContext* grandparentContext = parentContext->GetParent();
|
||||
if (!grandparentContext) {
|
||||
// No grandparent --> our parent is the root node, so its
|
||||
// "align-self: auto" computes to the default "align-items" value:
|
||||
|
10
mfbt/Util.h
10
mfbt/Util.h
@ -222,35 +222,35 @@ class Maybe
|
||||
|
||||
void construct() {
|
||||
MOZ_ASSERT(!constructed);
|
||||
new (storage.addr()) T();
|
||||
::new (storage.addr()) T();
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
template<class T1>
|
||||
void construct(const T1& t1) {
|
||||
MOZ_ASSERT(!constructed);
|
||||
new (storage.addr()) T(t1);
|
||||
::new (storage.addr()) T(t1);
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
void construct(const T1& t1, const T2& t2) {
|
||||
MOZ_ASSERT(!constructed);
|
||||
new (storage.addr()) T(t1, t2);
|
||||
::new (storage.addr()) T(t1, t2);
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
template<class T1, class T2, class T3>
|
||||
void construct(const T1& t1, const T2& t2, const T3& t3) {
|
||||
MOZ_ASSERT(!constructed);
|
||||
new (storage.addr()) T(t1, t2, t3);
|
||||
::new (storage.addr()) T(t1, t2, t3);
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
template<class T1, class T2, class T3, class T4>
|
||||
void construct(const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
|
||||
MOZ_ASSERT(!constructed);
|
||||
new (storage.addr()) T(t1, t2, t3, t4);
|
||||
::new (storage.addr()) T(t1, t2, t3, t4);
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user