Merge layout work from projects/birch, part 1. a=bsmedberg

This commit is contained in:
L. David Baron 2011-03-23 12:36:08 -07:00
Родитель 1ef146d92d 2819c13fc2
Коммит 4520f10e49
50 изменённых файлов: 1515 добавлений и 2073 удалений

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

@ -2320,7 +2320,6 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
language, language,
fontStyle->mFont.sizeAdjust, fontStyle->mFont.sizeAdjust,
fontStyle->mFont.systemFont, fontStyle->mFont.systemFont,
fontStyle->mFont.familyNameQuirks,
printerFont, printerFont,
fontStyle->mFont.featureSettings, fontStyle->mFont.featureSettings,
fontStyle->mFont.languageOverride); fontStyle->mFont.languageOverride);

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

@ -194,7 +194,6 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (value && value->Type() == nsAttrValue::eString && if (value && value->Type() == nsAttrValue::eString &&
!value->IsEmptyString()) { !value->IsEmptyString()) {
font.mFamily.SetStringValue(value->GetStringValue(), eCSSUnit_Families); font.mFamily.SetStringValue(value->GetStringValue(), eCSSUnit_Families);
font.mFamilyFromHTML = PR_TRUE;
} }
} }

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

@ -403,7 +403,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
aData->mFontData->mFamily.GetUnit() == eCSSUnit_Null) { aData->mFontData->mFamily.GetUnit() == eCSSUnit_Null) {
aData->mFontData->mFamily.SetStringValue(value->GetStringValue(), aData->mFontData->mFamily.SetStringValue(value->GetStringValue(),
eCSSUnit_Families); eCSSUnit_Families);
aData->mFontData->mFamilyFromHTML = PR_FALSE;
} }
} }

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

