Bug 1706346 part 2 - [css-lists] Implement the counter value calculations for 'reversed(<counter-name>)'. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D129956
This commit is contained in:
Mats Palmgren
2021-11-14 03:49:36 +00:00
parent c7ae2935d7
commit ef8843e0bf
3 changed files with 96 additions and 35 deletions

View File

@@ -9566,25 +9566,12 @@ inline void nsCSSFrameConstructor::ConstructFramesFromItemList(
CreateNeededPseudoInternalRubyBoxes(aState, aItems, aParentFrame);
CreateNeededPseudoSiblings(aState, aItems, aParentFrame);
bool listItemListIsDirty = false;
for (FCItemIterator iter(aItems); !iter.IsDone(); iter.Next()) {
MOZ_ASSERT(!iter.item().mIsRenderedLegend,
"Only one item can be the rendered legend, "
"and it should've been handled above");
NS_ASSERTION(iter.item().DesiredParentType() == GetParentType(aParentFrame),
"Needed pseudos didn't get created; expect bad things");
// display:list-item boxes affects the start value of the "list-item"
// counter when an <ol reversed> element doesn't have an explicit start
// value.
if (!listItemListIsDirty &&
iter.item().mComputedStyle->StyleList()->mMozListReversed ==
StyleMozListReversed::True &&
iter.item().mComputedStyle->StyleDisplay()->IsListItem()) {
auto* list = mCounterManager.CounterListFor(nsGkAtoms::list_item);
list->SetDirty();
CountersDirty();
listItemListIsDirty = true;
}
ConstructFramesFromItem(aState, iter, aParentFrame, aFrameList);
}