Added width and height attributes for images

git-svn-id: svn://10.0.0.236/trunk@28309 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
1999-04-20 21:07:26 +00:00
parent c4f2a27153
commit 66cbbedcb3
2 changed files with 58 additions and 2 deletions

View File

@@ -1223,6 +1223,34 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
kidDesiredSize.height = NS_UNCONSTRAINEDSIZE;
}
// adjust kidReflowState
nsIHTMLContent* hc = nsnull;
mContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
if(hc != nsnull)
{
float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t);
nsHTMLValue val;
if(NS_CONTENT_ATTR_HAS_VALUE == hc->GetHTMLAttribute(nsHTMLAtoms::width, val))
{
if(eHTMLUnit_Pixel == val.GetUnit())
{
nscoord width = val.GetPixelValue();
kidReflowState.computedWidth = NSIntPixelsToTwips(width, p2t);
}
}
if(NS_CONTENT_ATTR_HAS_VALUE == hc->GetHTMLAttribute(nsHTMLAtoms::height, val))
{
if(eHTMLUnit_Pixel == val.GetUnit())
{
nscoord height = val.GetPixelValue();
kidReflowState.computedHeight = NSIntPixelsToTwips(height, p2t);
}
}
}
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, status);
nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height);
@@ -1233,7 +1261,7 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
aMetrics.ascent = kidDesiredSize.height;
aMetrics.descent = 0;
aStatus = NS_FRAME_COMPLETE;
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}

View File

@@ -1223,6 +1223,34 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
kidDesiredSize.height = NS_UNCONSTRAINEDSIZE;
}
// adjust kidReflowState
nsIHTMLContent* hc = nsnull;
mContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
if(hc != nsnull)
{
float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t);
nsHTMLValue val;
if(NS_CONTENT_ATTR_HAS_VALUE == hc->GetHTMLAttribute(nsHTMLAtoms::width, val))
{
if(eHTMLUnit_Pixel == val.GetUnit())
{
nscoord width = val.GetPixelValue();
kidReflowState.computedWidth = NSIntPixelsToTwips(width, p2t);
}
}
if(NS_CONTENT_ATTR_HAS_VALUE == hc->GetHTMLAttribute(nsHTMLAtoms::height, val))
{
if(eHTMLUnit_Pixel == val.GetUnit())
{
nscoord height = val.GetPixelValue();
kidReflowState.computedHeight = NSIntPixelsToTwips(height, p2t);
}
}
}
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, status);
nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height);
@@ -1233,7 +1261,7 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext,
aMetrics.ascent = kidDesiredSize.height;
aMetrics.descent = 0;
aStatus = NS_FRAME_COMPLETE;
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}