@ -52,7 +52,6 @@ nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
style = aStyle; style = aStyle;
systemFont = PR_FALSE; systemFont = PR_FALSE;
variant = aVariant; variant = aVariant;
familyNameQuirks = PR_FALSE;
weight = aWeight; weight = aWeight;
stretch = aStretch; stretch = aStretch;
decorations = aDecoration; decorations = aDecoration;
@ -76,7 +75,6 @@ nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant,
style = aStyle; style = aStyle;
systemFont = PR_FALSE; systemFont = PR_FALSE;
variant = aVariant; variant = aVariant;
familyNameQuirks = PR_FALSE;
weight = aWeight; weight = aWeight;
stretch = aStretch; stretch = aStretch;
decorations = aDecoration; decorations = aDecoration;
@ -96,7 +94,6 @@ nsFont::nsFont(const nsFont& aOther)
style = aOther.style; style = aOther.style;
systemFont = aOther.systemFont; systemFont = aOther.systemFont;
variant = aOther.variant; variant = aOther.variant;
familyNameQuirks = aOther.familyNameQuirks;
weight = aOther.weight; weight = aOther.weight;
stretch = aOther.stretch; stretch = aOther.stretch;
decorations = aOther.decorations; decorations = aOther.decorations;
@ -118,7 +115,6 @@ PRBool nsFont::BaseEquals(const nsFont& aOther) const
{ {
if ((style == aOther.style) && if ((style == aOther.style) &&
(systemFont == aOther.systemFont) && (systemFont == aOther.systemFont) &&
(familyNameQuirks == aOther.familyNameQuirks) &&
(weight == aOther.weight) && (weight == aOther.weight) &&
(stretch == aOther.stretch) && (stretch == aOther.stretch) &&
(size == aOther.size) && (size == aOther.size) &&
@ -147,7 +143,6 @@ nsFont& nsFont::operator=(const nsFont& aOther)
style = aOther.style; style = aOther.style;
systemFont = aOther.systemFont; systemFont = aOther.systemFont;
variant = aOther.variant; variant = aOther.variant;
familyNameQuirks = aOther.familyNameQuirks;
weight = aOther.weight; weight = aOther.weight;
stretch = aOther.stretch; stretch = aOther.stretch;
decorations = aOther.decorations; decorations = aOther.decorations;

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

@ -78,10 +78,6 @@ struct NS_GFX nsFont {
// The variant of the font (normal, small-caps) // The variant of the font (normal, small-caps)
PRUint8 variant; PRUint8 variant;
// True if the character set quirks (for treatment of "Symbol",
// "Wingdings", etc.) should be applied.
PRUint8 familyNameQuirks;
// The weight of the font; see gfxFontConstants.h. // The weight of the font; see gfxFontConstants.h.
PRUint16 weight; PRUint16 weight;

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

@ -826,7 +826,6 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
aFont->style = fontStyle.style; aFont->style = fontStyle.style;
aFont->systemFont = fontStyle.systemFont; aFont->systemFont = fontStyle.systemFont;
aFont->variant = NS_FONT_VARIANT_NORMAL; aFont->variant = NS_FONT_VARIANT_NORMAL;
aFont->familyNameQuirks = fontStyle.familyNameQuirks;
aFont->weight = fontStyle.weight; aFont->weight = fontStyle.weight;
aFont->stretch = fontStyle.stretch; aFont->stretch = fontStyle.stretch;
aFont->decorations = NS_FONT_DECORATION_NONE; aFont->decorations = NS_FONT_DECORATION_NONE;

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

@ -82,7 +82,6 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage,
mFontStyle = new gfxFontStyle(aFont.style, aFont.weight, aFont.stretch, mFontStyle = new gfxFontStyle(aFont.style, aFont.weight, aFont.stretch,
size, aLanguage, size, aLanguage,
aFont.sizeAdjust, aFont.systemFont, aFont.sizeAdjust, aFont.systemFont,
aFont.familyNameQuirks,
printerFont, printerFont,
aFont.featureSettings, aFont.featureSettings,
aFont.languageOverride); aFont.languageOverride);

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

@ -117,19 +117,6 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect,
return mContext; return mContext;
} }
void
gfxAlphaBoxBlur::PremultiplyAlpha(gfxFloat alpha)
{
if (!mImageSurface)
return;
unsigned char* data = mImageSurface->Data();
PRInt32 length = mImageSurface->GetDataSize();
for (PRInt32 i=0; i<length; ++i)
data[i] = static_cast<unsigned char>(data[i] * alpha);
}
/** /**
* Box blur involves looking at one pixel, and setting its value to the average * Box blur involves looking at one pixel, and setting its value to the average
* of its neighbouring pixels. * of its neighbouring pixels.

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

@ -103,11 +103,6 @@ public:
return mContext; return mContext;
} }
/**
* Premultiplies the image by the given alpha.
*/
void PremultiplyAlpha(gfxFloat alpha);
/** /**
* Does the actual blurring/spreading and mask applying. Users of this * Does the actual blurring/spreading and mask applying. Users of this
* object must have drawn whatever they want to be blurred onto the internal * object must have drawn whatever they want to be blurred onto the internal

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

@ -2860,7 +2860,7 @@ gfxFontStyle::ParseFontLanguageOverride(const nsString& aLangTag)
gfxFontStyle::gfxFontStyle() : gfxFontStyle::gfxFontStyle() :
style(FONT_STYLE_NORMAL), systemFont(PR_TRUE), printerFont(PR_FALSE), style(FONT_STYLE_NORMAL), systemFont(PR_TRUE), printerFont(PR_FALSE),
familyNameQuirks(PR_FALSE), weight(FONT_WEIGHT_NORMAL), weight(FONT_WEIGHT_NORMAL),
stretch(NS_FONT_STRETCH_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE), stretch(NS_FONT_STRETCH_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE),
sizeAdjust(0.0f), sizeAdjust(0.0f),
language(gfxAtoms::x_western), language(gfxAtoms::x_western),
@ -2871,12 +2871,11 @@ gfxFontStyle::gfxFontStyle() :
gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch,
gfxFloat aSize, nsIAtom *aLanguage, gfxFloat aSize, nsIAtom *aLanguage,
float aSizeAdjust, PRPackedBool aSystemFont, float aSizeAdjust, PRPackedBool aSystemFont,
PRPackedBool aFamilyNameQuirks,
PRPackedBool aPrinterFont, PRPackedBool aPrinterFont,
const nsString& aFeatureSettings, const nsString& aFeatureSettings,
const nsString& aLanguageOverride): const nsString& aLanguageOverride):
style(aStyle), systemFont(aSystemFont), printerFont(aPrinterFont), style(aStyle), systemFont(aSystemFont), printerFont(aPrinterFont),
familyNameQuirks(aFamilyNameQuirks), weight(aWeight), stretch(aStretch), weight(aWeight), stretch(aStretch),
size(aSize), sizeAdjust(aSizeAdjust), size(aSize), sizeAdjust(aSizeAdjust),
language(aLanguage), language(aLanguage),
languageOverride(ParseFontLanguageOverride(aLanguageOverride)) languageOverride(ParseFontLanguageOverride(aLanguageOverride))
@ -2904,7 +2903,7 @@ gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch,
gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) : gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
style(aStyle.style), systemFont(aStyle.systemFont), printerFont(aStyle.printerFont), style(aStyle.style), systemFont(aStyle.systemFont), printerFont(aStyle.printerFont),
familyNameQuirks(aStyle.familyNameQuirks), weight(aStyle.weight), weight(aStyle.weight),
stretch(aStyle.stretch), size(aStyle.size), stretch(aStyle.stretch), size(aStyle.size),
sizeAdjust(aStyle.sizeAdjust), sizeAdjust(aStyle.sizeAdjust),
language(aStyle.language), language(aStyle.language),

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

@ -111,7 +111,6 @@ struct THEBES_API gfxFontStyle {
gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch,
gfxFloat aSize, nsIAtom *aLanguage, gfxFloat aSize, nsIAtom *aLanguage,
float aSizeAdjust, PRPackedBool aSystemFont, float aSizeAdjust, PRPackedBool aSystemFont,
PRPackedBool aFamilyNameQuirks,
PRPackedBool aPrinterFont, PRPackedBool aPrinterFont,
const nsString& aFeatureSettings, const nsString& aFeatureSettings,
const nsString& aLanguageOverride); const nsString& aLanguageOverride);
@ -128,10 +127,6 @@ struct THEBES_API gfxFontStyle {
// Say that this font is used for print or print preview. // Say that this font is used for print or print preview.
PRPackedBool printerFont : 1; PRPackedBool printerFont : 1;
// True if the character set quirks (for treatment of "Symbol",
// "Wingdings", etc.) should be applied.
PRPackedBool familyNameQuirks : 1;
// The weight of the font: 100, 200, ... 900. // The weight of the font: 100, 200, ... 900.
PRUint16 weight; PRUint16 weight;
@ -177,8 +172,8 @@ struct THEBES_API gfxFontStyle {
} }
PLDHashNumber Hash() const { PLDHashNumber Hash() const {
return ((style + (systemFont << 7) + (familyNameQuirks << 8) + return ((style + (systemFont << 7) +
(weight << 9)) + PRUint32(size*1000) + PRUint32(sizeAdjust*1000)) ^ (weight << 8)) + PRUint32(size*1000) + PRUint32(sizeAdjust*1000)) ^
nsISupportsHashKey::HashKey(language); nsISupportsHashKey::HashKey(language);
} }
@ -189,7 +184,6 @@ struct THEBES_API gfxFontStyle {
(style == other.style) && (style == other.style) &&
(systemFont == other.systemFont) && (systemFont == other.systemFont) &&
(printerFont == other.printerFont) && (printerFont == other.printerFont) &&
(familyNameQuirks == other.familyNameQuirks) &&
(weight == other.weight) && (weight == other.weight) &&
(stretch == other.stretch) && (stretch == other.stretch) &&
(language == other.language) && (language == other.language) &&

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

@ -2346,7 +2346,7 @@ gfxFcFont::GetOrMakeFont(FcPattern *aRequestedPattern, FcPattern *aFontPattern)
// FIXME: Pass a real stretch based on renderPattern! // FIXME: Pass a real stretch based on renderPattern!
gfxFontStyle fontStyle(style, weight, NS_FONT_STRETCH_NORMAL, gfxFontStyle fontStyle(style, weight, NS_FONT_STRETCH_NORMAL,
size, language, 0.0, size, language, 0.0,
PR_TRUE, PR_FALSE, PR_FALSE, PR_TRUE, PR_FALSE,
NS_LITERAL_STRING(""), NS_LITERAL_STRING(""),
NS_LITERAL_STRING("")); NS_LITERAL_STRING(""));

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

@ -3434,7 +3434,7 @@ nsCSSFrameConstructor::ConstructTextFrame(const FrameConstructionData* aData,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt, nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt,
nsIContent* aContent, Element* aElement,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
const FrameConstructionDataByInt* aDataPtr, const FrameConstructionDataByInt* aDataPtr,
PRUint32 aDataLength) PRUint32 aDataLength)
@ -3446,7 +3446,7 @@ nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt,
if (curData->mInt == aInt) { if (curData->mInt == aInt) {
const FrameConstructionData* data = &curData->mData; const FrameConstructionData* data = &curData->mData;
if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) { if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) {
return data->mFunc.mDataGetter(aContent, aStyleContext); return data->mFunc.mDataGetter(aElement, aStyleContext);
} }
return data; return data;
@ -3459,7 +3459,7 @@ nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag, nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag,
nsIContent* aContent, Element* aElement,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
const FrameConstructionDataByTag* aDataPtr, const FrameConstructionDataByTag* aDataPtr,
PRUint32 aDataLength) PRUint32 aDataLength)
@ -3471,7 +3471,7 @@ nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag,
if (*curData->mTag == aTag) { if (*curData->mTag == aTag) {
const FrameConstructionData* data = &curData->mData; const FrameConstructionData* data = &curData->mData;
if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) { if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) {
return data->mFunc.mDataGetter(aContent, aStyleContext); return data->mFunc.mDataGetter(aElement, aStyleContext);
} }
return data; return data;
@ -3497,7 +3497,7 @@ nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent, nsCSSFrameConstructor::FindHTMLData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
@ -3520,9 +3520,8 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
(aParentFrame->GetType() != nsGkAtoms::fieldSetFrame && (aParentFrame->GetType() != nsGkAtoms::fieldSetFrame &&
aParentFrame->GetStyleContext()->GetPseudo() != aParentFrame->GetStyleContext()->GetPseudo() !=
nsCSSAnonBoxes::fieldsetContent) || nsCSSAnonBoxes::fieldsetContent) ||
!aContent->GetParent() || !aElement->GetParent() ||
!aContent->GetParent()->IsHTML() || !aElement->GetParent()->IsHTML(nsGkAtoms::fieldset) ||
aContent->GetParent()->Tag() != nsGkAtoms::fieldset ||
aStyleContext->GetStyleDisplay()->IsFloating() || aStyleContext->GetStyleDisplay()->IsFloating() ||
aStyleContext->GetStyleDisplay()->IsAbsolutelyPositioned())) { aStyleContext->GetStyleDisplay()->IsAbsolutelyPositioned())) {
// <legend> is only special inside fieldset, check both the frame tree // <legend> is only special inside fieldset, check both the frame tree
@ -3565,16 +3564,16 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent,
SIMPLE_TAG_CREATE(isindex, NS_NewIsIndexFrame) SIMPLE_TAG_CREATE(isindex, NS_NewIsIndexFrame)
}; };
return FindDataByTag(aTag, aContent, aStyleContext, sHTMLData, return FindDataByTag(aTag, aElement, aStyleContext, sHTMLData,
NS_ARRAY_LENGTH(sHTMLData)); NS_ARRAY_LENGTH(sHTMLData));
} }
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindImgData(nsIContent* aContent, nsCSSFrameConstructor::FindImgData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
if (!nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) { if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyleContext)) {
return nsnull; return nsnull;
} }
@ -3584,10 +3583,10 @@ nsCSSFrameConstructor::FindImgData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindImgControlData(nsIContent* aContent, nsCSSFrameConstructor::FindImgControlData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
if (!nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) { if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyleContext)) {
return nsnull; return nsnull;
} }
@ -3598,7 +3597,7 @@ nsCSSFrameConstructor::FindImgControlData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindInputData(nsIContent* aContent, nsCSSFrameConstructor::FindInputData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
static const FrameConstructionDataByInt sInputData[] = { static const FrameConstructionDataByInt sInputData[] = {
@ -3623,28 +3622,28 @@ nsCSSFrameConstructor::FindInputData(nsIContent* aContent,
// display (in practice, none). // display (in practice, none).
}; };
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aContent); nsCOMPtr<nsIFormControl> control = do_QueryInterface(aElement);
NS_ASSERTION(control, "input doesn't implement nsIFormControl?"); NS_ASSERTION(control, "input doesn't implement nsIFormControl?");
return FindDataByInt(control->GetType(), aContent, aStyleContext, return FindDataByInt(control->GetType(), aElement, aStyleContext,
sInputData, NS_ARRAY_LENGTH(sInputData)); sInputData, NS_ARRAY_LENGTH(sInputData));
} }
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindObjectData(nsIContent* aContent, nsCSSFrameConstructor::FindObjectData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
// GetDisplayedType isn't necessarily nsIObjectLoadingContent::TYPE_NULL for // GetDisplayedType isn't necessarily nsIObjectLoadingContent::TYPE_NULL for
// cases when the object is broken/suppressed/etc (e.g. a broken image), but // cases when the object is broken/suppressed/etc (e.g. a broken image), but
// we want to treat those cases as TYPE_NULL // we want to treat those cases as TYPE_NULL
PRUint32 type; PRUint32 type;
if (aContent->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | if (aElement->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
NS_EVENT_STATE_USERDISABLED | NS_EVENT_STATE_USERDISABLED |
NS_EVENT_STATE_SUPPRESSED)) { NS_EVENT_STATE_SUPPRESSED)) {
type = nsIObjectLoadingContent::TYPE_NULL; type = nsIObjectLoadingContent::TYPE_NULL;
} else { } else {
nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(aContent)); nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(aElement));
NS_ASSERTION(objContent, NS_ASSERTION(objContent,
"applet, embed and object must implement " "applet, embed and object must implement "
"nsIObjectLoadingContent!"); "nsIObjectLoadingContent!");
@ -3664,7 +3663,7 @@ nsCSSFrameConstructor::FindObjectData(nsIContent* aContent,
// Nothing for TYPE_NULL so we'll construct frames by display there // Nothing for TYPE_NULL so we'll construct frames by display there
}; };
return FindDataByInt((PRInt32)type, aContent, aStyleContext, return FindDataByInt((PRInt32)type, aElement, aStyleContext,
sObjectData, NS_ARRAY_LENGTH(sObjectData)); sObjectData, NS_ARRAY_LENGTH(sObjectData));
} }
@ -4008,7 +4007,7 @@ nsIFrame* NS_NewGridBoxFrame(nsIPresShell* aPresShell,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULTagData(nsIContent* aContent, nsCSSFrameConstructor::FindXULTagData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
@ -4056,17 +4055,17 @@ nsCSSFrameConstructor::FindXULTagData(nsIContent* aContent,
SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame) SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame)
}; };
return FindDataByTag(aTag, aContent, aStyleContext, sXULTagData, return FindDataByTag(aTag, aElement, aStyleContext, sXULTagData,
NS_ARRAY_LENGTH(sXULTagData)); NS_ARRAY_LENGTH(sXULTagData));
} }
#ifdef MOZ_XUL #ifdef MOZ_XUL
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindPopupGroupData(nsIContent* aContent, nsCSSFrameConstructor::FindPopupGroupData(Element* aElement,
nsStyleContext* /* unused */) nsStyleContext* /* unused */)
{ {
if (!aContent->IsRootOfNativeAnonymousSubtree()) { if (!aElement->IsRootOfNativeAnonymousSubtree()) {
return nsnull; return nsnull;
} }
@ -4081,10 +4080,10 @@ nsCSSFrameConstructor::sXULTextBoxData = SIMPLE_XUL_FCDATA(NS_NewTextBoxFrame);
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULLabelData(nsIContent* aContent, nsCSSFrameConstructor::FindXULLabelData(Element* aElement,
nsStyleContext* /* unused */) nsStyleContext* /* unused */)
{ {
if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
return &sXULTextBoxData; return &sXULTextBoxData;
} }
@ -4104,10 +4103,10 @@ NS_NewXULDescriptionFrame(nsIPresShell* aPresShell, nsStyleContext *aContext)
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULDescriptionData(nsIContent* aContent, nsCSSFrameConstructor::FindXULDescriptionData(Element* aElement,
nsStyleContext* /* unused */) nsStyleContext* /* unused */)
{ {
if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
return &sXULTextBoxData; return &sXULTextBoxData;
} }
@ -4119,7 +4118,7 @@ nsCSSFrameConstructor::FindXULDescriptionData(nsIContent* aContent,
#ifdef XP_MACOSX #ifdef XP_MACOSX
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULMenubarData(nsIContent* aContent, nsCSSFrameConstructor::FindXULMenubarData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
nsCOMPtr<nsISupports> container = nsCOMPtr<nsISupports> container =
@ -4150,7 +4149,7 @@ nsCSSFrameConstructor::FindXULMenubarData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULListBoxBodyData(nsIContent* aContent, nsCSSFrameConstructor::FindXULListBoxBodyData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
if (aStyleContext->GetStyleDisplay()->mDisplay != if (aStyleContext->GetStyleDisplay()->mDisplay !=
@ -4165,7 +4164,7 @@ nsCSSFrameConstructor::FindXULListBoxBodyData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULListItemData(nsIContent* aContent, nsCSSFrameConstructor::FindXULListItemData(Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
if (aStyleContext->GetStyleDisplay()->mDisplay != if (aStyleContext->GetStyleDisplay()->mDisplay !=
@ -4183,7 +4182,7 @@ nsCSSFrameConstructor::FindXULListItemData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay, nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay,
nsIContent* aContent, Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
static const FrameConstructionDataByInt sXULDisplayData[] = { static const FrameConstructionDataByInt sXULDisplayData[] = {
@ -4207,7 +4206,7 @@ nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay,
}; };
// Processing by display here: // Processing by display here:
return FindDataByInt(aDisplay->mDisplay, aContent, aStyleContext, return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext,
sXULDisplayData, NS_ARRAY_LENGTH(sXULDisplayData)); sXULDisplayData, NS_ARRAY_LENGTH(sXULDisplayData));
} }
@ -4327,7 +4326,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState,
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
nsIContent* aContent, Element* aElement,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
{ {
PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET)));
@ -4346,10 +4345,9 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// XXXbz is this the right place to do this? If this code moves, // XXXbz is this the right place to do this? If this code moves,
// make this function static. // make this function static.
PRBool propagatedScrollToViewport = PR_FALSE; PRBool propagatedScrollToViewport = PR_FALSE;
if (aContent->NodeInfo()->Equals(nsGkAtoms::body) && if (aElement->IsHTML(nsGkAtoms::body)) {
aContent->IsHTML()) {
propagatedScrollToViewport = propagatedScrollToViewport =
PropagateScrollToViewport() == aContent; PropagateScrollToViewport() == aElement;
} }
NS_ASSERTION(!propagatedScrollToViewport || NS_ASSERTION(!propagatedScrollToViewport ||
@ -4369,7 +4367,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// anonymous stuff. // anonymous stuff.
if (mPresShell->GetPresContext()->IsPaginated() && if (mPresShell->GetPresContext()->IsPaginated() &&
aDisplay->IsBlockOutside() && aDisplay->IsBlockOutside() &&
!aContent->IsInNativeAnonymousSubtree()) { !aElement->IsInNativeAnonymousSubtree()) {
static const FrameConstructionData sForcedNonScrollableBlockData = static const FrameConstructionData sForcedNonScrollableBlockData =
FULL_CTOR_FCDATA(FCDATA_FORCED_NON_SCROLLABLE_BLOCK, FULL_CTOR_FCDATA(FCDATA_FORCED_NON_SCROLLABLE_BLOCK,
&nsCSSFrameConstructor::ConstructNonScrollableBlock); &nsCSSFrameConstructor::ConstructNonScrollableBlock);
@ -4444,7 +4442,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
&nsCSSFrameConstructor::ConstructTableCell) } &nsCSSFrameConstructor::ConstructTableCell) }
}; };
return FindDataByInt(aDisplay->mDisplay, aContent, aStyleContext, return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext,
sDisplayData, NS_ARRAY_LENGTH(sDisplayData)); sDisplayData, NS_ARRAY_LENGTH(sDisplayData));
} }
@ -4654,7 +4652,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent, nsCSSFrameConstructor::FindMathMLData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsStyleContext* aStyleContext) nsStyleContext* aStyleContext)
@ -4715,7 +4713,7 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
SIMPLE_MATHML_CREATE(semantics_, NS_NewMathMLsemanticsFrame) SIMPLE_MATHML_CREATE(semantics_, NS_NewMathMLsemanticsFrame)
}; };
return FindDataByTag(aTag, aContent, aStyleContext, sMathMLData, return FindDataByTag(aTag, aElement, aStyleContext, sMathMLData,
NS_ARRAY_LENGTH(sMathMLData)); NS_ARRAY_LENGTH(sMathMLData));
} }
#endif // MOZ_MATHML #endif // MOZ_MATHML
@ -4731,7 +4729,7 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
/* static */ /* static */
const nsCSSFrameConstructor::FrameConstructionData* const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindSVGData(nsIContent* aContent, nsCSSFrameConstructor::FindSVGData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
@ -4789,7 +4787,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
} }
// We don't need frames for animation elements // We don't need frames for animation elements
if (aContent->IsNodeOfType(nsINode::eANIMATION)) { if (aElement->IsNodeOfType(nsINode::eANIMATION)) {
return &sSuppressData; return &sSuppressData;
} }
@ -4807,7 +4805,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
return &sOuterSVGData; return &sOuterSVGData;
} }
if (!nsSVGFeatures::PassesConditionalProcessingTests(aContent)) { if (!nsSVGFeatures::PassesConditionalProcessingTests(aElement)) {
// Elements with failing conditional processing attributes never get // Elements with failing conditional processing attributes never get
// rendered. Note that this is not where we select which frame in a // rendered. Note that this is not where we select which frame in a
// <switch> to render! That happens in nsSVGSwitchFrame::PaintSVG. // <switch> to render! That happens in nsSVGSwitchFrame::PaintSVG.
@ -4892,7 +4890,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
}; };
const FrameConstructionData* data = const FrameConstructionData* data =
FindDataByTag(aTag, aContent, aStyleContext, sSVGData, FindDataByTag(aTag, aElement, aStyleContext, sSVGData,
NS_ARRAY_LENGTH(sSVGData)); NS_ARRAY_LENGTH(sSVGData));
if (!data) { if (!data) {
@ -5091,6 +5089,10 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
PRUint32 aFlags, PRUint32 aFlags,
FrameConstructionItemList& aItems) FrameConstructionItemList& aItems)
{ {
NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT) ||
aContent->IsElement(),
"Shouldn't get anything else here!");
// The following code allows the user to specify the base tag // The following code allows the user to specify the base tag
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.) // of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
// can then be extended arbitrarily. // can then be extended arbitrarily.
@ -5144,7 +5146,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
return; return;
} }
PRBool isText = aContent->IsNodeOfType(nsINode::eTEXT); PRBool isText = !aContent->IsElement();
// never create frames for non-option/optgroup kids of <select> and // never create frames for non-option/optgroup kids of <select> and
// non-option kids of <optgroup> inside a <select>. // non-option kids of <optgroup> inside a <select>.
@ -5181,46 +5183,48 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
return; return;
} }
} else { } else {
Element* element = aContent->AsElement();
// Don't create frames for non-SVG element children of SVG elements. // Don't create frames for non-SVG element children of SVG elements.
if (aNameSpaceID != kNameSpaceID_SVG && if (aNameSpaceID != kNameSpaceID_SVG &&
aParentFrame && aParentFrame &&
aParentFrame->IsFrameOfType(nsIFrame::eSVG) && aParentFrame->IsFrameOfType(nsIFrame::eSVG) &&
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject) !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
) { ) {
SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, SetAsUndisplayedContent(aState.mFrameManager, element, styleContext,
isGeneratedContent); isGeneratedContent);
return; return;
} }
data = FindHTMLData(aContent, aTag, aNameSpaceID, aParentFrame, data = FindHTMLData(element, aTag, aNameSpaceID, aParentFrame,
styleContext); styleContext);
if (!data) { if (!data) {
data = FindXULTagData(aContent, aTag, aNameSpaceID, styleContext); data = FindXULTagData(element, aTag, aNameSpaceID, styleContext);
} }
#ifdef MOZ_MATHML #ifdef MOZ_MATHML
if (!data) { if (!data) {
data = FindMathMLData(aContent, aTag, aNameSpaceID, styleContext); data = FindMathMLData(element, aTag, aNameSpaceID, styleContext);
} }
#endif #endif
if (!data) { if (!data) {
data = FindSVGData(aContent, aTag, aNameSpaceID, aParentFrame, data = FindSVGData(element, aTag, aNameSpaceID, aParentFrame,
styleContext); styleContext);
} }
// Now check for XUL display types // Now check for XUL display types
if (!data) { if (!data) {
data = FindXULDisplayData(display, aContent, styleContext); data = FindXULDisplayData(display, element, styleContext);
} }
// And general display types // And general display types
if (!data) { if (!data) {
data = FindDisplayData(display, aContent, styleContext); data = FindDisplayData(display, element, styleContext);
} }
NS_ASSERTION(data, "Should have frame construction data now"); NS_ASSERTION(data, "Should have frame construction data now");
if (data->mBits & FCDATA_SUPPRESS_FRAME) { if (data->mBits & FCDATA_SUPPRESS_FRAME) {
SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, SetAsUndisplayedContent(aState.mFrameManager, element, styleContext,
isGeneratedContent); isGeneratedContent);
return; return;
} }
@ -5231,7 +5235,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
aParentFrame->GetType() != nsGkAtoms::menuFrame)) { aParentFrame->GetType() != nsGkAtoms::menuFrame)) {
if (!aState.mPopupItems.containingBlock && if (!aState.mPopupItems.containingBlock &&
!aState.mHavePendingPopupgroup) { !aState.mHavePendingPopupgroup) {
SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, SetAsUndisplayedContent(aState.mFrameManager, element, styleContext,
isGeneratedContent); isGeneratedContent);
return; return;
} }
@ -8879,8 +8883,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
// have to look at insertionElement here... // have to look at insertionElement here...
if (aMultiple && !*aMultiple) { if (aMultiple && !*aMultiple) {
nsIContent* content = insertionElement ? insertionElement : container; nsIContent* content = insertionElement ? insertionElement : container;
if (content->IsHTML() && if (content->IsHTML(nsGkAtoms::fieldset)) {
content->Tag() == nsGkAtoms::fieldset) {
*aMultiple = PR_TRUE; *aMultiple = PR_TRUE;
} }
} }
@ -10942,7 +10945,7 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
for (ChildIterator::Init(parentContent, &iter, &last); for (ChildIterator::Init(parentContent, &iter, &last);
iter != last; iter != last;
++iter) { ++iter) {
// Manually check for comments/PIs, since we do't have a frame to pass to // Manually check for comments/PIs, since we don't have a frame to pass to
// AddFrameConstructionItems. We know our parent is a non-replaced inline, // AddFrameConstructionItems. We know our parent is a non-replaced inline,
// so there is no need to do the NeedFrameFor check. // so there is no need to do the NeedFrameFor check.
nsIContent* content = *iter; nsIContent* content = *iter;

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

@ -623,7 +623,7 @@ private:
*/ */
struct FrameConstructionData; struct FrameConstructionData;
typedef const FrameConstructionData* typedef const FrameConstructionData*
(* FrameConstructionDataGetter)(nsIContent*, nsStyleContext*); (* FrameConstructionDataGetter)(Element*, nsStyleContext*);
/* A constructor function that's used for complicated construction tasks. /* A constructor function that's used for complicated construction tasks.
This is expected to create the new frame, initialize it, add whatever This is expected to create the new frame, initialize it, add whatever
@ -787,7 +787,7 @@ private:
match or if the matching integer has a FrameConstructionDataGetter that match or if the matching integer has a FrameConstructionDataGetter that
returns null. */ returns null. */
static const FrameConstructionData* static const FrameConstructionData*
FindDataByInt(PRInt32 aInt, nsIContent* aContent, FindDataByInt(PRInt32 aInt, Element* aElement,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
const FrameConstructionDataByInt* aDataPtr, const FrameConstructionDataByInt* aDataPtr,
PRUint32 aDataLength); PRUint32 aDataLength);
@ -798,7 +798,7 @@ private:
match or if the matching tag has a FrameConstructionDataGetter that match or if the matching tag has a FrameConstructionDataGetter that
returns null. */ returns null. */
static const FrameConstructionData* static const FrameConstructionData*
FindDataByTag(nsIAtom* aTag, nsIContent* aContent, FindDataByTag(nsIAtom* aTag, Element* aElement,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
const FrameConstructionDataByTag* aDataPtr, const FrameConstructionDataByTag* aDataPtr,
PRUint32 aDataLength); PRUint32 aDataLength);
@ -1194,24 +1194,24 @@ private:
nsStyleContext* aMainStyleContext, nsStyleContext* aMainStyleContext,
FrameConstructionItemList& aItems); FrameConstructionItemList& aItems);
// Function to find FrameConstructionData for aContent. Will return // Function to find FrameConstructionData for aElement. Will return
// null if aContent is not HTML. // null if aElement is not HTML.
// aParentFrame might be null. If it is, that means it was an // aParentFrame might be null. If it is, that means it was an
// inline frame. // inline frame.
static const FrameConstructionData* FindHTMLData(nsIContent* aContent, static const FrameConstructionData* FindHTMLData(Element* aContent,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
// HTML data-finding helper functions // HTML data-finding helper functions
static const FrameConstructionData* static const FrameConstructionData*
FindImgData(nsIContent* aContent, nsStyleContext* aStyleContext); FindImgData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData* static const FrameConstructionData*
FindImgControlData(nsIContent* aContent, nsStyleContext* aStyleContext); FindImgControlData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData* static const FrameConstructionData*
FindInputData(nsIContent* aContent, nsStyleContext* aStyleContext); FindInputData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData* static const FrameConstructionData*
FindObjectData(nsIContent* aContent, nsStyleContext* aStyleContext); FindObjectData(Element* aElement, nsStyleContext* aStyleContext);
/* Construct a frame from the given FrameConstructionItem. This function /* Construct a frame from the given FrameConstructionItem. This function
will handle adding the frame to frame lists, processing children, setting will handle adding the frame to frame lists, processing children, setting
@ -1289,7 +1289,7 @@ private:
// Function to find FrameConstructionData for aContent. Will return // Function to find FrameConstructionData for aContent. Will return
// null if aContent is not MathML. // null if aContent is not MathML.
static const FrameConstructionData* FindMathMLData(nsIContent* aContent, static const FrameConstructionData* FindMathMLData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
@ -1297,28 +1297,28 @@ private:
// Function to find FrameConstructionData for aContent. Will return // Function to find FrameConstructionData for aContent. Will return
// null if aContent is not XUL. // null if aContent is not XUL.
static const FrameConstructionData* FindXULTagData(nsIContent* aContent, static const FrameConstructionData* FindXULTagData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
// XUL data-finding helper functions and structures // XUL data-finding helper functions and structures
#ifdef MOZ_XUL #ifdef MOZ_XUL
static const FrameConstructionData* static const FrameConstructionData*
FindPopupGroupData(nsIContent* aContent, nsStyleContext* aStyleContext); FindPopupGroupData(Element* aElement, nsStyleContext* aStyleContext);
// sXULTextBoxData used for both labels and descriptions // sXULTextBoxData used for both labels and descriptions
static const FrameConstructionData sXULTextBoxData; static const FrameConstructionData sXULTextBoxData;
static const FrameConstructionData* static const FrameConstructionData*
FindXULLabelData(nsIContent* aContent, nsStyleContext* aStyleContext); FindXULLabelData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData* static const FrameConstructionData*
FindXULDescriptionData(nsIContent* aContent, nsStyleContext* aStyleContext); FindXULDescriptionData(Element* aElement, nsStyleContext* aStyleContext);
#ifdef XP_MACOSX #ifdef XP_MACOSX
static const FrameConstructionData* static const FrameConstructionData*
FindXULMenubarData(nsIContent* aContent, nsStyleContext* aStyleContext); FindXULMenubarData(Element* aElement, nsStyleContext* aStyleContext);
#endif /* XP_MACOSX */ #endif /* XP_MACOSX */
static const FrameConstructionData* static const FrameConstructionData*
FindXULListBoxBodyData(nsIContent* aContent, nsStyleContext* aStyleContext); FindXULListBoxBodyData(Element* aElement, nsStyleContext* aStyleContext);
static const FrameConstructionData* static const FrameConstructionData*
FindXULListItemData(nsIContent* aContent, nsStyleContext* aStyleContext); FindXULListItemData(Element* aElement, nsStyleContext* aStyleContext);
#endif /* MOZ_XUL */ #endif /* MOZ_XUL */
// Function to find FrameConstructionData for aContent using one of the XUL // Function to find FrameConstructionData for aContent using one of the XUL
@ -1328,12 +1328,12 @@ private:
// constructed by tag. // constructed by tag.
static const FrameConstructionData* static const FrameConstructionData*
FindXULDisplayData(const nsStyleDisplay* aDisplay, FindXULDisplayData(const nsStyleDisplay* aDisplay,
nsIContent* aContent, Element* aElement,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
// SVG - rods // SVG - rods
#ifdef MOZ_SVG #ifdef MOZ_SVG
static const FrameConstructionData* FindSVGData(nsIContent* aContent, static const FrameConstructionData* FindSVGData(Element* aElement,
nsIAtom* aTag, nsIAtom* aTag,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
@ -1350,7 +1350,7 @@ private:
/* Not static because it does PropagateScrollToViewport. If this /* Not static because it does PropagateScrollToViewport. If this
changes, make this static */ changes, make this static */
const FrameConstructionData* const FrameConstructionData*
FindDisplayData(const nsStyleDisplay* aDisplay, nsIContent* aContent, FindDisplayData(const nsStyleDisplay* aDisplay, Element* aElement,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
/** /**

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

@ -2074,14 +2074,17 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// multiplying by stopScale. // multiplying by stopScale.
double stopScale; double stopScale;
double stopDelta = lastStop - firstStop; double stopDelta = lastStop - firstStop;
if (stopDelta < 1e-6 || lineLength < 1e-6 || PRBool zeroRadius = aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR &&
(aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR && (radiusX < 1e-6 || radiusY < 1e-6);
(radiusX < 1e-6 || radiusY < 1e-6))) { if (stopDelta < 1e-6 || lineLength < 1e-6 || zeroRadius) {
// Stops are all at the same place. Map all stops to 0.0. // Stops are all at the same place. Map all stops to 0.0.
// For radial gradients we need to fill with the last stop color, // For repeating radial gradients, or for any radial gradients with
// so just set both radii to 0. // a zero radius, we need to fill with the last stop color, so just set
// both radii to 0.
stopScale = 0.0; stopScale = 0.0;
radiusX = radiusY = 0.0; if (aGradient->mRepeating || zeroRadius) {
radiusX = radiusY = 0.0;
}
lastStop = firstStop; lastStop = firstStop;
} else { } else {
stopScale = 1.0/stopDelta; stopScale = 1.0/stopDelta;
@ -2115,6 +2118,11 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// So our radii are based on radiusX. // So our radii are based on radiusX.
double innerRadius = radiusX*firstStop; double innerRadius = radiusX*firstStop;
double outerRadius = radiusX*lastStop; double outerRadius = radiusX*lastStop;
if (stopScale == 0.0) {
// Stops are all at the same place. See above (except we now have
// the inside vs. outside of an ellipse).
outerRadius = innerRadius + 1;
}
gradientPattern = new gfxPattern(lineStart.x, lineStart.y, innerRadius, gradientPattern = new gfxPattern(lineStart.x, lineStart.y, innerRadius,
lineStart.x, lineStart.y, outerRadius); lineStart.x, lineStart.y, outerRadius);
if (gradientPattern && radiusX != radiusY) { if (gradientPattern && radiusX != radiusY) {
@ -2135,12 +2143,11 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
// Now set normalized color stops in pattern. // Now set normalized color stops in pattern.
if (stopScale == 0.0) { if (stopScale == 0.0) {
// Non-repeating linear gradient with all stops in same place -> just add // Non-repeating gradient with all stops in same place -> just add
// first stop and last stop, both at position 0. // first stop and last stop, both at position 0.
// Repeating or radial gradient with all stops in the same place -> just // Repeating gradient with all stops in the same place, or radial
// paint the last stop color. // gradient with radius of 0 -> just paint the last stop color.
if (!aGradient->mRepeating && if (!aGradient->mRepeating && !zeroRadius) {
aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) {
gradientPattern->AddColorStop(0.0, stops[0].mColor); gradientPattern->AddColorStop(0.0, stops[0].mColor);
} }
gradientPattern->AddColorStop(0.0, stops[stops.Length() - 1].mColor); gradientPattern->AddColorStop(0.0, stops[stops.Length() - 1].mColor);

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

@ -60,23 +60,31 @@ using mozilla::TimeStamp;
// Compute the interval to use for the refresh driver timer, in // Compute the interval to use for the refresh driver timer, in
// milliseconds // milliseconds
static PRInt32 PRInt32
GetRefreshTimerInterval(bool aThrottled) nsRefreshDriver::GetRefreshTimerInterval() const
{ {
const char* prefName = const char* prefName =
aThrottled ? "layout.throttled_frame_rate" : "layout.frame_rate"; mThrottled ? "layout.throttled_frame_rate" : "layout.frame_rate";
PRInt32 rate = nsContentUtils::GetIntPref(prefName, -1); PRInt32 rate = nsContentUtils::GetIntPref(prefName, -1);
if (rate <= 0) { if (rate <= 0) {
// TODO: get the rate from the platform // TODO: get the rate from the platform
rate = aThrottled ? DEFAULT_THROTTLED_FRAME_RATE : DEFAULT_FRAME_RATE; rate = mThrottled ? DEFAULT_THROTTLED_FRAME_RATE : DEFAULT_FRAME_RATE;
} }
NS_ASSERTION(rate > 0, "Must have positive rate here"); NS_ASSERTION(rate > 0, "Must have positive rate here");
return NSToIntRound(1000.0/rate); PRInt32 interval = NSToIntRound(1000.0/rate);
if (mThrottled) {
interval = NS_MAX(interval, mLastTimerInterval * 2);
}
mLastTimerInterval = interval;
return interval;
} }
static PRInt32 PRInt32
GetRefreshTimerType() nsRefreshDriver::GetRefreshTimerType() const
{ {
if (mThrottled) {
return nsITimer::TYPE_ONE_SHOT;
}
PRBool precise = PRBool precise =
nsContentUtils::GetBoolPref("layout.frame_rate.precise", PR_FALSE); nsContentUtils::GetBoolPref("layout.frame_rate.precise", PR_FALSE);
return precise ? (PRInt32)nsITimer::TYPE_REPEATING_PRECISE return precise ? (PRInt32)nsITimer::TYPE_REPEATING_PRECISE
@ -150,7 +158,7 @@ nsRefreshDriver::EnsureTimerStarted()
} }
nsresult rv = mTimer->InitWithCallback(this, nsresult rv = mTimer->InitWithCallback(this,
GetRefreshTimerInterval(mThrottled), GetRefreshTimerInterval(),
GetRefreshTimerType()); GetRefreshTimerType());
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
mTimer = nsnull; mTimer = nsnull;
@ -330,6 +338,16 @@ nsRefreshDriver::Notify(nsITimer * /* unused */)
} }
} }
if (mThrottled) {
// Stop the timer now and restart it here. Stopping is ok because either
// it's already one-shot, and it just fired, and all we need to do is null
// it out, or it's repeating and we need to reset it to be one-shot. Note
// that the EnsureTimerStarted() call here is ok because EnsureTimerStarted
// makes sure to not start the timer if it shouldn't be started.
StopTimer();
EnsureTimerStarted();
}
return NS_OK; return NS_OK;
} }
@ -358,10 +376,10 @@ nsRefreshDriver::SetThrottled(bool aThrottled)
if (aThrottled != mThrottled) { if (aThrottled != mThrottled) {
mThrottled = aThrottled; mThrottled = aThrottled;
if (mTimer) { if (mTimer) {
// Stopping and restarting the timer would update our most recent refresh // We want to switch our timer type here, so just stop and
// time, which isn't quite right. Luckily, we can just reschedule the // restart the timer.
// timer. StopTimer();
mTimer->SetDelay(GetRefreshTimerInterval(mThrottled)); EnsureTimerStarted();
} }
} }
} }

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

