Bug 1563163 Part 1: Make Flex::Flex gracefully handle frames without FlexContainerInfo structures. r=mats

Differential Revision: https://phabricator.services.mozilla.com/D44283

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-08-30 23:16:09 +00:00
parent 2bdd678c48
commit 9521ad6e9c

View File

@ -29,8 +29,13 @@ Flex::Flex(Element* aParent, nsFlexContainerFrame* aFrame) : mParent(aParent) {
// going to keep it around.
const ComputedFlexContainerInfo* containerInfo =
aFrame->GetFlexContainerInfo();
MOZ_ASSERT(containerInfo, "Should only be passed a frame with info.");
if (!containerInfo) {
// It's weird but possible to fail to get a ComputedFlexContainerInfo
// structure. Assign sensible default values.
mMainAxisDirection = FlexPhysicalDirection::Horizontal_lr;
mCrossAxisDirection = FlexPhysicalDirection::Vertical_tb;
return;
}
mLines.SetLength(containerInfo->mLines.Length());
uint32_t index = 0;
for (auto&& l : containerInfo->mLines) {