Bug 981116: Convert nsFlexContainerFrame boolean member-var into frame state bit. r=heycam

This commit is contained in:
Daniel Holbert 2014-03-07 15:58:38 -08:00
Родитель a72e872bab
Коммит cded82fd98
4 изменённых файлов: 18 добавлений и 7 удалений

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

@ -1457,7 +1457,8 @@ nsFlexContainerFrame::SanityCheckAnonymousFlexItems() const
"but it isn't"); "but it isn't");
if (child->StyleContext()->GetPseudo() == if (child->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::anonymousFlexItem) { nsCSSAnonBoxes::anonymousFlexItem) {
MOZ_ASSERT(!prevChildWasAnonFlexItem || mChildrenHaveBeenReordered, MOZ_ASSERT(!prevChildWasAnonFlexItem ||
HasAnyStateBits(NS_STATE_FLEX_CHILDREN_REORDERED),
"two anon flex items in a row (shouldn't happen, unless our " "two anon flex items in a row (shouldn't happen, unless our "
"children have been reordered with the 'order' property)"); "children have been reordered with the 'order' property)");
@ -2740,9 +2741,11 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// operations need to use a fancier LEQ function that also takes DOM order // operations need to use a fancier LEQ function that also takes DOM order
// into account, so that we can honor the spec's requirement that frames w/ // into account, so that we can honor the spec's requirement that frames w/
// equal "order" values are laid out in DOM order. // equal "order" values are laid out in DOM order.
if (!mChildrenHaveBeenReordered) {
mChildrenHaveBeenReordered = if (!HasAnyStateBits(NS_STATE_FLEX_CHILDREN_REORDERED)) {
SortChildrenIfNeeded<IsOrderLEQ>(); if (SortChildrenIfNeeded<IsOrderLEQ>()) {
AddStateBits(NS_STATE_FLEX_CHILDREN_REORDERED);
}
} else { } else {
SortChildrenIfNeeded<IsOrderLEQWithDOMFallback>(); SortChildrenIfNeeded<IsOrderLEQWithDOMFallback>();
} }

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

@ -20,6 +20,7 @@ typedef nsContainerFrame nsFlexContainerFrameSuper;
template <class T> class nsTArray; template <class T> class nsTArray;
class nsFlexContainerFrame : public nsFlexContainerFrameSuper { class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame) NS_DECL_QUERYFRAME_TARGET(nsFlexContainerFrame)
NS_DECL_QUERYFRAME NS_DECL_QUERYFRAME
@ -28,7 +29,6 @@ class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
friend nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell, friend nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext); nsStyleContext* aContext);
public:
// Forward-decls of helper classes // Forward-decls of helper classes
class FlexItem; class FlexItem;
class FlexLine; class FlexLine;
@ -60,8 +60,7 @@ public:
protected: protected:
// Protected constructor & destructor // Protected constructor & destructor
nsFlexContainerFrame(nsStyleContext* aContext) : nsFlexContainerFrame(nsStyleContext* aContext) :
nsFlexContainerFrameSuper(aContext), nsFlexContainerFrameSuper(aContext)
mChildrenHaveBeenReordered(false)
{} {}
virtual ~nsFlexContainerFrame(); virtual ~nsFlexContainerFrame();

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

@ -10,6 +10,7 @@
#include "nsBlockFrame.h" #include "nsBlockFrame.h"
#include "nsBoxFrame.h" #include "nsBoxFrame.h"
#include "nsBulletFrame.h" #include "nsBulletFrame.h"
#include "nsFlexContainerFrame.h"
#include "nsGfxScrollFrame.h" #include "nsGfxScrollFrame.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsISVGChildFrame.h" #include "nsISVGChildFrame.h"

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

@ -284,6 +284,14 @@ FRAME_STATE_BIT(Box, 60, NS_FRAME_MOUSE_THROUGH_ALWAYS)
FRAME_STATE_BIT(Box, 61, NS_FRAME_MOUSE_THROUGH_NEVER) FRAME_STATE_BIT(Box, 61, NS_FRAME_MOUSE_THROUGH_NEVER)
// == Frame state bits that apply to flex container frames ====================
FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame)
// Set for a flex container whose children have been reordered due to 'order'.
// (Means that we have to be more thorough about checking them for sortedness.)
FRAME_STATE_BIT(FlexContainer, 20, NS_STATE_FLEX_CHILDREN_REORDERED)
// == Frame state bits that apply to SVG frames =============================== // == Frame state bits that apply to SVG frames ===============================
FRAME_STATE_GROUP(SVG, nsISVGChildFrame) FRAME_STATE_GROUP(SVG, nsISVGChildFrame)