@ -218,6 +218,9 @@ private:
// Trigger a refresh immediately, if haven't been disconnected or frozen. // Trigger a refresh immediately, if haven't been disconnected or frozen.
void DoRefresh(); void DoRefresh();
PRInt32 GetRefreshTimerInterval() const;
PRInt32 GetRefreshTimerType() const;
nsCOMPtr<nsITimer> mTimer; nsCOMPtr<nsITimer> mTimer;
mozilla::TimeStamp mMostRecentRefresh; // only valid when mTimer non-null mozilla::TimeStamp mMostRecentRefresh; // only valid when mTimer non-null
PRInt64 mMostRecentRefreshEpochTime; // same thing as mMostRecentRefresh, PRInt64 mMostRecentRefreshEpochTime; // same thing as mMostRecentRefresh,
@ -237,6 +240,10 @@ private:
nsTArray<nsIDocument*> mBeforePaintTargets; nsTArray<nsIDocument*> mBeforePaintTargets;
// nsTArray on purpose, because we want to be able to swap. // nsTArray on purpose, because we want to be able to swap.
nsTArray<nsIDocument*> mAnimationFrameListenerDocs; nsTArray<nsIDocument*> mAnimationFrameListenerDocs;
// This is the last interval we used for our timer. May be 0 if we
// haven't computed a timer interval yet.
mutable PRInt32 mLastTimerInterval;
}; };
#endif /* !defined(nsRefreshDriver_h_) */ #endif /* !defined(nsRefreshDriver_h_) */

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var frame = document.getElementById("f");
var frameDoc = frame.contentDocument;
frameDoc.getElementById("g").style.background = "yellow";
frame.style.cssFloat = "right";
document.documentElement.offsetHeight;
frameDoc.documentElement.style.color = "green";
}
</script>
</head>
<body onload="boom();"><iframe id="f" src="data:text/html,<!DOCTYPE html><frameset><frame id=g></frameset>"></iframe></body>
</html>

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

