Fixed it so border and padding style specified for the HTML element
work again
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
// Interface IDs
|
// Interface IDs
|
||||||
static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
||||||
|
|
||||||
class RootFrame : public nsContainerFrame {
|
class RootFrame : public nsHTMLContainerFrame {
|
||||||
public:
|
public:
|
||||||
RootFrame(nsIContent* aContent);
|
RootFrame(nsIContent* aContent);
|
||||||
|
|
||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
aBase = PR_TRUE;
|
aBase = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual PRIntn GetSkipSides() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pseudo frame created by the root frame
|
// Pseudo frame created by the root frame
|
||||||
@@ -99,7 +102,7 @@ NS_NewHTMLFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RootFrame::RootFrame(nsIContent* aContent)
|
RootFrame::RootFrame(nsIContent* aContent)
|
||||||
: nsContainerFrame(aContent, nsnull)
|
: nsHTMLContainerFrame(aContent, nsnull)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,21 +160,30 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
// Reflow our pseudo frame. It will choose whetever height its child frame
|
// Reflow our pseudo frame. It will choose whetever height its child frame
|
||||||
// wants
|
// wants
|
||||||
if (nsnull != mFirstChild) {
|
if (nsnull != mFirstChild) {
|
||||||
|
// Compute how much space to reserve for our border and padding
|
||||||
|
const nsStyleSpacing* spacing =
|
||||||
|
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin borderPadding;
|
||||||
|
spacing->CalcBorderPaddingFor(this, borderPadding);
|
||||||
|
|
||||||
|
nsSize kidMaxSize(aReflowState.maxSize);
|
||||||
|
kidMaxSize.width -= borderPadding.left + borderPadding.right;
|
||||||
|
kidMaxSize.height -= borderPadding.top + borderPadding.bottom;
|
||||||
nsHTMLReflowMetrics desiredSize(nsnull);
|
nsHTMLReflowMetrics desiredSize(nsnull);
|
||||||
nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState,
|
nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState,
|
||||||
aReflowState.maxSize);
|
kidMaxSize);
|
||||||
// XXX HACK
|
// XXX HACK
|
||||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
||||||
kidReflowState.minWidth = aReflowState.maxSize.width;
|
kidReflowState.minWidth = kidMaxSize.width;
|
||||||
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
||||||
kidReflowState.minHeight = aReflowState.maxSize.height;
|
kidReflowState.minHeight = kidMaxSize.height;
|
||||||
nsIHTMLReflow* htmlReflow;
|
nsIHTMLReflow* htmlReflow;
|
||||||
|
|
||||||
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||||
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||||
|
|
||||||
// Place and size the child
|
// Place and size the child
|
||||||
nsRect rect(0, 0, desiredSize.width, desiredSize.height);
|
nsRect rect(borderPadding.left, borderPadding.top, desiredSize.width, desiredSize.height);
|
||||||
mFirstChild->SetRect(rect);
|
mFirstChild->SetRect(rect);
|
||||||
|
|
||||||
// XXX We should resolve the details of who/when DidReflow() notifications
|
// XXX We should resolve the details of who/when DidReflow() notifications
|
||||||
@@ -190,6 +202,12 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRIntn
|
||||||
|
RootFrame::GetSkipSides() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
RootFrame::HandleEvent(nsIPresContext& aPresContext,
|
RootFrame::HandleEvent(nsIPresContext& aPresContext,
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
// Interface IDs
|
// Interface IDs
|
||||||
static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID);
|
||||||
|
|
||||||
class RootFrame : public nsContainerFrame {
|
class RootFrame : public nsHTMLContainerFrame {
|
||||||
public:
|
public:
|
||||||
RootFrame(nsIContent* aContent);
|
RootFrame(nsIContent* aContent);
|
||||||
|
|
||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
aBase = PR_TRUE;
|
aBase = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual PRIntn GetSkipSides() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pseudo frame created by the root frame
|
// Pseudo frame created by the root frame
|
||||||
@@ -99,7 +102,7 @@ NS_NewHTMLFrame(nsIContent* aContent, nsIFrame* aParentFrame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RootFrame::RootFrame(nsIContent* aContent)
|
RootFrame::RootFrame(nsIContent* aContent)
|
||||||
: nsContainerFrame(aContent, nsnull)
|
: nsHTMLContainerFrame(aContent, nsnull)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,21 +160,30 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
// Reflow our pseudo frame. It will choose whetever height its child frame
|
// Reflow our pseudo frame. It will choose whetever height its child frame
|
||||||
// wants
|
// wants
|
||||||
if (nsnull != mFirstChild) {
|
if (nsnull != mFirstChild) {
|
||||||
|
// Compute how much space to reserve for our border and padding
|
||||||
|
const nsStyleSpacing* spacing =
|
||||||
|
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||||
|
nsMargin borderPadding;
|
||||||
|
spacing->CalcBorderPaddingFor(this, borderPadding);
|
||||||
|
|
||||||
|
nsSize kidMaxSize(aReflowState.maxSize);
|
||||||
|
kidMaxSize.width -= borderPadding.left + borderPadding.right;
|
||||||
|
kidMaxSize.height -= borderPadding.top + borderPadding.bottom;
|
||||||
nsHTMLReflowMetrics desiredSize(nsnull);
|
nsHTMLReflowMetrics desiredSize(nsnull);
|
||||||
nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState,
|
nsHTMLReflowState kidReflowState(aPresContext, mFirstChild, aReflowState,
|
||||||
aReflowState.maxSize);
|
kidMaxSize);
|
||||||
// XXX HACK
|
// XXX HACK
|
||||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
||||||
kidReflowState.minWidth = aReflowState.maxSize.width;
|
kidReflowState.minWidth = kidMaxSize.width;
|
||||||
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
||||||
kidReflowState.minHeight = aReflowState.maxSize.height;
|
kidReflowState.minHeight = kidMaxSize.height;
|
||||||
nsIHTMLReflow* htmlReflow;
|
nsIHTMLReflow* htmlReflow;
|
||||||
|
|
||||||
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||||
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||||
|
|
||||||
// Place and size the child
|
// Place and size the child
|
||||||
nsRect rect(0, 0, desiredSize.width, desiredSize.height);
|
nsRect rect(borderPadding.left, borderPadding.top, desiredSize.width, desiredSize.height);
|
||||||
mFirstChild->SetRect(rect);
|
mFirstChild->SetRect(rect);
|
||||||
|
|
||||||
// XXX We should resolve the details of who/when DidReflow() notifications
|
// XXX We should resolve the details of who/when DidReflow() notifications
|
||||||
@@ -190,6 +202,12 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRIntn
|
||||||
|
RootFrame::GetSkipSides() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
RootFrame::HandleEvent(nsIPresContext& aPresContext,
|
RootFrame::HandleEvent(nsIPresContext& aPresContext,
|
||||||
nsGUIEvent* aEvent,
|
nsGUIEvent* aEvent,
|
||||||
|
|||||||
Reference in New Issue
Block a user