Bug 799647 part 1: Use style-context parent instead of frame parent when resolving "align-self:auto" on a flex item. r=dbaron

This commit is contained in:
Daniel Holbert 2012-10-11 18:41:05 -07:00
parent 562cb0044f
commit c9e80c7e5c
6 changed files with 82 additions and 9 deletions

View File

@ -698,7 +698,8 @@ FlexItem::FlexItem(nsIFrame* aChildFrame,
// Resolve "align-self: auto" to parent's "align-items" value.
if (mAlignSelf == NS_STYLE_ALIGN_SELF_AUTO) {
mAlignSelf = mFrame->GetParent()->GetStylePosition()->mAlignItems;
mAlignSelf =
mFrame->GetStyleContext()->GetParent()->GetStylePosition()->mAlignItems;
}
// If the flex item's inline axis is the same as the cross axis, then

View File

@ -43,7 +43,6 @@
.orange { background: orange; }
.pink { background: pink; }
.aqua { background: aqua; }
.violet { background: violet; }
.tan { background: tan; }
</style>
</head>
@ -56,9 +55,6 @@
><div class="pink"><span class="sub">sub</span></div
><table cellspacing="0" cellpadding="0"
class="aqua big">big<br/>text<br/>3lines</table
><table class="violet" border="1">
<tr><td>tr1</td></tr>
<tr><td>tr2</td></tr></table
><table class="tan" cellspacing="0" cellpadding="0">
<i>ital<br/>ic</i>
</table>

View File

@ -43,7 +43,6 @@
.orange { background: orange; }
.pink { background: pink; }
.aqua { background: aqua; }
.violet { background: violet; }
.tan { background: tan; }
</style>
</head>
@ -54,9 +53,6 @@
<div class="orange"><span class="super">super</span></div>
<div class="pink"><span class="sub">sub</span></div>
<div class="aqua big">big<br/>text<br/>3lines</div>
<table class="violet" border="1">
<tr><td>tr1</td></tr>
<tr><td>tr2</td></tr></table>
<i class="tan">ital<br/>ic</i>
</div>
</body>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Reference case for behavior of the 'baseline' value for align-items and
align-self.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
div.flexbox {
display: block;
border: 1px dashed blue;
font: 14px sans-serif;
}
div { display: inline-block; }
table {
display: inline-table;
margin: 1px; /* to fix fuzziness from text overlapping table border */
}
.lime { background: lime; }
.pink { background: pink; }
.aqua { background: aqua; }
</style>
</head>
<body>
<div class="flexbox">
<div class="lime">text</div
><table class="pink" border="1">
<tr><td>tr1</td></tr>
<tr><td>tr2</td></tr>
</table>
</div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Testcase for behavior of the 'baseline' value for align-items (and
align-self, implicitly). This test baseline-aligns a <table>.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
div.flexbox {
display: -moz-flex;
-moz-align-items: baseline;
border: 1px dashed blue;
font: 14px sans-serif;
}
table {
margin: 1px; /* to fix fuzziness from text overlapping table border */
}
.lime { background: lime; }
.pink { background: pink; }
.aqua { background: aqua; }
</style>
</head>
<body>
<div class="flexbox">
<div class="lime">text</div>
<table class="pink" border="1">
<tr><td>tr1</td></tr>
<tr><td>tr2</td></tr>
</table>
</div>
</body>
</html>

View File

@ -10,6 +10,11 @@ fails test-pref(layout.css.flexbox.enabled,true) == flexbox-align-self-baseline-
# This one fails on windows R (but not Ru, strangely). On Windows R, the
# single-line <label> flex item has a different background size in test vs. ref
random-if(winWidget) test-pref(layout.css.flexbox.enabled,true) == flexbox-align-self-baseline-horiz-3.xhtml flexbox-align-self-baseline-horiz-3-ref.xhtml # XXXdholbert investigate
# XXXdholbert This test needs the flexbox pref to be enabled _at startup time_
# (when we parse ua.css) in order to pass -- so it'll fail until we enable the
# flexbox pref by default (bug 783409):
fails == flexbox-align-self-baseline-horiz-4.xhtml flexbox-align-self-baseline-horiz-4-ref.xhtml
test-pref(layout.css.flexbox.enabled,true) == flexbox-align-self-horiz-1.xhtml flexbox-align-self-horiz-1-ref.xhtml
test-pref(layout.css.flexbox.enabled,true) == flexbox-align-self-horiz-2.xhtml flexbox-align-self-horiz-2-ref.xhtml
test-pref(layout.css.flexbox.enabled,true) == flexbox-align-self-horiz-3.xhtml flexbox-align-self-horiz-3-ref.xhtml