@ -352,3 +352,4 @@ load 603510-1.html
load 604314-1.html load 604314-1.html
load 604843.html load 604843.html
load 605340.html load 605340.html
load 621841-1.html

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

@ -365,15 +365,24 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
for (PRUint32 childX = 0; childX < numChildren; childX++) { for (PRUint32 childX = 0; childX < numChildren; childX++) {
if (mChildCount == numCells) { // we have more <frame> or <frameset> than cells if (mChildCount == numCells) { // we have more <frame> or <frameset> than cells
// Clear the lazy bits in the remaining children. // Clear the lazy bits in the remaining children. Also clear
// the restyle flags, like nsCSSFrameConstructor::ProcessChildren does.
for (PRUint32 i = childX; i < numChildren; i++) { for (PRUint32 i = childX; i < numChildren; i++) {
mContent->GetChildAt(i)->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | nsIContent *child = mContent->GetChildAt(i);
NODE_NEEDS_FRAME); child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
if (child->IsElement()) {
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
}
} }
break; break;
} }
nsIContent *child = mContent->GetChildAt(childX); nsIContent *child = mContent->GetChildAt(childX);
child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME); child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
// Also clear the restyle flags in the child like
// nsCSSFrameConstructor::ProcessChildren does.
if (child->IsElement()) {
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
}
// IMPORTANT: This must match the conditions in // IMPORTANT: This must match the conditions in
// nsCSSFrameConstructor::ContentAppended/Inserted/Removed // nsCSSFrameConstructor::ContentAppended/Inserted/Removed

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

@ -2597,12 +2597,12 @@ nsGfxScrollFrameInner::AsyncScrollPortEvent::Run()
} }
PRBool PRBool
nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnTop) nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnBottom)
{ {
if (!mInner.mHScrollbarBox) if (!mInner.mHScrollbarBox)
return PR_TRUE; return PR_TRUE;
return AddRemoveScrollbar(aState, aOnTop, PR_TRUE, PR_TRUE); return AddRemoveScrollbar(aState, aOnBottom, PR_TRUE, PR_TRUE);
} }
PRBool PRBool
@ -2615,13 +2615,13 @@ nsXULScrollFrame::AddVerticalScrollbar(nsBoxLayoutState& aState, PRBool aOnRight
} }
void void
nsXULScrollFrame::RemoveHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnTop) nsXULScrollFrame::RemoveHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnBottom)
{ {
// removing a scrollbar should always fit // removing a scrollbar should always fit
#ifdef DEBUG #ifdef DEBUG
PRBool result = PRBool result =
#endif #endif
AddRemoveScrollbar(aState, aOnTop, PR_TRUE, PR_FALSE); AddRemoveScrollbar(aState, aOnBottom, PR_TRUE, PR_FALSE);
NS_ASSERTION(result, "Removing horizontal scrollbar failed to fit??"); NS_ASSERTION(result, "Removing horizontal scrollbar failed to fit??");
} }
@ -2638,7 +2638,7 @@ nsXULScrollFrame::RemoveVerticalScrollbar(nsBoxLayoutState& aState, PRBool aOnRi
PRBool PRBool
nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
PRBool aOnTop, PRBool aHorizontal, PRBool aAdd) PRBool aOnRightOrBottom, PRBool aHorizontal, PRBool aAdd)
{ {
if (aHorizontal) { if (aHorizontal) {
if (mInner.mNeverHasHorizontalScrollbar || !mInner.mHScrollbarBox) if (mInner.mNeverHasHorizontalScrollbar || !mInner.mHScrollbarBox)
@ -2653,7 +2653,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
PRBool fit = AddRemoveScrollbar(hasHorizontalScrollbar, PRBool fit = AddRemoveScrollbar(hasHorizontalScrollbar,
mInner.mScrollPort.y, mInner.mScrollPort.y,
mInner.mScrollPort.height, mInner.mScrollPort.height,
hSize.height, aOnTop, aAdd); hSize.height, aOnRightOrBottom, aAdd);
mInner.mHasHorizontalScrollbar = hasHorizontalScrollbar; // because mHasHorizontalScrollbar is a PRPackedBool mInner.mHasHorizontalScrollbar = hasHorizontalScrollbar; // because mHasHorizontalScrollbar is a PRPackedBool
if (!fit) if (!fit)
mInner.SetScrollbarVisibility(mInner.mHScrollbarBox, !aAdd); mInner.SetScrollbarVisibility(mInner.mHScrollbarBox, !aAdd);
@ -2672,7 +2672,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
PRBool fit = AddRemoveScrollbar(hasVerticalScrollbar, PRBool fit = AddRemoveScrollbar(hasVerticalScrollbar,
mInner.mScrollPort.x, mInner.mScrollPort.x,
mInner.mScrollPort.width, mInner.mScrollPort.width,
vSize.width, aOnTop, aAdd); vSize.width, aOnRightOrBottom, aAdd);
mInner.mHasVerticalScrollbar = hasVerticalScrollbar; // because mHasVerticalScrollbar is a PRPackedBool mInner.mHasVerticalScrollbar = hasVerticalScrollbar; // because mHasVerticalScrollbar is a PRPackedBool
if (!fit) if (!fit)
mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, !aAdd); mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, !aAdd);
@ -2684,7 +2684,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
PRBool PRBool
nsXULScrollFrame::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY, nsXULScrollFrame::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY,
nscoord& aSize, nscoord aSbSize, nscoord& aSize, nscoord aSbSize,
PRBool aRightOrBottom, PRBool aAdd) PRBool aOnRightOrBottom, PRBool aAdd)
{ {
nscoord size = aSize; nscoord size = aSize;
nscoord xy = aXY; nscoord xy = aXY;
@ -2692,11 +2692,11 @@ nsXULScrollFrame::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY,
if (size != NS_INTRINSICSIZE) { if (size != NS_INTRINSICSIZE) {
if (aAdd) { if (aAdd) {
size -= aSbSize; size -= aSbSize;
if (!aRightOrBottom && size >= 0) if (!aOnRightOrBottom && size >= 0)
xy += aSbSize; xy += aSbSize;
} else { } else {
size += aSbSize; size += aSbSize;
if (!aRightOrBottom) if (!aOnRightOrBottom)
xy -= aSbSize; xy -= aSbSize;
} }
} }

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

@ -653,7 +653,7 @@ public:
PRBool aAdd); PRBool aAdd);
PRBool AddRemoveScrollbar(nsBoxLayoutState& aState, PRBool AddRemoveScrollbar(nsBoxLayoutState& aState,
PRBool aOnTop, PRBool aOnRightOrBottom,
PRBool aHorizontal, PRBool aHorizontal,
PRBool aAdd); PRBool aAdd);

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

