bug 92143 - alexsavulov's patch for special handling of nowrap on <td> when there is a width. sr=attinasi, r=karnaze.

This commit is contained in:
karnaze%netscape.com 2001-09-21 13:43:18 +00:00
Родитель b0afd473d0
Коммит b66c308429
2 изменённых файлов: 46 добавлений и 2 удалений

Просмотреть файл

@ -51,6 +51,7 @@
#endif
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsINameSpaceManager.h"
//TABLECELL SELECTION
@ -149,7 +150,28 @@ void nsTableCellFrame::SetPass1MaxElementSize(nscoord aMaxWidth,
const nsSize& aMaxElementSize)
{
mPass1MaxElementSize.height = aMaxElementSize.height;
mPass1MaxElementSize.width = aMaxElementSize.width;
nscoord maxElemWidth = aMaxElementSize.width;
const nsStylePosition* stylePosition;
const nsStyleText* styleText;
// check for fixed width and not nowrap and not pre
GetStyleData(eStyleStruct_Position, ((const nsStyleStruct *&)stylePosition));
GetStyleData(eStyleStruct_Text, ((const nsStyleStruct *&)styleText));
if (stylePosition->mWidth.GetUnit() == eStyleUnit_Coord &&
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_NOWRAP &&
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_PRE) {
// has fixed width, check the content for nowrap
nsAutoString nowrap;
nsCOMPtr<nsIContent> cellContent;
GetContent(getter_AddRefs(cellContent));
nsresult result = cellContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::nowrap, nowrap);
if(NS_CONTENT_ATTR_NOT_THERE != result) {
// content has nowrap (is not mapped to style be cause it has width)
// set the max element size to the value of the fixed width (NAV/IE quirk)
maxElemWidth = stylePosition->mWidth.GetCoordValue();
}
}
mPass1MaxElementSize.width = maxElemWidth;
}
NS_IMETHODIMP

Просмотреть файл

@ -51,6 +51,7 @@
#endif
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsINameSpaceManager.h"
//TABLECELL SELECTION
@ -149,7 +150,28 @@ void nsTableCellFrame::SetPass1MaxElementSize(nscoord aMaxWidth,
const nsSize& aMaxElementSize)
{
mPass1MaxElementSize.height = aMaxElementSize.height;
mPass1MaxElementSize.width = aMaxElementSize.width;
nscoord maxElemWidth = aMaxElementSize.width;
const nsStylePosition* stylePosition;
const nsStyleText* styleText;
// check for fixed width and not nowrap and not pre
GetStyleData(eStyleStruct_Position, ((const nsStyleStruct *&)stylePosition));
GetStyleData(eStyleStruct_Text, ((const nsStyleStruct *&)styleText));
if (stylePosition->mWidth.GetUnit() == eStyleUnit_Coord &&
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_NOWRAP &&
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_PRE) {
// has fixed width, check the content for nowrap
nsAutoString nowrap;
nsCOMPtr<nsIContent> cellContent;
GetContent(getter_AddRefs(cellContent));
nsresult result = cellContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::nowrap, nowrap);
if(NS_CONTENT_ATTR_NOT_THERE != result) {
// content has nowrap (is not mapped to style be cause it has width)
// set the max element size to the value of the fixed width (NAV/IE quirk)
maxElemWidth = stylePosition->mWidth.GetCoordValue();
}
}
mPass1MaxElementSize.width = maxElemWidth;
}
NS_IMETHODIMP