Bug 1364361 - Part 1: Refactor frame anon box restyling machinery so it can return a list of anon boxes. r=bholley,bz

MozReview-Commit-ID: 3InVAUw8djN
* * *
Bug 1364361 - Followup to address review comment. r=me

MozReview-Commit-ID: IpdoSon9MAj

--HG--
extra : rebase_source : 086c49319d3847099614d65c8bb9d924f4e9be38
This commit is contained in:
Cameron McCormack 2017-06-16 17:22:33 +08:00
parent 9365133d05
commit 139e81fb2f
28 changed files with 219 additions and 164 deletions

View File

@ -1189,15 +1189,10 @@ nsComboboxControlFrame::GetContentInsertionFrame() {
}
void
nsComboboxControlFrame::DoUpdateStyleOfOwnedAnonBoxes(
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsComboboxControlFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
UpdateStyleOfChildAnonBox(mDropdownFrame, aStyleSet, aChangeList,
aHintForThisFrame);
UpdateStyleOfChildAnonBox(mDisplayFrame, aStyleSet, aChangeList,
aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(mDropdownFrame));
aResult.AppendElement(OwnedAnonBox(mDisplayFrame));
}
nsresult

View File

@ -117,10 +117,8 @@ public:
virtual nsContainerFrame* GetContentInsertionFrame() override;
// Update the style on the block wrappers around our kids.
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return the dropdown and display frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
// nsIFormControlFrame
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) override;

View File

@ -664,13 +664,10 @@ nsFieldSetFrame::GetNaturalBaselineBOffset(WritingMode aWM,
}
void
nsFieldSetFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsFieldSetFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
nsIFrame* kid = GetInner();
if (kid) {
UpdateStyleOfChildAnonBox(kid, aStyleSet, aChangeList, aHintForThisFrame);
if (nsIFrame* kid = GetInner()) {
aResult.AppendElement(OwnedAnonBox(kid));
}
}

View File

@ -73,11 +73,8 @@ public:
return do_QueryFrame(GetInner());
}
// Update the style on the block wrappers around our kids.
virtual void DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return the block wrapper around our kids.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;

View File

@ -396,16 +396,12 @@ nsHTMLButtonControlFrame::SetAdditionalStyleContext(int32_t aIndex,
}
void
nsHTMLButtonControlFrame::DoUpdateStyleOfOwnedAnonBoxes(
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsHTMLButtonControlFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
MOZ_ASSERT(mFrames.FirstChild(), "Must have our button-content anon box");
MOZ_ASSERT(!mFrames.FirstChild()->GetNextSibling(),
"Must only have our button-content anon box");
UpdateStyleOfChildAnonBox(mFrames.FirstChild(),
aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(mFrames.FirstChild()));
}
#ifdef DEBUG

View File

@ -98,12 +98,9 @@ public:
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* Update the style of our ::-moz-button-content anonymous box.
*/
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return the ::-moz-button-content anonymous box.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
protected:
nsHTMLButtonControlFrame(nsStyleContext* aContext, nsIFrame::ClassID aID);

View File

@ -1260,10 +1260,7 @@ nsColumnSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
void
nsColumnSetFrame::DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsColumnSetFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
// Everything in mFrames is continuations of the first thing in mFrames.
nsIFrame* column = mFrames.FirstChild();
@ -1276,7 +1273,7 @@ nsColumnSetFrame::DoUpdateStyleOfOwnedAnonBoxes(
MOZ_ASSERT(column->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::columnContent,
"What sort of child is this?");
UpdateStyleOfChildAnonBox(column, aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(column));
}
#ifdef DEBUG

View File

