Bug 460664. Reset prop inheritance should skip first-line even if the whole struct is inheriting. r+sr=dbaron

This commit is contained in:
Boris Zbarsky 2008-10-20 12:14:25 -04:00
parent 2ffaaab36b
commit 41c5ae0633
6 changed files with 63 additions and 3 deletions

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<style>
div { background: green; }
</style>
</head>
<body>
<div>OneTwo</div>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<style>
div { background: green; }
div::first-line { background-color: red; }
span.one { background: inherit; }
span.two { background-color: inherit; }
</style>
</head>
<body>
<div><span class="one">One</span><span class="two">Two</span></div>
</body>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<style>
div { background: green; }
</style>
</head>
<body>
<div><p>OneTwo</p></div>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
div { background: green; }
div::first-line { background-color: red; }
p::first-line { background-color: red; }
span.one { background: inherit; }
span.two { background-color: inherit; }
</style>
</head>
<body>
<div><p><span class="one">One</span><span class="two">Two</span></p></div>
</body>

View File

@ -9,6 +9,8 @@ fails == out-of-flow-1d.html out-of-flow-1-ref.html # bug 396645
# parent style context correct
== parent-style-1.html parent-style-1-ref.html
== parent-style-2.html parent-style-2-ref.html
== parent-style-3.html parent-style-3-ref.html
# stress-tests
== stress-1.html about:blank # assertion test

View File

@ -1664,6 +1664,14 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// In the absence of any computed data in the rule tree and with
// no rules specified that didn't have values of 'inherit', we should check our parent.
nsStyleContext* parentContext = aContext->GetParent();
if (isReset) {
/* Reset structs don't inherit from first-line. */
/* See similar code in COMPUTE_START_RESET */
while (parentContext &&
parentContext->GetPseudoType() == nsCSSPseudoElements::firstLine) {
parentContext = parentContext->GetParent();
}
}
if (parentContext) {
// We have a parent, and so we should just inherit from the parent.
// Set the inherit bits on our context. These bits tell the style context that
@ -2036,9 +2044,10 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
"should not have bothered calling Compute*Data"); \
\
nsStyleContext* parentContext = aContext->GetParent(); \
if (parentContext && \
parentContext->GetPseudoType() == nsCSSPseudoElements::firstLine) { \
/* Reset structs don't inherit from first-line */ \
/* Reset structs don't inherit from first-line */ \
/* See similar code in WalkRuleTree */ \
while (parentContext && \
parentContext->GetPseudoType() == nsCSSPseudoElements::firstLine) { \
parentContext = parentContext->GetParent(); \
} \
\