@ -1313,32 +1313,50 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
PRBool marginRightIsAuto = PRBool marginRightIsAuto =
eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit(); eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit();
if (availMarginSpace < 0 || if (marginLeftIsAuto) {
(!marginLeftIsAuto && !marginRightIsAuto)) {
// We're over-constrained so use the direction of the containing block
// to dictate which value to ignore. (And note that the spec says to ignore
// 'left' or 'right' rather than 'margin-left' or 'margin-right'.)
if (cbrs &&
NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
// Ignore the specified value for 'left'.
mComputedOffsets.left += availMarginSpace;
} else {
// Ignore the specified value for 'right'.
mComputedOffsets.right += availMarginSpace;
}
} else if (marginLeftIsAuto) {
if (marginRightIsAuto) { if (marginRightIsAuto) {
// Both 'margin-left' and 'margin-right' are 'auto', so they get if (availMarginSpace < 0) {
// equal values // Note that this case is different from the neither-'auto'
mComputedMargin.left = availMarginSpace / 2; // case below, where the spec says to ignore 'left'/'right'.
mComputedMargin.right = availMarginSpace - mComputedMargin.left; if (cbrs &&
NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
// Ignore the specified value for 'margin-left'.
mComputedMargin.left = availMarginSpace;
} else {
// Ignore the specified value for 'margin-right'.
mComputedMargin.right = availMarginSpace;
}
} else {
// Both 'margin-left' and 'margin-right' are 'auto', so they get
// equal values
mComputedMargin.left = availMarginSpace / 2;
mComputedMargin.right = availMarginSpace - mComputedMargin.left;
}
} else { } else {
// Just 'margin-left' is 'auto' // Just 'margin-left' is 'auto'
mComputedMargin.left = availMarginSpace; mComputedMargin.left = availMarginSpace;
} }
} else { } else {
// Just 'margin-right' is 'auto' if (marginRightIsAuto) {
mComputedMargin.right = availMarginSpace; // Just 'margin-right' is 'auto'
mComputedMargin.right = availMarginSpace;
} else {
// We're over-constrained so use the direction of the containing
// block to dictate which value to ignore. (And note that the
// spec says to ignore 'left' or 'right' rather than
// 'margin-left' or 'margin-right'.)
// Note that this case is different from the both-'auto' case
// above, where the spec says to ignore
// 'margin-left'/'margin-right'.
if (cbrs &&
NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
// Ignore the specified value for 'left'.
mComputedOffsets.left += availMarginSpace;
} else {
// Ignore the specified value for 'right'.
mComputedOffsets.right += availMarginSpace;
}
}
} }
} }
@ -1392,24 +1410,31 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
PRBool marginBottomIsAuto = PRBool marginBottomIsAuto =
eStyleUnit_Auto == mStyleMargin->mMargin.GetBottomUnit(); eStyleUnit_Auto == mStyleMargin->mMargin.GetBottomUnit();
if (availMarginSpace < 0 || (!marginTopIsAuto && !marginBottomIsAuto)) { if (marginTopIsAuto) {
// We're over-constrained so ignore the specified value for
// 'bottom'. (And note that the spec says to ignore 'bottom'
// rather than 'margin-bottom'.)
mComputedOffsets.bottom += availMarginSpace;
} else if (marginTopIsAuto) {
if (marginBottomIsAuto) { if (marginBottomIsAuto) {
// Both 'margin-top' and 'margin-bottom' are 'auto', so they get if (availMarginSpace < 0) {
// equal values // FIXME: Note that the spec doesn't actually say we should do this!
mComputedMargin.top = availMarginSpace / 2; mComputedMargin.bottom = availMarginSpace;
mComputedMargin.bottom = availMarginSpace - mComputedMargin.top; } else {
// Both 'margin-top' and 'margin-bottom' are 'auto', so they get
// equal values
mComputedMargin.top = availMarginSpace / 2;
mComputedMargin.bottom = availMarginSpace - mComputedMargin.top;
}
} else { } else {
// Just 'margin-top' is 'auto' // Just 'margin-top' is 'auto'
mComputedMargin.top = availMarginSpace; mComputedMargin.top = availMarginSpace;
} }
} else { } else {
// Just 'margin-bottom' is 'auto' if (marginBottomIsAuto) {
mComputedMargin.bottom = availMarginSpace; // Just 'margin-bottom' is 'auto'
mComputedMargin.bottom = availMarginSpace;
} else {
// We're over-constrained so ignore the specified value for
// 'bottom'. (And note that the spec says to ignore 'bottom'
// rather than 'margin-bottom'.)
mComputedOffsets.bottom += availMarginSpace;
}
} }
} }
} }

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

@ -11,16 +11,6 @@ div { height: 1px; background: navy; }
</head> </head>
<body> <body>
<!--
Differences between CSS 2.1 and this reference:
2. it ignores single 'auto' margins (one side only) when they should
become negative; this is a bug that we should fix:
https://bugzilla.mozilla.org/show_bug.cgi?id=419100
-->
<!-- ***** NARROW WIDTH ***** --> <!-- ***** NARROW WIDTH ***** -->
<!-- nothing auto --> <!-- nothing auto -->
@ -354,14 +344,13 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 684px;"></div> <div style="margin-left: -53px; width: 684px;"></div>
<div style="margin-left: -53px; width: 684px;"></div> <div style="margin-left: -53px; width: 684px;"></div>
<!-- only margin-left auto --> <!-- only margin-left auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 53px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: 53px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: 53px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: 53px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div>
<div style="margin-left: -11px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
<!-- left and margin-left auto --> <!-- left and margin-left auto -->
<div style="margin-left: -11px; width: 684px;"></div> <div style="margin-left: -11px; width: 684px;"></div>
@ -391,15 +380,14 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 684px;"></div> <div style="margin-left: -53px; width: 684px;"></div>
<div style="margin-left: -53px; width: 684px;"></div> <div style="margin-left: -53px; width: 684px;"></div>
<!-- only margin-right auto --> <!-- only margin-right auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 70px; width: 684px;"></div> <div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 8px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div> <div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 8px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div> <div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 8px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div> <div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 8px; width: 684px;"></div> <div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div>
<div style="margin-left: 70px; width: 684px;"></div>
<!-- left and margin-right auto (margin-right like 0) --> <!-- left and margin-right auto (margin-right like 0) -->
<div style="margin-left: 8px; width: 684px;"></div> <div style="margin-left: 8px; width: 684px;"></div>
<div style="margin-left: 8px; width: 684px;"></div> <div style="margin-left: 8px; width: 684px;"></div>

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

@ -12,16 +12,6 @@ div { height: 1px; background: blue;
</head> </head>
<body> <body>
<!--
Differences between CSS 2.1 and this reference:
2. it ignores single 'auto' margins (one side only) when they should
become negative; this is a bug that we should fix:
https://bugzilla.mozilla.org/show_bug.cgi?id=419100
-->
<!-- ***** WIDE WIDTH ***** --> <!-- ***** WIDE WIDTH ***** -->
<!-- nothing auto --> <!-- nothing auto -->
@ -61,14 +51,13 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<!-- only margin-left auto --> <!-- only margin-left auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<!-- left and margin-left auto --> <!-- left and margin-left auto -->
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
@ -98,15 +87,14 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<!-- only margin-right auto --> <!-- only margin-right auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<!-- left and margin-right auto (margin-right like 0) --> <!-- left and margin-right auto (margin-right like 0) -->
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 8px; width: 660px;"></div>
@ -504,14 +492,13 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<!-- only margin-left auto --> <!-- only margin-left auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: 53px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div>
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
<!-- left and margin-left auto --> <!-- left and margin-left auto -->
<div style="margin-left: -11px; width: 660px;"></div> <div style="margin-left: -11px; width: 660px;"></div>
@ -541,15 +528,14 @@ Differences between CSS 2.1 and this reference:
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<div style="margin-left: -53px; width: 660px;"></div> <div style="margin-left: -53px; width: 660px;"></div>
<!-- only margin-right auto --> <!-- only margin-right auto -->
<!-- THIS SET AFFECTED BY CHANGE (2) FROM CSS 2.1 SPEC -->
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<div style="margin-left: 70px; width: 660px;"></div>
<!-- left and margin-right auto (margin-right like 0) --> <!-- left and margin-right auto (margin-right like 0) -->
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 8px; width: 660px;"></div>
<div style="margin-left: 8px; width: 660px;"></div> <div style="margin-left: 8px; width: 660px;"></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-linear-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-linear-gradient(left, blue 0%, blue 25%, orange 25%, orange 100%);
}
</style>
<div></div>

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

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<title>Test for -moz-linear-gradient() with all stops at the same position</title>
<style>
#div1 {
float: left;
width: 50px;
height: 200px;
background: blue;
}
#div2 {
float: left;
width: 150px;
height: 200px;
background: orange;
}
</style>
<div id="div1"></div>
<div id="div2"></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-linear-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-linear-gradient(left, blue 25%, orange 25%);
}
</style>
<div></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>orange square</title>
<style>
div {
width: 200px;
height: 200px;
background: orange;
}
</style>
<div></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-radial-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-radial-gradient(contain, blue 0%, blue 25%, orange 25%, orange 100%);
}
</style>
<div></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-radial-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-radial-gradient(contain, blue 25%, orange 25%);
}
</style>
<div></div>

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

@ -88,3 +88,9 @@ fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607
== height-dependence-1.html height-dependence-1-ref.html == height-dependence-1.html height-dependence-1-ref.html
fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # bug 535007 fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # bug 535007
== height-dependence-3.html height-dependence-3-ref.html == height-dependence-3.html height-dependence-3-ref.html
fails-if(d2d) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664
== linear-onestopposition-1.html linear-onestopposition-1-ref2.html
fails-if(d2d) fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664
== repeating-linear-onestopposition-1.html orange-square.html
== repeating-radial-onestopposition-1.html orange-square.html

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-repeating-linear-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-repeating-linear-gradient(left, blue 25%, orange 25%);
}
</style>
<div></div>

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>Test for -moz-repeating-radial-gradient() with all stops at the same position</title>
<style>
div {
width: 200px;
height: 200px;
background-image: -moz-repeating-radial-gradient(contain, blue 25%, orange 25%);
}
</style>
<div></div>

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