@ -77,12 +77,8 @@ public:
*/
void DrainOverflowColumns();
/**
* Update the style on our column-content frames.
*/
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return the column-content frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {

View File

@ -46,7 +46,7 @@
#include "mozilla/GeckoRestyleManager.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/RestyleManagerInlines.h"
#include "nsInlineFrame.h"
#include "nsIDOMNode.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
@ -10201,10 +10201,10 @@ nsFrame::BoxMetrics() const
}
void
nsFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
{
MOZ_ASSERT(aChildFrame->GetParent() == this,
"This should only be used for children!");
@ -10479,16 +10479,73 @@ nsIFrame::IsScrolledOutOfView()
return IsFrameScrolledOutOfView(this);
}
/* virtual */
void
nsIFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
{
// As a special case, we check for {ib}-split block frames here, rather
// than have an nsInlineFrame::AppendDirectlyOwnedAnonBoxes implementation
// that returns them.
//
// (If we did handle them in AppendDirectlyOwnedAnonBoxes, we would have to
// return *all* of the in-flow {ib}-split block frames, not just the first
// one. For restyling, we really just need the first in flow, and the other
// user of the AppendOwnedAnonBoxes API, AllChildIterator, doesn't need to
// know about them at all, since these block frames never create NAC. So we
// avoid any unncessary hashtable lookups for the {ib}-split frames by calling
// UpdateStyleOfOwnedAnonBoxesForIBSplit directly here.)
if (IsInlineFrame()) {
if ((GetStateBits() & NS_FRAME_PART_OF_IBSPLIT)) {
static_cast<nsInlineFrame*>(this)->
UpdateStyleOfOwnedAnonBoxesForIBSplit(aStyleSet, aChangeList,
aHintForThisFrame);
}
return;
}
AutoTArray<OwnedAnonBox,4> frames;
AppendDirectlyOwnedAnonBoxes(frames);
for (OwnedAnonBox& box : frames) {
if (box.mUpdateStyleFn) {
box.mUpdateStyleFn(this, box.mAnonBoxFrame,
aStyleSet, aChangeList, aHintForThisFrame);
} else {
UpdateStyleOfChildAnonBox(box.mAnonBoxFrame,
aStyleSet, aChangeList, aHintForThisFrame);
}
}
}
/* virtual */ void
nsIFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_OWNS_ANON_BOXES));
MOZ_ASSERT(false, "Why did this get called?");
}
void
nsIFrame::DoAppendOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
size_t i = aResult.Length();
AppendDirectlyOwnedAnonBoxes(aResult);
// After appending the directly owned anonymous boxes of this frame to
// aResult above, we need to check each of them to see if they own
// any anonymous boxes themselves. Note that we keep progressing
// through aResult, looking for additional entries in aResult from these
// subsequent AppendDirectlyOwnedAnonBoxes calls. (Thus we can't
// use a ranged for loop here.)
while (i < aResult.Length()) {
nsIFrame* f = aResult[i].mAnonBoxFrame;
if (f->GetStateBits() & NS_FRAME_OWNS_ANON_BOXES) {
f->AppendDirectlyOwnedAnonBoxes(aResult);
}
++i;
}
}
nsIFrame::CaretPosition::CaretPosition()
: mContentOffset(0)
{

View File

@ -701,13 +701,6 @@ protected:
// Fire DOM event. If no aContent argument use frame's mContent.
void FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent = nullptr);
// A helper for implementing UpdateStyleOfOwnedAnonBoxes for the specific case
// of the owned anon box being a child of this frame.
void UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
private:
void BoxReflow(nsBoxLayoutState& aState,
nsPresContext* aPresContext,

View File

@ -1042,12 +1042,9 @@ public:
return mHelper.IsRootScrollFrameOfDocument();
}
// Update the style on our scrolled frame.
virtual void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override {
UpdateStyleOfChildAnonBox(mHelper.GetScrolledFrame(), aStyleSet,
aChangeList, aHintForThisFrame);
// Return the scrolled frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override {
aResult.AppendElement(OwnedAnonBox(mHelper.GetScrolledFrame()));
}
#ifdef DEBUG_FRAME_DUMP
@ -1487,11 +1484,9 @@ public:
return mHelper.IsRootScrollFrameOfDocument();
}
virtual void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override {
UpdateStyleOfChildAnonBox(mHelper.GetScrolledFrame(), aStyleSet,
aChangeList, aHintForThisFrame);
// Return the scrolled frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override {
aResult.AppendElement(OwnedAnonBox(mHelper.GetScrolledFrame()));
}
#ifdef DEBUG_FRAME_DUMP

View File

@ -414,15 +414,12 @@ nsHTMLCanvasFrame::GetContinuationOffset(nscoord* aWidth) const
}
void
nsHTMLCanvasFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsHTMLCanvasFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
MOZ_ASSERT(mFrames.FirstChild(), "Must have our canvas content anon box");
MOZ_ASSERT(!mFrames.FirstChild()->GetNextSibling(),
"Must only have our canvas content anon box");
UpdateStyleOfChildAnonBox(mFrames.FirstChild(),
aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(mFrames.FirstChild()));
}
#ifdef ACCESSIBILITY

View File

@ -97,12 +97,9 @@ public:
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
/**
* Update the style of our ::-moz-html-canvas-content anonymous box.
*/
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return the ::-moz-html-canvas-content anonymous box.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
protected:
virtual ~nsHTMLCanvasFrame();

View File

