Files
firefox/layout/generic/ColumnSetWrapperFrame.h
T
Ting-Yu Lin 9f6fd81b9d Bug 1421105 Part 5 - Fix anonymous -moz-column-span-wrapper block's style is overridden after restyling. r=bzbarsky,emilio
The major change in this patch is ::-moz-column-span-wrapper blocks are no
longer linked into the continuation chains when they're created in
CreateColumnSpanSiblings(). We can do that because
::-moz-column-span-wrapper is an non-inheriting anon box, which doesn't need
to be restyled.

This prevents RestyleManager::ProcessPostTraversal or
nsIFrame::UpdateStyleOfOwnedChildFrame, which set the same style on all
continuations of the frame they are working with, from overriding the
::-moz-column-span-wrapper style.

GetNextContinuationWithSameStyle was deleted in bug 1447367. Delete the comment
in nsInlineFrame::UpdateStyleOfOwnedAnonBoxesForIBSplit() to avoid confusion.

This patch also adds another condition to reframe the multi-column container
in MaybeRecreateContainerForFrameRemoval(). That condition is when an
element has a "column-span:all" descendant, i.e. the element's frame has
"column-span:all" siblings (which is created by CreateColumnSpanSiblings).
The added test multicol-span-all-dynamic-remove-006.html will fail without
this patch.

Depends on D5212

Differential Revision: https://phabricator.services.mozilla.com/D9988
2018-11-08 19:11:55 +00:00

68 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// A frame for CSS multi-column layout that wraps nsColumnSetFrames and
// column-span frames.
#ifndef mozilla_ColumnSetWrapperFrame_h
#define mozilla_ColumnSetWrapperFrame_h
#include "nsBlockFrame.h"
namespace mozilla {
// This class is a wrapper for nsColumnSetFrames and column-span frame.
// Essentially, we divide the *original* nsColumnSetFrame into multiple
// nsColumnSetFrames on the basis of the number and position of spanning
// elements.
//
// This wrapper is necessary for implementing column-span as it allows us to
// maintain each nsColumnSetFrame as an independent set of columns, and each
// column-span element then becomes just a block level element.
//
class ColumnSetWrapperFrame final : public nsBlockFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS(ColumnSetWrapperFrame)
NS_DECL_QUERYFRAME
friend nsBlockFrame* ::NS_NewColumnSetWrapperFrame(nsIPresShell* aPresShell,
ComputedStyle* aStyle,
nsFrameState aStateFlags);
nsContainerFrame* GetContentInsertionFrame() override;
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override;
#endif
void AppendFrames(ChildListID aListID, nsFrameList& aFrameList) override;
void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override;
void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
private:
explicit ColumnSetWrapperFrame(ComputedStyle* aStyle);
~ColumnSetWrapperFrame() override = default;
#ifdef DEBUG
static void AssertColumnSpanWrapperSubtreeIsSane(const nsIFrame* aFrame);
// True if frame constructor has finished building this frame and all of
// its descendants.
bool mFinishedBuildingColumns = false;
#endif
};
} // namespace mozilla
#endif // mozilla_ColumnSetWrapperFrame_h