@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
from the CSS 2.1 test suite,
http://test.csswg.org/suites/css2.1/20110111/html4/at-rule-013.htm
See ../css3-namespace/LICENSE .
-->
<html>
<head>
<title>CSS Test: Ignoring at-rules inside @media blocks</title>
<link rel="author" title="L. David Baron" href="http://dbaron.org/">
<style type="text/css">
p {
color: green;
background: transparent;
}
</style>
</head>
<body>
<p>This sentence must be green.</p>
<p>This sentence must be green.</p>
<p>This sentence must be green.</p>
<p>This sentence must be green.</p>
</body>
</html>

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

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
from the CSS 2.1 test suite,
http://test.csswg.org/suites/css2.1/20110111/html4/at-rule-013.htm
See ../css3-namespace/LICENSE .
-->
<html>
<head>
<title>CSS Test: Ignoring at-rules inside @media blocks</title>
<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
<link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">
<link rel="help" href="http://www.w3.org/TR/CSS21/media.html#at-media-rule">
<meta name="flags" content="invalid">
<meta name="assert" content="At-rules inside @media blocks are ignored up to up to the end of the block that contains the invalid at-keyword, or up to and including the next semicolon (;) or up to and including the next block ({...}), whichever comes first.">
<style type="text/css">
p {
color: red;
background: red;
}
@media all {
#semicolon { background: transparent; }
@foo ] & | # $ % test-token \
[; # { background: red; } ]
(; #semicolon { background: red; } } } } )
'; #semicolon { background: red; } } } }',
"; #semicolon { background: red; }' } } }"
;
#semicolon { color: green; }
}
@media all {
#block { background: transparent; }
@foo ] & | # $ % test-token \
[; #block { background: red; } ]
(; #block { background: red; } )
'; #block { background: red; }',
"; #block { background: red; }'"
{; #block { background: red; }
#block { background: red; } }
#block { color: green; }
}
@media all {
#eob { background: transparent; }
@import "support/import-red.css"
}
#eob {
color: green;
}
@media all {
#eob-complex { background: transparent; }
@import "support/import-red.css"
[; #eob-complex { background: red; } ]
(; #eob-complex { background: red; } )
'; #eob-complex { background: red; }',
"; #eob-complex { background: red; }'"
}
#eob-complex {
color: green;
}
</style>
</head>
<body>
<p id="semicolon">This sentence must be green.</p>
<p id="block">This sentence must be green.</p>
<p id="eob">This sentence must be green.</p>
<p id="eob-complex">This sentence must be green.</p>
</body>
</html>

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

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<style>
p { color: green; }
</style>
<style>
div { color: green; }
</style>
</head>
<body>
<p>This text should be green.</p>
<div>This text should be green.</p>
</body>
</html>

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

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<style>
p { color: red; }
[
p { color: red !important; }
p { color: red !important; }
] p { color: red !important; }
p { color: green; }
</style>
<style>
div { color: red; }
:not([)
div { color: red !important; }
div { color: red !important; }
]) div { color: red !important; }
div { color: green; }
</style>
</head>
<body>
<p>This text should be green.</p>
<div>This text should be green.</p>
</body>
</html>

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

@ -1,2 +1,4 @@
== at-rule-013.html at-rule-013-ref.html
== invalid-url-handling.xhtml invalid-url-handling-ref.xhtml == invalid-url-handling.xhtml invalid-url-handling-ref.xhtml
== pseudo-elements-1.html pseudo-elements-1-ref.html == pseudo-elements-1.html pseudo-elements-1-ref.html
== invalid-attr-1.html invalid-attr-1-ref.html

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

@ -190,10 +190,6 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
TryToStartImageLoad(*val, doc, iProp); TryToStartImageLoad(*val, doc, iProp);
} }
*target = *val; *target = *val;
if (iProp == eCSSProperty_font_family) {
// XXX Are there other things like this?
aRuleData->mFontData->mFamilyFromHTML = PR_FALSE;
}
if (nsCSSProps::PropHasFlags(iProp, if (nsCSSProps::PropHasFlags(iProp,
CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED) && CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED) &&
ShouldIgnoreColors(aRuleData)) ShouldIgnoreColors(aRuleData))

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

