mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 381645: Remove nsBoxFrame::GetContentOf. r+sr=dbaron.
This commit is contained in:
parent
c8d6f7ee01
commit
d4a50fcc87
@ -851,14 +851,6 @@ nsHTMLScrollFrame::CurPosAttributeChanged(nsIContent* aChild,
|
||||
mInner.CurPosAttributeChanged(aChild);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLScrollFrame::GetContentOf(nsIContent** aContent)
|
||||
{
|
||||
*aContent = GetContent();
|
||||
NS_IF_ADDREF(*aContent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLScrollFrame)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
|
||||
#ifdef NS_DEBUG
|
||||
@ -1196,15 +1188,6 @@ nsXULScrollFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULScrollFrame::GetContentOf(nsIContent** aContent)
|
||||
{
|
||||
*aContent = GetContent();
|
||||
NS_IF_ADDREF(*aContent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXULScrollFrame)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -373,8 +373,6 @@ public:
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
virtual nsresult GetContentOf(nsIContent** aContent);
|
||||
|
||||
PRBool DidHistoryRestore() { return mInner.mDidHistoryRestore; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -572,8 +570,6 @@ public:
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
|
||||
virtual nsresult GetContentOf(nsIContent** aContent);
|
||||
|
||||
protected:
|
||||
nsXULScrollFrame(nsIPresShell* aShell, nsStyleContext* aContext, PRBool aIsRoot);
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
@ -292,15 +292,12 @@ nsBoxFrame::CacheAttributes()
|
||||
PRBool
|
||||
nsBoxFrame::GetInitialDebug(PRBool& aDebug)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_false, &nsGkAtoms::_true, nsnull};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::debug, strings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
aDebug = index == 1;
|
||||
@ -314,16 +311,14 @@ nsBoxFrame::GetInitialDebug(PRBool& aDebug)
|
||||
PRBool
|
||||
nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
// XXXdwh Everything inside this if statement is deprecated code.
|
||||
static nsIContent::AttrValuesArray alignStrings[] =
|
||||
{&nsGkAtoms::left, &nsGkAtoms::right, nsnull};
|
||||
static const Halignment alignValues[] = {hAlign_Left, hAlign_Right};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align,
|
||||
alignStrings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
aHalign = alignValues[index];
|
||||
@ -338,7 +333,7 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
||||
{&nsGkAtoms::_empty, &nsGkAtoms::start, &nsGkAtoms::center, &nsGkAtoms::end, nsnull};
|
||||
static const Halignment values[] =
|
||||
{hAlign_Left/*not used*/, hAlign_Left, hAlign_Center, hAlign_Right};
|
||||
index = content->FindAttrValueIn(kNameSpaceID_None, attrName,
|
||||
index = GetContent()->FindAttrValueIn(kNameSpaceID_None, attrName,
|
||||
strings, eCaseMatters);
|
||||
|
||||
if (index == nsIContent::ATTR_VALUE_NO_MATCH) {
|
||||
@ -391,16 +386,14 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
||||
PRBool
|
||||
nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
static nsIContent::AttrValuesArray valignStrings[] =
|
||||
{&nsGkAtoms::top, &nsGkAtoms::baseline, &nsGkAtoms::middle, &nsGkAtoms::bottom, nsnull};
|
||||
static const Valignment valignValues[] =
|
||||
{vAlign_Top, vAlign_BaseLine, vAlign_Middle, vAlign_Bottom};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::valign,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::valign,
|
||||
valignStrings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
aValign = valignValues[index];
|
||||
@ -416,7 +409,7 @@ nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign)
|
||||
&nsGkAtoms::baseline, &nsGkAtoms::end, nsnull};
|
||||
static const Valignment values[] =
|
||||
{vAlign_Top/*not used*/, vAlign_Top, vAlign_Middle, vAlign_BaseLine, vAlign_Bottom};
|
||||
index = content->FindAttrValueIn(kNameSpaceID_None, attrName,
|
||||
index = GetContent()->FindAttrValueIn(kNameSpaceID_None, attrName,
|
||||
strings, eCaseMatters);
|
||||
if (index == nsIContent::ATTR_VALUE_NO_MATCH) {
|
||||
// The attr was present but had a nonsensical value. Revert to the default.
|
||||
@ -472,10 +465,7 @@ void
|
||||
nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
||||
{
|
||||
// see if we are a vertical or horizontal box.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return;
|
||||
|
||||
// Check the style system first.
|
||||
@ -489,7 +479,7 @@ nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
||||
// the style system value.
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::vertical, &nsGkAtoms::horizontal, nsnull};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::orient,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::orient,
|
||||
strings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
aIsHorizontal = index == 1;
|
||||
@ -499,10 +489,7 @@ nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
||||
void
|
||||
nsBoxFrame::GetInitialDirection(PRBool& aIsNormal)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return;
|
||||
|
||||
if (IsHorizontal()) {
|
||||
@ -522,7 +509,7 @@ nsBoxFrame::GetInitialDirection(PRBool& aIsNormal)
|
||||
// the style system value.
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::reverse, &nsGkAtoms::ltr, &nsGkAtoms::rtl, nsnull};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
|
||||
strings, eCaseMatters);
|
||||
if (index >= 0) {
|
||||
PRPackedBool values[] = {!aIsNormal, PR_TRUE, PR_FALSE};
|
||||
@ -536,13 +523,10 @@ PRBool
|
||||
nsBoxFrame::GetInitialEqualSize(PRBool& aEqualSize)
|
||||
{
|
||||
// see if we are a vertical or horizontal box.
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::equalsize,
|
||||
if (GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::equalsize,
|
||||
nsGkAtoms::always, eCaseMatters)) {
|
||||
aEqualSize = PR_TRUE;
|
||||
return PR_TRUE;
|
||||
@ -556,16 +540,13 @@ nsBoxFrame::GetInitialEqualSize(PRBool& aEqualSize)
|
||||
PRBool
|
||||
nsBoxFrame::GetInitialAutoStretch(PRBool& aStretch)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
// Check the align attribute.
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_empty, &nsGkAtoms::stretch, nsnull};
|
||||
PRInt32 index = content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align,
|
||||
PRInt32 index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align,
|
||||
strings, eCaseMatters);
|
||||
if (index != nsIContent::ATTR_MISSING && index != 0) {
|
||||
aStretch = index == 1;
|
||||
@ -1495,25 +1476,6 @@ nsBoxFrame::GetDebug(PRBool& aDebug)
|
||||
|
||||
// REVIEW: GetCursor had debug-only event dumping code. I have replaced it
|
||||
// with instrumentation in nsDisplayXULDebug.
|
||||
nsresult
|
||||
nsBoxFrame::GetContentOf(nsIContent** aContent)
|
||||
{
|
||||
// If we don't have a content node find a parent that does.
|
||||
nsIFrame *frame = this;
|
||||
while (frame) {
|
||||
*aContent = frame->GetContent();
|
||||
if (*aContent) {
|
||||
NS_ADDREF(*aContent);
|
||||
NS_ASSERTION(*aContent == GetContent(), "Can't happen");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
frame = frame->GetParent();
|
||||
}
|
||||
|
||||
*aContent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
void
|
||||
@ -1594,7 +1556,6 @@ nsBoxFrame::GetDebugPadding(nsMargin& aPadding)
|
||||
{
|
||||
aPadding.SizeTo(2,2,2,2);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsBoxFrame::PixelMarginToTwips(nsPresContext* aPresContext, nsMargin& aMarginPixels)
|
||||
@ -1606,8 +1567,6 @@ nsBoxFrame::PixelMarginToTwips(nsPresContext* aPresContext, nsMargin& aMarginPix
|
||||
aMarginPixels.bottom *= onePixel;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
void
|
||||
nsBoxFrame::GetValue(nsPresContext* aPresContext, const nsSize& a, const nsSize& b, char* ch)
|
||||
{
|
||||
@ -1774,7 +1733,6 @@ nsBoxFrame::SetDebugOnChildList(nsBoxLayoutState& aState, nsIBox* aChild, PRBool
|
||||
child = child->GetNextBox();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsBoxFrame::GetFrameSizeWithMargin(nsIBox* aBox, nsSize& aSize)
|
||||
@ -1787,6 +1745,7 @@ nsBoxFrame::GetFrameSizeWithMargin(nsIBox* aBox, nsSize& aSize)
|
||||
aSize.height = rect.height;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Boxed don't support fixed positionioning of their children.
|
||||
|
@ -50,15 +50,6 @@
|
||||
#include "nsContainerFrame.h"
|
||||
class nsBoxLayoutState;
|
||||
|
||||
class nsHTMLReflowCommand;
|
||||
class nsHTMLInfo;
|
||||
|
||||
// flags for box info
|
||||
#define NS_FRAME_BOX_SIZE_VALID 0x0001
|
||||
#define NS_FRAME_BOX_IS_COLLAPSED 0x0002
|
||||
#define NS_FRAME_BOX_NEEDS_RECALC 0x0004
|
||||
|
||||
|
||||
// flags from box
|
||||
#define NS_STATE_BOX_CHILD_RESERVED 0x00100000
|
||||
#define NS_STATE_STACK_NOT_POSITIONED 0x00200000
|
||||
@ -169,8 +160,6 @@ public:
|
||||
|
||||
virtual ~nsBoxFrame();
|
||||
|
||||
virtual nsresult GetContentOf(nsIContent** aContent);
|
||||
|
||||
nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = nsnull, nsIBoxLayout* aLayoutManager = nsnull);
|
||||
|
||||
static nsresult CreateViewForFrame(nsPresContext* aPresContext,
|
||||
@ -188,9 +177,6 @@ public:
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
nsIBox* GetBoxAt(PRInt32 aIndex) { return mFrames.FrameAt(aIndex); }
|
||||
PRInt32 GetChildCount() { return mFrames.GetLength(); }
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
virtual void SetDebugOnChildList(nsBoxLayoutState& aState, nsIBox* aChild, PRBool aDebug);
|
||||
nsresult DisplayDebugInfoFor(nsIBox* aBox,
|
||||
@ -258,13 +244,10 @@ private:
|
||||
void GetDebugPadding(nsMargin& aInset);
|
||||
void GetDebugMargin(nsMargin& aInset);
|
||||
|
||||
#endif
|
||||
|
||||
nsresult GetFrameSizeWithMargin(nsIBox* aBox, nsSize& aSize);
|
||||
|
||||
void PixelMarginToTwips(nsPresContext* aPresContext, nsMargin& aMarginPixels);
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
void GetValue(nsPresContext* aPresContext, const nsSize& a, const nsSize& b, char* value);
|
||||
void GetValue(nsPresContext* aPresContext, PRInt32 a, PRInt32 b, char* value);
|
||||
void DrawSpacer(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, PRBool aHorizontal, PRInt32 flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize);
|
||||
|
@ -187,7 +187,7 @@ nsDeckFrame::GetSelectedIndex()
|
||||
nsIBox*
|
||||
nsDeckFrame::GetSelectedBox()
|
||||
{
|
||||
return (mIndex >= 0) ? GetBoxAt(mIndex) : nsnull;
|
||||
return (mIndex >= 0) ? mFrames.FrameAt(mIndex) : nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -59,7 +59,6 @@
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIImage.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -303,13 +303,10 @@ nsResizerFrame::GetInitialDirection(eDirection& aDirection)
|
||||
// see what kind of resizer we are.
|
||||
nsAutoString value;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
GetContentOf(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
if (!GetContent())
|
||||
return PR_FALSE;
|
||||
|
||||
if (content->GetAttr(kNameSpaceID_None, nsGkAtoms::dir, value)) {
|
||||
if (GetContent()->GetAttr(kNameSpaceID_None, nsGkAtoms::dir, value)) {
|
||||
return EvalDirection(value,aDirection);
|
||||
}
|
||||
|
||||
|
@ -56,15 +56,12 @@
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsScrollbarButtonFrame.h"
|
||||
#include "nsIScrollbarListener.h"
|
||||
#include "nsIScrollbarMediator.h"
|
||||
#include "nsIScrollbarFrame.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsRepeatService.h"
|
||||
#include "nsBoxLayoutState.h"
|
||||
@ -134,8 +131,7 @@ nsSliderFrame::RemoveFrame(nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
|
||||
PRInt32 start = GetChildCount();
|
||||
if (start == 0)
|
||||
if (mFrames.IsEmpty())
|
||||
RemoveListener();
|
||||
|
||||
return rv;
|
||||
@ -146,9 +142,9 @@ nsSliderFrame::InsertFrames(nsIAtom* aListName,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList)
|
||||
{
|
||||
PRInt32 start = GetChildCount();
|
||||
PRBool wasEmpty = mFrames.IsEmpty();
|
||||
nsresult rv = nsBoxFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
|
||||
if (start == 0)
|
||||
if (wasEmpty)
|
||||
AddListener();
|
||||
|
||||
return rv;
|
||||
@ -160,9 +156,9 @@ nsSliderFrame::AppendFrames(nsIAtom* aListName,
|
||||
{
|
||||
// if we have no children and on was added then make sure we add the
|
||||
// listener
|
||||
PRInt32 start = GetChildCount();
|
||||
PRBool wasEmpty = mFrames.IsEmpty();
|
||||
nsresult rv = nsBoxFrame::AppendFrames(aListName, aFrameList);
|
||||
if (start == 0)
|
||||
if (wasEmpty)
|
||||
AddListener();
|
||||
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user