@ -3310,6 +3310,22 @@ public:
}
}
protected:
// This does the actual work of UpdateStyleOfOwnedAnonBoxes. It calls
// AppendDirectlyOwnedAnonBoxes to find all of the anonymous boxes
// owned by this frame, and then updates styles on each of them.
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
// A helper for DoUpdateStyleOfOwnedAnonBoxes for the specific case
// of the owned anon box being a child of this frame.
void UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
public:
// A helper both for UpdateStyleOfChildAnonBox, and to update frame-backed
// pseudo-elements in ServoRestyleManager.
//
@ -3318,17 +3334,57 @@ public:
// and adding to the change list as appropriate.
//
// Returns the generated change hint for the frame.
nsChangeHint UpdateStyleOfOwnedChildFrame(nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
nsStyleChangeList& aChangeList);
nsChangeHint UpdateStyleOfOwnedChildFrame(
nsIFrame* aChildFrame,
nsStyleContext* aNewStyleContext,
nsStyleChangeList& aChangeList);
struct OwnedAnonBox
{
typedef void (*UpdateStyleFn)(nsIFrame* aOwningFrame, nsIFrame* aAnonBox,
mozilla::ServoStyleSet&,
nsStyleChangeList&, nsChangeHint);
explicit OwnedAnonBox(nsIFrame* aAnonBoxFrame,
UpdateStyleFn aUpdateStyleFn = nullptr)
: mAnonBoxFrame(aAnonBoxFrame)
, mUpdateStyleFn(aUpdateStyleFn)
{}
nsIFrame* mAnonBoxFrame;
UpdateStyleFn mUpdateStyleFn;
};
/**
* Hook subclasses can override to actually implement updating of style of
* owned anon boxes.
* Appends information about all of the anonymous boxes owned by this frame,
* including other anonymous boxes owned by those which this frame owns
* directly.
*/
virtual void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
void AppendOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) {
if (GetStateBits() & NS_FRAME_OWNS_ANON_BOXES) {
if (IsInlineFrame()) {
// See comment in nsIFrame::DoUpdateStyleOfOwnedAnonBoxes for why
// we skip nsInlineFrames.
return;
}
DoAppendOwnedAnonBoxes(aResult);
}
}
protected:
// This does the actual work of AppendOwnedAnonBoxes.
void DoAppendOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult);
public:
/**
* Hook subclasses can override to return their owned anonymous boxes.
*
* This function only appends anonymous boxes that are directly owned by
* this frame, i.e. direct children or (for certain frames) a wrapper
* parent, unlike AppendOwnedAnonBoxes, which will append all anonymous
* boxes transitively owned by this frame.
*/
virtual void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult);
/**
* Determines whether a frame is visible for painting;

View File

@ -1014,9 +1014,10 @@ nsInlineFrame::AccessibleType()
#endif
void
nsInlineFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsInlineFrame::UpdateStyleOfOwnedAnonBoxesForIBSplit(
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
{
MOZ_ASSERT(GetStateBits() & NS_FRAME_OWNS_ANON_BOXES,
"Why did we get called?");

View File

@ -114,12 +114,12 @@ public:
: (!GetNextInFlow());
}
// Update the style on the block wrappers around our non-inline-outside kids.
// Restyles the block wrappers around our non-inline-outside kids.
// This will only be called when such wrappers in fact exist.
virtual void DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
void UpdateStyleOfOwnedAnonBoxesForIBSplit(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
protected:
// Additional reflow state used during our reflow methods

View File

@ -5582,11 +5582,8 @@ SVGTextFrame::TransformFrameRectFromTextChild(const nsRect& aRect,
}
void
SVGTextFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
SVGTextFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
MOZ_ASSERT(PrincipalChildList().FirstChild(), "Must have our anon box");
UpdateStyleOfChildAnonBox(PrincipalChildList().FirstChild(),
aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(PrincipalChildList().FirstChild()));
}

View File

@ -353,12 +353,8 @@ public:
gfxRect TransformFrameRectFromTextChild(const nsRect& aRect,
nsIFrame* aChildFrame);
/**
* Update the style of our ::-moz-svg-text anonymous box.
*/
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our ::-moz-svg-text anonymous box.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
private:
/**

View File

@ -572,12 +572,8 @@ nsSVGForeignObjectFrame::GetInvalidRegion()
}
void
nsSVGForeignObjectFrame::DoUpdateStyleOfOwnedAnonBoxes(
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsSVGForeignObjectFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
MOZ_ASSERT(PrincipalChildList().FirstChild(), "Must have our anon box");
UpdateStyleOfChildAnonBox(PrincipalChildList().FirstChild(),
aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(PrincipalChildList().FirstChild()));
}

View File

@ -82,12 +82,8 @@ public:
nsRect GetInvalidRegion();
/**
* Update the style of our ::-moz-svg-foreign-content anonymous box.
*/
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our ::-moz-svg-foreign-content anonymous box.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
protected:
// implementation helpers:

View File

