Bug 825810 part 2: When digging for a flex item's first non-anonymous descendant, check table caption list & column-group list. r=bz

This commit is contained in:
Daniel Holbert 2013-05-22 11:59:36 +08:00
parent c0ae6eb860
commit 35aa3d8c53
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<body>
<div style="display: flex;">
<div style="display: table-column;"></div>
abc
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<body>
<div style="display: flex;">
<div style="display: table-caption;"></div>
abc
</div>
</body>
</html>

View File

@ -474,6 +474,8 @@ asserts(12) test-pref(layout.css.flexbox.enabled,true) load 799207-2.html
test-pref(layout.css.flexbox.enabled,true) load 801268-1.html
test-pref(layout.css.flexbox.enabled,true) load 804089-1.xhtml
load 810726.html
test-pref(layout.css.flexbox.enabled,true) load 825810-1.html
test-pref(layout.css.flexbox.enabled,true) load 825810-2.html
test-pref(layout.css.flexbox.enabled,true) load 827076.html
load 840818.html
test-pref(layout.css.flexbox.enabled,true) load 812822-1.html

View File

@ -18,6 +18,7 @@
#include <algorithm>
using namespace mozilla::css;
using namespace mozilla::layout;
#ifdef PR_LOGGING
static PRLogModuleInfo*
@ -480,6 +481,29 @@ GetFirstNonAnonBoxDescendant(nsIFrame* aFrame)
}
// Otherwise, descend to its first child and repeat.
// SPECIAL CASE: if we're dealing with an anonymous table, then it might
// be wrapping something non-anonymous in its caption or col-group lists
// (instead of its principal child list), so we have to look there.
// (Note: For anonymous tables that have a non-anon cell *and* a non-anon
// column, we'll always return the column. This is fine; we're really just
// looking for a handle to *anything* with a meaningful content node inside
// the table, for use in DOM comparisons to things outside of the table.)
if (MOZ_UNLIKELY(aFrame->GetType() == nsGkAtoms::tableOuterFrame)) {
nsIFrame* captionDescendant =
GetFirstNonAnonBoxDescendant(aFrame->GetFirstChild(kCaptionList));
if (captionDescendant) {
return captionDescendant;
}
} else if (MOZ_UNLIKELY(aFrame->GetType() == nsGkAtoms::tableFrame)) {
nsIFrame* colgroupDescendant =
GetFirstNonAnonBoxDescendant(aFrame->GetFirstChild(kColGroupList));
if (colgroupDescendant) {
return colgroupDescendant;
}
}
// USUAL CASE: Descend to the first child in principal list.
aFrame = aFrame->GetFirstPrincipalChild();
}
return aFrame;