зеркало из https://github.com/mozilla/gecko-dev.git
added visibility style attribute
moved attributes from position to display struct
This commit is contained in:
Родитель
3ce1b73e85
Коммит
9067bd0670
|
@ -52,16 +52,21 @@ NS_METHOD nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect)
|
||||
{
|
||||
// Do not paint ourselves if we are a pseudo-frame
|
||||
if (PR_FALSE == IsPseudoFrame()) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* spacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *color);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *spacing, skipSides);
|
||||
if (PR_FALSE == IsPseudoFrame()) { // this trip isn't really necessary
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
if (disp->mVisible) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* spacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *color);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *spacing, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
|
||||
|
|
|
@ -32,14 +32,19 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext,
|
|||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* mySpacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *myColor);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *mySpacing, 0);
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
if (disp->mVisible) {
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* mySpacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *myColor);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *mySpacing, 0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ AbsoluteFrame::~AbsoluteFrame()
|
|||
|
||||
nsIView* AbsoluteFrame::CreateView(nsIView* aContainingView,
|
||||
const nsRect& aRect,
|
||||
nsStylePosition* aPosition)
|
||||
nsStylePosition* aPosition,
|
||||
nsStyleDisplay* aDisplay)
|
||||
{
|
||||
nsIView* view;
|
||||
|
||||
|
@ -81,22 +82,22 @@ nsIView* AbsoluteFrame::CreateView(nsIView* aContainingView,
|
|||
nsIScrollableView* scrollView = nsnull;
|
||||
nsresult result;
|
||||
nsViewClip clip = {0, 0, 0, 0};
|
||||
PRUint8 clipType = (aPosition->mClipFlags & NS_STYLE_CLIP_TYPE_MASK);
|
||||
PRUint8 clipType = (aDisplay->mClipFlags & NS_STYLE_CLIP_TYPE_MASK);
|
||||
nsViewClip* pClip = nsnull;
|
||||
|
||||
// Is there a clip rect specified?
|
||||
if (NS_STYLE_CLIP_RECT == clipType) {
|
||||
if ((NS_STYLE_CLIP_LEFT_AUTO & aPosition->mClipFlags) == 0) {
|
||||
clip.mLeft = aPosition->mClip.left;
|
||||
if ((NS_STYLE_CLIP_LEFT_AUTO & aDisplay->mClipFlags) == 0) {
|
||||
clip.mLeft = aDisplay->mClip.left;
|
||||
}
|
||||
if ((NS_STYLE_CLIP_RIGHT_AUTO & aPosition->mClipFlags) == 0) {
|
||||
clip.mRight = aPosition->mClip.right;
|
||||
if ((NS_STYLE_CLIP_RIGHT_AUTO & aDisplay->mClipFlags) == 0) {
|
||||
clip.mRight = aDisplay->mClip.right;
|
||||
}
|
||||
if ((NS_STYLE_CLIP_TOP_AUTO & aPosition->mClipFlags) == 0) {
|
||||
clip.mTop = aPosition->mClip.top;
|
||||
if ((NS_STYLE_CLIP_TOP_AUTO & aDisplay->mClipFlags) == 0) {
|
||||
clip.mTop = aDisplay->mClip.top;
|
||||
}
|
||||
if ((NS_STYLE_CLIP_BOTTOM_AUTO & aPosition->mClipFlags) == 0) {
|
||||
clip.mBottom = aPosition->mClip.bottom;
|
||||
if ((NS_STYLE_CLIP_BOTTOM_AUTO & aDisplay->mClipFlags) == 0) {
|
||||
clip.mBottom = aDisplay->mClip.bottom;
|
||||
}
|
||||
pClip = &clip;
|
||||
}
|
||||
|
@ -285,7 +286,8 @@ NS_METHOD AbsoluteFrame::Reflow(nsIPresContext* aPresContext,
|
|||
ComputeViewBounds(containingRect, position, rect);
|
||||
|
||||
// Create a view for the frame
|
||||
nsIView* view = CreateView(containingView, rect, position);
|
||||
nsStyleDisplay* display = (nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
nsIView* view = CreateView(containingView, rect, position, display);
|
||||
NS_RELEASE(containingView);
|
||||
|
||||
mFrame->SetView(view);
|
||||
|
@ -294,7 +296,7 @@ NS_METHOD AbsoluteFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// Resize reflow the absolutely positioned element
|
||||
nsSize availSize(rect.width, rect.height);
|
||||
|
||||
if (NS_STYLE_OVERFLOW_VISIBLE == position->mOverflow) {
|
||||
if (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow) {
|
||||
// Don't constrain the height since the container should be enlarged to
|
||||
// contain overflowing frames
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
@ -309,7 +311,7 @@ NS_METHOD AbsoluteFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// the desired size
|
||||
if ((eStyleUnit_Auto == position->mWidth.GetUnit()) ||
|
||||
((desiredSize.width > availSize.width) &&
|
||||
(NS_STYLE_OVERFLOW_VISIBLE == position->mOverflow))) {
|
||||
(NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow))) {
|
||||
rect.width = desiredSize.width;
|
||||
}
|
||||
if (eStyleUnit_Auto == position->mHeight.GetUnit()) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "nsFrame.h"
|
||||
struct nsStylePosition;
|
||||
struct nsStyleDisplay;
|
||||
|
||||
// Implementation of a frame that's used as a placeholder for an absolutely
|
||||
// positioned frame
|
||||
|
@ -58,7 +59,8 @@ protected:
|
|||
|
||||
nsIView* CreateView(nsIView* aContainingView,
|
||||
const nsRect& aRect,
|
||||
nsStylePosition* aPosition);
|
||||
nsStylePosition* aPosition,
|
||||
nsStyleDisplay* aDisplay);
|
||||
nsIFrame* GetContainingBlock();
|
||||
void ComputeViewBounds(const nsRect& aContainingInnerRect,
|
||||
nsStylePosition* aPosition,
|
||||
|
|
|
@ -98,6 +98,13 @@ NS_METHOD HRuleFrame::Paint(nsIPresContext& aPresContext,
|
|||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
if (PR_FALSE == disp->mVisible) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
nscoord thickness = nscoord(p2t * ((HRulePart*)mContent)->mThickness);
|
||||
|
||||
|
|
|
@ -52,16 +52,21 @@ NS_METHOD nsHTMLContainerFrame::Paint(nsIPresContext& aPresContext,
|
|||
const nsRect& aDirtyRect)
|
||||
{
|
||||
// Do not paint ourselves if we are a pseudo-frame
|
||||
if (PR_FALSE == IsPseudoFrame()) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* spacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *color);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *spacing, skipSides);
|
||||
if (PR_FALSE == IsPseudoFrame()) { // this trip isn't really necessary
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
if (disp->mVisible) {
|
||||
PRIntn skipSides = GetSkipSides();
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* spacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *color);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *spacing, skipSides);
|
||||
}
|
||||
}
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
|
||||
|
|
|
@ -326,24 +326,29 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// First paint background and borders
|
||||
nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
// XXX when rendering the broken image, do not scale!
|
||||
// XXX when we don't have the image, draw the we-don't-have-an-image look
|
||||
if (disp->mVisible) {
|
||||
// First paint background and borders
|
||||
nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
|
||||
|
||||
nsIImage* image = mImageLoader.GetImage();
|
||||
if (nsnull == image) {
|
||||
// No image yet
|
||||
return NS_OK;
|
||||
// XXX when rendering the broken image, do not scale!
|
||||
// XXX when we don't have the image, draw the we-don't-have-an-image look
|
||||
|
||||
nsIImage* image = mImageLoader.GetImage();
|
||||
if (nsnull == image) {
|
||||
// No image yet
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Now render the image into our inner area (the area without the
|
||||
// borders and padding)
|
||||
nsRect inner;
|
||||
GetInnerArea(&aPresContext, inner);
|
||||
aRenderingContext.DrawImage(image, inner);
|
||||
}
|
||||
|
||||
// Now render the image into our inner area (the area without the
|
||||
// borders and padding)
|
||||
nsRect inner;
|
||||
GetInnerArea(&aPresContext, inner);
|
||||
aRenderingContext.DrawImage(image, inner);
|
||||
|
||||
if (GetShowFrameBorders()) {
|
||||
nsIImageMap* map = GetImageMap();
|
||||
if (nsnull != map) {
|
||||
|
|
|
@ -32,14 +32,19 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext,
|
|||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* mySpacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *myColor);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *mySpacing, 0);
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
if (disp->mVisible) {
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleSpacing* mySpacing =
|
||||
(nsStyleSpacing*)mStyleContext->GetData(eStyleStruct_Spacing);
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *myColor);
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
||||
aDirtyRect, mRect, *mySpacing, 0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,42 +86,47 @@ NS_METHOD BulletFrame::Paint(nsIPresContext& aCX,
|
|||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
nsStyleFont* myFont =
|
||||
(nsStyleFont*)mStyleContext->GetData(eStyleStruct_Font);
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleList* myList =
|
||||
(nsStyleList*)mStyleContext->GetData(eStyleStruct_List);
|
||||
nsIFontMetrics* fm = aCX.GetMetricsFor(myFont->mFont);
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
nscoord pad;
|
||||
if (disp->mVisible) {
|
||||
nsStyleFont* myFont =
|
||||
(nsStyleFont*)mStyleContext->GetData(eStyleStruct_Font);
|
||||
nsStyleColor* myColor =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleList* myList =
|
||||
(nsStyleList*)mStyleContext->GetData(eStyleStruct_List);
|
||||
nsIFontMetrics* fm = aCX.GetMetricsFor(myFont->mFont);
|
||||
|
||||
nsAutoString text;
|
||||
switch (myList->mListStyleType) {
|
||||
case NS_STYLE_LIST_STYLE_NONE:
|
||||
break;
|
||||
nscoord pad;
|
||||
|
||||
case NS_STYLE_LIST_STYLE_DISC:
|
||||
case NS_STYLE_LIST_STYLE_CIRCLE:
|
||||
case NS_STYLE_LIST_STYLE_SQUARE:
|
||||
pad = PAD_DISC;
|
||||
aRenderingContext.SetColor(myColor->mColor);
|
||||
aRenderingContext.FillRect(pad, pad, mRect.width - (pad + pad),
|
||||
mRect.height - (pad + pad));/* XXX */
|
||||
break;
|
||||
nsAutoString text;
|
||||
switch (myList->mListStyleType) {
|
||||
case NS_STYLE_LIST_STYLE_NONE:
|
||||
break;
|
||||
|
||||
case NS_STYLE_LIST_STYLE_DECIMAL:
|
||||
case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
|
||||
case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
|
||||
case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
|
||||
GetListItemText(&aCX, text, *myList);
|
||||
aRenderingContext.SetColor(myColor->mColor);
|
||||
aRenderingContext.SetFont(myFont->mFont);
|
||||
aRenderingContext.DrawString(text, 0, 0, fm->GetWidth(text));
|
||||
break;
|
||||
case NS_STYLE_LIST_STYLE_DISC:
|
||||
case NS_STYLE_LIST_STYLE_CIRCLE:
|
||||
case NS_STYLE_LIST_STYLE_SQUARE:
|
||||
pad = PAD_DISC;
|
||||
aRenderingContext.SetColor(myColor->mColor);
|
||||
aRenderingContext.FillRect(pad, pad, mRect.width - (pad + pad),
|
||||
mRect.height - (pad + pad));/* XXX */
|
||||
break;
|
||||
|
||||
case NS_STYLE_LIST_STYLE_DECIMAL:
|
||||
case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
|
||||
case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
|
||||
case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
|
||||
GetListItemText(&aCX, text, *myList);
|
||||
aRenderingContext.SetColor(myColor->mColor);
|
||||
aRenderingContext.SetFont(myFont->mFont);
|
||||
aRenderingContext.DrawString(text, 0, 0, fm->GetWidth(text));
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(fm);
|
||||
}
|
||||
NS_RELEASE(fm);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -431,31 +431,36 @@ NS_METHOD TextFrame::Paint(nsIPresContext& aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get style data
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleFont* font =
|
||||
(nsStyleFont*)mStyleContext->GetData(eStyleStruct_Font);
|
||||
nsStyleDisplay* disp =
|
||||
(nsStyleDisplay*)mStyleContext->GetData(eStyleStruct_Display);
|
||||
|
||||
// Set font and color
|
||||
aRenderingContext.SetColor(color->mColor);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
if (disp->mVisible) {
|
||||
// Get style data
|
||||
nsStyleColor* color =
|
||||
(nsStyleColor*)mStyleContext->GetData(eStyleStruct_Color);
|
||||
nsStyleFont* font =
|
||||
(nsStyleFont*)mStyleContext->GetData(eStyleStruct_Font);
|
||||
|
||||
if (nsnull != mWords) {
|
||||
PaintJustifiedText(aRenderingContext, aDirtyRect, 0, 0);
|
||||
// Set font and color
|
||||
aRenderingContext.SetColor(color->mColor);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
|
||||
if (nsnull != mWords) {
|
||||
PaintJustifiedText(aRenderingContext, aDirtyRect, 0, 0);
|
||||
if (font->mThreeD) {
|
||||
nscoord onePixel = nscoord(1.0f * aPresContext.GetPixelsToTwips());
|
||||
aRenderingContext.SetColor(color->mBackgroundColor);
|
||||
PaintJustifiedText(aRenderingContext, aDirtyRect, onePixel, onePixel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
PaintRegularText(aPresContext, aRenderingContext, aDirtyRect, 0, 0);
|
||||
//nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
|
||||
if (font->mThreeD) {
|
||||
nscoord onePixel = nscoord(1.0f * aPresContext.GetPixelsToTwips());
|
||||
aRenderingContext.SetColor(color->mBackgroundColor);
|
||||
PaintJustifiedText(aRenderingContext, aDirtyRect, onePixel, onePixel);
|
||||
PaintRegularText(aPresContext, aRenderingContext, aDirtyRect, onePixel, onePixel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
PaintRegularText(aPresContext, aRenderingContext, aDirtyRect, 0, 0);
|
||||
//nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect);
|
||||
if (font->mThreeD) {
|
||||
nscoord onePixel = nscoord(1.0f * aPresContext.GetPixelsToTwips());
|
||||
aRenderingContext.SetColor(color->mBackgroundColor);
|
||||
PaintRegularText(aPresContext, aRenderingContext, aDirtyRect, onePixel, onePixel);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче