Bug 1359205 - Make XUL pseudo values nsICSSAnonBoxPseudo* instead of nsIAtom* and assert that IsTreePseudoElement() got a pseudo tag of the right type. r=bz

MozReview-Commit-ID: G2WFsNV4Fjz
This commit is contained in:
Mats Palmgren 2017-04-26 17:54:43 +02:00
parent 8bbd081c88
commit ef94ae96c4
7 changed files with 19 additions and 13 deletions

View File

@ -56,6 +56,7 @@ bool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
/* static */ bool
nsCSSAnonBoxes::IsTreePseudoElement(nsIAtom* aPseudo)
{
MOZ_ASSERT(nsCSSAnonBoxes::IsAnonBox(aPseudo));
return StringBeginsWith(nsDependentAtomString(aPseudo),
NS_LITERAL_STRING(":-moz-tree-"));
}

View File

@ -2172,7 +2172,7 @@ nsStyleSet::ResolveNonInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag)
#ifdef MOZ_XUL
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveXULTreePseudoStyle(Element* aParentElement,
nsIAtom* aPseudoTag,
nsICSSAnonBoxPseudo* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator)
{

View File

@ -298,7 +298,7 @@ class nsStyleSet final
// non-null. aComparator must be non-null.
already_AddRefed<nsStyleContext>
ResolveXULTreePseudoStyle(mozilla::dom::Element* aParentElement,
nsIAtom* aPseudoTag,
nsICSSAnonBoxPseudo* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator);
#endif

View File

@ -1057,7 +1057,7 @@ nsTreeBodyFrame::GetCellAt(int32_t aX, int32_t aY, int32_t* aRow, nsITreeColumn*
}
nsTreeColumn* col;
nsIAtom* child;
nsICSSAnonBoxPseudo* child;
GetCellAt(point.x, point.y, aRow, &col, &child);
if (col) {
@ -1484,7 +1484,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText,
aTextRect.width = width;
}
nsIAtom*
nsICSSAnonBoxPseudo*
nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
int32_t aRowIndex,
nsTreeColumn* aColumn)
@ -1634,7 +1634,8 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
void
nsTreeBodyFrame::GetCellAt(nscoord aX, nscoord aY, int32_t* aRow,
nsTreeColumn** aCol, nsIAtom** aChildElt)
nsTreeColumn** aCol,
nsICSSAnonBoxPseudo** aChildElt)
{
*aCol = nullptr;
*aChildElt = nullptr;
@ -2528,7 +2529,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
if (mView && GetContent()->GetComposedDoc()->GetScriptHandlingObject(dummy)) {
int32_t row;
nsTreeColumn* col;
nsIAtom* child;
nsICSSAnonBoxPseudo* child;
GetCellAt(aPoint.x, aPoint.y, &row, &col, &child);
if (child) {
@ -4475,7 +4476,7 @@ nsTreeBodyFrame::ThumbMoved(nsScrollbarFrame* aScrollbar,
// The style cache.
nsStyleContext*
nsTreeBodyFrame::GetPseudoStyleContext(nsIAtom* aPseudoElement)
nsTreeBodyFrame::GetPseudoStyleContext(nsICSSAnonBoxPseudo* aPseudoElement)
{
return mStyleCache.GetStyleContext(this, PresContext(), mContent,
mStyleContext, aPseudoElement,

View File

@ -318,13 +318,15 @@ protected:
nsRect& aTextRect);
// A helper used when hit testing.
nsIAtom* GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
int32_t aRowIndex, nsTreeColumn* aColumn);
nsICSSAnonBoxPseudo* GetItemWithinCellAt(nscoord aX,
const nsRect& aCellRect,
int32_t aRowIndex,
nsTreeColumn* aColumn);
// An internal hit test. aX and aY are expected to be in twips in the
// coordinate system of this frame.
void GetCellAt(nscoord aX, nscoord aY, int32_t* aRow, nsTreeColumn** aCol,
nsIAtom** aChildElt);
nsICSSAnonBoxPseudo** aChildElt);
// Retrieve the area for the twisty for a cell.
nsITheme* GetTwistyRect(int32_t aRowIndex,
@ -362,7 +364,7 @@ protected:
// Looks up a style context in the style cache. On a cache miss we resolve
// the pseudo-styles passed in and place them into the cache.
nsStyleContext* GetPseudoStyleContext(nsIAtom* aPseudoElement);
nsStyleContext* GetPseudoStyleContext(nsICSSAnonBoxPseudo* aPseudoElement);
// Retrieves the scrollbars and scrollview relevant to this treebody. We
// traverse the frame tree under our base element, in frame order, looking

View File

@ -36,9 +36,11 @@ nsTreeStyleCache::GetStyleContext(nsICSSPseudoComparator* aComparator,
nsPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aContext,
nsIAtom* aPseudoElement,
nsICSSAnonBoxPseudo* aPseudoElement,
const AtomArray & aInputWord)
{
MOZ_ASSERT(nsCSSAnonBoxes::IsTreePseudoElement(aPseudoElement));
uint32_t count = aInputWord.Length();
// Go ahead and init the transition table.

View File

@ -40,7 +40,7 @@ public:
nsPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aContext,
nsIAtom* aPseudoElement,
nsICSSAnonBoxPseudo* aPseudoElement,
const AtomArray & aInputWord);
protected: