mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Give captions the right style context parent when dynamically restyling. Bug378240, r=bernd, sr=dbaron
This commit is contained in:
parent
2012087fb2
commit
be25658d6f
40
layout/reftests/bugs/323656-6-ref.html
Normal file
40
layout/reftests/bugs/323656-6-ref.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test inheritance into captions</title>
|
||||
<style>
|
||||
/**
|
||||
* The idea is that "color" inherits by default while "border-color" does
|
||||
* not. So if the former is red and the latter is green on a parent, and
|
||||
* the child's border-color is set to "inherit", it'll be green only if
|
||||
* the child is inheriting from the parent. If not, it'll either be
|
||||
* whatever the border-color is on what it's inheriting from, which will
|
||||
* be red if what it's inheriting from has the default (currentColor)
|
||||
* border-color).
|
||||
*/
|
||||
|
||||
/* 't' for "test" */
|
||||
* { color: red; border: 0px hidden red; background: transparent }
|
||||
.t, .t2 { border-color: green }
|
||||
.t > :first-child
|
||||
{ border-color: green; border-style: solid; border-width: 10px }
|
||||
.t2 > :first-child
|
||||
{ border-style: solid; border-width: 10px }
|
||||
.t2 > .test
|
||||
{ border-color: green }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="t"><caption></caption></table>
|
||||
|
||||
<table class="t2 d2"><caption class="test"></caption></table>
|
||||
|
||||
<table class="t d"><caption></caption></table>
|
||||
<table class="t d"><caption></caption></table>
|
||||
<table class="t d"><caption></caption></table>
|
||||
|
||||
<table class="t2 d d2"><caption class="test"></caption></table>
|
||||
<table class="t2 d d2"><caption class="test"></caption></table>
|
||||
<table class="t2 d d2"><caption class="test"></caption></table>
|
||||
</body>
|
||||
</html>
|
57
layout/reftests/bugs/323656-6.html
Normal file
57
layout/reftests/bugs/323656-6.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test inheritance into captions</title>
|
||||
<style>
|
||||
/**
|
||||
* The idea is that "color" inherits by default while "border-color" does
|
||||
* not. So if the former is red and the latter is green on a parent, and
|
||||
* the child's border-color is set to "inherit", it'll be green only if
|
||||
* the child is inheriting from the parent. If not, it'll either be
|
||||
* whatever the border-color is on what it's inheriting from, which will
|
||||
* be red if what it's inheriting from has the default (currentColor)
|
||||
* border-color).
|
||||
*/
|
||||
|
||||
/* 't' for "test" */
|
||||
* { color: red; border: 0px hidden red; background: transparent }
|
||||
.t, .t2 { border-color: green }
|
||||
.t > caption
|
||||
{ border-color: inherit; border-style: solid; border-width: 10px }
|
||||
.t2 > caption
|
||||
{ border-style: solid; border-width: 10px }
|
||||
.t2 > caption.test
|
||||
{ border-color: inherit }
|
||||
</style>
|
||||
<script>
|
||||
function makeCaption() {
|
||||
return document.createElement("caption");
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
var lst = document.getElementsByClassName("d");
|
||||
for (var i = 0; i < lst.length; ++i) {
|
||||
lst[i].appendChild(makeCaption());
|
||||
}
|
||||
|
||||
var lst = document.getElementsByClassName("d2");
|
||||
for (var i = 0; i < lst.length; ++i) {
|
||||
lst[i].firstChild.className = "test";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table class="t"><caption></caption></table>
|
||||
|
||||
<table class="t2 d2"><caption></caption></table>
|
||||
|
||||
<table class="t d"></table>
|
||||
<div class="t d"></div>
|
||||
<div style="display: table" class="t d"></div>
|
||||
|
||||
<table class="t2 d d2"></table>
|
||||
<div class="t2 d d2"></div>
|
||||
<div style="display: table" class="t2 d d2"></div>
|
||||
</body>
|
||||
</html>
|
@ -105,6 +105,7 @@ fails == 25888-3r.html 25888-3r-ref.html # bug 25888
|
||||
== 323656-3.html 323656-3-ref.html
|
||||
== 323656-4.html 323656-4-ref.html
|
||||
fails == 323656-5.svg 323656-5-ref.svg # bug 377584
|
||||
== 323656-6.html 323656-6-ref.html
|
||||
== 325486-1.html 325486-1-ref.html
|
||||
random == 328829-1.xhtml 328829-1-ref.xhtml # bug 369046 (intermittent)
|
||||
== 328829-2.xhtml 328829-2-ref.xhtml
|
||||
|
@ -110,6 +110,30 @@ nsTableCaptionFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableCaptionFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild)
|
||||
{
|
||||
// The caption's style context parent is the inner frame, unless
|
||||
// it's anonymous.
|
||||
nsIFrame* outerFrame = GetParent();
|
||||
if (outerFrame && outerFrame->GetType() == nsGkAtoms::tableOuterFrame) {
|
||||
nsIFrame* innerFrame = outerFrame->GetFirstChild(nsnull);
|
||||
if (innerFrame) {
|
||||
*aProviderFrame =
|
||||
nsFrame::CorrectStyleParentFrame(innerFrame,
|
||||
GetStyleContext()->GetPseudoType());
|
||||
*aIsChild = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_NOTREACHED("Where is our inner table frame?");
|
||||
return nsBlockFrame::GetParentStyleContextFrame(aPresContext, aProviderFrame,
|
||||
aIsChild);
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
NS_IMETHODIMP
|
||||
nsTableCaptionFrame::GetFrameName(nsAString& aResult) const
|
||||
|
@ -57,6 +57,9 @@ public:
|
||||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, PRBool aShrinkWrap);
|
||||
|
||||
NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
PRBool* aIsChild);
|
||||
#ifdef NS_DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user