@ -201,13 +201,9 @@ nsSVGMarkerFrame::SetParentCoordCtxProvider(SVGSVGElement *aContext)
}
void
nsSVGMarkerFrame::DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsSVGMarkerFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
UpdateStyleOfChildAnonBox(GetAnonymousChildFrame(this), aStyleSet,
aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(GetAnonymousChildFrame(this)));
}
//----------------------------------------------------------------------

View File

@ -90,10 +90,8 @@ public:
const nsSVGMark& aMark,
float aStrokeWidth);
// Update the style on our anonymous box child.
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our anonymous box child.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
private:
// stuff needed for callback

View File

@ -971,14 +971,11 @@ nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const
}
void
nsSVGOuterSVGFrame::DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsSVGOuterSVGFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
nsIFrame* anonKid = PrincipalChildList().FirstChild();
MOZ_ASSERT(anonKid->IsSVGOuterSVGAnonChildFrame());
UpdateStyleOfChildAnonBox(anonKid, aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(anonKid));
}
//----------------------------------------------------------------------

View File

@ -99,10 +99,8 @@ public:
bool IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const override;
// Update the style on our anonymous box child.
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our anonymous box child.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
// nsISVGSVGFrame interface:
virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) override;

View File

@ -1065,14 +1065,12 @@ nsTableCellFrame::GetBorderWidth(WritingMode aWM) const
}
void
nsTableCellFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsTableCellFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
nsIFrame* kid = mFrames.FirstChild();
MOZ_ASSERT(kid && !kid->GetNextSibling(),
"Table cells should have just one child");
UpdateStyleOfChildAnonBox(kid, aStyleSet, aChangeList, aHintForThisFrame);
aResult.AppendElement(OwnedAnonBox(kid));
}
#ifdef DEBUG_FRAME_DUMP

View File

@ -158,11 +158,8 @@ public:
// there is no set row index because row index depends on the cell's parent row only
// Update the style on the block wrappers around our kids.
virtual void DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our cell content frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
/*---------------- nsITableCellLayout methods ------------------------*/

View File

@ -8001,19 +8001,31 @@ nsTableFrame::InvalidateTableFrame(nsIFrame* aFrame,
}
void
nsTableFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
nsTableFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
{
nsIFrame* wrapper = GetParent();
MOZ_ASSERT(wrapper->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::tableWrapper,
"What happened to our parent?");
aResult.AppendElement(
OwnedAnonBox(wrapper, &UpdateStyleOfOwnedAnonBoxesForTableWrapper));
}
/* static */ void
nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
nsIFrame* aOwningFrame,
nsIFrame* aWrapperFrame,
ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
{
MOZ_ASSERT(aWrapperFrame->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::tableWrapper,
"What happened to our parent?");
RefPtr<nsStyleContext> newContext =
aStyleSet.ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper,
StyleContext());
aOwningFrame->StyleContext());
// Figure out whether we have an actual change. It's important that we do
// this, even though all the wrapper's changes are due to properties it
@ -8021,18 +8033,19 @@ nsTableFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
// style structs and hence changes to them aren't reflected in
// aHintForThisFrame at all.
uint32_t equalStructs, samePointerStructs; // Not used, actually.
nsChangeHint wrapperHint = wrapper->StyleContext()->CalcStyleDifference(
nsChangeHint wrapperHint = aWrapperFrame->StyleContext()->CalcStyleDifference(
newContext,
&equalStructs,
&samePointerStructs);
if (wrapperHint) {
aChangeList.AppendChange(wrapper, wrapper->GetContent(), wrapperHint);
aChangeList.AppendChange(aWrapperFrame, aWrapperFrame->GetContent(),
wrapperHint);
}
for (nsIFrame* cur = wrapper; cur; cur = cur->GetNextContinuation()) {
for (nsIFrame* cur = aWrapperFrame; cur; cur = cur->GetNextContinuation()) {
cur->SetStyleContext(newContext);
}
MOZ_ASSERT(!(wrapper->GetStateBits() & NS_FRAME_OWNS_ANON_BOXES),
MOZ_ASSERT(!(aWrapperFrame->GetStateBits() & NS_FRAME_OWNS_ANON_BOXES),
"Wrapper frame doesn't have any anon boxes of its own!");
}

View File

@ -593,12 +593,16 @@ public:
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
// Update the style of our table wrapper frame.
virtual void DoUpdateStyleOfOwnedAnonBoxes(
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame) override;
// Return our wrapper frame.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
protected:
static void UpdateStyleOfOwnedAnonBoxesForTableWrapper(
nsIFrame* aOwningFrame,
nsIFrame* aWrapperFrame,
mozilla::ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame);
/** protected constructor.
* @see NewFrame