зеркало из https://github.com/mozilla/gecko-dev.git
Back out 91690545debc0d3537fcb0598ebd6ac7e21f2072 due to mac startup failures.
This commit is contained in:
Родитель
753588abda
Коммит
b7c9a551d4
|
@ -167,7 +167,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../style \
|
||||
-I$(srcdir)/../generic \
|
||||
-I$(srcdir)/../forms \
|
||||
-I$(srcdir)/../tables \
|
||||
|
|
|
@ -84,9 +84,6 @@
|
|||
#include "nsRuleNode.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "nsCSSRules.h"
|
||||
#include "nsFontFaceLoader.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
|
@ -231,7 +228,6 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
|
|||
}
|
||||
NS_ASSERTION(mDocument, "Null document");
|
||||
mUserFontSet = nsnull;
|
||||
mUserFontSetDirty = PR_TRUE;
|
||||
}
|
||||
|
||||
nsPresContext::~nsPresContext()
|
||||
|
@ -290,7 +286,8 @@ nsPresContext::~nsPresContext()
|
|||
NS_IF_RELEASE(mDeviceContext);
|
||||
NS_IF_RELEASE(mLookAndFeel);
|
||||
NS_IF_RELEASE(mLangGroup);
|
||||
NS_IF_RELEASE(mUserFontSet);
|
||||
|
||||
SetUserFontSet(nsnull);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsPresContext)
|
||||
|
@ -1570,163 +1567,17 @@ nsPresContext::HasAuthorSpecifiedRules(nsIFrame *aFrame, PRUint32 ruleTypeMask)
|
|||
HasAuthorSpecifiedRules(aFrame->GetStyleContext(), ruleTypeMask);
|
||||
}
|
||||
|
||||
static void
|
||||
InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet)
|
||||
{
|
||||
PRInt32 type;
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(aRule->GetType(type))
|
||||
&& type == nsICSSRule::FONT_FACE_RULE,
|
||||
"InsertFontFaceRule passed a non-fontface CSS rule");
|
||||
|
||||
// aRule->List();
|
||||
|
||||
nsAutoString fontfamily;
|
||||
nsCSSValue val;
|
||||
|
||||
PRUint32 unit;
|
||||
PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
||||
PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
||||
PRUint32 italicStyle = FONT_STYLE_NORMAL;
|
||||
|
||||
// set up family name
|
||||
aRule->GetDesc(eCSSFontDesc_Family, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit == eCSSUnit_String) {
|
||||
val.GetStringValue(fontfamily);
|
||||
fontfamily.Trim("\"");
|
||||
} else {
|
||||
NS_ASSERTION(unit == eCSSUnit_String,
|
||||
"@font-face family name has non-string unit type");
|
||||
return;
|
||||
}
|
||||
|
||||
// set up weight
|
||||
aRule->GetDesc(eCSSFontDesc_Weight, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit != eCSSUnit_Null) {
|
||||
if (unit == eCSSUnit_Normal) {
|
||||
weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
||||
} else {
|
||||
weight = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up stretch
|
||||
aRule->GetDesc(eCSSFontDesc_Stretch, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit != eCSSUnit_Null) {
|
||||
if (unit == eCSSUnit_Normal) {
|
||||
stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
||||
} else {
|
||||
stretch = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up font style
|
||||
aRule->GetDesc(eCSSFontDesc_Style, val);
|
||||
if (val.GetUnit() != eCSSUnit_Null) {
|
||||
if (val.GetUnit() == eCSSUnit_Normal) {
|
||||
italicStyle = FONT_STYLE_NORMAL;
|
||||
} else {
|
||||
italicStyle = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up src array
|
||||
nsTArray<gfxFontFaceSrc> srcArray;
|
||||
|
||||
aRule->GetDesc(eCSSFontDesc_Src, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit == eCSSUnit_Array) {
|
||||
nsCSSValue::Array *srcArr = val.GetArrayValue();
|
||||
PRUint32 i, numSrc = srcArr->Count();
|
||||
|
||||
for (i = 0; i < numSrc; i++) {
|
||||
val = srcArr->Item(i);
|
||||
unit = val.GetUnit();
|
||||
gfxFontFaceSrc *face = srcArray.AppendElements(1);
|
||||
if (!face)
|
||||
return;
|
||||
|
||||
switch (unit) {
|
||||
|
||||
case eCSSUnit_Local_Font:
|
||||
val.GetStringValue(face->mLocalName);
|
||||
face->mIsLocal = PR_TRUE;
|
||||
face->mURI = nsnull;
|
||||
face->mFormatFlags = 0;
|
||||
break;
|
||||
case eCSSUnit_URL:
|
||||
face->mIsLocal = PR_FALSE;
|
||||
face->mURI = val.GetURLValue();
|
||||
NS_ASSERTION(face->mURI, "null url in @font-face rule");
|
||||
face->mReferrer = val.GetURLStructValue()->mReferrer;
|
||||
face->mLocalName.Truncate();
|
||||
face->mFormatFlags = 0;
|
||||
while (i + 1 < numSrc && (val = srcArr->Item(i+1),
|
||||
val.GetUnit() == eCSSUnit_Font_Format)) {
|
||||
nsDependentString valueString(val.GetStringBufferValue());
|
||||
if (valueString.LowerCaseEqualsASCII("opentype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_OPENTYPE;
|
||||
} else if (valueString.LowerCaseEqualsASCII("truetype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE;
|
||||
} else if (valueString.LowerCaseEqualsASCII("truetype-aat")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_AAT;
|
||||
} else if (valueString.LowerCaseEqualsASCII("embedded-opentype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_EOT;
|
||||
} else if (valueString.LowerCaseEqualsASCII("svg")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_SVG;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(unit == eCSSUnit_Local_Font || unit == eCSSUnit_URL,
|
||||
"strange unit type in font-face src array");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fontfamily.IsEmpty() && srcArray.Length() > 0) {
|
||||
aFontSet->AddFontFace(fontfamily, srcArray, weight, stretch, italicStyle);
|
||||
}
|
||||
gfxUserFontSet*
|
||||
nsPresContext::GetUserFontSet() {
|
||||
return mUserFontSet;
|
||||
}
|
||||
|
||||
gfxUserFontSet*
|
||||
nsPresContext::GetUserFontSet()
|
||||
void
|
||||
nsPresContext::SetUserFontSet(gfxUserFontSet *aUserFontSet)
|
||||
{
|
||||
if (mUserFontSetDirty) {
|
||||
NS_IF_RELEASE(mUserFontSet);
|
||||
|
||||
if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> > rules;
|
||||
if (!mShell->StyleSet()->AppendFontFaceRules(this, rules))
|
||||
return nsnull;
|
||||
|
||||
if (rules.Length() > 0) {
|
||||
nsFontFaceLoaderContext *loaderCtx =
|
||||
new nsFontFaceLoaderContext(this);
|
||||
if (!loaderCtx)
|
||||
return nsnull;
|
||||
gfxUserFontSet *fs = new gfxUserFontSet(loaderCtx);
|
||||
// user font set owns loader context
|
||||
if (!fs) {
|
||||
delete loaderCtx;
|
||||
return nsnull;
|
||||
}
|
||||
mUserFontSet = fs;
|
||||
NS_ADDREF(mUserFontSet);
|
||||
|
||||
for (PRUint32 i = 0, i_end = rules.Length(); i < i_end; ++i) {
|
||||
InsertFontFaceRule(rules[i], fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mUserFontSetDirty = PR_FALSE;
|
||||
}
|
||||
return mUserFontSet;
|
||||
NS_IF_RELEASE(mUserFontSet);
|
||||
mUserFontSet = aUserFontSet;
|
||||
NS_IF_ADDREF(mUserFontSet);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -743,6 +743,7 @@ public:
|
|||
PRBool SupressingResizeReflow() const { return mSupressResizeReflow; }
|
||||
|
||||
gfxUserFontSet* GetUserFontSet();
|
||||
void SetUserFontSet(gfxUserFontSet *aUserFontSet);
|
||||
|
||||
void NotifyInvalidation(const nsRect& aRect, PRBool aIsCrossDoc);
|
||||
void FireDOMPaintEvent();
|
||||
|
@ -870,7 +871,6 @@ protected:
|
|||
unsigned mPendingMediaFeatureValuesChanged : 1;
|
||||
unsigned mPrefChangePendingNeedsReflow : 1;
|
||||
unsigned mRenderedPositionVaryingContent : 1;
|
||||
unsigned mUserFontSetDirty : 1;
|
||||
|
||||
// resize reflow is supressed when the only change has been to zoom
|
||||
// the document rather than to change the document's dimensions
|
||||
|
|
|
@ -82,7 +82,10 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIMediaList.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "nsCSSRules.h"
|
||||
#include "nsFontFaceLoader.h"
|
||||
|
||||
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
|
||||
|
||||
|
@ -706,8 +709,6 @@ struct RuleCascadeData {
|
|||
nsVoidArray mIDSelectors;
|
||||
PLDHashTable mAttributeSelectors; // nsIAtom* -> nsVoidArray*
|
||||
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> > mFontFaceRules;
|
||||
|
||||
// Looks up or creates the appropriate list in |mAttributeSelectors|.
|
||||
// Returns null only on allocation failure.
|
||||
nsVoidArray* AttributeListFor(nsIAtom* aAttribute);
|
||||
|
@ -2146,23 +2147,6 @@ nsCSSRuleProcessor::MediumFeaturesChanged(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Append all the currently-active font face rules to aArray. Return
|
||||
// true for success and false for failure.
|
||||
PRBool
|
||||
nsCSSRuleProcessor::AppendFontFaceRules(
|
||||
nsPresContext *aPresContext,
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& aArray)
|
||||
{
|
||||
RuleCascadeData* cascade = GetRuleCascade(aPresContext);
|
||||
|
||||
if (cascade) {
|
||||
if (!aArray.AppendElements(cascade->mFontFaceRules))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCSSRuleProcessor::ClearRuleCascades()
|
||||
{
|
||||
|
@ -2304,11 +2288,9 @@ static PLDHashTableOps gRulesByWeightOps = {
|
|||
|
||||
struct CascadeEnumData {
|
||||
CascadeEnumData(nsPresContext* aPresContext,
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& aFontFaceRules,
|
||||
nsMediaQueryResultCacheKey& aKey,
|
||||
PLArenaPool& aArena)
|
||||
: mPresContext(aPresContext),
|
||||
mFontFaceRules(aFontFaceRules),
|
||||
mCacheKey(aKey),
|
||||
mArena(aArena)
|
||||
{
|
||||
|
@ -2324,7 +2306,6 @@ struct CascadeEnumData {
|
|||
}
|
||||
|
||||
nsPresContext* mPresContext;
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& mFontFaceRules;
|
||||
nsMediaQueryResultCacheKey& mCacheKey;
|
||||
// Hooray, a manual PLDHashTable since nsClassHashtable doesn't
|
||||
// provide a getter that gives me a *reference* to the value.
|
||||
|
@ -2332,16 +2313,133 @@ struct CascadeEnumData {
|
|||
PLArenaPool& mArena;
|
||||
};
|
||||
|
||||
/*
|
||||
* This enumerates style rules in a sheet (and recursively into any
|
||||
* grouping rules) in order to:
|
||||
* (1) add any style rules, in order, into data->mRulesByWeight (for
|
||||
* the primary CSS cascade), where they are separated by weight
|
||||
* but kept in order per-weight, and
|
||||
* (2) add any @font-face rules, in order, into data->mFontFaceRules.
|
||||
*/
|
||||
static void
|
||||
InsertFontFaceRule(nsICSSRule* aRule, gfxUserFontSet* fs)
|
||||
{
|
||||
nsCSSFontFaceRule *fontFace = static_cast<nsCSSFontFaceRule*> (aRule);
|
||||
PRInt32 type;
|
||||
NS_ASSERTION(NS_SUCCEEDED(aRule->GetType(type))
|
||||
&& type == nsICSSRule::FONT_FACE_RULE,
|
||||
"InsertFontFaceRule passed a non-fontface CSS rule");
|
||||
|
||||
// fontFace->List();
|
||||
|
||||
nsAutoString fontfamily, valueString;
|
||||
nsCSSValue val;
|
||||
|
||||
PRUint32 unit;
|
||||
PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
||||
PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
||||
PRUint32 italicStyle = FONT_STYLE_NORMAL;
|
||||
|
||||
// set up family name
|
||||
fontFace->GetDesc(eCSSFontDesc_Family, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit == eCSSUnit_String) {
|
||||
val.GetStringValue(fontfamily);
|
||||
fontfamily.Trim("\"");
|
||||
} else {
|
||||
NS_ASSERTION(unit == eCSSUnit_String,
|
||||
"@font-face family name has non-string unit type");
|
||||
return;
|
||||
}
|
||||
|
||||
// set up weight
|
||||
fontFace->GetDesc(eCSSFontDesc_Weight, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit != eCSSUnit_Null) {
|
||||
if (unit == eCSSUnit_Normal) {
|
||||
weight = NS_STYLE_FONT_WEIGHT_NORMAL;
|
||||
} else {
|
||||
weight = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up stretch
|
||||
fontFace->GetDesc(eCSSFontDesc_Stretch, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit != eCSSUnit_Null) {
|
||||
if (unit == eCSSUnit_Normal) {
|
||||
stretch = NS_STYLE_FONT_STRETCH_NORMAL;
|
||||
} else {
|
||||
stretch = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up font style
|
||||
fontFace->GetDesc(eCSSFontDesc_Style, val);
|
||||
if (val.GetUnit() != eCSSUnit_Null) {
|
||||
if (val.GetUnit() == eCSSUnit_Normal) {
|
||||
italicStyle = FONT_STYLE_NORMAL;
|
||||
} else {
|
||||
italicStyle = val.GetIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
// set up src array
|
||||
nsTArray<gfxFontFaceSrc> srcArray;
|
||||
|
||||
fontFace->GetDesc(eCSSFontDesc_Src, val);
|
||||
unit = val.GetUnit();
|
||||
if (unit == eCSSUnit_Array) {
|
||||
nsCSSValue::Array *srcArr = val.GetArrayValue();
|
||||
PRUint32 i, numSrc = srcArr->Count(), faceIndex = 0;
|
||||
|
||||
for (i = 0; i < numSrc; i++) {
|
||||
val = srcArr->Item(i);
|
||||
unit = val.GetUnit();
|
||||
gfxFontFaceSrc *face = srcArray.AppendElements(1);
|
||||
if (!face)
|
||||
return;
|
||||
|
||||
switch (unit) {
|
||||
|
||||
case eCSSUnit_Local_Font:
|
||||
val.GetStringValue(face->mLocalName);
|
||||
face->mIsLocal = PR_TRUE;
|
||||
face->mURI = nsnull;
|
||||
face->mFormatFlags = 0;
|
||||
break;
|
||||
case eCSSUnit_URL:
|
||||
face->mIsLocal = PR_FALSE;
|
||||
face->mURI = val.GetURLValue();
|
||||
NS_ASSERTION(face->mURI, "null url in @font-face rule");
|
||||
face->mReferrer = val.GetURLStructValue()->mReferrer;
|
||||
face->mLocalName.Truncate();
|
||||
face->mFormatFlags = 0;
|
||||
while (i + 1 < numSrc && (val = srcArr->Item(i+1),
|
||||
val.GetUnit() == eCSSUnit_Font_Format)) {
|
||||
nsDependentString valueString(val.GetStringBufferValue());
|
||||
if (valueString.LowerCaseEqualsASCII("opentype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_OPENTYPE;
|
||||
} else if (valueString.LowerCaseEqualsASCII("truetype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE;
|
||||
} else if (valueString.LowerCaseEqualsASCII("truetype-aat")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_AAT;
|
||||
} else if (valueString.LowerCaseEqualsASCII("embedded-opentype")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_EOT;
|
||||
} else if (valueString.LowerCaseEqualsASCII("svg")) {
|
||||
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_SVG;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(unit == eCSSUnit_Local_Font || unit == eCSSUnit_URL,
|
||||
"strange unit type in font-face src array");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fontfamily.IsEmpty() && srcArray.Length() > 0) {
|
||||
fs->AddFontFace(fontfamily, srcArray, weight, stretch, italicStyle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static PRBool
|
||||
CascadeRuleEnumFunc(nsICSSRule* aRule, void* aData)
|
||||
InsertRuleByWeight(nsICSSRule* aRule, void* aData)
|
||||
{
|
||||
CascadeEnumData* data = (CascadeEnumData*)aData;
|
||||
PRInt32 type = nsICSSRule::UNKNOWN_RULE;
|
||||
|
@ -2370,22 +2468,33 @@ CascadeRuleEnumFunc(nsICSSRule* aRule, void* aData)
|
|||
nsICSSRule::DOCUMENT_RULE == type) {
|
||||
nsICSSGroupRule* groupRule = (nsICSSGroupRule*)aRule;
|
||||
if (groupRule->UseForPresentation(data->mPresContext, data->mCacheKey))
|
||||
if (!groupRule->EnumerateRulesForwards(CascadeRuleEnumFunc, aData))
|
||||
if (!groupRule->EnumerateRulesForwards(InsertRuleByWeight, aData))
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (nsICSSRule::FONT_FACE_RULE == type) {
|
||||
nsCSSFontFaceRule *fontFaceRule = static_cast<nsCSSFontFaceRule*>(aRule);
|
||||
nsRefPtr<nsCSSFontFaceRule> *ptr = data->mFontFaceRules.AppendElement();
|
||||
if (!ptr)
|
||||
return PR_FALSE;
|
||||
*ptr = fontFaceRule;
|
||||
else if (nsICSSRule::FONT_FACE_RULE == type
|
||||
&& gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
|
||||
nsPresContext *presContext = data->mPresContext;
|
||||
gfxUserFontSet *fs = presContext->GetUserFontSet();
|
||||
if (!fs) {
|
||||
nsFontFaceLoaderContext *loaderCtx = new nsFontFaceLoaderContext(presContext);
|
||||
if (!loaderCtx)
|
||||
return PR_FALSE;
|
||||
fs = new gfxUserFontSet(loaderCtx); // user font set owns loader context
|
||||
if (!fs) {
|
||||
delete loaderCtx;
|
||||
return PR_FALSE;
|
||||
}
|
||||
presContext->SetUserFontSet(fs);
|
||||
}
|
||||
|
||||
InsertFontFaceRule(aRule, fs);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsCSSRuleProcessor::CascadeSheetEnumFunc(nsICSSStyleSheet* aSheet, void* aData)
|
||||
nsCSSRuleProcessor::CascadeSheetRulesInto(nsICSSStyleSheet* aSheet, void* aData)
|
||||
{
|
||||
nsCSSStyleSheet* sheet = static_cast<nsCSSStyleSheet*>(aSheet);
|
||||
CascadeEnumData* data = static_cast<CascadeEnumData*>(aData);
|
||||
|
@ -2397,12 +2506,11 @@ nsCSSRuleProcessor::CascadeSheetEnumFunc(nsICSSStyleSheet* aSheet, void* aData)
|
|||
sheet->mInner) {
|
||||
nsCSSStyleSheet* child = sheet->mInner->mFirstChild;
|
||||
while (child) {
|
||||
CascadeSheetEnumFunc(child, data);
|
||||
CascadeSheetRulesInto(child, data);
|
||||
child = child->mNext;
|
||||
}
|
||||
|
||||
if (!sheet->mInner->mOrderedRules.EnumerateForwards(CascadeRuleEnumFunc,
|
||||
data))
|
||||
if (!sheet->mInner->mOrderedRules.EnumerateForwards(InsertRuleByWeight, data))
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
@ -2484,12 +2592,11 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext)
|
|||
new RuleCascadeData(aPresContext->Medium(),
|
||||
eCompatibility_NavQuirks == aPresContext->CompatibilityMode()));
|
||||
if (newCascade) {
|
||||
CascadeEnumData data(aPresContext, newCascade->mFontFaceRules,
|
||||
newCascade->mCacheKey,
|
||||
CascadeEnumData data(aPresContext, newCascade->mCacheKey,
|
||||
newCascade->mRuleHash.Arena());
|
||||
if (!data.mRulesByWeight.ops)
|
||||
return; /* out of memory */
|
||||
if (!mSheets.EnumerateForwards(CascadeSheetEnumFunc, &data))
|
||||
if (!mSheets.EnumerateForwards(CascadeSheetRulesInto, &data))
|
||||
return; /* out of memory */
|
||||
|
||||
// Sort the hash table of per-weight linked lists by weight.
|
||||
|
|
|
@ -47,12 +47,9 @@
|
|||
|
||||
#include "nsIStyleRuleProcessor.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
struct RuleCascadeData;
|
||||
struct nsCSSSelectorList;
|
||||
class nsCSSFontFaceRule;
|
||||
|
||||
/**
|
||||
* The CSS style rule processor provides a mechanism for sibling style
|
||||
|
@ -100,11 +97,6 @@ public:
|
|||
NS_IMETHOD MediumFeaturesChanged(nsPresContext* aPresContext,
|
||||
PRBool* aRulesChanged);
|
||||
|
||||
// Append all the currently-active font face rules to aArray. Return
|
||||
// true for success and false for failure.
|
||||
PRBool AppendFontFaceRules(nsPresContext* aPresContext,
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& aArray);
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertQuirksChangeOK() {
|
||||
NS_ASSERTION(!mRuleCascades, "can't toggle quirks style sheet without "
|
||||
|
@ -113,7 +105,7 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
static PRBool CascadeSheetEnumFunc(nsICSSStyleSheet* aSheet, void* aData);
|
||||
static PRBool CascadeSheetRulesInto(nsICSSStyleSheet* aSheet, void* aData);
|
||||
|
||||
RuleCascadeData* GetRuleCascade(nsPresContext* aPresContext);
|
||||
void RefreshRuleCascade(nsPresContext* aPresContext);
|
||||
|
|
|
@ -58,13 +58,6 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
static const nsStyleSet::sheetType gCSSSheetTypes[] = {
|
||||
nsStyleSet::eAgentSheet,
|
||||
nsStyleSet::eUserSheet,
|
||||
nsStyleSet::eDocSheet,
|
||||
nsStyleSet::eOverrideSheet
|
||||
};
|
||||
|
||||
nsStyleSet::nsStyleSet()
|
||||
: mRuleTree(nsnull),
|
||||
mRuleWalker(nsnull),
|
||||
|
@ -789,21 +782,6 @@ nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
|
|||
return result;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsStyleSet::AppendFontFaceRules(nsPresContext* aPresContext,
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& aArray)
|
||||
{
|
||||
NS_ENSURE_FALSE(mInShutdown, PR_FALSE);
|
||||
|
||||
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gCSSSheetTypes); ++i) {
|
||||
nsCSSRuleProcessor *ruleProc = static_cast<nsCSSRuleProcessor*>
|
||||
(mRuleProcessors[gCSSSheetTypes[i]].get());
|
||||
if (ruleProc && !ruleProc->AppendFontFaceRules(aPresContext, aArray))
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleSet::BeginShutdown(nsPresContext* aPresContext)
|
||||
{
|
||||
|
|
|
@ -53,10 +53,8 @@
|
|||
#include "nsRuleNode.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsCSSFontFaceRule;
|
||||
|
||||
// The style set object is created by the document viewer and ownership is
|
||||
// then handed off to the PresShell. Only the PresShell should delete a
|
||||
|
@ -115,11 +113,6 @@ class nsStyleSet
|
|||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
// Append all the currently-active font face rules to aArray. Return
|
||||
// true for success and false for failure.
|
||||
PRBool AppendFontFaceRules(nsPresContext* aPresContext,
|
||||
nsTArray< nsRefPtr<nsCSSFontFaceRule> >& aArray);
|
||||
|
||||
// Begin ignoring style context destruction, to avoid lots of unnecessary
|
||||
// work on document teardown.
|
||||
void BeginShutdown(nsPresContext* aPresContext);
|
||||
|
|
Загрузка…
Ссылка в новой задаче