Bug 1171419 part 7 - Make nsBlockFrame::AttributeChanged look for flex/grid ancestors too, not just blocks. r=xidorn

This commit is contained in:
Mats Palmgren 2016-09-01 17:36:22 +02:00
Родитель 0d83513904
Коммит fa28266c00
1 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -2931,19 +2931,25 @@ nsBlockFrame::AttributeChanged(int32_t aNameSpaceID,
if (nsGkAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay = StyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) {
// Search for the closest ancestor that's a block frame. We
// make the assumption that all related list items share a
// common block parent.
// Search for the closest ancestor that's a block/grid/flex frame.
// We make the assumption that all related list items share a
// common block/grid/flex ancestor.
// XXXldb I think that's a bad assumption.
nsBlockFrame* blockParent = nsLayoutUtils::FindNearestBlockAncestor(this);
// Tell the enclosing block frame to renumber list items within
// itself
if (nullptr != blockParent) {
nsContainerFrame* ancestor = GetParent();
for (; ancestor; ancestor = ancestor->GetParent()) {
auto frameType = ancestor->GetType();
if (frameType == nsGkAtoms::blockFrame ||
frameType == nsGkAtoms::flexContainerFrame ||
frameType == nsGkAtoms::gridContainerFrame) {
break;
}
}
// Tell the ancestor to renumber list items within itself.
if (ancestor) {
// XXX Not sure if this is necessary anymore
if (blockParent->RenumberLists()) {
if (ancestor->RenumberLists()) {
PresContext()->PresShell()->
FrameNeedsReflow(blockParent, nsIPresShell::eStyleChange,
FrameNeedsReflow(ancestor, nsIPresShell::eStyleChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
}
}