зеркало из https://github.com/mozilla/pjs.git
added GetMarginWidth, SetMarginWidth, GetMarginHeight, SetMarginHeight to web widget, frameset codes calls it.
This commit is contained in:
Родитель
829cd98506
Коммит
46e9b25173
|
@ -133,6 +133,11 @@ public:
|
|||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
NS_IMETHOD GetTitle(nsString& aResult);
|
||||
|
||||
NS_IMETHOD GetMarginWidth (PRInt32& aWidth);
|
||||
NS_IMETHOD SetMarginWidth (PRInt32 aWidth);
|
||||
NS_IMETHOD GetMarginHeight(PRInt32& aWidth);
|
||||
NS_IMETHOD SetMarginHeight(PRInt32 aHeight);
|
||||
|
||||
// nsIWebShellContainer
|
||||
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
|
||||
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
|
||||
|
@ -192,6 +197,8 @@ protected:
|
|||
nsString mOverTarget;
|
||||
|
||||
nsScrollPreference mScrollPref;
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
|
||||
void ReleaseChildren();
|
||||
|
||||
|
@ -262,6 +269,8 @@ nsWebShell::nsWebShell()
|
|||
mScrollPref = nsScrollPreference_kAuto;
|
||||
mScriptGlobal = nsnull;
|
||||
mScriptContext = nsnull;
|
||||
mMarginWidth = -1;
|
||||
mMarginHeight = -1;
|
||||
}
|
||||
|
||||
nsWebShell::~nsWebShell()
|
||||
|
@ -776,6 +785,34 @@ nsWebShell::FindChildWithName(const nsString& aName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetMarginWidth(PRInt32& aWidth)
|
||||
{
|
||||
aWidth = mMarginWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetMarginWidth(PRInt32 aWidth)
|
||||
{
|
||||
mMarginWidth = aWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetMarginHeight(PRInt32& aHeight)
|
||||
{
|
||||
aHeight = mMarginHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetMarginHeight(PRInt32 aHeight)
|
||||
{
|
||||
mMarginHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// History methods
|
||||
|
|
|
@ -198,10 +198,15 @@ public:
|
|||
PRBool IsInline() { return mInline; }
|
||||
|
||||
virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue);
|
||||
PRInt32 GetMarginWidth(nsIPresContext* aPresContext);
|
||||
PRInt32 GetMarginHeight(nsIPresContext* aPresContext);
|
||||
|
||||
|
||||
protected:
|
||||
nsHTMLFrame(nsIAtom* aTag, PRBool aInline, nsIWebShell* aParentWebWidget);
|
||||
virtual ~nsHTMLFrame();
|
||||
PRInt32 GetMargin(nsIAtom* aType, nsIPresContext* aPresContext);
|
||||
|
||||
|
||||
PRBool mInline; // true for <IFRAME>, false for <FRAME>
|
||||
// this is held for a short time until the frame uses it, so it is not ref counted
|
||||
|
@ -502,6 +507,10 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// pass along marginwidth, marginheight so sub document can use it
|
||||
mWebShell->SetMarginWidth(content->GetMarginWidth(&aPresContext));
|
||||
mWebShell->SetMarginHeight(content->GetMarginHeight(&aPresContext));
|
||||
|
||||
nsString frameName;
|
||||
if (content->GetName(frameName)) {
|
||||
mWebShell->SetName(frameName);
|
||||
|
@ -684,6 +693,34 @@ void nsHTMLFrame::MapAttributesInto(nsIStyleContext* aContext,
|
|||
MapImagePropertiesInto(aContext, aPresContext);
|
||||
}
|
||||
|
||||
PRInt32 nsHTMLFrame::GetMargin(nsIAtom* aType, nsIPresContext* aPresContext)
|
||||
{
|
||||
float p2t = aPresContext->GetPixelsToTwips();
|
||||
nsAutoString strVal;
|
||||
PRInt32 intVal;
|
||||
|
||||
if (eContentAttr_HasValue == (GetAttribute(aType, strVal))) {
|
||||
PRInt32 status;
|
||||
intVal = strVal.ToInteger(&status);
|
||||
if (intVal < 0) {
|
||||
intVal = 0;
|
||||
}
|
||||
return NSIntPixelsToTwips(intVal, p2t);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32 nsHTMLFrame::GetMarginWidth(nsIPresContext* aPresContext)
|
||||
{
|
||||
return GetMargin(nsHTMLAtoms::marginwidth, aPresContext);
|
||||
}
|
||||
|
||||
PRInt32 nsHTMLFrame::GetMarginHeight(nsIPresContext* aPresContext)
|
||||
{
|
||||
return GetMargin(nsHTMLAtoms::marginheight, aPresContext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrame::CreateFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParentFrame,
|
||||
|
|
|
@ -125,6 +125,12 @@ public:
|
|||
NS_IMETHOD FindChildWithName(const nsString& aName,
|
||||
nsIWebShell*& aResult) = 0;
|
||||
|
||||
// XXX these are here until there a better way to pass along info to a sub doc
|
||||
NS_IMETHOD GetMarginWidth (PRInt32& aWidth) = 0;
|
||||
NS_IMETHOD SetMarginWidth (PRInt32 aWidth) = 0;
|
||||
NS_IMETHOD GetMarginHeight(PRInt32& aWidth) = 0;
|
||||
NS_IMETHOD SetMarginHeight(PRInt32 aHeight) = 0;
|
||||
|
||||
// History api's
|
||||
NS_IMETHOD Back() = 0;
|
||||
NS_IMETHOD Forward() = 0;
|
||||
|
|
|
@ -133,6 +133,11 @@ public:
|
|||
NS_IMETHOD SetTitle(const nsString& aTitle);
|
||||
NS_IMETHOD GetTitle(nsString& aResult);
|
||||
|
||||
NS_IMETHOD GetMarginWidth (PRInt32& aWidth);
|
||||
NS_IMETHOD SetMarginWidth (PRInt32 aWidth);
|
||||
NS_IMETHOD GetMarginHeight(PRInt32& aWidth);
|
||||
NS_IMETHOD SetMarginHeight(PRInt32 aHeight);
|
||||
|
||||
// nsIWebShellContainer
|
||||
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
|
||||
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
|
||||
|
@ -192,6 +197,8 @@ protected:
|
|||
nsString mOverTarget;
|
||||
|
||||
nsScrollPreference mScrollPref;
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
|
||||
void ReleaseChildren();
|
||||
|
||||
|
@ -262,6 +269,8 @@ nsWebShell::nsWebShell()
|
|||
mScrollPref = nsScrollPreference_kAuto;
|
||||
mScriptGlobal = nsnull;
|
||||
mScriptContext = nsnull;
|
||||
mMarginWidth = -1;
|
||||
mMarginHeight = -1;
|
||||
}
|
||||
|
||||
nsWebShell::~nsWebShell()
|
||||
|
@ -776,6 +785,34 @@ nsWebShell::FindChildWithName(const nsString& aName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetMarginWidth(PRInt32& aWidth)
|
||||
{
|
||||
aWidth = mMarginWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetMarginWidth(PRInt32 aWidth)
|
||||
{
|
||||
mMarginWidth = aWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::GetMarginHeight(PRInt32& aHeight)
|
||||
{
|
||||
aHeight = mMarginHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebShell::SetMarginHeight(PRInt32 aHeight)
|
||||
{
|
||||
mMarginHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// History methods
|
||||
|
|
Загрузка…
Ссылка в новой задаче