@ -310,7 +310,7 @@ protected:
void SkipUntil(PRUnichar aStopSymbol); void SkipUntil(PRUnichar aStopSymbol);
void SkipUntilOneOf(const PRUnichar* aStopSymbolChars); void SkipUntilOneOf(const PRUnichar* aStopSymbolChars);
void SkipRuleSet(PRBool aInsideBraces); void SkipRuleSet(PRBool aInsideBraces);
PRBool SkipAtRule(); PRBool SkipAtRule(PRBool aInsideBlock);
PRBool SkipDeclaration(PRBool aCheckForBraces); PRBool SkipDeclaration(PRBool aCheckForBraces);
PRBool PushGroup(nsICSSGroupRule* aRule); PRBool PushGroup(nsICSSGroupRule* aRule);
@ -323,8 +323,8 @@ protected:
PRBool ParseImportRule(RuleAppendFunc aAppendFunc, void* aProcessData); PRBool ParseImportRule(RuleAppendFunc aAppendFunc, void* aProcessData);
PRBool GatherURL(nsString& aURL); PRBool GatherURL(nsString& aURL);
PRBool GatherMedia(nsMediaList* aMedia, PRBool GatherMedia(nsMediaList* aMedia,
PRUnichar aStopSymbol); PRBool aInAtRule);
PRBool ParseMediaQuery(PRUnichar aStopSymbol, nsMediaQuery **aQuery, PRBool ParseMediaQuery(PRBool aInAtRule, nsMediaQuery **aQuery,
PRBool *aParsedSomething, PRBool *aHitStop); PRBool *aParsedSomething, PRBool *aHitStop);
PRBool ParseMediaQueryExpression(nsMediaQuery* aQuery); PRBool ParseMediaQueryExpression(nsMediaQuery* aQuery);
void ProcessImport(const nsString& aURLSpec, void ProcessImport(const nsString& aURLSpec,
@ -1178,7 +1178,7 @@ CSSParserImpl::ParseMediaList(const nsSubstring& aBuffer,
// to a media query. (The main substative difference is the relative // to a media query. (The main substative difference is the relative
// precedence of commas and paretheses.) // precedence of commas and paretheses.)
if (!GatherMedia(aMediaList, PRUnichar(0))) { if (!GatherMedia(aMediaList, PR_FALSE)) {
aMediaList->Clear(); aMediaList->Clear();
aMediaList->SetNonEmpty(); // don't match anything aMediaList->SetNonEmpty(); // don't match anything
if (!mHTMLMediaMode) { if (!mHTMLMediaMode) {
@ -1434,7 +1434,7 @@ CSSParserImpl::NextIdent()
} }
PRBool PRBool
CSSParserImpl::SkipAtRule() CSSParserImpl::SkipAtRule(PRBool aInsideBlock)
{ {
for (;;) { for (;;) {
if (!GetToken(PR_TRUE)) { if (!GetToken(PR_TRUE)) {
@ -1446,6 +1446,11 @@ CSSParserImpl::SkipAtRule()
if (symbol == ';') { if (symbol == ';') {
break; break;
} }
if (aInsideBlock && symbol == '}') {
// The closing } doesn't belong to us.
UngetToken();
break;
}
if (symbol == '{') { if (symbol == '{') {
SkipUntil('}'); SkipUntil('}');
break; break;
@ -1465,6 +1470,12 @@ PRBool
CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc, CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
void* aData) void* aData)
{ {
// If we ever allow nested at-rules, we need to be very careful about
// the error handling rules in the CSS spec. In particular, we need
// to pass in to ParseAtRule whether we're inside a block, we need to
// ensure that all the individual at-rule parsing functions terminate
// immediately when they hit a '}', and then we need to pass whether
// we're inside a block to SkipAtRule below.
nsCSSSection newSection; nsCSSSection newSection;
PRBool (CSSParserImpl::*parseFunc)(RuleAppendFunc, void*); PRBool (CSSParserImpl::*parseFunc)(RuleAppendFunc, void*);
@ -1505,13 +1516,13 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
OUTPUT_ERROR(); OUTPUT_ERROR();
} }
// Skip over unsupported at rule, don't advance section // Skip over unsupported at rule, don't advance section
return SkipAtRule(); return SkipAtRule(PR_FALSE);
} }
if (!(this->*parseFunc)(aAppendFunc, aData)) { if (!(this->*parseFunc)(aAppendFunc, aData)) {
// Skip over invalid at rule, don't advance section // Skip over invalid at rule, don't advance section
OUTPUT_ERROR(); OUTPUT_ERROR();
return SkipAtRule(); return SkipAtRule(PR_FALSE);
} }
mSection = newSection; mSection = newSection;
@ -1528,6 +1539,7 @@ CSSParserImpl::ParseCharsetRule(RuleAppendFunc aAppendFunc,
} }
if (eCSSToken_String != mToken.mType) { if (eCSSToken_String != mToken.mType) {
UngetToken();
REPORT_UNEXPECTED_TOKEN(PECharsetRuleNotString); REPORT_UNEXPECTED_TOKEN(PECharsetRuleNotString);
return PR_FALSE; return PR_FALSE;
} }
@ -1567,7 +1579,7 @@ CSSParserImpl::GatherURL(nsString& aURL)
} }
PRBool PRBool
CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, CSSParserImpl::ParseMediaQuery(PRBool aInAtRule,
nsMediaQuery **aQuery, nsMediaQuery **aQuery,
PRBool *aParsedSomething, PRBool *aParsedSomething,
PRBool *aHitStop) PRBool *aHitStop)
@ -1582,7 +1594,7 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol,
if (!GetToken(PR_TRUE)) { if (!GetToken(PR_TRUE)) {
*aHitStop = PR_TRUE; *aHitStop = PR_TRUE;
// expected termination by EOF // expected termination by EOF
if (aStopSymbol == PRUnichar(0)) if (!aInAtRule)
return PR_TRUE; return PR_TRUE;
// unexpected termination by EOF // unexpected termination by EOF
@ -1590,8 +1602,8 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol,
return PR_TRUE; return PR_TRUE;
} }
if (eCSSToken_Symbol == mToken.mType && if (eCSSToken_Symbol == mToken.mType && aInAtRule &&
mToken.mSymbol == aStopSymbol) { (mToken.mSymbol == ';' || mToken.mSymbol == '{')) {
*aHitStop = PR_TRUE; *aHitStop = PR_TRUE;
UngetToken(); UngetToken();
return PR_TRUE; return PR_TRUE;
@ -1648,7 +1660,7 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol,
if (!GetToken(PR_TRUE)) { if (!GetToken(PR_TRUE)) {
*aHitStop = PR_TRUE; *aHitStop = PR_TRUE;
// expected termination by EOF // expected termination by EOF
if (aStopSymbol == PRUnichar(0)) if (!aInAtRule)
break; break;
// unexpected termination by EOF // unexpected termination by EOF
@ -1656,8 +1668,8 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol,
break; break;
} }
if (eCSSToken_Symbol == mToken.mType && if (eCSSToken_Symbol == mToken.mType && aInAtRule &&
mToken.mSymbol == aStopSymbol) { (mToken.mSymbol == ';' || mToken.mSymbol == '{')) {
*aHitStop = PR_TRUE; *aHitStop = PR_TRUE;
UngetToken(); UngetToken();
break; break;
@ -1685,22 +1697,27 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol,
// (out-of-memory). // (out-of-memory).
PRBool PRBool
CSSParserImpl::GatherMedia(nsMediaList* aMedia, CSSParserImpl::GatherMedia(nsMediaList* aMedia,
PRUnichar aStopSymbol) PRBool aInAtRule)
{ {
for (;;) { for (;;) {
nsAutoPtr<nsMediaQuery> query; nsAutoPtr<nsMediaQuery> query;
PRBool parsedSomething, hitStop; PRBool parsedSomething, hitStop;
if (!ParseMediaQuery(aStopSymbol, getter_Transfers(query), if (!ParseMediaQuery(aInAtRule, getter_Transfers(query),
&parsedSomething, &hitStop)) { &parsedSomething, &hitStop)) {
NS_ASSERTION(!hitStop, "should return true when hit stop"); NS_ASSERTION(!hitStop, "should return true when hit stop");
if (NS_FAILED(mScanner.GetLowLevelError())) { if (NS_FAILED(mScanner.GetLowLevelError())) {
return PR_FALSE; return PR_FALSE;
} }
const PRUnichar stopChars[] = if (aInAtRule) {
{ PRUnichar(','), aStopSymbol /* may be null */, PRUnichar(0) }; const PRUnichar stopChars[] =
SkipUntilOneOf(stopChars); { PRUnichar(','), PRUnichar('{'), PRUnichar(';'), PRUnichar(0) };
SkipUntilOneOf(stopChars);
} else {
SkipUntil(',');
}
// Rely on SkipUntilOneOf leaving mToken around as the last token read. // Rely on SkipUntilOneOf leaving mToken around as the last token read.
if (mToken.mType == eCSSToken_Symbol && mToken.mSymbol == aStopSymbol) { if (mToken.mType == eCSSToken_Symbol && aInAtRule &&
(mToken.mSymbol == '{' || mToken.mSymbol == ';')) {
UngetToken(); UngetToken();
hitStop = PR_TRUE; hitStop = PR_TRUE;
} }
@ -1883,7 +1900,7 @@ CSSParserImpl::ParseImportRule(RuleAppendFunc aAppendFunc, void* aData)
} }
if (!ExpectSymbol(';', PR_TRUE)) { if (!ExpectSymbol(';', PR_TRUE)) {
if (!GatherMedia(media, ';') || if (!GatherMedia(media, PR_TRUE) ||
!ExpectSymbol(';', PR_TRUE)) { !ExpectSymbol(';', PR_TRUE)) {
REPORT_UNEXPECTED_TOKEN(PEImportUnexpected); REPORT_UNEXPECTED_TOKEN(PEImportUnexpected);
// don't advance section, simply ignore invalid @import // don't advance section, simply ignore invalid @import
@ -1966,7 +1983,7 @@ CSSParserImpl::ParseGroupRule(nsICSSGroupRule* aRule,
break; break;
} }
if (eCSSToken_AtKeyword == mToken.mType) { if (eCSSToken_AtKeyword == mToken.mType) {
SkipAtRule(); // group rules cannot contain @rules SkipAtRule(PR_TRUE); // group rules cannot contain @rules
continue; continue;
} }
UngetToken(); UngetToken();
@ -1992,7 +2009,7 @@ CSSParserImpl::ParseMediaRule(RuleAppendFunc aAppendFunc, void* aData)
return PR_FALSE; return PR_FALSE;
} }
if (GatherMedia(media, '{')) { if (GatherMedia(media, PR_TRUE)) {
// XXXbz this could use better error reporting throughout the method // XXXbz this could use better error reporting throughout the method
nsRefPtr<nsCSSMediaRule> rule(new nsCSSMediaRule()); nsRefPtr<nsCSSMediaRule> rule(new nsCSSMediaRule());
// Append first, so when we do SetMedia() the rule // Append first, so when we do SetMedia() the rule
@ -3215,6 +3232,10 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask,
} }
else if (mToken.IsSymbol('[')) { // [attribute else if (mToken.IsSymbol('[')) { // [attribute
parsingStatus = ParseAttributeSelector(aDataMask, *newSel); parsingStatus = ParseAttributeSelector(aDataMask, *newSel);
if (eSelectorParsingStatus_Error == parsingStatus) {
// Skip forward to the matching ']'
SkipUntil(']');
}
} }
else { else {
// then it should be a type element or universal selector // then it should be a type element or universal selector
@ -3473,6 +3494,9 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
} }
else if (mToken.IsSymbol('[')) { // [attribute else if (mToken.IsSymbol('[')) { // [attribute
parsingStatus = ParseAttributeSelector(dataMask, *selector); parsingStatus = ParseAttributeSelector(dataMask, *selector);
if (eSelectorParsingStatus_Error == parsingStatus) {
SkipUntil(']');
}
} }
else { // not a selector token, we're done else { // not a selector token, we're done
parsingStatus = eSelectorParsingStatus_Done; parsingStatus = eSelectorParsingStatus_Done;
@ -5677,7 +5701,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
return ParseVariant(aValue, VARIANT_HK, return ParseVariant(aValue, VARIANT_HK,
nsCSSProps::kBoxPackKTable); nsCSSProps::kBoxPackKTable);
case eCSSProperty_box_ordinal_group: case eCSSProperty_box_ordinal_group:
return ParseNonNegativeVariant(aValue, VARIANT_HI, nsnull); return ParsePositiveNonZeroVariant(aValue, VARIANT_HI, nsnull);
#ifdef MOZ_SVG #ifdef MOZ_SVG
case eCSSProperty_clip_path: case eCSSProperty_clip_path:
return ParseVariant(aValue, VARIANT_HUO, nsnull); return ParseVariant(aValue, VARIANT_HUO, nsnull);

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

@ -140,7 +140,6 @@ private:
}; };
struct nsRuleDataFont : public nsCSSFont { struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
nsRuleDataFont() {} nsRuleDataFont() {}
private: private:
nsRuleDataFont(const nsRuleDataFont& aOther); // NOT IMPLEMENTED nsRuleDataFont(const nsRuleDataFont& aOther); // NOT IMPLEMENTED

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -123,289 +123,290 @@ private:
#include "nsStyleStructList.h" #include "nsStyleStructList.h"
#undef STYLE_STRUCT #undef STYLE_STRUCT
nsresult GetEllipseRadii(const nsStyleCorners& aRadius, // All of the property getters below return a pointer to a refcounted object
PRUint8 aFullCorner, // that has just been created, but the refcount is still 0. Caller must take
PRBool aIsBorder, // else outline // ownership.
nsIDOMCSSValue** aValue);
nsresult GetOffsetWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetEllipseRadii(const nsStyleCorners& aRadius,
PRUint8 aFullCorner,
PRBool aIsBorder); // else outline
nsresult GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetOffsetWidthFor(mozilla::css::Side aSide);
nsresult GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetAbsoluteOffset(mozilla::css::Side aSide);
nsresult GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetRelativeOffset(mozilla::css::Side aSide);
nsresult GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetStaticOffset(mozilla::css::Side aSide);
nsresult GetBorderColorsFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetPaddingWidthFor(mozilla::css::Side aSide);
nsresult GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetBorderColorsFor(mozilla::css::Side aSide);
nsresult GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetBorderStyleFor(mozilla::css::Side aSide);
nsresult GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetBorderWidthFor(mozilla::css::Side aSide);
nsresult GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetBorderColorFor(mozilla::css::Side aSide);
nsresult GetSVGPaintFor(PRBool aFill, nsIDOMCSSValue** aValue); nsIDOMCSSValue* GetMarginWidthFor(mozilla::css::Side aSide);
nsIDOMCSSValue* GetSVGPaintFor(PRBool aFill);
PRBool GetLineHeightCoord(nscoord& aCoord); PRBool GetLineHeightCoord(nscoord& aCoord);
nsresult GetCSSShadowArray(nsCSSShadowArray* aArray, nsIDOMCSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray,
const nscolor& aDefaultColor, const nscolor& aDefaultColor,
PRBool aIsBoxShadow, PRBool aIsBoxShadow);
nsIDOMCSSValue** aValue);
nsresult GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember, nsIDOMCSSValue* GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
PRUint32 nsStyleBackground::* aCount, PRUint32 nsStyleBackground::* aCount,
const PRInt32 aTable[], const PRInt32 aTable[]);
nsIDOMCSSValue** aResult);
nsresult GetCSSGradientString(const nsStyleGradient* aGradient, void GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString); nsAString& aString);
nsresult GetImageRectString(nsIURI* aURI, void GetImageRectString(nsIURI* aURI,
const nsStyleSides& aCropRect, const nsStyleSides& aCropRect,
nsString& aString); nsString& aString);
/* Properties queryable as CSSValues. /* Properties queryable as CSSValues.
* To avoid a name conflict with nsIDOM*CSS2Properties, these are all * To avoid a name conflict with nsIDOM*CSS2Properties, these are all
* DoGetXXX instead of GetXXX. * DoGetXXX instead of GetXXX.
*/ */
nsresult DoGetAppearance(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetAppearance();
/* Box properties */ /* Box properties */
nsresult DoGetBoxAlign(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxAlign();
nsresult DoGetBoxDirection(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxDirection();
nsresult DoGetBoxFlex(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxFlex();
nsresult DoGetBoxOrdinalGroup(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxOrdinalGroup();
nsresult DoGetBoxOrient(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxOrient();
nsresult DoGetBoxPack(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxPack();
nsresult DoGetBoxSizing(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxSizing();
nsresult DoGetWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetWidth();
nsresult DoGetHeight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetHeight();
nsresult DoGetMaxHeight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMaxHeight();
nsresult DoGetMaxWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMaxWidth();
nsresult DoGetMinHeight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMinHeight();
nsresult DoGetMinWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMinWidth();
nsresult DoGetLeft(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetLeft();
nsresult DoGetTop(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTop();
nsresult DoGetRight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetRight();
nsresult DoGetBottom(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBottom();
nsresult DoGetStackSizing(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStackSizing();
/* Font properties */ /* Font properties */
nsresult DoGetColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColor();
nsresult DoGetFontFamily(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontFamily();
nsresult DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMozFontFeatureSettings();
nsresult DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMozFontLanguageOverride();
nsresult DoGetFontSize(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontSize();
nsresult DoGetFontSizeAdjust(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontSizeAdjust();
nsresult DoGetFontStretch(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontStretch();
nsresult DoGetFontStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontStyle();
nsresult DoGetFontWeight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontWeight();
nsresult DoGetFontVariant(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFontVariant();
/* Background properties */ /* Background properties */
nsresult DoGetBackgroundAttachment(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundAttachment();
nsresult DoGetBackgroundColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundColor();
nsresult DoGetBackgroundImage(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundImage();
nsresult DoGetBackgroundPosition(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundPosition();
nsresult DoGetBackgroundRepeat(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundRepeat();
nsresult DoGetBackgroundClip(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundClip();
nsresult DoGetBackgroundInlinePolicy(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundInlinePolicy();
nsresult DoGetBackgroundOrigin(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBackgroundOrigin();
nsresult DoGetMozBackgroundSize(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMozBackgroundSize();
/* Padding properties */ /* Padding properties */
nsresult DoGetPadding(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPadding();
nsresult DoGetPaddingTop(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPaddingTop();
nsresult DoGetPaddingBottom(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPaddingBottom();
nsresult DoGetPaddingLeft(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPaddingLeft();
nsresult DoGetPaddingRight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPaddingRight();
/* Table Properties */ /* Table Properties */
nsresult DoGetBorderCollapse(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderCollapse();
nsresult DoGetBorderSpacing(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderSpacing();
nsresult DoGetCaptionSide(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetCaptionSide();
nsresult DoGetEmptyCells(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetEmptyCells();
nsresult DoGetTableLayout(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTableLayout();
nsresult DoGetVerticalAlign(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetVerticalAlign();
/* Border Properties */ /* Border Properties */
nsresult DoGetBorderStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderStyle();
nsresult DoGetBorderWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderWidth();
nsresult DoGetBorderTopStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopStyle();
nsresult DoGetBorderBottomStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomStyle();
nsresult DoGetBorderLeftStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderLeftStyle();
nsresult DoGetBorderRightStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderRightStyle();
nsresult DoGetBorderTopWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopWidth();
nsresult DoGetBorderBottomWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomWidth();
nsresult DoGetBorderLeftWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderLeftWidth();
nsresult DoGetBorderRightWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderRightWidth();
nsresult DoGetBorderTopColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopColor();
nsresult DoGetBorderBottomColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomColor();
nsresult DoGetBorderLeftColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderLeftColor();
nsresult DoGetBorderRightColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderRightColor();
nsresult DoGetBorderBottomColors(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomColors();
nsresult DoGetBorderLeftColors(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderLeftColors();
nsresult DoGetBorderRightColors(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderRightColors();
nsresult DoGetBorderTopColors(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopColors();
nsresult DoGetBorderBottomLeftRadius(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomLeftRadius();
nsresult DoGetBorderBottomRightRadius(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderBottomRightRadius();
nsresult DoGetBorderTopLeftRadius(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopLeftRadius();
nsresult DoGetBorderTopRightRadius(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderTopRightRadius();
nsresult DoGetFloatEdge(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFloatEdge();
nsresult DoGetBorderImage(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBorderImage();
/* Box Shadow */ /* Box Shadow */
nsresult DoGetBoxShadow(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBoxShadow();
/* Window Shadow */ /* Window Shadow */
nsresult DoGetWindowShadow(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetWindowShadow();
/* Margin Properties */ /* Margin Properties */
nsresult DoGetMarginWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarginWidth();
nsresult DoGetMarginTopWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarginTopWidth();
nsresult DoGetMarginBottomWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarginBottomWidth();
nsresult DoGetMarginLeftWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarginLeftWidth();
nsresult DoGetMarginRightWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarginRightWidth();
/* Outline Properties */ /* Outline Properties */
nsresult DoGetOutline(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutline();
nsresult DoGetOutlineWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineWidth();
nsresult DoGetOutlineStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineStyle();
nsresult DoGetOutlineColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineColor();
nsresult DoGetOutlineOffset(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineOffset();
nsresult DoGetOutlineRadiusBottomLeft(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineRadiusBottomLeft();
nsresult DoGetOutlineRadiusBottomRight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineRadiusBottomRight();
nsresult DoGetOutlineRadiusTopLeft(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineRadiusTopLeft();
nsresult DoGetOutlineRadiusTopRight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOutlineRadiusTopRight();
/* Content Properties */ /* Content Properties */
nsresult DoGetContent(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetContent();
nsresult DoGetCounterIncrement(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetCounterIncrement();
nsresult DoGetCounterReset(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetCounterReset();
nsresult DoGetMarkerOffset(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarkerOffset();
/* Quotes Properties */ /* Quotes Properties */
nsresult DoGetQuotes(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetQuotes();
/* z-index */ /* z-index */
nsresult DoGetZIndex(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetZIndex();
/* List properties */ /* List properties */
nsresult DoGetListStyleImage(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetListStyleImage();
nsresult DoGetListStylePosition(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetListStylePosition();
nsresult DoGetListStyleType(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetListStyleType();
nsresult DoGetImageRegion(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetImageRegion();
/* Text Properties */ /* Text Properties */
nsresult DoGetLineHeight(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetLineHeight();
nsresult DoGetTextAlign(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextAlign();
nsresult DoGetTextDecoration(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextDecoration();
nsresult DoGetTextIndent(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextIndent();
nsresult DoGetTextTransform(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextTransform();
nsresult DoGetTextShadow(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextShadow();
nsresult DoGetLetterSpacing(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetLetterSpacing();
nsresult DoGetWordSpacing(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetWordSpacing();
nsresult DoGetWhiteSpace(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetWhiteSpace();
nsresult DoGetWordWrap(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetWordWrap();
nsresult DoGetMozTabSize(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMozTabSize();
/* Visibility properties */ /* Visibility properties */
nsresult DoGetOpacity(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOpacity();
nsresult DoGetPointerEvents(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPointerEvents();
nsresult DoGetVisibility(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetVisibility();
/* Direction properties */ /* Direction properties */
nsresult DoGetDirection(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetDirection();
nsresult DoGetUnicodeBidi(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetUnicodeBidi();
/* Display properties */ /* Display properties */
nsresult DoGetBinding(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetBinding();
nsresult DoGetClear(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetClear();
nsresult DoGetCssFloat(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetCssFloat();
nsresult DoGetDisplay(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetDisplay();
nsresult DoGetPosition(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPosition();
nsresult DoGetClip(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetClip();
nsresult DoGetOverflow(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOverflow();
nsresult DoGetOverflowX(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOverflowX();
nsresult DoGetOverflowY(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetOverflowY();
nsresult DoGetResize(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetResize();
nsresult DoGetPageBreakAfter(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPageBreakAfter();
nsresult DoGetPageBreakBefore(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetPageBreakBefore();
nsresult DoGetMozTransform(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMozTransform();
nsresult DoGetMozTransformOrigin(nsIDOMCSSValue **aValue); nsIDOMCSSValue* DoGetMozTransformOrigin();
/* User interface properties */ /* User interface properties */
nsresult DoGetCursor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetCursor();
nsresult DoGetForceBrokenImageIcon(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetForceBrokenImageIcon();
nsresult DoGetIMEMode(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetIMEMode();
nsresult DoGetUserFocus(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetUserFocus();
nsresult DoGetUserInput(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetUserInput();
nsresult DoGetUserModify(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetUserModify();
nsresult DoGetUserSelect(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetUserSelect();
/* Column properties */ /* Column properties */
nsresult DoGetColumnCount(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnCount();
nsresult DoGetColumnWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnWidth();
nsresult DoGetColumnGap(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnGap();
nsresult DoGetColumnRuleWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnRuleWidth();
nsresult DoGetColumnRuleStyle(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnRuleStyle();
nsresult DoGetColumnRuleColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColumnRuleColor();
/* CSS Transitions */ /* CSS Transitions */
nsresult DoGetTransitionProperty(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTransitionProperty();
nsresult DoGetTransitionDuration(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTransitionDuration();
nsresult DoGetTransitionDelay(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTransitionDelay();
nsresult DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTransitionTimingFunction();
/* SVG properties */ /* SVG properties */
nsresult DoGetFill(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFill();
nsresult DoGetStroke(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStroke();
nsresult DoGetMarkerEnd(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarkerEnd();
nsresult DoGetMarkerMid(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarkerMid();
nsresult DoGetMarkerStart(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMarkerStart();
nsresult DoGetStrokeDasharray(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeDasharray();
nsresult DoGetStrokeDashoffset(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeDashoffset();
nsresult DoGetStrokeWidth(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeWidth();
nsresult DoGetFillOpacity(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFillOpacity();
nsresult DoGetFloodOpacity(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFloodOpacity();
nsresult DoGetStopOpacity(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStopOpacity();
nsresult DoGetStrokeMiterlimit(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeMiterlimit();
nsresult DoGetStrokeOpacity(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeOpacity();
nsresult DoGetClipRule(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetClipRule();
nsresult DoGetFillRule(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFillRule();
nsresult DoGetStrokeLinecap(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeLinecap();
nsresult DoGetStrokeLinejoin(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStrokeLinejoin();
nsresult DoGetTextAnchor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextAnchor();
nsresult DoGetColorInterpolation(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColorInterpolation();
nsresult DoGetColorInterpolationFilters(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetColorInterpolationFilters();
nsresult DoGetDominantBaseline(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetDominantBaseline();
nsresult DoGetImageRendering(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetImageRendering();
nsresult DoGetShapeRendering(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetShapeRendering();
nsresult DoGetTextRendering(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetTextRendering();
nsresult DoGetFloodColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFloodColor();
nsresult DoGetLightingColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetLightingColor();
nsresult DoGetStopColor(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetStopColor();
nsresult DoGetClipPath(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetClipPath();
nsresult DoGetFilter(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetFilter();
nsresult DoGetMask(nsIDOMCSSValue** aValue); nsIDOMCSSValue* DoGetMask();
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue(); nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited); nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited);
nsresult SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
nsresult SetValueToStyleImage(const nsStyleImage& aStyleImage, void SetValueToStyleImage(const nsStyleImage& aStyleImage,
nsROCSSPrimitiveValue* aValue); nsROCSSPrimitiveValue* aValue);
/** /**
* A method to get a percentage base for a percentage value. Returns PR_TRUE * A method to get a percentage base for a percentage value. Returns PR_TRUE
@ -456,7 +457,7 @@ private:
struct ComputedStyleMapEntry struct ComputedStyleMapEntry
{ {
// Create a pointer-to-member-function type. // Create a pointer-to-member-function type.
typedef nsresult (nsComputedDOMStyle::*ComputeMethod)(nsIDOMCSSValue**); typedef nsIDOMCSSValue* (nsComputedDOMStyle::*ComputeMethod)();
nsCSSProperty mProperty; nsCSSProperty mProperty;
ComputeMethod mGetter; ComputeMethod mGetter;

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

@ -65,10 +65,10 @@ NS_INTERFACE_MAP_BEGIN(nsDOMCSSValueList)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSValueList) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSValueList)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
PRBool void
nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue) nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue)
{ {
return mCSSValues.AppendObject(aValue); mCSSValues.AppendElement(aValue);
} }
// nsIDOMCSSValueList // nsIDOMCSSValueList
@ -76,7 +76,7 @@ nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue)
NS_IMETHODIMP NS_IMETHODIMP
nsDOMCSSValueList::GetLength(PRUint32* aLength) nsDOMCSSValueList::GetLength(PRUint32* aLength)
{ {
*aLength = mCSSValues.Count(); *aLength = mCSSValues.Length();
return NS_OK; return NS_OK;
} }
@ -98,7 +98,7 @@ nsDOMCSSValueList::GetCssText(nsAString& aCssText)
{ {
aCssText.Truncate(); aCssText.Truncate();
PRUint32 count = mCSSValues.Count(); PRUint32 count = mCSSValues.Length();
nsAutoString separator; nsAutoString separator;
if (mCommaDelimited) { if (mCommaDelimited) {

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

@ -63,14 +63,12 @@ public:
/** /**
* Adds a value to this list. * Adds a value to this list.
* @retval PR_TRUE Adding the value succeeded
* @retval PR_FALSE The value could not be added (Out of memory)
*/ */
PRBool AppendCSSValue(nsIDOMCSSValue* aValue); void AppendCSSValue(nsIDOMCSSValue* aValue);
nsIDOMCSSValue* GetItemAt(PRUint32 aIndex) nsIDOMCSSValue* GetItemAt(PRUint32 aIndex)
{ {
return mCSSValues.SafeObjectAt(aIndex); return mCSSValues.SafeElementAt(aIndex, nsnull);
} }
static nsDOMCSSValueList* FromSupports(nsISupports* aSupports) static nsDOMCSSValueList* FromSupports(nsISupports* aSupports)
@ -97,7 +95,7 @@ private:
PRPackedBool mReadonly; // Are we read-only? PRPackedBool mReadonly; // Are we read-only?
nsCOMArray<nsIDOMCSSValue> mCSSValues; InfallibleTArray<nsCOMPtr<nsIDOMCSSValue> > mCSSValues;
}; };

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

@ -2943,9 +2943,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
// defaultVariableFont.name should always be "serif" or "sans-serif". // defaultVariableFont.name should always be "serif" or "sans-serif".
aFont->mFont.name.Append(defaultVariableFont->name); aFont->mFont.name.Append(defaultVariableFont->name);
} }
aFont->mFont.familyNameQuirks =
(aPresContext->CompatibilityMode() == eCompatibility_NavQuirks &&
aFontData.mFamilyFromHTML);
aFont->mFont.systemFont = PR_FALSE; aFont->mFont.systemFont = PR_FALSE;
// Technically this is redundant with the code below, but it's good // Technically this is redundant with the code below, but it's good
// to have since we'll still want it once we get rid of // to have since we'll still want it once we get rid of
@ -2954,20 +2951,17 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
} }
else if (eCSSUnit_System_Font == aFontData.mFamily.GetUnit()) { else if (eCSSUnit_System_Font == aFontData.mFamily.GetUnit()) {
aFont->mFont.name = systemFont.name; aFont->mFont.name = systemFont.name;
aFont->mFont.familyNameQuirks = PR_FALSE;
aFont->mFont.systemFont = PR_TRUE; aFont->mFont.systemFont = PR_TRUE;
aFont->mGenericID = kGenericFont_NONE; aFont->mGenericID = kGenericFont_NONE;
} }
else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) { else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
aCanStoreInRuleTree = PR_FALSE; aCanStoreInRuleTree = PR_FALSE;
aFont->mFont.name = aParentFont->mFont.name; aFont->mFont.name = aParentFont->mFont.name;
aFont->mFont.familyNameQuirks = aParentFont->mFont.familyNameQuirks;
aFont->mFont.systemFont = aParentFont->mFont.systemFont; aFont->mFont.systemFont = aParentFont->mFont.systemFont;
aFont->mGenericID = aParentFont->mGenericID; aFont->mGenericID = aParentFont->mGenericID;
} }
else if (eCSSUnit_Initial == aFontData.mFamily.GetUnit()) { else if (eCSSUnit_Initial == aFontData.mFamily.GetUnit()) {
aFont->mFont.name = defaultVariableFont->name; aFont->mFont.name = defaultVariableFont->name;
aFont->mFont.familyNameQuirks = PR_FALSE;
aFont->mFont.systemFont = defaultVariableFont->systemFont; aFont->mFont.systemFont = defaultVariableFont->systemFont;
aFont->mGenericID = kGenericFont_NONE; aFont->mGenericID = kGenericFont_NONE;
} }

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

@ -208,7 +208,6 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
(aFont1.sizeAdjust == aFont2.sizeAdjust) && (aFont1.sizeAdjust == aFont2.sizeAdjust) &&
(aFont1.style == aFont2.style) && (aFont1.style == aFont2.style) &&
(aFont1.variant == aFont2.variant) && (aFont1.variant == aFont2.variant) &&
(aFont1.familyNameQuirks == aFont2.familyNameQuirks) &&
(aFont1.weight == aFont2.weight) && (aFont1.weight == aFont2.weight) &&
(aFont1.stretch == aFont2.stretch) && (aFont1.stretch == aFont2.stretch) &&
(aFont1.name == aFont2.name) && (aFont1.name == aFont2.name) &&

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

@ -369,8 +369,8 @@ var gCSSProperties = {
inherited: false, inherited: false,
type: CSS_TYPE_LONGHAND, type: CSS_TYPE_LONGHAND,
initial_values: [ "1" ], initial_values: [ "1" ],
other_values: [ "0", "100" ], other_values: [ "2", "100" ],
invalid_values: [ "1.0", "-1", "-1000" ] invalid_values: [ "1.0", "-1", "-1000", "0" ]
}, },
"-moz-box-orient": { "-moz-box-orient": {
domProp: "MozBoxOrient", domProp: "MozBoxOrient",

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

@ -1602,7 +1602,6 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale,
gfxFontStyle fontStyle(font.style, font.weight, font.stretch, textRunSize, gfxFontStyle fontStyle(font.style, font.weight, font.stretch, textRunSize,
mStyleContext->GetStyleVisibility()->mLanguage, mStyleContext->GetStyleVisibility()->mLanguage,
font.sizeAdjust, font.systemFont, font.sizeAdjust, font.systemFont,
font.familyNameQuirks,
printerFont, printerFont,
font.featureSettings, font.featureSettings,
font.languageOverride); font.languageOverride);